/* Sotto admin panel. Colours are the redesign's ramps (docs/design/redesign-2026-09/tokens.md, A · Gece
 * Altını): the dark theme is the semantic dark set as the apps use it; the light theme picks mirror steps
 * from the same ramps (the tokens' `semantic.light` is still null). Chart series colours are a
 * categorical set validated for colour-vision deficiency on both surfaces (worst adjacent CVD ΔE 9.1
 * light / 8.4 dark); light-mode slots under 3:1 are why every chart has a legend and a table view.
 *
 * CSP: this file is the only style source. Nothing is styled from markup or script; state is classes
 * and the `hidden` attribute, geometry is SVG attributes. */

:root {
  color-scheme: light dark;

  --bg: #FBF9F7;             /* neutral.98 */
  --s1: #FFFFFF;
  --s2: #F3EEE6;             /* neutral.94 */
  --s3: #D8D1C5;             /* neutral.84 */
  --hairline: #D8D1C5;
  --border-strong: #BDB3A4;  /* neutral.73 */
  --border-input: #817668;   /* neutral.50 */
  --t1: #0D0B09;             /* neutral.3 */
  --t2: #4A4136;             /* neutral.28 */
  --t3: #6B6053;             /* neutral.41 */
  --accent: #E9B45F;         /* gold.77: fills only in light, text is too faint */
  --accent-hover: #F0C27A;
  --accent-pressed: #D9A45A;
  --on-accent: #1A1206;
  --accent-ink: #765A2F;     /* gold.40: accent as text and focus ring on light surfaces */
  --accent-subtle: #F9E6C8;  /* gold.92 */
  --ok: #315C3F;   --ok-bg: #BDE7C9;
  --warn: #734925; --warn-bg: #FCD6B8;
  --err: #903332;  --err-bg: #FEE2DE;
  --focus: #765A2F;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #E7E1D8;
  --axis: #BDB3A4;

  --ui: system-ui, -apple-system, "SF Pro Text", Roboto, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-pill: 999px;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0B09;           /* surface.0 */
    --s1: #16130F;           /* surface.1 */
    --s2: #211C16;           /* surface.2 */
    --s3: #2E2820;           /* surface.3 */
    --hairline: #2C261F;
    --border-strong: #4A4136;
    --border-input: #817668;
    --t1: #F3EEE6;
    --t2: #BDB3A4;
    --t3: #9A8F80;
    --accent: #E9B45F;
    --accent-hover: #F0C27A;
    --accent-pressed: #D9A45A;
    --on-accent: #1A1206;
    --accent-ink: #E9B45F;
    --accent-subtle: #302410;
    --ok: #6FCB8F;   --ok-bg: #121F16;
    --warn: #F29D52; --warn-bg: #26190E;
    --err: #FF7A6E;  --err-bg: #301312;
    --focus: #E9B45F;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --grid: #2C261F;
    --axis: #4A4136;
  }
}

@media (min-width: 600px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font: 400 1rem/1.5 var(--ui);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ol, ul, dl, figure { margin: 0; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.h2, h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 650; }
.h3, h3 { font-size: 1rem; line-height: 1.4; font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
a { color: var(--accent-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip { position: absolute; left: 8px; top: -48px; padding: 8px 12px; background: var(--accent); color: var(--on-accent); border-radius: var(--r-s); z-index: 10; }
.skip:focus { top: 8px; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------------------------------------------------------------- header */
.top { border-bottom: 1px solid var(--hairline); background: var(--s1); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.brand-mark path { fill: var(--accent); }
.brand-name { font-size: 1.125rem; letter-spacing: -0.01em; }
.brand-sub { color: var(--t3); font-weight: 500; padding-left: 8px; border-left: 1px solid var(--hairline); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-account { color: var(--t2); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

main { padding-top: 24px; padding-bottom: 64px; }
main:focus { outline: none; }
.view > * + * { margin-top: 16px; }
.lead { color: var(--t2); max-width: 64ch; }
.fine { color: var(--t3); font-size: 0.875rem; max-width: 72ch; }
.muted { color: var(--t3); }
.eyebrow { color: var(--t3); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--s1); border: 1px solid var(--hairline); border-radius: var(--r-m); padding: 20px; }
.card > * + * { margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-weight: 600; font-size: 0.9375rem; text-decoration: none; white-space: nowrap;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}
.btn:disabled { cursor: default; opacity: 0.55; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-pressed); }
.btn-secondary { border-color: var(--border-strong); color: var(--t1); }
.btn-secondary:hover:not(:disabled) { background: var(--s2); }
.btn-ghost { color: var(--t2); border-color: var(--hairline); }
.btn-ghost:hover:not(:disabled) { background: var(--s2); color: var(--t1); }
.btn-s { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 0.8125rem; font-weight: 600; }
.btn-ghost[aria-pressed="true"] { background: var(--accent-subtle); color: var(--t1); border-color: var(--accent-ink); }

.notice { padding: 12px 16px; border-radius: var(--r-s); border: 1px solid var(--hairline); background: var(--s1); }
.notice-err { background: var(--err-bg); color: var(--t1); border-color: var(--err); }
.notice-warn { background: var(--warn-bg); color: var(--t1); border-color: var(--warn); }
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--t1); border: 1px solid var(--warn); font-size: 0.8125rem; font-weight: 600; }

.input {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: var(--r-s);
  border: 1px solid var(--border-input); background: var(--s1); color: var(--t1); font: inherit;
}
.input::placeholder { color: var(--t3); }
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* ---------------------------------------------------------------- sign-in */
.pair { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 840px) { .pair { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.pair-code { text-align: center; padding: 28px 20px; }
.code {
  font-size: clamp(2.75rem, 1.6rem + 6vw, 4.75rem); line-height: 1.1; font-weight: 700;
  letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--t1); word-break: keep-all; white-space: nowrap;
}
.code.is-placeholder { color: var(--t3); }
.pair-progress { -webkit-appearance: none; appearance: none; width: min(100%, 320px); height: 6px; border: 0; border-radius: var(--r-pill); background: var(--s3); overflow: hidden; }
.pair-progress::-webkit-progress-bar { background: var(--s3); border-radius: var(--r-pill); }
.pair-progress::-webkit-progress-value { background: var(--accent); border-radius: var(--r-pill); }
.pair-progress::-moz-progress-bar { background: var(--accent); border-radius: var(--r-pill); }
.pair-left { color: var(--t2); font-variant-numeric: tabular-nums; }
.pair-note { color: var(--t3); font-size: 0.875rem; }
.pair-status { color: var(--t2); font-weight: 600; }
.pair-refused { color: var(--t1); background: var(--warn-bg); border: 1px solid var(--warn); border-radius: var(--r-s); padding: 8px 12px; font-size: 0.875rem; }
.how-line { font-size: 1.25rem; font-weight: 700; color: var(--t1); }
.steps { padding-left: 1.25rem; color: var(--t2); }
.steps li + li { margin-top: 6px; }
.confirm { max-width: 640px; border-color: var(--accent-ink); }
.confirm-account { font-size: 1.5rem; font-weight: 700; word-break: break-all; }
.confirm-providers { color: var(--t2); }
.confirm-question { font-weight: 650; }
.ended { max-width: 640px; }
.old-code { color: var(--t3); display: flex; align-items: baseline; gap: 12px; }
.old-code s { font-size: 1.75rem; font-weight: 700; letter-spacing: 0.08em; }
.mono-line { font-family: var(--mono); word-break: break-all; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- toolbar, tabs, range */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tabs {
  display: flex; gap: 4px; padding: 4px; background: var(--s2); border-radius: var(--r-pill);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--t2); font-weight: 600; font-size: 0.9375rem; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--t1); }
.tab[aria-selected="true"] { background: var(--s1); color: var(--t1); box-shadow: inset 0 -2px 0 var(--accent); }
.toolbar-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range { display: inline-flex; border: 0; margin: 0; padding: 4px; gap: 4px; background: var(--s2); border-radius: var(--r-pill); }
.range input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.range label { min-height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: var(--r-pill); color: var(--t2); font-weight: 600; font-size: 0.875rem; cursor: pointer; white-space: nowrap; }
.range input:checked + label { background: var(--s1); color: var(--t1); box-shadow: inset 0 -2px 0 var(--accent); }
.range input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.range.is-off { opacity: 0.45; }
.stamp { color: var(--t3); font-size: 0.8125rem; min-height: 1.2em; }

.pane { margin-top: 8px; transition: opacity 160ms var(--ease); }
.pane:focus { outline: none; }
.pane.is-loading { opacity: 0.55; }
.pane > * + * { margin-top: 24px; }
.pane > .section-head { margin-top: 40px; }
.pane > .section-head:first-child { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head p { color: var(--t3); font-size: 0.875rem; }

/* ---------------------------------------------------------------- search and account */
.search { display: grid; gap: 8px; max-width: 760px; }
.search-label { font-weight: 650; }
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1 1 auto; min-width: 0; }
.results { list-style: none; padding: 0; display: grid; gap: 8px; }
.result {
  width: 100%; text-align: left; display: grid; gap: 2px; padding: 14px 16px; cursor: pointer;
  background: var(--s1); border: 1px solid var(--hairline); border-radius: var(--r-m);
}
.result:hover { border-color: var(--accent-ink); background: var(--s2); }
.result-main { font-weight: 650; word-break: break-all; }
.result-sub { color: var(--t2); font-size: 0.875rem; }
.result-id { color: var(--t3); font-family: var(--mono); font-size: 0.8125rem; word-break: break-all; }

#accountOut > * + * { margin-top: 16px; }
#accountOut > .section-head { margin-top: 32px; }
#searchOut > * + * { margin-top: 12px; }
.account-head { display: grid; gap: 6px; }
.account-title:focus { outline: none; }
.account-title { font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.625rem); font-weight: 700; word-break: break-all; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--t2); font-size: 0.875rem; align-items: center; }
.meta code { color: var(--t1); word-break: break-all; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 0.9375rem; }
.kv dt { color: var(--t3); }
.kv dd { margin: 0; word-break: break-word; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.select { min-height: 36px; padding: 0 10px; border-radius: var(--r-s); border: 1px solid var(--border-input); background: var(--s1); color: var(--t1); font: inherit; font-size: 0.875rem; max-width: 100%; }

.reports { display: grid; gap: 12px; }
.report { background: var(--s1); border: 1px solid var(--hairline); border-radius: var(--r-m); padding: 16px; display: grid; gap: 8px; }
.report-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.report-code { font-family: var(--mono); font-weight: 700; font-size: 1.125rem; color: var(--t1); }
.report-when { color: var(--t3); font-size: 0.875rem; }
.report-note { white-space: pre-wrap; word-break: break-word; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--s2); border-radius: 0 var(--r-s) var(--r-s) 0; }
.report-note.is-empty { color: var(--t3); border-left-color: var(--hairline); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 0.8125rem; padding: 2px 10px; border-radius: var(--r-pill); background: var(--s2); color: var(--t2); border: 1px solid var(--hairline); }
.plain { list-style: none; padding: 0; display: grid; gap: 6px; color: var(--t2); font-size: 0.875rem; }
.unavailable { background: var(--s2); }
details.more > summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 0.875rem; }
details.more[open] > summary { margin-bottom: 8px; }

/* ---------------------------------------------------------------- tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
@media (max-width: 599px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .tile { padding: 12px; } .tile-value { font-size: 1.375rem; } }
.tile { background: var(--s1); border: 1px solid var(--hairline); border-radius: var(--r-m); padding: 16px; display: grid; gap: 4px; align-content: start; }
.tile-label { color: var(--t2); font-size: 0.875rem; }
.tile-value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; letter-spacing: -0.01em; word-break: break-word; }
.tile-sub { color: var(--t3); font-size: 0.8125rem; }
.tile.is-missing .tile-value { color: var(--t3); font-size: 1.25rem; }

/* ---------------------------------------------------------------- tables */
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-m); background: var(--s1); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
caption { text-align: left; padding: 10px 12px; color: var(--t2); font-weight: 600; caption-side: top; }
th, td { padding: 8px 12px; text-align: left; border-top: 1px solid var(--hairline); vertical-align: top; }
thead th { color: var(--t3); font-weight: 600; font-size: 0.8125rem; white-space: nowrap; background: var(--s1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover td { background: var(--s2); }
td.is-high { color: var(--err); font-weight: 700; }
td .sub { display: block; color: var(--t3); font-size: 0.75rem; font-weight: 400; }
td.day { white-space: nowrap; }
td.wrap-id { font-family: var(--mono); font-size: 0.8125rem; word-break: break-all; min-width: 18ch; }
.is-wide td, .is-wide th { white-space: nowrap; }

/* ---------------------------------------------------------------- charts */
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.chart { background: var(--s1); border: 1px solid var(--hairline); border-radius: var(--r-m); padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; min-width: 0; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-title { display: block; font-weight: 650; }
.chart-sub { display: block; color: var(--t3); font-size: 0.8125rem; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.8125rem; color: var(--t2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.key.is-line { height: 3px; width: 14px; border-radius: 2px; }
.k1 { background: var(--series-1); } .k2 { background: var(--series-2); } .k3 { background: var(--series-3); }
.k4 { background: var(--series-4); } .k5 { background: var(--series-5); }
.readout { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; min-height: 1.5em; font-size: 0.8125rem; color: var(--t2); font-variant-numeric: tabular-nums; }
.readout-x { color: var(--t1); font-weight: 650; }
.readout b { color: var(--t1); font-weight: 650; }
.readout .ro { display: inline-flex; align-items: center; gap: 6px; }
.chart-plot { position: relative; min-height: 40px; }
.chart-plot svg { display: block; overflow: visible; }
.chart-plot svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.chart-empty { color: var(--t3); font-size: 0.875rem; padding: 24px 0; text-align: center; }
.chart-note { color: var(--t3); font-size: 0.8125rem; }

svg .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
svg .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
svg .tick { fill: var(--t3); font-size: 11px; font-family: var(--ui); font-variant-numeric: tabular-nums; }
svg .lbl { fill: var(--t2); font-size: 12px; font-family: var(--ui); }
svg .val { fill: var(--t1); font-size: 12px; font-family: var(--ui); font-weight: 600; font-variant-numeric: tabular-nums; }
svg .end-lbl { fill: var(--t2); font-size: 12px; font-family: var(--ui); }
svg .c1 { fill: var(--series-1); } svg .c2 { fill: var(--series-2); } svg .c3 { fill: var(--series-3); }
svg .c4 { fill: var(--series-4); } svg .c5 { fill: var(--series-5); }
svg .l1 { stroke: var(--series-1); } svg .l2 { stroke: var(--series-2); } svg .l3 { stroke: var(--series-3); }
svg .l4 { stroke: var(--series-4); } svg .l5 { stroke: var(--series-5); }
svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .dot { stroke: var(--s1); stroke-width: 2; }
svg .hit { fill: transparent; cursor: crosshair; }
svg .band { fill: var(--s2); }
svg .crosshair { stroke: var(--border-strong); stroke-width: 1; shape-rendering: crispEdges; }
svg .row-hit { fill: transparent; }
svg .row-hit:hover { fill: var(--s2); }
svg .mark { transition: opacity 120ms var(--ease); }
svg.has-active .mark { opacity: 0.55; }
svg.has-active .mark.is-active { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media (forced-colors: active) {
  svg .c1, svg .c2, svg .c3, svg .c4, svg .c5 { fill: CanvasText; }
  svg .l1, svg .l2, svg .l3, svg .l4, svg .l5 { stroke: CanvasText; }
  .key { background: CanvasText; }
}

@media (max-width: 599px) {
  .card { padding: 16px; }
  .chart { padding: 12px; }
  .search-row { flex-direction: column; }
  .toolbar { align-items: stretch; }
  .toolbar-end { justify-content: space-between; }
  .brand-sub { display: none; }
}
