/* Liquidity Radar — interface styles.
   Colour roles follow the validated reference palette: categorical slots in
   fixed order for the score breakdown, the reserved status palette for claim
   verdicts (always paired with an icon and a label, never colour alone), and an
   ordinal blue ramp for the priority bands. */

:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --surface-2:   #f2f1ed;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --ink-muted:   #898781;
  --rule:        #e1e0d9;
  --rule-strong: #c3c2b7;
  --border:      rgba(11, 11, 11, 0.10);

  /* categorical slots — score breakdown rows, fixed order */
  --s1: #2a78d6;  --s2: #eb6834;  --s3: #1baf7a;
  --s4: #eda100;  --s5: #e87ba4;  --s6: #008300;

  /* status — verdicts */
  --good: #0ca30c;  --warning: #fab219;
  --serious: #ec835a;  --critical: #d03b3b;

  /* ordinal ramp — priority bands (light: no lighter than step 250) */
  --p1: #1c5cab;  --p2: #3987e5;  --p3: #86b6ef;  --p0: #c3c2b7;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);
}

/* Three states, not two. An explicit choice stamps data-theme on the root; the
   default "system" stamps nothing, so only the media query separates light
   from dark there. Each dark rule is therefore written twice: once guarded
   against an explicit light choice, once for an explicit dark one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:        #0d0d0d;
    --surface:     #1a1a19;
    --surface-2:   #232322;
    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --ink-muted:   #898781;
    --rule:        #2c2c2a;
    --rule-strong: #383835;
    --border:      rgba(255, 255, 255, 0.10);
    --s1: #3987e5;  --s2: #d95926;  --s3: #199e70;
    --s4: #c98500;  --s5: #d55181;  --s6: #008300;
    --p1: #86b6ef;  --p2: #3987e5;  --p3: #256abf;  --p0: #383835;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface:     #1a1a19;
  --surface-2:   #232322;
  --ink:         #ffffff;
  --ink-2:       #c3c2b7;
  --ink-muted:   #898781;
  --rule:        #2c2c2a;
  --rule-strong: #383835;
  --border:      rgba(255, 255, 255, 0.10);
  --s1: #3987e5;  --s2: #d95926;  --s3: #199e70;
  --s4: #c98500;  --s5: #d55181;  --s6: #008300;
  --p1: #86b6ef;  --p2: #3987e5;  --p3: #256abf;  --p0: #383835;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--s1); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px 64px; }

/* ---------- header ---------- */

header.top {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.top-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 28px; min-height: 58px;
}
.brand { font-weight: 620; letter-spacing: -0.01em; font-size: 15px; color: var(--ink); }
.brand span { color: var(--ink-muted); font-weight: 420; }
nav.top-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.top-nav a {
  color: var(--ink-2); padding: 6px 11px; border-radius: 7px; font-size: 13px;
}
nav.top-nav a:hover { background: var(--surface-2); text-decoration: none; }
nav.top-nav a.on { background: var(--surface-2); color: var(--ink); font-weight: 560; }

/* ---------- demo banner ---------- */

.demo-banner {
  background: #fff6e0; border-bottom: 1px solid #f0dca8; color: #6b4a05;
  padding: 9px 24px; font-size: 13px;
}
.demo-banner strong { font-weight: 620; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .demo-banner {
    background: #2a2310; border-color: #4a3d15; color: #f0d79a;
  }
}

:root[data-theme="dark"] .demo-banner {
  background: #2a2310; border-color: #4a3d15; color: #f0d79a;
}

/* ---------- page head ---------- */

.page-head { padding: 30px 0 20px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.02em; font-weight: 640; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.stamp { color: var(--ink-muted); font-size: 12.5px; margin-top: 8px; }

/* ---------- stat tiles ---------- */

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.tile .k { font-size: 12px; color: var(--ink-muted); text-transform: uppercase;
           letter-spacing: 0.045em; font-weight: 560; }
.tile .v { font-size: 27px; font-weight: 640; letter-spacing: -0.02em;
           margin-top: 5px; line-height: 1.1; }
.tile .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.tile.accent .v { color: var(--p1); }

/* ---------- filters ---------- */

.filters {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.filters .label {
  font-size: 12px; color: var(--ink-muted); text-transform: uppercase;
  letter-spacing: 0.045em; font-weight: 560; margin-right: 4px;
}
.chip {
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
  padding: 5px 11px; border-radius: 999px; font-size: 13px;
}
.chip:hover { border-color: var(--rule-strong); text-decoration: none; }
.chip.on { background: var(--ink); color: var(--page); border-color: var(--ink); }

/* ---------- cards / tables ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card > h2 {
  margin: 0; padding: 15px 18px 13px; font-size: 13px; font-weight: 620;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}
.card > .body { padding: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-muted); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.who { font-weight: 600; color: var(--ink); }
.what { color: var(--ink-2); font-size: 13px; margin-top: 2px;
        display: block; max-width: 46ch; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  font-weight: 620; padding: 3px 8px; border-radius: 5px; white-space: nowrap;
  letter-spacing: 0.02em;
}
.pri-P1 { background: var(--p1); color: #fff; }
.pri-P2 { background: var(--p2); color: #fff; }
.pri-P3 { background: var(--p3); color: #0b0b0b; }
.pri-REJECTED { background: var(--p0); color: #0b0b0b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pri-P1 { color: #0d0d0d; }
  :root:not([data-theme="light"]) .pri-P3 { color: #fff; }
  :root:not([data-theme="light"]) .pri-REJECTED { color: #c3c2b7; }
}

:root[data-theme="dark"] .pri-P1 { color: #0d0d0d; }
:root[data-theme="dark"] .pri-P3 { color: #fff; }
:root[data-theme="dark"] .pri-REJECTED { color: #c3c2b7; }

.tag {
  display: inline-block; font-size: 11.5px; padding: 2px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--rule);
  white-space: nowrap;
}
.tag.new { background: var(--s1); color: #fff; border-color: var(--s1); }

/* verdicts — status colour plus an icon plus the word */
.verdict { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
           font-weight: 560; white-space: nowrap; }
.verdict .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.v-VERIFIED .dot { background: var(--good); }
.v-PARTIALLY_VERIFIED .dot { background: var(--warning); }
.v-UNVERIFIED .dot { background: var(--serious); }
.v-CONTRADICTED .dot { background: var(--critical); }

.tier {
  font-size: 11px; font-weight: 620; letter-spacing: 0.04em; padding: 2px 6px;
  border-radius: 4px; border: 1px solid var(--rule-strong); color: var(--ink-2);
}
.tier-PRIMARY { border-color: var(--good); color: var(--good); }

/* ---------- score ---------- */

.score-cell { display: flex; align-items: center; gap: 10px; }
.score-num { font-variant-numeric: tabular-nums; font-weight: 640; font-size: 15px;
             min-width: 24px; text-align: right; }

/* One filled rectangle. A stack of six at this width left the smallest
   component about six pixels across, which no amount of care renders cleanly. */
.bar {
  width: 116px; height: 8px; flex: none;
  background: var(--surface-2); border-radius: 4px; overflow: hidden;
}
.bar i { display: block; height: 100%; background: var(--p2); border-radius: 4px; }

/* Composition, where there is room to read it. */
.breakdown { display: grid; gap: 9px; }
.bd-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px auto;
  align-items: center; gap: 12px;
}
.bd-label { font-size: 13px; color: var(--ink-2); }
.bd-track {
  height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden;
}
.bd-fill { display: block; height: 100%; border-radius: 4px; }
.bd-num {
  font-size: 13px; font-weight: 620; font-variant-numeric: tabular-nums;
  min-width: 46px; text-align: right;
}
.bd-of { color: var(--ink-muted); font-weight: 400; }

/* ---------- event card ---------- */

.event-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
              padding: 26px 0 18px; }
.event-head h1 { margin: 0 0 4px; font-size: 25px; letter-spacing: -0.02em; }
.event-head .who-line { color: var(--ink-2); font-size: 15px; }
.event-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.event-score { margin-left: auto; text-align: right; min-width: 120px; }
.event-score .n { font-size: 40px; font-weight: 660; letter-spacing: -0.03em;
                  line-height: 1; }
.event-score .of { color: var(--ink-muted); font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
           gap: 16px; align-items: start; }
/* Grid items default to min-width:auto, so a wide table inside the left column
   refuses to shrink and starves the right one. */
.grid-2 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Facts read as a table of figures, so the values align on their own column
   and the numerals are tabular. */
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto;
         gap: 10px 16px; align-items: baseline; }
.facts dt { color: var(--ink-2); font-size: 13px; margin: 0; }
.facts dd { margin: 0; text-align: right; font-size: 13.5px; font-weight: 560;
            font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts dd .qual { color: var(--ink-muted); font-weight: 400; font-size: 12.5px; }
.facts dd.unset { color: var(--ink-muted); font-weight: 400; }

.why-region { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.why-region .k { display: block; color: var(--ink-muted); font-size: 12px;
                 text-transform: uppercase; letter-spacing: 0.05em;
                 font-weight: 560; margin-bottom: 5px; }
.why-region p { margin: 0; font-size: 13.5px; color: var(--ink-2); }

.calc {
  background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: 8px; padding: 13px 15px; font-size: 13.5px; color: var(--ink-2);
  line-height: 1.6;
}
.calc .result { color: var(--ink); font-weight: 620; font-size: 19px;
                font-variant-numeric: tabular-nums; display: block; margin-bottom: 5px; }

ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin-bottom: 7px; color: var(--ink-2); }
ul.plain li:last-child { margin-bottom: 0; }

.reject-note {
  border-left: 3px solid var(--serious); background: var(--surface-2);
  padding: 11px 14px; border-radius: 0 8px 8px 0; color: var(--ink-2);
}

.empty { padding: 44px 18px; text-align: center; color: var(--ink-muted); }

.doc-title { font-weight: 560; }
.doc-url { color: var(--ink-muted); font-size: 12px; }
.doc-url a { word-break: break-all; }
/* Fixed layout keeps all four columns on screen: the verdict and the document
   a claim is bound to are the point of this table, so neither may scroll away. */
.claims-table { table-layout: fixed; }
.claims-table th:nth-child(1), .claims-table td:nth-child(1) { width: 20%; }
.claims-table th:nth-child(2), .claims-table td:nth-child(2) { width: 33%; }
.claims-table th:nth-child(3), .claims-table td:nth-child(3) { width: 17%; }
.claims-table td { overflow-wrap: break-word; }

.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.funnel-row .fl { width: 190px; font-size: 13px; color: var(--ink-2); flex: none; }
.funnel-row .fb { height: 22px; background: var(--s1); border-radius: 4px; min-width: 3px; }
.funnel-row .fn { font-variant-numeric: tabular-nums; font-weight: 620; }

footer.foot { color: var(--ink-muted); font-size: 12.5px; padding: 26px 0 0;
              border-top: 1px solid var(--rule); margin-top: 30px; }

/* ---------- sign-in ---------- */

.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  /* A quiet wash so the card sits on something, in both themes. */
  background:
    radial-gradient(1100px 520px at 50% -8%, var(--surface-2), transparent 70%),
    var(--page);
}

.login-shell { width: 100%; max-width: 384px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 34px 32px 30px;
}

.login-mark {
  width: 46px; height: 46px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 20px;
  background: var(--surface-2); color: var(--p2);
  border: 1px solid var(--rule);
}

.login-card h1 {
  margin: 0 0 6px; font-size: 21px; font-weight: 640;
  letter-spacing: -0.02em;
}
.login-sub {
  margin: 0 0 24px; color: var(--ink-2); font-size: 13.5px; line-height: 1.5;
}

.login-error {
  background: var(--surface-2);
  border-left: 3px solid var(--critical);
  border-radius: 0 7px 7px 0;
  padding: 10px 13px; margin-bottom: 20px;
  font-size: 13.5px; color: var(--ink);
}

.login-card label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px;
}

.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 17px;
  background: var(--page); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 8px;
  font: inherit; font-size: 14.5px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.login-card input:focus {
  outline: none; border-color: var(--p2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--p2) 22%, transparent);
}

.login-card button {
  width: 100%; padding: 11px 14px; margin-top: 4px;
  background: var(--p1); color: #fff;
  border: 0; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 600;
  transition: filter 120ms ease;
}
.login-card button:hover { filter: brightness(1.08); }
.login-card button:focus-visible {
  outline: 2px solid var(--p2); outline-offset: 2px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-card button { color: #0d0d0d; }
}

:root[data-theme="dark"] .login-card button { color: #0d0d0d; }

.login-foot {
  margin: 20px 4px 0; font-size: 12px; line-height: 1.5;
  color: var(--ink-muted); text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .login-card input, .login-card button { transition: none; }
}

/* Sign-out sits at the end of the main navigation. */
nav.top-nav a.signout { color: var(--ink-muted); }

.tier-key { display: grid; gap: 9px 22px; }
@media (min-width: 720px) { .tier-key { grid-template-columns: 1fr 1fr; } }
.tier-key > div { display: flex; gap: 10px; align-items: baseline;
                  font-size: 13.5px; color: var(--ink-2); }
.tier-key .tier { flex: none; }

/* The whole row is a target; the anchor in the first cell is still the link. */
tbody tr[data-href] { cursor: pointer; }

.back { margin: 22px 0 -8px; font-size: 13.5px; }
.back a { color: var(--ink-2); }
.back a:hover { color: var(--ink); text-decoration: none; }

/* ---------- tooltip ---------- */

#tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--page);
  padding: 5px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; opacity: 0; transform: translateY(2px);
  transition: opacity 90ms ease, transform 90ms ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}
#tip.on { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { #tip { transition: none; } }
[data-tip] { cursor: help; }

/* ---------- theme switch ---------- */

.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-left: 4px;
  background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--ink-2); font-size: 14px; line-height: 1; cursor: pointer;
  font-family: inherit;
}
.theme-btn:hover { background: var(--surface-2); color: var(--ink); }
.theme-btn:focus-visible { outline: 2px solid var(--p2); outline-offset: 2px; }
.theme-ico { pointer-events: none; }

/* Cards stacked in the exported file, each its own section. */
.export-card { border-top: 1px solid var(--rule); margin-top: 34px; padding-top: 4px; }
.export-card:target > .back a { color: var(--p2); }
