/* ═══════════════════════════════════════════════════════════════
    AdminPanel — History (list, diff, timeline)
   ═══════════════════════════════════════════════════════════════ */

/* ── List ─────────────────────────────────────────────────────── */

.td-nowrap { white-space: nowrap; }

.history-diff-toggle {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-diff-pre {
    font-size: 0.75rem;
    margin-top: 0.4rem;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
    background: var(--bg-main);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
}

/* ── Meta strip (diff + timeline) ────────────────────────────── */

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
    font-size: 0.85rem;
}

.history-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.history-meta-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.history-meta-value { color: var(--text-main); }

/* ── Diff table ───────────────────────────────────────────────── */

.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.diff-table th {
    padding: 0.6rem 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
    text-align: left;
}

.diff-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    word-break: break-word;
}

.diff-table tr:last-child td { border-bottom: none; }

.diff-key {
    width: 160px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.diff-old {
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    border-left: 3px solid rgba(239, 68, 68, 0.4);
}

.diff-new {
    background: rgba(34, 197, 94, 0.08);
    color: #86efac;
    border-left: 3px solid rgba(34, 197, 94, 0.4);
}

/* ── Navigation ───────────────────────────────────────────────── */

.history-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* ── Timeline filter bar ──────────────────────────────────────── */

.timeline-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.timeline-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ── History filter form ──────────────────────────────────────── */

.history-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.history-filter-select {
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
}

.history-filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Batch inline diff ───────────────────────────────────────── */

.batch-diff-inline {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.batch-diff-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.batch-diff-field .diff-key {
    width: auto;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 80px;
}

.batch-diff-field .diff-old,
.batch-diff-field .diff-new {
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.78rem;
    border-left: none;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-diff-field .diff-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.batch-obj {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.batch-obj-name {
    font-size: 0.85rem;
    color: var(--text-main);
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 600px) {
    .diff-key { width: 90px; font-size: 0.72rem; }
    .history-meta { gap: 0.5rem 1rem; }
    .diff-table td { padding: 0.5rem 0.75rem; }
    .admin-table th { width: 46%;}
}
