[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --navy-950: #070e1c;
  --navy-900: #0b1426;
  --navy-800: #13203b;
  --charcoal-900: #14171d;
  --charcoal-800: #1b1f27;
  --charcoal-700: #262b35;
  --line: #2c323d;
  --text-primary: #eef1f6;
  --text-secondary: #a9b2c3;
  --text-muted: #7c8699;
  --accent: #6f9bf0;
  --good: #3fb57f;
  --critical: #e66767;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 var(--sans); background: var(--charcoal-900); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--navy-900) 232px, var(--charcoal-900) 232px); }
.sidebar { background: var(--navy-900); border-right: 1px solid #1a2744; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: baseline; gap: 10px; padding: 0 8px; }
.wordmark { font-weight: 600; letter-spacing: 0.3em; font-size: 14px; }
.brand-sub { color: var(--text-muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--text-secondary); text-decoration: none; padding: 9px 10px; border-radius: 8px; }
.sidebar nav a:hover { background: var(--navy-800); color: var(--text-primary); }
.sidebar nav a.active { background: var(--navy-800); color: var(--text-primary); box-shadow: inset 2px 0 0 var(--accent); }
.whoami { margin-top: auto; color: var(--text-muted); font-size: 12px; padding: 0 8px; overflow-wrap: anywhere; }

.main { padding: 24px 32px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; }
.range { display: inline-flex; background: var(--charcoal-800); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.range button { background: none; border: 0; color: var(--text-secondary); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.range button[aria-pressed="true"] { background: var(--charcoal-700); color: var(--text-primary); }

.notice { background: #2a2414; border: 1px solid #5c4a17; color: #f1dca4; padding: 12px 14px; border-radius: 8px; margin-bottom: 20px; }
.notice.error { background: #2c1717; border-color: #6b2b2b; color: #f3c2c2; }

.section { font-size: 15px; font-weight: 600; margin: 32px 0 12px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.hint { font-weight: 400; color: var(--text-muted); font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--charcoal-800); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.tile h2 { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin: 0 0 8px; }
.tile .big { font-size: 28px; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .kes { margin: 2px 0 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.tile .sub { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; }
.money .tile { border-top: 2px solid var(--navy-800); }

.panel { background: var(--charcoal-800); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; color: var(--text-secondary); font-size: 12px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }

.chart { position: relative; height: 260px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; }
.chart .dot { stroke: var(--charcoal-800); stroke-width: 2; }
.chart .empty { fill: var(--text-muted); font-size: 13px; }

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--charcoal-700); }
.table .num { text-align: right; }
.table .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; }
.table .muted { color: var(--text-muted); }
.outcome { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.outcome.allowed { color: var(--good); }
.outcome.refused, .outcome.failed { color: var(--critical); }
.foot { color: var(--text-muted); font-size: 12px; margin: 10px 0 0; }

.tooltip { position: fixed; pointer-events: none; background: var(--navy-950); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; z-index: 10; min-width: 160px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.tooltip .t-day { color: var(--text-muted); margin-bottom: 4px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 16px; }
.tooltip .t-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tooltip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; background: var(--charcoal-900); }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 16px; padding: 12px 16px; }
  .sidebar nav { flex-direction: row; }
  .whoami { margin: 0 0 0 auto; }
  .main { padding: 16px; }
  .tiles { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  #apps-table, #audit-table { display: block; overflow-x: auto; }
}

/* Staff tools */
.signin { min-height: 100vh; display: grid; place-items: center; background: var(--navy-950); padding: 16px; }
.card { background: var(--charcoal-800); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--text-secondary); font-size: 13px; }
input, select, textarea { font: inherit; color: var(--text-primary); background: var(--charcoal-900); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
textarea { min-height: 80px; resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--charcoal-700); color: var(--text-primary); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1426; font-weight: 600; }
.btn.danger { color: #ffd0d0; border-color: #6b2b2b; background: #2c1717; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; margin-top: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.count { background: var(--critical); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 6px; }
.count:empty { display: none; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-secondary); white-space: nowrap; }
.pill.bad { color: var(--critical); border-color: #6b2b2b; }
.pill.good { color: var(--good); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.item { border-top: 1px solid var(--charcoal-700); padding: 14px 0; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.item:first-child { border-top: 0; }
.item .body { flex: 1; min-width: 240px; }
.quote { background: var(--charcoal-900); border-left: 3px solid var(--line); padding: 8px 12px; border-radius: 6px; margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 160px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--charcoal-900); }
dialog { background: var(--charcoal-800); color: var(--text-primary); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(460px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .tiles.four { grid-template-columns: 1fr 1fr; } .kv { grid-template-columns: 1fr; } }
.main a { color: var(--accent); }
