/* AnalyzeMe — design tokens per the supplied reference.
   Light is the default; .dark on <html> switches, and a user with no stored
   preference follows prefers-color-scheme. Shadow opacity is 0 in the
   reference, so depth comes from borders and surface steps, never drop shadows. */

:root {
  --background: #ffffff;
  --foreground: #0f1419;
  --card: #f7f8f8;
  --card-foreground: #0f1419;
  --popover: #ffffff;
  --popover-foreground: #0f1419;
  --primary: #1e9df1;
  --primary-foreground: #ffffff;
  --secondary: #0f1419;
  --secondary-foreground: #ffffff;
  --muted: #e5e5e6;
  --muted-foreground: #5b6b76;
  --accent: #e3ecf6;
  --accent-foreground: #1e9df1;
  --destructive: #f4212e;
  --destructive-foreground: #ffffff;
  --border: #e1eaef;
  --input: #f7f9fa;
  --ring: #1da1f2;
  --chart-1: #1e9df1;
  --chart-2: #00b87a;
  --chart-3: #f7b928;
  --chart-4: #17bf63;
  --chart-5: #e0245e;

  --font-sans: "Open Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: Menlo, ui-monospace, SFMono-Regular, monospace;

  --radius: 1.3rem;
  --radius-md: .9rem;
  --radius-sm: .6rem;
  --radius-pill: 999px;

  /* One height for every single-line control. Browsers give <select> its own
     intrinsic height, so identical padding alone still renders it shorter than
     an <input>; the shared height is what actually lines them up. */
  --control-h: 2.9rem;
  --select-arrow: #5b6b76;

  /* Status scale: green -> amber -> red, readable on a light surface. */
  --good-bg: #e6f7ee; --good-fg: #06693a; --good-line: #17bf63;
  --warn-bg: #fdf4de; --warn-fg: #7a5807; --warn-line: #f7b928;
  --bad-bg:  #fdeaec; --bad-fg:  #a1121c; --bad-line: #f4212e;

  /* Initials tile behind a missing performer photo. */
  --tint-a: 55% 88%; --tint-b: 50% 76%; --tint-ink: 45% 30%;

  color-scheme: light;
}

.dark {
  --background: #000000;
  --foreground: #e7e9ea;
  --card: #17181c;
  --card-foreground: #d9d9d9;
  --popover: #000000;
  --popover-foreground: #e7e9ea;
  --primary: #1c9cf0;
  --primary-foreground: #ffffff;
  --secondary: #f0f3f4;
  --secondary-foreground: #0f1419;
  --muted: #181818;
  --muted-foreground: #72767a;
  --accent: #061622;
  --accent-foreground: #1c9cf0;
  --destructive: #f4212e;
  --destructive-foreground: #ffffff;
  --border: #242628;
  --input: #22303c;
  --ring: #1da1f2;

  --good-bg: #06251a; --good-fg: #4ade80; --good-line: #17bf63;
  --warn-bg: #2a2109; --warn-fg: #fbbf24; --warn-line: #f7b928;
  --bad-bg:  #2b0f13; --bad-fg:  #fb7185; --bad-line: #f4212e;

  --tint-a: 40% 26%; --tint-b: 45% 14%; --tint-ink: 60% 78%;
  --select-arrow: #8b9198;

  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
main.wrap { flex: 1; padding-block: 2rem 3.5rem; }

/* ---------- header / footer ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--background);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; padding-block: .85rem; flex-wrap: wrap; }
.brand { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; color: var(--foreground); }
.brand span { color: var(--primary); }
.tagline { color: var(--muted-foreground); font-size: .82rem; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.nav-btn {
  background: transparent; color: var(--foreground);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font: inherit; font-size: .85rem; font-weight: 600;
  padding: .45rem .9rem; cursor: pointer; transition: background .15s, color .15s;
}
.nav-btn:hover { background: var(--accent); color: var(--accent-foreground); }
.nav-btn[aria-current="true"] { background: var(--accent); color: var(--accent-foreground); }
.who {
  color: var(--muted-foreground); font-size: .8rem;
  padding-left: .6rem; margin-left: .2rem; border-left: 1px solid var(--border);
}
.theme-toggle { font-size: 1rem; line-height: 1; padding: .45rem .6rem; }

.site-footer { border-top: 1px solid var(--border); background: var(--card); }
.site-footer .wrap { padding-block: 1rem; color: var(--muted-foreground); font-size: .78rem; }

/* ---------- typography ---------- */
h1 { font-size: clamp(1.5rem, 4vw, 2.05rem); margin-bottom: .4rem; letter-spacing: -.022em; font-weight: 800; }
h2 { font-size: 1.15rem; margin: 2rem 0 .8rem; letter-spacing: -.012em; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
.lede { color: var(--muted-foreground); margin-bottom: 1.6rem; }
.muted { color: var(--muted-foreground); }
.small { font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
/* Not scoped to `form` — the admin decision panel uses the same grid outside a
   <form> element. */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.span2 { grid-column: span 2; }
@media (max-width: 660px) { .grid { grid-template-columns: 1fr; } .span2 { grid-column: span 1; } }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span, .box-label { font-size: .85rem; font-weight: 600; color: var(--foreground); }
.field small { color: var(--muted-foreground); font-weight: 400; }
.field small.hint { font-size: .75rem; line-height: 1.4; }
.field em { color: var(--destructive); font-style: normal; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: var(--radius-md);
  padding: .65rem .85rem;
  font: inherit; line-height: 1.4; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
/* Every single-line control shares one height. Checkboxes, radios and the
   hidden file input keep their own sizing. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select {
  height: var(--control-h);
}
textarea { min-height: var(--control-h); resize: vertical; }

/* Drop the native control chrome so a select is the same shape as an input on
   every OS, then draw the chevron ourselves in the theme's own colour. */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 2.4rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--select-arrow) 50%),
                    linear-gradient(135deg, var(--select-arrow) 50%, transparent 50%);
  /* The two halves must be exactly one tile apart or the triangle splits. */
  background-position: calc(100% - 20px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select::-ms-expand { display: none; }
/* The dropdown list itself is drawn by the OS, so give it explicit colours or
   dark mode shows black text on a black popup in some browsers. */
select option { background: var(--popover); color: var(--popover-foreground); }
input::placeholder, textarea::placeholder { color: var(--muted-foreground); opacity: .75; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.budget-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem; gap: .75rem;
}
.budget-options { display: grid; grid-template-columns: 1fr auto 1.2fr; gap: 1rem; align-items: center; }
@media (max-width: 660px) { .budget-options { grid-template-columns: 1fr; } .or { text-align: center; } }
.upload-drop {
  border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 1.1rem;
  text-align: center; cursor: pointer; color: var(--muted-foreground);
  transition: border-color .15s, background .15s; display: block; background: var(--background);
}
.upload-drop:hover, .upload-drop.dragover { border-color: var(--primary); background: var(--accent); }
.upload-drop.has-file { border-style: solid; border-color: var(--primary); color: var(--foreground); background: var(--accent); }
.upload-drop input[type="file"] { display: none; }
.or { color: var(--muted-foreground); font-size: .85rem; }
.sheet-url input { font-size: .85rem; }

.actions { margin-top: 1.4rem; display: flex; flex-direction: column; gap: .75rem; }

/* ---------- buttons ---------- */
button[type="submit"], .btn {
  background: var(--primary); color: var(--primary-foreground);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font: inherit; font-weight: 700; padding: .75rem 1.5rem;
  cursor: pointer; align-self: flex-start;
  transition: filter .15s, background .15s; text-decoration: none; display: inline-block;
}
button[type="submit"]:hover, .btn:hover { filter: brightness(1.07); }
button[disabled] { opacity: .55; cursor: not-allowed; filter: none; }
.btn.secondary {
  background: transparent; color: var(--foreground); border-color: var(--border);
}
.btn.secondary:hover { background: var(--accent); color: var(--accent-foreground); border-color: var(--accent); }
.btn.tiny { padding: .42rem .95rem; font-size: .78rem; }

.icon-btn {
  background: none; border: 0; color: var(--muted-foreground); font: inherit;
  font-size: .78rem; cursor: pointer; padding: 0; text-decoration: underline;
}
.icon-btn:hover { color: var(--destructive); }
.icon-btn:disabled { opacity: .5; cursor: default; }
.linkish {
  background: none; border: 0; color: var(--primary); font: inherit;
  font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline;
}
.open-link { color: var(--primary); text-decoration: none; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.open-link:hover { text-decoration: underline; }

.error {
  background: var(--bad-bg); color: var(--bad-fg);
  border: 1px solid var(--bad-line); border-radius: var(--radius-md);
  padding: .65rem .95rem; font-size: .9rem;
}
.flash {
  background: var(--good-bg); color: var(--good-fg); border: 1px solid var(--good-line);
  border-radius: var(--radius-md); padding: .65rem .95rem; margin-bottom: 1rem; font-size: .9rem;
}

/* ---------- landing / auth ----------
   The landing owns the whole viewport and does not scroll. `on-landing` hides
   the app shell so the split fills the screen exactly. */
body.on-landing { overflow: hidden; }
body.on-landing .site-header,
body.on-landing .site-footer { display: none; }
body.on-landing main.wrap { width: 100%; padding: 0; }

.landing {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  /* dvh follows the mobile URL bar, which vh does not. */
  height: 100dvh;
  min-height: 100dvh;
}

.landing-pitch {
  background: var(--card);
  border-right: 1px solid var(--border);
  /* Generous inset, and the copy is capped so it never hugs the edge on a wide
     monitor. */
  padding-block: clamp(2rem, 5vh, 4rem);
  padding-inline: clamp(1.75rem, 7vw, 7rem);
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
.landing-pitch > * { max-width: 34rem; }
.landing-brand { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: clamp(1.2rem, 4vh, 2.5rem); }
.landing-brand span { color: var(--primary); }
.landing-brand em { font-style: normal; font-weight: 400; font-size: .8rem; color: var(--muted-foreground); }
.landing-pitch h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.8rem); line-height: 1.12;
  letter-spacing: -.03em; margin-bottom: .8rem; max-width: 16ch;
}
.landing-sub {
  color: var(--muted-foreground); font-size: clamp(.9rem, 1.1vw, 1rem);
  max-width: 46ch; margin-bottom: clamp(1.2rem, 3.5vh, 2rem);
}
.landing-points { list-style: none; display: flex; flex-direction: column; gap: clamp(.6rem, 1.8vh, 1rem); max-width: 48ch; }
.landing-points li {
  position: relative; padding-left: 1.75rem;
  color: var(--muted-foreground); font-size: clamp(.85rem, 1vw, .95rem); line-height: 1.5;
}
.landing-points li::before {
  content: "✓"; position: absolute; left: 0; top: -1px;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-foreground);
  font-size: .7rem; font-weight: 900; text-align: center; line-height: 1.15rem;
}
.landing-points strong { color: var(--foreground); font-weight: 700; }
.landing-staff {
  margin-top: clamp(1.2rem, 4vh, 2.2rem); padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground); font-size: .78rem;
}

.landing-form {
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1.25rem, 4vw, 3rem);
  /* The safety net: if the viewport is too short for the sign-up fields this
     column scrolls internally, so the submit button is never unreachable. */
  overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 400px; margin: auto;
  background: transparent; border: 0; border-radius: 0; padding: 0;
}
.auth-card h2 { font-size: 1.5rem; margin: 0 0 .35rem; letter-spacing: -.02em; font-weight: 800; }
.auth-lede { color: var(--muted-foreground); font-size: .88rem; margin-bottom: 1.4rem; }
.auth-card .field { margin-bottom: .85rem; }
.auth-card button[type="submit"] { width: 100%; text-align: center; align-self: stretch; }
.auth-switch { margin-top: 1.1rem; text-align: center; }
.mobile-brand { display: none; }
.landing-theme {
  position: fixed; top: 1rem; right: 1rem; z-index: 10;
  background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  cursor: pointer; font-family: inherit;
}
.landing-theme:hover { background: var(--accent); color: var(--accent-foreground); }

@media (max-width: 900px) {
  /* Phones: the pitch collapses to the wordmark so the form owns the screen. */
  .landing { grid-template-columns: 1fr; }
  .landing-pitch { display: none; }
  .mobile-brand { display: block; text-align: center; margin-bottom: 1.5rem; }
  .landing-form { padding: 1.5rem; }
}

/* ---------- loading ---------- */
#loading { text-align: center; padding-block: 4rem; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto 1.2rem; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards & chips ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: .8rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .38rem;
  padding: .18rem .7rem; border-radius: var(--radius-pill);
  font-size: .74rem; font-weight: 700; letter-spacing: .02em;
  border: 1px solid; white-space: nowrap;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.low    { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.chip.medium { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.chip.high   { background: var(--bad-bg);  color: var(--bad-fg);  border-color: var(--bad-line); }
.badge {
  display: inline-block; background: var(--accent); color: var(--accent-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: .08rem .6rem; font-size: .72rem; font-weight: 600;
}

/* ---------- report ---------- */
.report-head {
  display: grid; grid-template-columns: auto auto 1fr; gap: 1.4rem;
  align-items: center; margin-bottom: 1.5rem;
}
.report-head .hcard-media { width: 132px; height: 132px; border-radius: var(--radius); flex: none; }
.report-head .hcard-fallback { font-size: 2.4rem; }
@media (max-width: 800px) { .report-head { grid-template-columns: auto 1fr; } .report-head > :last-child { grid-column: 1 / -1; } }
@media (max-width: 520px) { .report-head { grid-template-columns: 1fr; } .report-head .hcard-media { width: 100%; height: 190px; } }

.score-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem 1.5rem; text-align: center; min-width: 165px;
}
.score-tile .num { font-size: 2.7rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.score-tile .of { color: var(--muted-foreground); font-size: .78rem; }
.verdict {
  display: inline-block; margin-top: .55rem; padding: .28rem .9rem;
  border-radius: var(--radius-pill); font-weight: 800; font-size: .82rem; border: 1px solid;
}
.verdict.GO      { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.verdict.CAUTION { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.verdict.NO_GO   { background: var(--bad-bg);  color: var(--bad-fg);  border-color: var(--bad-line); }
.capped-note { margin-top: .35rem; font-size: .7rem; color: var(--muted-foreground); }
.exec-summary { color: var(--card-foreground); }
.report-meta { color: var(--muted-foreground); font-size: .8rem; margin-top: .45rem; }

/* ---------- verdict meter ----------
   Fill = severity step; track = a lighter step of the SAME ramp. Light-mode
   fills are darkened from the token hues so each clears 3:1 against the white
   page (#0e8f4a 4.16:1, #b07d08 3.63:1, #d81824 5.15:1); the dark-mode fills
   use the brighter tokens (8.7:1 / 11.9:1 / 5.1:1 on black). */
:root { --vm-fill: var(--muted-foreground); --vm-track: var(--muted); }
.vmeter[data-verdict="GO"]      { --vm-fill: #0e8f4a; --vm-track: var(--good-bg); --vm-ink: var(--good-fg); }
.vmeter[data-verdict="CAUTION"] { --vm-fill: #b07d08; --vm-track: var(--warn-bg); --vm-ink: var(--warn-fg); }
.vmeter[data-verdict="NO_GO"]   { --vm-fill: #d81824; --vm-track: var(--bad-bg);  --vm-ink: var(--bad-fg); }
.dark .vmeter[data-verdict="GO"]      { --vm-fill: #17bf63; }
.dark .vmeter[data-verdict="CAUTION"] { --vm-fill: #f7b928; }
.dark .vmeter[data-verdict="NO_GO"]   { --vm-fill: #f4212e; }

.vmeter {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 1.4rem 1rem;
  margin-bottom: 1rem;
}
.vm-top { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.vm-figure { line-height: 1; }
/* Hero figure: proportional figures, not tabular — tabular looks loose this big. */
.vm-score { font-size: 3.2rem; font-weight: 800; letter-spacing: -.04em; color: var(--vm-ink); }
.vm-outof { font-size: 1rem; font-weight: 600; color: var(--muted-foreground); }
.vm-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--vm-track); color: var(--vm-ink);
  border: 1px solid var(--vm-fill); border-radius: var(--radius-pill);
  padding: .3rem .95rem; font-weight: 800; font-size: .9rem; letter-spacing: .03em;
}
.vm-icon {
  width: 18px; height: 18px; border-radius: 50%; background: var(--vm-fill);
  color: #fff; font-size: .72rem; line-height: 18px; text-align: center; font-weight: 900;
}
.vm-caption { flex: 1 1 260px; font-size: .78rem; color: var(--muted-foreground); line-height: 1.45; }
.vm-caption strong { color: var(--vm-ink); }

.vm-track {
  position: relative; height: 14px; margin-top: 1rem;
  background: var(--vm-track); border-radius: var(--radius-pill); overflow: hidden;
}
.vm-fill {
  position: absolute; inset: 0 auto 0 0; background: var(--vm-fill);
  border-radius: var(--radius-pill); transition: width .5s ease;
}
/* Threshold dividers at 45 and 70, drawn in the surface colour so they read as
   gaps rather than extra marks. */
.vm-div { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--card); opacity: .9; }
.vm-needle {
  position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px;
  background: var(--foreground); border-radius: 2px;
}
.vm-scale { display: flex; margin-top: .4rem; }
.vm-band {
  position: relative; font-size: .64rem; font-weight: 700; letter-spacing: .05em;
  color: var(--muted-foreground); padding-left: .3rem; border-left: 1px solid var(--border);
}
.vm-band i { display: block; font-style: normal; font-weight: 400; opacity: .8; }

.vm-deal {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border);
}
.vm-deal-label { font-size: .78rem; font-weight: 700; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 560px) {
  .vm-score { font-size: 2.6rem; }
  .vm-band { font-size: .58rem; }
}

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 780px) { .twocol { grid-template-columns: 1fr; } }
.plain-list.red li { color: var(--bad-fg); }

/* Headline profitability figures, directly under the report title. */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .8rem; margin: 1.5rem 0 .8rem;
}
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1.1rem;
}
.stat.stat-bad { border-color: var(--bad-line); }
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-foreground); font-weight: 700; }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin: .15rem 0; font-variant-numeric: tabular-nums; }
.stat-value.pos { color: var(--good-fg); }
.stat-value.neg { color: var(--destructive); }
.stat-value .chip { font-size: .8rem; vertical-align: middle; }
.stat-note { font-size: .74rem; color: var(--muted-foreground); line-height: 1.35; }
.big-warning { font-weight: 600; margin-bottom: 1rem; }

.flag-list li, .plain-list li { margin-left: 1.2rem; margin-bottom: .3rem; color: var(--card-foreground); }
.cal-list { list-style: none; }
.cal-list li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.cal-list li:last-child { border-bottom: 0; }
.cal-list .chip { margin-right: .5rem; }
.cal-list .muted { font-size: .85rem; margin-top: .2rem; }
h4.sub {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted-foreground); margin: .95rem 0 .35rem; font-weight: 700;
}

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table.matrix { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 520px; }
.matrix th, .matrix td { padding: .6rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.matrix th {
  background: var(--muted); color: var(--foreground);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
}
.matrix tr:last-child td { border-bottom: 0; }
.matrix td.num { font-variant-numeric: tabular-nums; }
td.loss { color: var(--destructive); font-weight: 700; }
td.gain { color: var(--good-fg); font-weight: 700; }

details.risk {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: .6rem; overflow: hidden;
}
details.risk summary {
  cursor: pointer; padding: .85rem 1.2rem; display: flex; gap: .8rem;
  align-items: center; font-weight: 700; list-style: none;
}
details.risk summary::-webkit-details-marker { display: none; }
details.risk summary:hover { background: var(--accent); }
details.risk summary .cat { color: var(--muted-foreground); font-weight: 400; font-size: .8rem; }
details.risk .body { padding: 0 1.2rem 1.1rem; }
details.risk h4 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted-foreground); margin: .75rem 0 .3rem;
}

.venues { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 760px) { .venues { grid-template-columns: 1fr; } }
.venue-card h3 { margin-bottom: .18rem; }
.venue-card .vmeta { color: var(--muted-foreground); font-size: .8rem; margin-bottom: .5rem; }
.venue-card p { font-size: .89rem; color: var(--card-foreground); margin-bottom: .35rem; }
.venue-card .caveat { font-size: .82rem; color: var(--warn-fg); }
.rank {
  display: inline-block; background: var(--primary); color: var(--primary-foreground);
  font-weight: 800; font-size: .72rem; border-radius: var(--radius-pill);
  padding: .1rem .6rem; margin-right: .45rem;
}
.locked-badge { background: var(--good-line); color: #ffffff; }
.backup-badge { background: var(--muted); color: var(--muted-foreground); }
.venue-locked { border-color: var(--good-line); }
.maiseat-card { border-color: var(--primary); }

.report-actions { margin-top: 2rem; display: flex; gap: .8rem; flex-wrap: wrap; }

/* ---------- history cards ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1.1rem; }
.hcard {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .15s, transform .15s;
  --status-bg: var(--muted); --status-ink: var(--muted-foreground); --status-line: var(--border);
}
.hcard:hover { border-color: var(--primary); transform: translateY(-2px); }
.hcard.picked { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }

.hcard[data-verdict="GO"]      { --status-bg: var(--good-bg); --status-ink: var(--good-fg); --status-line: var(--good-line); }
.hcard[data-verdict="CAUTION"] { --status-bg: var(--warn-bg); --status-ink: var(--warn-fg); --status-line: var(--warn-line); }
.hcard[data-verdict="NO_GO"]   { --status-bg: var(--bad-bg);  --status-ink: var(--bad-fg);  --status-line: var(--bad-line); }
.hcard::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--status-line); z-index: 5;
}
.hcard .verdict.small-verdict {
  background: var(--status-bg); color: var(--status-ink); border-color: var(--status-line);
  margin-top: 0; padding: .18rem .7rem; font-size: .72rem; font-weight: 800;
}
.hcard .hcard-score {
  background: var(--status-bg); color: var(--status-ink); border-color: var(--status-line);
}

.hcard-media {
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  background: linear-gradient(140deg, hsl(var(--tint) var(--tint-a)), hsl(var(--tint) var(--tint-b)));
  display: flex; align-items: center; justify-content: center;
}
.hcard-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 22%; display: block;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.hcard-media.has-photo .hcard-img { opacity: 1; }
.hcard-media.has-photo .hcard-fallback { display: none; }
.hcard-media:hover .hcard-img { transform: scale(1.03); }
.hcard-fallback {
  font-size: 2.2rem; font-weight: 800; letter-spacing: .04em;
  color: hsl(var(--tint) var(--tint-ink));
}
.hcard-media.loading-photo .hcard-fallback { opacity: .5; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .85; } }

.hcard-open { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.hcard-score {
  position: absolute; right: .55rem; bottom: .55rem; z-index: 2; pointer-events: none;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: .92rem; font-weight: 800; padding: .1rem .6rem; font-variant-numeric: tabular-nums;
}
.photo-credit {
  position: absolute; left: 0; bottom: 0; z-index: 3; max-width: 72%;
  background: color-mix(in srgb, var(--background) 82%, transparent);
  color: var(--muted-foreground); text-decoration: none;
  font-size: .6rem; padding: .12rem .45rem; border-top-right-radius: var(--radius-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-credit:hover { color: var(--primary); }

.hcard-pick { position: absolute; top: .85rem; left: .55rem; z-index: 6; cursor: pointer; }
.hcard-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.hcard-pick-box {
  display: block; width: 22px; height: 22px; border-radius: var(--radius-sm);
  border: 2px solid var(--background);
  background: color-mix(in srgb, var(--foreground) 35%, transparent);
  transition: background .15s, border-color .15s;
}
.hcard-pick input:checked + .hcard-pick-box { background: var(--primary); border-color: var(--primary); }
.hcard-pick input:checked + .hcard-pick-box::after {
  content: "✓"; display: block; text-align: center; line-height: 18px;
  color: var(--primary-foreground); font-weight: 900; font-size: .85rem;
}
.hcard-pick input:focus-visible + .hcard-pick-box { outline: 2px solid var(--ring); outline-offset: 2px; }

.hcard-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.hcard-name { font-size: 1.02rem; line-height: 1.25; margin-bottom: .1rem; }
.hcard-sub { font-size: .82rem; color: var(--card-foreground); }
.hcard-sub.muted { color: var(--muted-foreground); }
.hcard-meta { margin: .75rem 0 .9rem; display: flex; flex-direction: column; gap: .24rem; font-size: .82rem; }
.hcard-meta > div { display: flex; gap: .5rem; }
.hcard-meta dt { color: var(--muted-foreground); min-width: 58px; flex: none; }
.hcard-meta dd { color: var(--card-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard-foot {
  margin-top: auto; padding-top: .65rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  flex-wrap: nowrap;
}
.hcard-foot .verdict { white-space: nowrap; }
.hcard-foot .open-link { white-space: nowrap; }
.foot-right { display: flex; align-items: center; gap: .7rem; }
/* Secondary actions sit on their own row: four items on one line forced
   "Re-run" to wrap mid-word in a narrow card. */
.hcard-actions {
  display: flex; align-items: center; gap: .5rem;
  padding-top: .5rem; font-size: .78rem;
}
.hcard-actions .icon-btn { white-space: nowrap; }
.hcard-actions .dot { color: var(--muted-foreground); }

/* ---------- portal ---------- */
.decision-box {
  background: var(--accent); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .55rem .75rem; margin-bottom: .7rem; font-size: .85rem;
}
.queue-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.decision-form { margin-bottom: 1.2rem; border-color: var(--primary); }
.decision-form h2 { margin-top: 0; }

/* ---------- compare ---------- */
.small-verdict { margin-top: 0; padding: .12rem .6rem; font-size: .72rem; }
.compare-bar { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; flex-wrap: wrap; }
.compare-wrap { margin-top: 1rem; }
.compare-table th { min-width: 150px; }
.compare-table th:first-child, .compare-table td:first-child { min-width: 130px; color: var(--muted-foreground); font-weight: 600; }
.compare-table td.best { box-shadow: inset 3px 0 0 var(--primary); }

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #111; }
  .site-header, .site-footer, .report-actions, #form-section, #loading, .hcard-pick { display: none !important; }
  .card, details.risk, .score-tile, .table-scroll, .hcard { border-color: #ccc; background: #fff; }
  details.risk { break-inside: avoid; }
  details.risk[open] summary { border-bottom: 1px solid #ccc; }
}
