/* Admin dashboard shell — riusa i token globali (--quindi-*) per coerenza
   visiva con la dashboard utente, ma con accenti piu' "operativi": niente
   ombre dense, niente animazioni hover su righe (vogliamo che l'operatore
   scorra liste lunghe senza distrazioni). */

.admin-shell {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-body.with-rail {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
}

.admin-rail {
    position: sticky;
    top: 32px;
    align-self: start;
    background: var(--quindi-surface);
    border: 1px solid var(--quindi-border);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}

.admin-nav {
    display: block;
    padding: 8px 12px;
    color: var(--quindi-text);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}
.admin-nav:hover {
    background: var(--quindi-surface-2);
    text-decoration: none;
}
.admin-nav.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.admin-main {
    min-width: 0; /* niente overflow su tabelle larghe */
}
.admin-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px;
}
.admin-loading {
    color: var(--quindi-text-soft);
    font-size: 13px;
    padding: 24px 0;
}

/* Overview: griglia di card statistiche compatte. */
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.admin-stat-card {
    background: var(--quindi-surface);
    border: 1px solid var(--quindi-border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.admin-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--quindi-text-soft);
    margin-bottom: 4px;
}
.admin-stat-value {
    font-size: 26px;
    font-weight: 600;
    color: var(--quindi-text);
    font-variant-numeric: tabular-nums;
}
.admin-stat-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--quindi-text-soft);
}

/* Tabelle admin: dense, monospaced sugli id, niente alternating row colors
   (rumore visivo per liste lunghe). */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.admin-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--quindi-border);
    color: var(--quindi-text-soft);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
}
.admin-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--quindi-border-soft);
    vertical-align: top;
    color: var(--quindi-text);
}
.admin-table tr:hover td {
    background: var(--quindi-surface-2);
}
.admin-table td.mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 11px;
    color: var(--quindi-text-soft);
}
/* Click-to-sort affordance on table headers. The arrow is part of the th text
   content (rendered by the page), so the header only needs the affordance
   (cursor + hover tint) — no pseudo-element gymnastics. */
.admin-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.admin-table th.sortable:hover {
    color: var(--quindi-text);
}

.admin-link {
    /* Match GlassButton ghost spacing/look anche su <a> in topbar. */
    text-decoration: none;
}

/* ── Audit payload modal ────────────────────────────────────────────────── */
/* "view" trigger on each audit row opens a floating modal with the pretty-
   printed JSON. The cell is 1% wide and would otherwise force the JSON into
   an unreadable strip — the modal floats above the table and gives the
   payload room to breathe. */
.audit-payload-trigger {
    /* link-btn already gives us the accent color + cursor; just tighten the
       hit target so the cell stays compact. */
    font-size: 11px;
    padding: 0 4px;
}
.audit-payload-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8vh 16px 16px;
    outline: none;
    animation: glass-fade 0.18s ease;
}
.audit-payload-modal {
    width: min(820px, 100%);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--quindi-surface);
    border: 1px solid var(--quindi-border);
    border-radius: 8px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}
.audit-payload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--quindi-border);
    background: var(--quindi-surface-2);
}
.audit-payload-head-meta {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}
.audit-payload-head-actions {
    display: flex;
    gap: 8px;
}
.audit-payload-body {
    margin: 0;
    padding: 14px 16px;
    overflow: auto;
    font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--quindi-text);
    background: var(--quindi-surface);
    white-space: pre;
    /* The whole payload should be selectable for copy-fallback when the
       clipboard API is blocked. */
    user-select: text;
}
