/*
 * Scryly dashboard. An interim theme until Scryly has its brand: every colour, corner and font is a token here, so
 * the brand swap is this block. Layout and rules follow Sign2Approve (docs/UI-THEME.md, APP-SHELL-AND-NAVIGATION.md):
 * one top menu; status always as an icon and words, never colour alone; text at WCAG AA contrast.
 */
:root {
  color-scheme: light;
  --ink: #16213e;            /* top bar, sign-in hero */
  --ink-raised: #22305a;
  --on-ink: #ffffff;
  --on-ink-muted: #c3cae0;
  --highlight: #a9b4ff;      /* on ink only, never on white */
  --primary: #3d43c4;        /* buttons, links, focus; white text on it (7.5:1) */
  --primary-hover: #2f34a3;
  --app-bg: #f5f6f9;
  --surface: #ffffff;
  --sunken: #eceef3;
  --border: #d8dce5;
  --field-border: #7d8597;   /* 3:1 for controls */
  --text: #172033;
  --text-2: #424b5e;
  --text-3: #555e70;         /* >= 4.5:1 on white and on --app-bg */
  --radius-control: 8px;
  --radius-card: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Chart series: the dataviz reference palette's slots 1 and 2, validated (CVD and contrast) on the surface. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  /* Status (Sign2Approve's checked set): background, text. */
  --ok-bg: #ddf1e4;    --ok-text: #165c33;
  --warn-bg: #fcebd2;  --warn-text: #7a4300;
  --info-bg: #dcebf8;  --info-text: #14467a;
  --muted-bg: #eceff1; --muted-text: #3e4f4c;
  --bad-bg: #f9e0dc;   --bad-text: #8a1f12;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--app-bg); font-variant-numeric: tabular-nums; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- sign in: the welcome on the left, the form on the right (on a phone, a banner above) ---------- */
.split { display: grid; min-height: 100vh; background: var(--surface); }
@media (min-width: 860px) { .split { grid-template-columns: 44% 56%; } }
.hero { position: relative; overflow: hidden; background: var(--ink); color: var(--on-ink); padding: 24px; display: flex; flex-direction: column; }
@media (min-width: 860px) { .hero { position: sticky; top: 0; height: 100vh; padding: 48px 56px 0; } }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; color: inherit; text-decoration: none; }
.wordmark svg { color: var(--highlight); }
.hero-text { margin: 28px 0 0; display: grid; gap: 14px; max-width: 30em; }
@media (min-width: 860px) { .hero-text { margin-top: clamp(48px, 9vh, 104px); gap: 20px; } }
.hero-title { margin: 0; font-size: clamp(24px, 3vw, 42px); line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; text-wrap: balance; }
.hero-line { margin: 0; color: var(--on-ink-muted); font-size: 15px; line-height: 1.7; }
/* The illustration: the Panel answering a question, meeting the foot of the welcome. */
.mock { display: none; }
@media (min-width: 860px) {
  .mock { display: grid; gap: 12px; margin: auto -56px 0 56px; padding: 22px 22px 30px; background: var(--surface); color: var(--text); border-radius: 16px 0 0 0; box-shadow: 0 -18px 50px rgb(0 0 0 / .25); }
}
.mock-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.mock-head svg { color: var(--primary); }
.mock-q { justify-self: end; max-width: 80%; padding: 9px 13px; border-radius: 12px 12px 4px 12px; background: var(--sunken); font-size: 14px; }
.mock-a { padding: 12px 14px; border-radius: 12px 12px 12px 4px; background: #eef0fd; font-size: 14px; line-height: 1.55; }
.mock-a p { margin: 0 0 8px; }
.mock-src { margin: 0; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.mock-src span { color: var(--primary); }
.signin { position: relative; display: flex; justify-content: center; padding: 72px 24px 48px; }
@media (min-width: 860px) { .signin { align-items: center; padding: 110px 64px 56px; } }
.signin-help { position: absolute; top: 24px; right: 24px; font-size: 13px; color: var(--text-3); }
@media (min-width: 860px) { .signin-help { top: 48px; right: 48px; } }
.signin-box { width: 100%; max-width: 430px; }
.signin h1 { margin: 0 0 14px; font-size: 32px; line-height: 1.25; font-weight: 600; letter-spacing: -0.03em; }
.signin .line { margin: 0 0 32px; color: var(--text-3); font-size: 14px; line-height: 1.7; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; padding: 0 20px; border-radius: var(--radius-control); border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-wide { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--field-border); }
.btn-outline:hover { background: var(--sunken); color: var(--text); }
.btn[disabled] { cursor: not-allowed; opacity: .55; }
.alert { margin: 0 0 24px; padding: 12px 14px; border-radius: var(--radius-control); background: var(--bad-bg); color: var(--bad-text); font-size: 14px; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--text-3); }
.dev { margin-top: 36px; padding-top: 20px; border-top: 1px dashed var(--border); }
.dev h2 { margin: 0 0 4px; font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.dev ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.dev .btn { height: 44px; justify-content: flex-start; font-weight: 500; }

/* ---------- the top menu ---------- */
.top { background: var(--ink); color: var(--on-ink); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.top .wordmark { font-size: 19px; }
.switch { display: flex; align-items: center; gap: 8px; }
.switch select { font: inherit; font-size: 14px; color: var(--on-ink); background: var(--ink-raised); border: 1px solid #3b4a78; border-radius: var(--radius-control); padding: 7px 10px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--on-ink-muted); text-decoration: none; padding: 18px 10px 16px; font-size: 14px; font-weight: 550; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--on-ink); }
.nav a[aria-current='page'] { color: var(--on-ink); border-bottom-color: var(--highlight); }
.me { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--on-ink-muted); }
.me button { font: inherit; font-size: 13px; color: var(--on-ink); background: none; border: 1px solid #3b4a78; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.badge-super { padding: 2px 8px; border-radius: 999px; background: var(--ink-raised); color: var(--highlight); font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }

/* ---------- pages ---------- */
main.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.03em; }
.page-head p { margin: 4px 0 0; color: var(--text-3); font-size: 14px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 999px; }
.seg a { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--text-2); text-decoration: none; }
.seg a[aria-current='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 24px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px 20px; }
.tile-label { margin: 0; font-size: 13px; color: var(--text-3); font-weight: 550; }
.tile-value { margin: 6px 0 2px; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.tile-sub { margin: 0; font-size: 13px; color: var(--text-3); }
.cards { display: grid; gap: 24px; }
@media (min-width: 980px) { .cards.two { grid-template-columns: 3fr 2fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px 22px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 17px; font-weight: 650; }
.card .sub { margin: 0 0 16px; font-size: 13px; color: var(--text-3); }
.card-foot { margin: 14px 0 0; font-size: 14px; }
.empty { margin: 8px 0 0; color: var(--text-3); font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list .meta { display: block; font-size: 12px; color: var(--text-3); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; }

/* Status: an icon and words, never colour alone. */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.chip.info { background: var(--info-bg); color: var(--info-text); }
.chip.muted { background: var(--muted-bg); color: var(--muted-text); }
.chip.bad { background: var(--bad-bg); color: var(--bad-text); }

/* The question log */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.filters input[type='search'], .filters select { font: inherit; font-size: 14px; height: 38px; padding: 0 12px; border: 1px solid var(--field-border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); }
.filters input[type='search'] { min-width: 240px; flex: 1; }
.filters .btn { height: 38px; }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th { text-align: left; font-size: 12px; font-weight: 650; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.log td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.log td.when { white-space: nowrap; color: var(--text-2); width: 1%; }
table.log td.where { color: var(--text-2); max-width: 220px; overflow-wrap: anywhere; }
table.log summary { cursor: pointer; }
table.log .answer { margin: 10px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--sunken); white-space: pre-line; }
table.log .sources { margin: 8px 0 0; font-size: 13px; color: var(--text-3); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 14px; color: var(--text-3); }
.scroll { overflow-x: auto; }
@media (max-width: 700px) { table.log td.where, table.log th.where { display: none; } }

/* The chart: thin bars from one baseline, 2px gaps between segments, a legend, and a table view. */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart g.day:hover rect { opacity: .85; }
.legend { display: flex; gap: 18px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; pointer-events: none; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--on-ink); font-size: 12px; line-height: 1.5; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; }
.tip[hidden] { display: none; }
details.table-view { margin-top: 12px; font-size: 13px; }
details.table-view table { margin-top: 8px; border-collapse: collapse; }
details.table-view td, details.table-view th { padding: 3px 14px 3px 0; text-align: left; }
details.table-view th { color: var(--text-3); font-weight: 600; }
