/* ============================================================
   ROIFY — Design System v2.0
   ------------------------------------------------------------
   Register: a well-set financial statement, not a SaaS dashboard.
   The product's job is to survive a sceptical reader, so the type
   and the palette are deliberately quiet and the only saturated
   colour in the system is reserved for risk.
   ============================================================ */

/* ------------------------------------------------------------
   Tokens — light is the base. Dark redefines ONLY these values,
   twice: once for the system preference and once for an explicit
   [data-theme] choice, so the toggle wins in both directions.
   ------------------------------------------------------------ */
:root {
  /* Surfaces */
  --bg: #FBFCFD;
  --surface: #FFFFFF;
  --surface-alt: #F4F6F8;
  --surface-sunken: #EEF1F5;

  /* Lines */
  --border: #E3E8EE;
  --border-strong: #C8D2DE;

  /* Text — all three pass AA on --bg */
  --text: #0F172A;
  --text-sec: #475569;
  --text-ter: #5C6A7F;

  /* Interaction. One accent, used for interaction only. */
  --primary: #1250C8;
  --primary-dark: #0E3FA0;
  --primary-bg: rgba(18,80,200,0.06);
  --primary-border: rgba(18,80,200,0.18);
  --focus-ring: rgba(18,80,200,0.45);

  /* Risk. RESERVED — these three never decorate anything. If one of
     them is on screen, the report is telling the reader something is
     wrong with the estimate. */
  --risk-ok: #147A3A;
  --risk-ok-bg: rgba(20,122,58,0.08);
  --risk-ok-border: rgba(20,122,58,0.22);
  --risk-warn: #AC4F08;
  --risk-warn-bg: rgba(172,79,8,0.08);
  --risk-warn-border: rgba(172,79,8,0.22);
  --risk-high: #B91C1C;
  --risk-high-bg: rgba(185,28,28,0.08);
  --risk-high-border: rgba(185,28,28,0.22);

  /* Code */
  --code-bg: #0F172A;
  --code-text: #CBD5E1;

  /* Type */
  --font-ui: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Spacing — a 4px scale, so vertical rhythm is not improvised */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Radii and elevation */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 4px 16px rgba(15,23,42,0.07);

  /* Legacy aliases. app.js and app.html still reference these names in
     inline styles; keeping them mapped avoids a flag-day rename. */
  --muted: #5C6A7F;
  --line: #E3E8EE;
  --card: #FFFFFF;
  --text-secondary: #475569;
  --accent: #0EA5C4;
  --green: #147A3A;
  --green-bg: rgba(20,122,58,0.08);
  --green-border: rgba(20,122,58,0.22);
  --amber: #AC4F08;
  --red: #B91C1C;
}

/* Dark: system preference, unless an explicit light choice overrides it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0F14;
    --surface: #121821;
    --surface-alt: #19212C;
    --surface-sunken: #0E141B;
    --border: #232C38;
    --border-strong: #35414F;
    --text: #E6EDF3;
    --text-sec: #A3B2C2;
    --text-ter: #7D8FA1;
    --primary: #6BA5FF;
    --primary-dark: #8FBCFF;
    --primary-bg: rgba(107,165,255,0.10);
    --primary-border: rgba(107,165,255,0.26);
    --focus-ring: rgba(107,165,255,0.55);
    --risk-ok: #4ADE80;
    --risk-ok-bg: rgba(74,222,128,0.10);
    --risk-ok-border: rgba(74,222,128,0.26);
    --risk-warn: #FBBF24;
    --risk-warn-bg: rgba(251,191,36,0.10);
    --risk-warn-border: rgba(251,191,36,0.26);
    --risk-high: #F87171;
    --risk-high-bg: rgba(248,113,113,0.10);
    --risk-high-border: rgba(248,113,113,0.26);
    --code-bg: #060A0F;
    --code-text: #C3D0DD;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --muted: #7D8FA1;
    --line: #232C38;
    --card: #121821;
    --text-secondary: #A3B2C2;
    --accent: #22C7E0;
    --green: #4ADE80;
    --green-bg: rgba(74,222,128,0.10);
    --green-border: rgba(74,222,128,0.26);
    --amber: #FBBF24;
    --red: #F87171;
  }
}

/* Dark: explicit choice. Same values; must be duplicated because a
   media query cannot be re-entered from an attribute selector. */
:root[data-theme="dark"] {
  --bg: #0B0F14;
  --surface: #121821;
  --surface-alt: #19212C;
  --surface-sunken: #0E141B;
  --border: #232C38;
  --border-strong: #35414F;
  --text: #E6EDF3;
  --text-sec: #A3B2C2;
  --text-ter: #7D8FA1;
  --primary: #6BA5FF;
  --primary-dark: #8FBCFF;
  --primary-bg: rgba(107,165,255,0.10);
  --primary-border: rgba(107,165,255,0.26);
  --focus-ring: rgba(107,165,255,0.55);
  --risk-ok: #4ADE80;
  --risk-ok-bg: rgba(74,222,128,0.10);
  --risk-ok-border: rgba(74,222,128,0.26);
  --risk-warn: #FBBF24;
  --risk-warn-bg: rgba(251,191,36,0.10);
  --risk-warn-border: rgba(251,191,36,0.26);
  --risk-high: #F87171;
  --risk-high-bg: rgba(248,113,113,0.10);
  --risk-high-border: rgba(248,113,113,0.26);
  --code-bg: #060A0F;
  --code-text: #C3D0DD;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --muted: #7D8FA1;
  --line: #232C38;
  --card: #121821;
  --text-secondary: #A3B2C2;
  --accent: #22C7E0;
  --green: #4ADE80;
  --green-bg: rgba(74,222,128,0.10);
  --green-border: rgba(74,222,128,0.26);
  --amber: #FBBF24;
  --red: #F87171;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in, .js .fade-in { transition: none !important; opacity: 1 !important; transform: none !important; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
::selection { background: var(--primary-bg); }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------
   Figures.
   Every number in this product is meant to be compared with
   another number - across rows, across percentiles, across
   reports. Proportional digits make columns wobble and read as
   marketing; monospaced, tabular digits read as an instrument.
   ------------------------------------------------------------ */
.num, .figure, .metric-value, td.num, .range-scale {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------
   Focus. Visible, consistent, and only for keyboard users.
   There were six focus rules in the whole stylesheet and no
   :focus-visible at all.
   ------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Skip link — first tab stop, hidden until focused. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--surface); color: var(--text);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.skip-link:focus { left: var(--s4); top: var(--s4); }

/* Screen-reader-only, still focusable. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
code { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--surface-alt); padding: 2px 6px; border-radius: 4px; }

/* ============================================================
   Fade-in animation
   ============================================================ */
/* Content visible by default; JS adds .js to <html> enabling animations */
.fade-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.js .fade-in {
  opacity: 0;
  transform: translateY(14px);
}
.js .fade-in.visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   Nav — sticky with blur on scroll
   ============================================================ */
.header {
  position: sticky; top: 0; z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
  padding: 0 28px;
}
.header.scrolled {
  background: rgba(247,251,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand:hover { text-decoration: none; color: var(--primary); }
.patent-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(20,86,219,0.07);
  border: 1px solid rgba(20,86,219,0.12);
  border-radius: 100px;
  padding: 2px 9px;
  letter-spacing: 0.03em;
}
.nav { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   Hero — headline + analysis interface as the hero
   ============================================================ */
.hero {
  padding: 48px 28px 20px;
  text-align: center;
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 0 0 14px 0;
  background: linear-gradient(135deg, #1456DB, #0EC4E8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .tagline {
  font-size: 16px;
  color: var(--text-sec);
  margin: 0 auto 24px;
  max-width: 520px;
  line-height: 1.6;
}
.hero-badges {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-ter);
}
.hero-badge svg { width: 14px; height: 14px; color: var(--green); }

/* ============================================================
   Layout
   ============================================================ */
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 28px 32px; }
.sec { max-width: 960px; margin: 0 auto; padding: 0 28px; }
.hidden { display: none !important; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}
.card-header {
  margin: -24px -24px 24px -24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 14px 14px 0 0;
}
.card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { margin: 0 0 8px 0; font-size: 20px; font-weight: 600; }
h2 { margin: 0 0 8px 0; font-size: 16px; font-weight: 600; }
.sub { margin: 0 0 20px 0; color: var(--text-sec); font-size: 13.5px; }

.grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 24px; }
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }

/* ============================================================
   Form elements
   ============================================================ */
.label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px 0; color: var(--text); }
.label.small { font-weight: 500; font-size: 12.5px; color: var(--text-sec); }

.textarea {
  width: 100%;
  min-height: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 10px;
  resize: vertical;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.textarea::placeholder { color: var(--text-ter); }

.input, .select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.input::placeholder { color: var(--text-ter); }

.row { display: flex; gap: 16px; margin-top: 16px; }
.field { flex: 1; }
.field + .field { margin-top: 0; }
.actions { margin-top: 20px; display: flex; gap: 10px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sec);
  padding: 10px 20px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s;
}
.btn:hover { background: var(--surface-alt); border-color: var(--text-ter); }

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-sec);
}
.btn.secondary:hover { background: var(--surface-alt); }

.btn.small { padding: 6px 14px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Status & Error
   ============================================================ */
.status {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-sec);
  font-size: 13px;
}
.error {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 9px;
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--red);
  background: rgba(239,68,68,0.04);
  font-size: 13px;
}
.success-msg {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 9px;
  border: 1px solid var(--green-border);
  color: var(--green);
  background: var(--green-bg);
  font-size: 13px;
}

/* ============================================================
   Report panel
   ============================================================ */
.report {
  min-height: 280px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 10px;
  overflow: auto;
  font-size: 13.5px;
}

.muted { color: var(--text-ter); }
.small { font-size: 12.5px; }

/* Details/accordion */
.details { margin-top: 16px; }
.details summary {
  cursor: pointer;
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 0;
}
.details summary:hover { color: var(--text); }
.details[open] summary { margin-bottom: 8px; }

.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-sec); cursor: pointer; }
.checks input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ============================================================
   Feedback Section
   ============================================================ */
.feedback-section { margin-top: 16px; }
.feedback-details {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 14px 18px;
}
.feedback-details summary { color: var(--green); font-weight: 600; font-size: 13px; }
.feedback-details[open] { padding-bottom: 18px; }
.feedback-section .hint { font-size: 11.5px; color: var(--text-ter); margin: 4px 0 8px 0; }

.code {
  background: var(--code-bg);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 14px 18px;
  border-radius: 10px;
  overflow: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--code-text);
  line-height: 1.8;
}

.foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.hint { margin-top: 14px; color: var(--text-ter); font-size: 12.5px; }

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(10,22,40,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 48px rgba(10,22,40,0.12);
}
.modal-content.modal-wide { max-width: 700px; }
.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none; border: none;
  color: var(--text-ter);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal.hidden { display: none; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  margin: 18px 0 14px 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-ter);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { margin-top: 16px; }
.tab-content .field { margin-bottom: 14px; }

/* ============================================================
   History
   ============================================================ */
.history-list { max-height: 400px; overflow-y: auto; }
.history-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.history-item:hover { background: var(--surface-alt); border-color: var(--text-ter); }
.history-item .date { font-size: 11px; color: var(--text-ter); font-weight: 500; }
.history-item .summary { font-size: 13px; margin-top: 6px; color: var(--text); }
.history-item .conf { font-size: 11px; color: var(--primary); margin-top: 6px; font-weight: 600; }

/* Pagination */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sec);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
}
.pagination button:hover { background: var(--surface-alt); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Feature cards
   ============================================================ */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 28px;
}
@media (max-width: 768px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 18px 16px;
  transition: border-color 0.2s;
}
.feature:hover { border-color: var(--text-ter); }
.feature-header { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.feature-header .emoji { font-size: 15px; }
.feature-header .name { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.feature h3 { margin: 0 0 6px 0; font-size: 13.5px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.feature p { margin: 0; font-size: 12.5px; color: var(--text-sec); line-height: 1.55; }

/* ============================================================
   Trust strip
   ============================================================ */
.trust-strip {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 28px;
}
.trust-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.trust-item .value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1456DB, #0EC4E8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.trust-item .label { font-size: 12px; color: var(--text-ter); font-weight: 500; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-left { display: flex; align-items: center; gap: 12px; }
.footer-left .logo { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; color: var(--primary); }
.footer-left span, .footer-left a { font-size: 11.5px; color: var(--text-ter); }
.footer-left .sep { opacity: 0.3; }
.footer-right { font-size: 11.5px; color: var(--text-ter); }

/* ============================================================
   Section titles
   ============================================================ */
.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* Right buttons group */
.right { display: flex; gap: 8px; }
.feedback-btn { min-width: 36px; padding: 8px 14px; font-weight: 500; }
.feedback-btn.selected { background: rgba(20,86,219,0.07); border-color: var(--primary); color: var(--primary); }

/* ============================================================
   Methodology badge
   ============================================================ */
.methodology-strip {
  text-align: center;
  padding: 20px 28px 0;
}
.methodology-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Wraps. Without this it is a non-wrapping inline-flex row, so on a narrow
     screen the four claims were squeezed into four unreadable columns that
     overflowed the viewport rather than reflowing onto new lines. */
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 11.5px;
  color: var(--text-ter);
  font-weight: 500;
  max-width: 100%;
}
.methodology-badge .dot { opacity: 0.3; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }
  .hero .tagline { font-size: 14px; }
  .features { grid-template-columns: 1fr; }
  .trust-inner { gap: 28px; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 560px) {
  /* The nav gained the theme toggle, which pushed "Sign In" off the right edge
     on a phone. Tighten the gutter and the control sizes rather than hiding
     anything: the toggle and the sign-in button are both load-bearing. */
  .header { padding: 0 14px; }
  .nav { gap: 6px; }
  .brand { font-size: 17px; }
  .patent-badge { display: none; }
  .theme-toggle { padding: var(--s1) var(--s2); font-size: 12px; }

  /* One claim per line, and drop the separators - they only make sense between
     items on the same line. */
  .methodology-strip { padding: 16px 16px 0; }
  .methodology-badge { flex-direction: column; gap: var(--s2); }
  .methodology-badge .dot { display: none; }
}

/* ============================================================
   Report v2 — credibility components
   ============================================================ */

/* ------------------------------------------------------------
   Mode switch (Summary / Audit).
   Two readers, one artifact: the person proving their own value
   wants the number, the person approving it wants the working.
   ------------------------------------------------------------ */
.mode-switch {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px;
  gap: 2px;
}
.mode-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-sec);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: var(--s1) var(--s4);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-switch button:hover { color: var(--text); }
.mode-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Audit-only content. Hidden in summary mode rather than removed, so
   the toggle costs no re-render and the DOM stays inspectable. */
.report[data-mode="summary"] .audit-only { display: none; }

/* ------------------------------------------------------------
   Headline figure.
   ------------------------------------------------------------ */
.stat { margin: var(--s5) 0; }
.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-ter);
  margin-bottom: var(--s2);
}
.stat-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stat-value .unit {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-ter);
  margin-left: var(--s2);
}
.stat-sub { font-size: 13px; color: var(--text-sec); margin-top: var(--s2); }

/* ------------------------------------------------------------
   Range bar — P10 / P50 / P90.
   The single most credibility-bearing element in the report. An
   estimate written as "192 min (66-384)" reads as a number with
   an apology after it; drawn, the same figure reads as a
   measurement with a stated confidence. Nothing else in the UI
   communicates "we do not know this precisely" as honestly.
   ------------------------------------------------------------ */
.range { margin: var(--s3) 0 var(--s2); }
.range-track {
  position: relative;
  height: 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.range-span {
  position: absolute;
  top: -1px; bottom: -1px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--r-pill);
}
.range-marker {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 18px;
  margin-top: -9px;
  margin-left: -1.5px;
  background: var(--primary);
  border-radius: 2px;
}
.range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-ter);
  margin-top: var(--s2);
}
.range-scale b { color: var(--text-sec); font-weight: 600; }

/* ------------------------------------------------------------
   Risk signals. The only saturated colour in the product.
   ------------------------------------------------------------ */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px var(--s2);
  border-radius: var(--r-pill);
  border: 1px solid;
}
.risk-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.risk-ok       { color: var(--risk-ok);   background: var(--risk-ok-bg);   border-color: var(--risk-ok-border); }
.risk-baseline { color: var(--text-sec);  background: var(--surface-alt);  border-color: var(--border); }
.risk-unknown  { color: var(--text-ter);  background: var(--surface-alt);  border-color: var(--border); }
.risk-elevated { color: var(--risk-warn); background: var(--risk-warn-bg); border-color: var(--risk-warn-border); }
.risk-high     { color: var(--risk-high); background: var(--risk-high-bg); border-color: var(--risk-high-border); }

/* A signal serious enough to change what the number means. */
.signal {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--r-md);
  background: var(--surface-alt);
  padding: var(--s3) var(--s4);
  margin: var(--s3) 0;
}
.signal-title { font-weight: 600; font-size: 14px; margin-bottom: var(--s1); }
.signal-body { font-size: 13px; color: var(--text-sec); }
.signal ul { margin: var(--s2) 0 0 var(--s4); }
.signal li { font-size: 13px; color: var(--text-sec); margin-bottom: var(--s1); }
.signal.is-high     { border-left-color: var(--risk-high); background: var(--risk-high-bg); }
.signal.is-elevated { border-left-color: var(--risk-warn); background: var(--risk-warn-bg); }
.signal.is-info     { border-left-color: var(--primary); background: var(--primary-bg); }

/* The safety override. Must be impossible to skim past: the report
   is saying the figure is not claimable, and the old UI showed the
   figure as though it were. */
.signal.is-override {
  border-left-color: var(--risk-high);
  background: var(--risk-high-bg);
  border-color: var(--risk-high-border);
}

/* ------------------------------------------------------------
   Provenance — where a number came from.
   ------------------------------------------------------------ */
.prov { border-top: 1px solid var(--border); margin-top: var(--s4); }
.prov-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 2fr);
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: baseline;
}
.prov-key { color: var(--text-ter); }
.prov-val { color: var(--text); }
.prov-val .basis {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px var(--s2);
  border-radius: var(--r-sm);
  margin-left: var(--s2);
  border: 1px solid var(--border);
  color: var(--text-ter);
  background: var(--surface-alt);
}
/* A judgement is not a measurement, and the report says which is which. */
.prov-val .basis.is-judgement { color: var(--risk-warn); border-color: var(--risk-warn-border); background: var(--risk-warn-bg); }
.prov-val .basis.is-derived   { color: var(--risk-ok);   border-color: var(--risk-ok-border);   background: var(--risk-ok-bg); }

/* A cited source, shown inline with the claim it supports. */
.cite {
  display: block;
  font-size: 12px;
  color: var(--text-ter);
  border-left: 2px solid var(--border);
  padding-left: var(--s3);
  margin: var(--s2) 0;
}
.cite b { color: var(--text-sec); font-weight: 600; }

/* ------------------------------------------------------------
   Task rows.
   ------------------------------------------------------------ */
.task {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: var(--s4);
  margin-bottom: var(--s3);
}
.task-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
}
.task-name { font-weight: 600; font-size: 14px; }
.task-meta { font-size: 12px; color: var(--text-ter); margin-top: var(--s1); }
.task-saved {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Theme toggle.
   ------------------------------------------------------------ */
.theme-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-sec);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: var(--s1) var(--s3);
  line-height: 1.4;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* ------------------------------------------------------------
   Input safety notice — shown before submit, not after.
   ------------------------------------------------------------ */
.paste-notice {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  font-size: 12px;
  color: var(--text-ter);
  margin-top: var(--s2);
  line-height: 1.5;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .stat-value { font-size: 30px; }
  .prov-row { grid-template-columns: 1fr; gap: var(--s1); }
  .prov-key { font-size: 12px; }
  .task-head { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Public share page
   ------------------------------------------------------------
   Served to logged-out visitors with no application JavaScript,
   and read by the person being asked to approve the number. It
   uses the same tokens as the app deliberately: a shared report
   that looks like a different, glossier product than the one
   that produced it is the "ROI theater" failure in miniature.
   ============================================================ */
.share-page { background: var(--bg); }

.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  max-width: 860px;
  margin: 0 auto;
  padding: var(--s5) var(--s5) 0;
}
.share-header .brand {
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--primary); text-decoration: none;
}
.share-date { font-size: 13px; color: var(--text-ter); font-family: var(--font-num); }

.share-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--s5) var(--s5) var(--s8);
}
.share-title {
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  margin-top: var(--s5);
}
.share-summary { color: var(--text-sec); margin-top: var(--s2); }
.share-wrap section { margin-top: var(--s6); }

/* The methodological note is part of the artifact, not fine print. */
.share-note {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-ter);
  line-height: 1.6;
}
.share-cta { margin-top: var(--s5); }

/* Task rows. The figure column is monospaced and right-set so the minutes line
   up down the page - the reader is comparing them to each other. */
.share-wrap .task-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s4);
  align-items: baseline;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
}
.share-wrap .task-item:last-child { border-bottom: 0; }
.share-wrap .task-name { color: var(--text); }
.share-wrap .task-time {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--text-sec);
  white-space: nowrap;
}
.share-wrap .task-more {
  padding-top: var(--s3);
  font-size: 13px;
  color: var(--text-ter);
}

/* ============================================================
   Utilities
   ------------------------------------------------------------
   A deliberately tiny set, existing so the report renderer can
   stop emitting style="" attributes. Every inline style is a
   reason style-src has to allow 'unsafe-inline'.
   ============================================================ */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--s2); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s5); }
.w-full { width: 100%; }
.min-h-60 { min-height: 60px; }
.prewrap { white-space: pre-wrap; }
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}
.row-gap { display: flex; gap: var(--s2); }
.mt-1 { margin-top: var(--s1); }
.mt-3 { margin-top: var(--s3); }
.mt-5 { margin-top: var(--s5); }
.mb-3 { margin-bottom: var(--s3); }
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  cursor: pointer;
}
.actions-row { margin-top: var(--s5); display: flex; gap: var(--s3); }
.rule { border: 0; border-top: 1px solid var(--border); margin: var(--s4) 0; }
