/* Admin panel. Chart colours follow the validated reference palette (slots 1–2; light + dark steps). */
.admin {
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --grid: #e7e6e2;
    --st-good: #0ca30c;
    --st-warning: #b07800;
    --st-serious: #c4612f;
    --st-critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
    .admin {
        --series-1: #3987e5;
        --series-2: #d95926;
        --grid: #33332f;
        --st-warning: #fab219;
        --st-serious: #ec835a;
    }
}
.admin { --sidebar-bg: #111827; --sidebar-active: rgba(249, 115, 22, .16); }
.admin .sidebar nav a.active { box-shadow: inset 3px 0 0 #fb923c; }
.admin .sidebar nav a.active .icon { color: #fdba74; }
.admin-tag { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; padding: 2px 7px; border-radius: 6px; }
.alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.status-line { display: inline; }
.status-line.good { color: var(--st-good); }
.status-line.warning { color: var(--st-warning); }
.status-line.serious { color: var(--st-serious); }
.status-line.critical { color: var(--st-critical); }
.alerts .status-line { display: block; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); border-left: 4px solid currentColor; }
.alerts .status-line.warning { border-left-color: var(--st-warning); }
.alerts .status-line.serious { border-left-color: var(--st-serious); }
.alerts .status-line.critical { border-left-color: var(--st-critical); }
.kpi-table td, .kpi-table th { white-space: nowrap; }
.kpi-table tbody th { color: var(--text); font-weight: 500; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.filter-bar .tabs { margin: 0; }
.delta { display: inline-block; font-size: .8rem; margin-left: 4px; color: var(--muted); }
.delta.up { color: var(--st-good); }
.delta.down { color: var(--st-critical); }
.stat small.muted { display: block; }
.chart-card h3 { margin: 0 0 8px; font-size: 1rem; }
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .grid.zero { stroke: var(--muted); }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .mark.s1 { fill: var(--series-1); }
.chart .mark.s2 { fill: var(--series-2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .line.s1 { stroke: var(--series-1); }
.chart .line.s2 { stroke: var(--series-2); }
.chart .dot { opacity: 0; stroke: var(--surface); stroke-width: 2; }
.chart .dot.s1 { fill: var(--series-1); }
.chart .dot.s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; }
.chart .col:hover .hit { fill: var(--text); fill-opacity: .06; }
.chart .col:hover .dot { opacity: 1; }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 4px; border-radius: 2px; }
.swatch.s1 { background: var(--series-1); }
.swatch.s2 { background: var(--series-2); }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: .875rem; margin: 6px 0; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar-value { color: var(--muted); white-space: nowrap; }
pre.cred { margin: 8px 0 0; background: var(--surface); color: var(--text); }
@media (max-width: 860px) { .hbar { grid-template-columns: 90px 1fr auto; } }

/* Grouped navigation + work badges */
.sidebar .nav-group { margin: 16px 12px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.sidebar .nav-group:first-child { margin-top: 0; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgba(249, 115, 22, .2); color: #fdba74; font-size: .75rem; font-weight: 700; text-align: center; }
.tabs .count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; text-align: center; }
.tabs .count-alert { background: #fee2e2; color: #991b1b; }
.tabs a.active .count { background: rgba(255, 255, 255, .25); color: #fff; }
.tag.sub-failed { background: #fee2e2; color: #991b1b; }
.tag.sub-uncertain { background: #fef3c7; color: #92400e; }
.tag.sub-queued, .tag.sub-manual { background: var(--surface-2); color: var(--muted); }
.action-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; }
.action-box summary { cursor: pointer; font-weight: 600; }
.action-box[open] summary { margin-bottom: 10px; }
.input-sm { padding: 4px 28px 4px 8px; font-size: .85rem; width: auto; }
.row-menu-items .form { gap: 6px; min-width: 240px; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) {
    .tabs .count-alert, .tag.sub-failed { background: #350a0a; color: #fca5a5; }
    .tag.sub-uncertain { background: #2d1d05; color: #fcd34d; }
}
.page-head .inline-form .input { min-width: 280px; }
.page-head .inline-form .btn { white-space: nowrap; }
@media (max-width: 560px) { .page-head .inline-form { width: 100%; } .page-head .inline-form .input { min-width: 0; } }
.order-actions { display: flex; flex-direction: column; gap: 8px; }
.order-actions .action-box { margin: 0; }
.danger-box { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.row-menu-items .order-actions { min-width: 260px; }
.row-menu-items .action-box { padding: 6px 8px; }
.provider-facts > div { display: flex; flex-direction: column; gap: 2px; }
.provider-facts strong { font-size: 1.05rem; }
.provider-box { border-left: 3px solid var(--primary); }
.sidebar nav a.locked { opacity: .45; }
.lock-banner { font-size: .95rem; }
.paid-question { border: 1px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.paid-question legend { font-weight: 700; padding: 0 4px; }
.stat-owner { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }

/* Worksheets */
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ws-card { display: flex; flex-direction: column; gap: 6px; color: var(--text); margin: 0; }
.ws-card:hover { border-color: var(--primary); text-decoration: none; }
.ws-icon { color: var(--primary); }
.ws-head { align-items: flex-start; }
.ws-title { font-size: 1.2rem; font-weight: 700; min-width: 280px; }
.ws-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ws-ref { min-width: 48px; font-weight: 700; font-family: ui-monospace, Menlo, monospace; color: var(--muted); text-align: center; }
.ws-formula { flex: 1; min-width: 200px; }
.ws-import { cursor: pointer; }
.ws-scroll { padding: 0; overflow: auto; max-height: 72vh; }
.ws-table { border-collapse: collapse; table-layout: fixed; font-size: .875rem; }
.ws-table th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .75rem; border: 1px solid var(--border); padding: 3px 6px; text-align: center; }
.ws-table tbody th { position: sticky; left: 0; z-index: 1; min-width: 44px; }
.ws-table th.ws-corner { left: 0; z-index: 3; width: 44px; }
.ws-table td { border: 1px solid var(--border); padding: 0; background: var(--surface); }
.ws-cell { width: 100%; border: 0; padding: 5px 7px; font: inherit; background: transparent; color: var(--text); outline: none; }
.ws-cell:focus { box-shadow: inset 0 0 0 2px var(--primary); background: var(--surface); position: relative; z-index: 1; }
.ws-cell.ws-num { text-align: right; font-variant-numeric: tabular-nums; }
.ws-cell.ws-err { color: var(--danger); }
.ws-note { min-height: 60vh; font-size: .95rem; line-height: 1.6; }
