/*
 * static/css/admin-site.css — the /opensesame dashboard's Site views (plan R-120, lane dash-site; spec dashboard-2.md
 * §3.1, §3.8–§3.10): Overview (the tiles that are links, Needs attention grouped with a fixed state column, the period
 * list under the spend chart, the 7/12 + 5/12 columns, the Active now tile's short line), Limits (the rules table's
 * names and money fields), Settings (one column with Access, Context's ruler, the Dashboard sessions list; Context's
 * fields align by the shared setting-row rule in admin.css) and the Audit log (a day-grouped list of sentences).
 * Tables are the shared fit tables (admin.css); this file holds only what the views add. Same rules as admin.css:
 * `.adm-` selectors only, tokens only, each selector defined once.
 */

/* ============================================================
   OVERVIEW
   ============================================================ */
/* a tile that opens a view is a link (rule 11) */
.adm-tile { text-decoration: none; }
/* Active now: a narrow tile (a phone's 2×2, four across beside the navigation) says its sub-line short ("2 tabs · 1
   running · 14 today"); the long sentence is the tile's title */
.adm-stat--short { container: adm-tile / inline-size; }
.adm-stat-sub-short { display: none; }
@container adm-tile (max-width: 240px) {
    .adm-stat-sub-long { display: none; }
    .adm-stat-sub-short { display: inline; }
}
.adm-ov-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.adm-ov-main, .adm-ov-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Needs attention: small group headings; rows with a fixed state column so the titles line up */
.adm-attn-group + .adm-attn-group { margin-top: 4px; border-top: 1px solid var(--c-outline-variant); }
.adm-attn-head {
    display: flex; align-items: baseline; gap: 8px; padding: 14px 20px 4px;
    color: var(--c-on-3); font: var(--t-label-s); letter-spacing: 0.08em; text-transform: uppercase;
}
.adm-attn-count { letter-spacing: 0; font-variant-numeric: tabular-nums; }
.adm-attn-list { list-style: none; padding-bottom: 4px; }
.adm-attn {
    display: flex; align-items: center; gap: 12px; min-height: var(--adm-row); padding: 8px 20px;
    color: inherit; text-decoration: none;
}
.adm-attn:not(.adm-attn--static):hover { background: var(--c-hover); }
.adm-attn:focus-visible { outline-offset: -2px; }
.adm-attn-state { flex: none; display: flex; align-items: center; width: 92px; }
.adm-attn-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-attn-title { min-width: 0; color: var(--c-on); font: var(--t-label-l); }
.adm-attn-sub { min-width: 0; color: var(--c-on-3); font: var(--t-body-s); }
.adm-attn > time { flex: none; color: var(--c-on-3); font: var(--t-body-s); white-space: nowrap; }
.adm-attn-go { flex: none; color: var(--c-on-3); font: 400 1.25rem / 1 var(--font-sans); }

/* Spend: the period list under the chart (the total right, each model and each kind of person under it) */
.adm-periods { list-style: none; margin-top: 14px; border-top: 1px solid var(--c-outline-variant); }
.adm-period {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0;
    border-bottom: 1px solid var(--c-outline-variant);
}
.adm-period:last-child { padding-bottom: 0; border-bottom: 0; }
.adm-period-name { color: var(--c-on); font: var(--t-label-l); }
.adm-period-total { color: var(--c-on); font: var(--t-label-l); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.adm-period-split { grid-column: 1 / -1; color: var(--c-on-3); font: var(--t-body-s); font-variant-numeric: tabular-nums; }
/* System: a shorter meter, so "279.2 GB of 460.4 GB (61%)" stays on its key's line in the narrow column */
.adm-ov-side .adm-meter { width: 56px; }

/* ============================================================
   LIMITS
   ============================================================ */
.adm-rule-name { color: var(--c-on); font-weight: 500; }
.adm-table--rules .adm-numfield { align-items: flex-end; }
.adm-table--rules td.adm-c--money { padding-top: 6px; padding-bottom: 6px; }
/* the amounts' save bar inside the flush card: the card's own inset; raised while edited */
.adm-rules-panel > .adm-savebar { margin-top: 0; padding: 12px 20px; }
.adm-rules-panel > .adm-savebar[data-dirty="true"] { margin: 8px; padding: 10px 12px; }

/* ============================================================
   SETTINGS: Access, Context (with its ruler), Dashboard sessions
   ============================================================ */
.adm-settings { display: flex; flex-direction: column; gap: 20px; max-width: 880px; min-width: 0; }
/* Access: a switch stays beside its words at every width (the shared setting row stacks under 480 px) */
.adm-access .adm-setting-grid { grid-template-columns: minmax(0, 1fr) auto; }
.adm-access .adm-setting-control { justify-content: flex-end; }
.adm-ruler-host { margin-bottom: 6px; }
.adm-ruler { position: relative; height: 52px; margin: 0 4px; }
.adm-ruler::before {
    content: ''; position: absolute; left: 0; right: 0; top: 23px; height: 6px; border-radius: var(--radius-pill);
    background: var(--c-surface-highest);
}
.adm-ruler-mark { position: absolute; top: 16px; width: 2px; height: 20px; margin-left: -1px; border-radius: 1px; background: var(--c-accent); }
/* each label starts at its mark; the warning's ends there (it sits just before the compaction point and the ceiling) */
.adm-ruler-label { position: absolute; left: 0; white-space: nowrap; color: var(--c-on-2); font: var(--t-label-s); font-weight: 500; }
.adm-ruler-mark[data-key="compact_keep_tail_tokens"] .adm-ruler-label,
.adm-ruler-mark[data-key="compact_trigger_tokens"] .adm-ruler-label { bottom: 22px; }
.adm-ruler-mark[data-key="compact_in_turn_ceiling_tokens"] .adm-ruler-label { top: 22px; }
.adm-ruler-mark[data-key="context_warn_tokens"] .adm-ruler-label { top: 22px; left: auto; right: 0; }
.adm-ruler-label--end { left: auto; right: 0; }
/* Dashboard sessions: a list of sign-ins (the browser and its second line; End on the right) */
.adm-sessions { list-style: none; }
.adm-session {
    display: flex; align-items: center; gap: 12px; min-height: var(--adm-row); padding: 10px 20px;
    border-top: 1px solid var(--c-outline-variant);
}
.adm-session > .adm-cell-lines { flex: 1 1 auto; }
.adm-session > .adm-btn { flex: none; }
.adm-session-name { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; color: var(--c-on); font-weight: 500; }

/* ============================================================
   AUDIT LOG: one list grouped by day, each row a sentence
   ============================================================ */
.adm-audit-day + .adm-audit-day { border-top: 1px solid var(--c-outline-variant); }
.adm-audit-day-head {
    padding: 14px 20px 4px; color: var(--c-on-3); font: var(--t-label-s); letter-spacing: 0.08em; text-transform: uppercase;
}
.adm-audit-list { list-style: none; }
.adm-audit-row { padding: 10px 20px; }
.adm-audit-list > .adm-audit-row + .adm-audit-row { border-top: 1px solid var(--c-outline-variant); }
.adm-audit-line { display: flex; align-items: baseline; gap: 4px 12px; min-width: 0; }
.adm-audit-text { flex: 1 1 auto; min-width: 0; color: var(--c-on); font: var(--t-body-m); overflow-wrap: break-word; }
.adm-audit-action { font-weight: 500; }
.adm-audit-subject { overflow-wrap: break-word; }
.adm-audit-line > .adm-pill { flex: none; align-self: center; }
.adm-audit-time { flex: none; color: var(--c-on-3); font: var(--t-body-s); font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-audit-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; min-width: 0; margin-top: 2px;
    color: var(--c-on-3); font: var(--t-body-s);
}
.adm-audit-detail { min-width: 0; overflow-wrap: break-word; }

/* ============================================================
   NARROW SCREENS
   ============================================================ */
@media (max-width: 1100px) {
    .adm-ov-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .adm-attn-head, .adm-audit-day-head { padding-right: 16px; padding-left: 16px; }
    .adm-attn { gap: 10px; padding: 8px 16px; }
    .adm-attn-state { width: 84px; }
    .adm-attn > time { display: none; }
    .adm-audit-row, .adm-session { padding-right: 16px; padding-left: 16px; }
}
