/* Admin dashboard (#/admin). Mobile first, single column, uses the base theme variables. */

.adm { max-width: 760px; margin: 0 auto; }
.adm-title { margin: 12px 0 4px; font-size: 1.4rem; }
.adm-loading { text-align: center; margin: 60px auto; }
.adm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- login and messages */
.adm-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.adm-login { max-width: 480px; margin: 32px auto; }
.adm-login h1, .adm-login h2 { margin-top: 0; }
.adm-label { display: block; font-weight: 600; margin-bottom: 6px; }
.adm-input {
  width: 100%; min-height: 44px; padding: 8px 12px; font-size: 1rem; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg);
}
.adm-wide { width: 100%; margin-top: 14px; }
.adm-callout-warn { border-left-color: var(--warn); margin-top: 14px; }

/* ---- sticky header: period selector, logout, self exclusion */
.adm-head {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); padding: 8px 0; border-bottom: 1px solid var(--line);
}
.adm-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.adm-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.adm-seg-btn {
  min-width: 52px; min-height: 44px; padding: 0 12px; border: 0; border-right: 1px solid var(--line);
  background: var(--card); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer;
}
.adm-seg-btn:last-child { border-right: 0; }
.adm-seg-btn.is-on { background: var(--accent); color: var(--accent-fg); }
.adm-seg-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.adm-logout { min-height: 44px; }
.adm-self { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 0.85rem; }
.adm-self .btn { min-height: 44px; }
.adm-self-status { color: var(--warn); }

/* ---- accordion sections */
.adm-sec {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 12px 0;
}
.adm-sec-head {
  display: flex; align-items: center; min-height: 44px; padding: 4px 16px;
  cursor: pointer; list-style: none;
}
.adm-sec-head::-webkit-details-marker { display: none; }
.adm-sec-head::before {
  content: "+"; display: inline-block; width: 1.2em; font-weight: 700; color: var(--muted);
}
.adm-sec[open] > .adm-sec-head::before { content: "\2212"; }
.adm-sec-head:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
.adm-sec-title { margin: 0; font-size: 1.05rem; }
.adm-sec-body { padding: 0 16px 16px; }
.adm-sub { margin: 18px 0 8px; font-size: 0.9rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.adm-note { margin: 6px 0; font-size: 0.8rem; color: var(--muted); }
.adm-line { margin: 6px 0; font-size: 0.875rem; overflow-wrap: anywhere; }

.adm-inner { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.adm-inner > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }

/* ---- KPI tiles: 2x2 on mobile */
.adm-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.adm-tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); min-width: 0; }
.adm-tile-num { font-size: 28px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.adm-tile-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- verdict line: dot plus text, never colour alone */
.adm-verdict { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 0; font-size: 13px; line-height: 1.3; }
.adm-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.tone-ok .adm-dot { background: var(--ok); }
.tone-warn .adm-dot { background: var(--warn); border-radius: 1px; }
.tone-mid .adm-dot { background: var(--mid); }
.tone-warn { color: var(--warn); }

/* ---- pills */
.adm-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.adm-pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem;
  border: 1px solid var(--line); background: var(--bg);
}

/* ---- horizontal bars (plain divs) */
.adm-bars { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-height: 180px; }
.adm-bars-tall { min-height: 220px; gap: 4px; justify-content: space-between; }
.adm-bar-row, .adm-grow {
  display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr) 4.6em; align-items: center; gap: 8px;
  font-size: 0.85rem; min-height: 22px;
}
.adm-grow { grid-template-columns: minmax(0, 32%) minmax(0, 1fr); }
.adm-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-bar-track { display: block; height: 14px; border-radius: 3px; background: transparent; overflow: hidden; }
.adm-bar-track.is-bg { background: var(--viz-grid); }
.adm-bar-fill { display: block; height: 100%; min-width: 2px; background: var(--series-1); border-radius: 3px; }
.adm-bar-fill.is-zero { min-width: 0; }
.adm-bar-fill.is-b { background: var(--series-3); }
.adm-bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.1; }
.adm-bar-extra { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.adm-gpair { display: flex; flex-direction: column; gap: 2px; }
.adm-gbar { display: grid; grid-template-columns: minmax(0, 1fr) 6.4em; align-items: center; gap: 6px; }
.adm-gbar .adm-bar-track { height: 10px; }
.adm-gbar .adm-bar-val { font-size: 0.75rem; font-weight: 500; text-align: left; }

/* ---- daily chart (tiny SVG) */
.adm-figure { margin: 0; }
.adm-daily { display: block; width: 100%; height: 160px; }
.adm-svg-bar { fill: var(--series-1); }
.adm-svg-axis { stroke: var(--viz-axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
.adm-svg-line { fill: none; stroke: var(--series-2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.adm-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* ---- stacked new vs returning */
.adm-stack-bar { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: var(--viz-grid); }
.adm-stack-a { background: var(--series-1); }
.adm-stack-b { background: var(--series-3); }
.adm-stack-legend { display: flex; gap: 16px; font-size: 0.85rem; margin-top: 6px; }
.adm-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

/* ---- tables: max 3 columns, detail on a second line */
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; table-layout: fixed; }
.adm-table th, .adm-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.adm-table th { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.adm-table th:first-child, .adm-table td:first-child { width: 60%; }
.adm-table .adm-num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-cell-main { display: block; overflow-wrap: anywhere; }
.adm-cell-sub { display: block; font-size: 0.75rem; color: var(--muted); }
.adm-more { margin-top: 8px; min-height: 44px; }

/* ---- next actions */
.adm-actions { list-style: none; margin: 0; padding: 0; }
.adm-action {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem;
}
.adm-action:last-child { border-bottom: 0; }
.adm-kind { min-width: 3.6em; text-align: center; }
.kind-broken .adm-kind { color: var(--warn); }
.kind-leak .adm-kind, .kind-game .adm-kind { color: var(--mid); }
.kind-termly .adm-kind, .kind-traffic .adm-kind { color: var(--accent); }
.kind-ok .adm-kind { color: var(--ok); }
.adm-go { min-height: 44px; min-width: 44px; }

.kind-note .adm-kind { color: var(--muted); }
.kind-note .adm-action-text { color: var(--muted); }

.adm-live-wrap { margin: 8px 0 12px; }
.adm-live-title { margin: 0 0 6px; }
.adm-live .adm-verdict { margin-top: 4px; }
.adm-live-stamp { margin: 4px 0 0; font-size: 11px; }

@media (min-width: 600px) {
  .adm-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .adm-tiles:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
