/* ===========================================
   Veritiliz Master Stylesheet
   Theme: Warm Dark (default) + Warm Light — designed for tired eyes
   and people in emotional distress.
   No cool blues. No harsh whites. No alarm red.
   Warm charcoal, parchment, terracotta — in BOTH themes. Light mode is
   deliberately a warm cream/parchment palette, not a stark white/cool-gray
   inversion, to stay consistent with the brand identity above.
=========================================== */

:root {
  /* ── Dark theme (default) ────────────────────────────────────────────────
     Applied whenever [data-theme] is absent or explicitly "dark". The
     resolved theme (light/dark) is set as a data-theme attribute on <html>
     by theme-init.js, BEFORE first paint, to avoid a flash of the wrong
     theme — see theme-init.js for why that has to be a separate blocking
     script rather than logic inside script.js (which loads at the end of
     <body>, well after the page has already painted). */
  --bg-color:          #0e0b09;
  --surface-color:     #181310;
  --surface-raised:    #221c17;
  --text-primary:      #ede0cc;
  --text-secondary:    #9a8a76;
  --text-muted:        #6b5d50;
  --accent-color:      #b87252;
  --accent-hover:      #ca8868;
  --accent-glow:       rgba(184, 114, 82, 0.10);
  --border-color:      #2d2218;
  --border-light:      #3d3025;

  /* Risk band colours. Four bands because the rating scale genuinely has
     four: Safe 1-2, Moderate 3-4, High 5-7, Critical 8-10. Tuned for the
     near-black background; overridden for the light theme below. */
  --risk-safe:      #82c490;
  --risk-moderate:  #c8a55a;
  --risk-high:      #d08a4e;
  --risk-critical:  #d2664e;
  --heading-color:     #f5ebe0;
  --nav-bg:            rgba(14, 11, 9, 0.96);

  /* Semantic status colors — TOKENIZED here rather than left as the hardcoded
     hex literals that were previously scattered through the stylesheet
     (.analyzer-char-counter.at-limit, .checkout-status.error/.success,
     .upgrade-success-banner). This wasn't just tidiness: the original
     success green (#82c490) is a light pastel tuned for a near-black
     background — on the new light theme it would be nearly illegible
     (light-on-light). Tokenizing lets light mode use a properly darkened
     variant for the same semantic role instead of inheriting a color picked
     for the opposite theme.
     RGB triplets (no #) are provided alongside the hex for tint/border uses
     that need a specific alpha via rgba(var(--x-rgb), N) — this preserves
     the exact original alpha values at each call site (some were 0.10,
     others 0.12/0.28) without needing a separate variable per alpha. */
  --color-danger:          #e05050;
  --color-danger-soft:     #d07878;
  --color-danger-tint-rgb: 160, 60, 60;
  --color-success:         #82c490;
  --color-success-hover:   #a5d6b0;
  --color-success-tint-rgb: 60, 130, 75;
}

/* ── Light theme ──────────────────────────────────────────────────────────
   Applied when <html data-theme="light">. Warm parchment/cream, not stark
   white or cool gray — same terracotta accent family as dark mode, so the
   two themes read as one brand rather than a generic inversion. Text/accent
   values were deliberately darkened relative to a naive "just invert the
   dark values" approach, specifically for contrast against a light
   background (a straight inversion of e.g. --accent-color or
   --color-success would fail contrast as text on a light surface). */
[data-theme="light"] {
  --bg-color:          #f7f2ea;
  --surface-color:     #fffdf9;
  --surface-raised:    #ffffff;
  --text-primary:      #2b2117;
  --text-secondary:    #6b5d50;
  --text-muted:        #8f7d6b;
  --accent-color:      #96502f;
  --accent-hover:      #b0623c;
  --accent-glow:       rgba(150, 80, 47, 0.08);
  --border-color:      #e4d8c8;
  --border-light:      #d8c8b0;

  /* Darkened for contrast on parchment — the dark-theme values are pastels
     tuned for a near-black background and are illegible here. */
  --risk-safe:      #3f8f57;
  --risk-moderate:  #9a7318;
  --risk-high:      #b25f19;
  --risk-critical:  #b23a3a;
  --heading-color:     #1a130c;
  --nav-bg:            rgba(255, 253, 249, 0.96);

  --color-danger:          #b23a3a;
  --color-danger-soft:     #9c4040;
  --color-danger-tint-rgb: 200, 90, 90;
  --color-success:         #1e7a45;
  --color-success-hover:   #145c33;
  --color-success-tint-rgb: 60, 130, 75;
}

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

/* Smooth color transition when the theme is manually toggled. Scoped to a
   short, explicit property list (not a blanket `*` transition, which can
   cause jank and unintended animation on unrelated property changes) and
   only to elements whose look actually changes between themes. This has no
   effect on initial page load — theme-init.js sets the correct data-theme
   BEFORE first paint, so there is no wrong-to-right transition to animate;
   it only ever plays when a user clicks the theme toggle while viewing the
   page. */
body, nav, .analyzer-input-wrap, .file-preview-item, .attach-btn,
.checkout-status, .upgrade-success-banner, .theme-toggle-btn {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.05rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
  background-color: var(--bg-color);
  color: var(--text-primary);
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 400;
  color: var(--heading-color);
}

h1 { font-size: 3rem; letter-spacing: -0.5px; line-height: 1.2; }

h2 {
  font-size: 2rem;
  margin-top: 4.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.6rem;
}

h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
}

p { margin-bottom: 1.6rem; font-size: 1.1rem; }

ul, ol { margin-bottom: 1.5rem; padding-left: 2rem; }
li { font-size: 1.1rem; margin-bottom: 0.6rem; }

a { color: var(--accent-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--accent-hover); }
strong { color: var(--heading-color); font-weight: 600; }

/* Nav */
nav {
  position: sticky;
  top: 0;
  background-color: var(--nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.1rem 2rem;
  z-index: 100;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.3s ease;
  white-space: nowrap;
}

nav a:hover, nav a:active { color: var(--heading-color); }

/* Header */
header {
  padding: 4.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 3.5rem;
  text-align: center;
}

.hero { text-align: center; padding: 2rem 0; }
.subtitle { color: var(--text-secondary); font-size: 1.2rem; margin-top: 0.6rem; font-style: italic; }

/* ── Accessibility: visually-hidden but present for screen readers ────────── */
.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;
}

/* ── Hero: name as eyebrow, product as headline, tagline as subtitle ──────── */
/* Brand takes the display size the descriptor used to have; the descriptor
   drops to the small accent treatment. Both are spans inside one <h1>, so
   these need display:block to stack. */
.hero-title { margin: 0; letter-spacing: normal; }

.hero-brand {
  display: block;
  font-size: 3rem;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.hero-kicker {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-top: 0.7rem;
  /* h1 inherits the display serif; the kicker reads better in the body face at
     this size, where serif detail turns to noise. */
  font-family: inherit;
}

/* Retained for any page still using the old eyebrow class. */
.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.6rem;
}
.hero-lead {
  color: var(--text-primary);
  font-size: 1.12rem;
  line-height: 1.6;
  max-width: 40rem;
  margin: 0.9rem auto 0;
}
.hero-lead em { color: var(--accent-hover); font-style: italic; }

/* ── Trust badge: earns the paste before the user commits sensitive text ──── */
.trust-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1.6rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  background: var(--accent-glow);
}
.trust-badge > span:not([aria-hidden]) { font-weight: 500; color: var(--text-primary); }
.trust-badge > span[aria-hidden] { color: var(--text-muted); }

/* ── Example chips ────────────────────────────────────────────────────────── */
.example-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.example-chips__label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-right: 0.15rem;
}
.example-chip {
  font: inherit;
  font-size: 0.83rem;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.example-chip:hover,
.example-chip:focus-visible {
  border-color: var(--accent-color);
  background: var(--accent-glow);
  color: var(--accent-hover);
  outline: none;
}

/* ── Drag-and-drop cue inside the input box ───────────────────────────────── */
.analyzer-input-wrap { position: relative; }
.drop-cue {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;        /* never intercept a click, paste, or drop */
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  z-index: 1;
}
.drop-cue__icon { font-size: 0.85rem; }
/* Fade the cue out once the user starts typing, so it never fights their text.
   Toggled by script.js adding .has-content to the wrap. */
.analyzer-input-wrap.has-content .drop-cue { opacity: 0; }

/* ── Learn card: single "Learn more" instead of a stack of links ──────────── */
.category-link--more {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 600;
  color: var(--accent-color);
}
.category-link--more:hover { color: var(--accent-hover); }



/* Pull quote */
.highlight {
  border-left: 3px solid var(--accent-color);
  padding: 0.5rem 0 0.5rem 1.8rem;
  font-style: italic;
  color: var(--text-secondary);
  margin: 2.5rem 0;
  font-size: 1.25rem;
  line-height: 1.8;
  font-family: "Georgia", "Times New Roman", serif;
}

/* Script box / card */
.script-box {
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  margin-bottom: 2.5rem;
  border-radius: 10px;
  transition: border-color 0.3s ease;
}

.script-box:hover { border-color: var(--border-light); }

.script-box h3 {
  margin-top: 0;
  color: var(--heading-color);
  text-transform: none;
  letter-spacing: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem;
}

/* Closing statement */
.closing-statement {
  margin-top: 6rem;
  margin-bottom: 6rem;
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.closing-statement p {
  font-size: 1.35rem;
  color: var(--heading-color);
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 2.1;
}

/* Analyzer */
.analyzer {
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  border-radius: 10px;
}

.analyzer textarea {
  width: 100%;
  min-height: 200px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 1.4rem;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.8;
  border-radius: 8px;
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.analyzer textarea::placeholder { color: var(--text-muted); }
.analyzer textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-glow); }

/* Fraud grid */
.fraud-categories { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.8rem; }

.card.script-box { margin-bottom: 0; display: flex; flex-direction: column; }

.card p { font-size: 0.97rem; color: var(--text-secondary); flex-grow: 1; margin-bottom: 1.4rem; line-height: 1.7; }

.category-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  transition: color 0.3s ease, padding-left 0.3s ease;
}

.category-link:hover { color: var(--accent-hover); padding-left: 4px; }

/* Button */
.submit-btn {
  background-color: var(--accent-color);
  color: var(--heading-color);
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  align-self: flex-start;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
}

.submit-btn:hover { background-color: var(--accent-hover); transform: translateY(-1px); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Feedback form */
.feedback-form-container {
  margin-top: 4rem;
  padding: 3rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-align: left;
}

.feedback-form-container h3 {
  color: var(--heading-color);
  margin-top: 0;
  margin-bottom: 1rem;
  text-transform: none;
  letter-spacing: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem;
}

.feedback-form-container p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
}

.trauma-form { display: flex; flex-direction: column; gap: 1.4rem; }

.trauma-form label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trauma-form textarea,
.trauma-form input[type="email"],
.trauma-form input[type="text"] {
  width: 100%;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 1rem 1.2rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.7;
  border-radius: 8px;
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.trauma-form textarea::placeholder,
.trauma-form input::placeholder { color: var(--text-muted); }

.trauma-form textarea:focus,
.trauma-form input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-glow); }

/* Select — dark theme with custom chevron in accent colour */
.trauma-form select {
  width: 100%;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 1rem 2.8rem 1rem 1.2rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  border-radius: 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  /* Chevron SVG: accent colour #b87252, URL-encoded */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='9' viewBox='0 0 13 9'%3E%3Cpath d='M1 1l5.5 6L12 1' stroke='%23b87252' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.1rem center;
  background-size: 13px 9px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.trauma-form select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Option elements — background follows browser rendering; set surface for
   browsers that respect it (Chromium-based) */
.trauma-form select option {
  background-color: var(--surface-raised);
  color: var(--text-primary);
}

/* Field wrapper — label stacked above its control */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Optional field hint (inside label) */
.field-optional {
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
}

/* Story form — 2-column grid for the six dropdowns */
.story-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  margin-bottom: 0.2rem; /* gap between grid and full-width fields below */
}

/* Share story section wrapper — matches the about-strip spacing rhythm */
.share-story-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 2rem;
}

@media (max-width: 640px) {
  .story-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Unified analyzer input — textarea + file bar in one border */
.analyzer-input-wrap {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.analyzer-input-wrap:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Drag-over state on the whole analyzer section */
.analyzer.drag-active .analyzer-input-wrap {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Remove individual textarea border — the wrap provides it */
.analyzer-input-wrap textarea {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Character counter — bottom-right beneath the textarea/file bar */
.analyzer-char-counter {
  text-align: right;
  font-size: 0.77rem;
  color: var(--text-muted);
  padding: 0.28rem 0.5rem 0;
  transition: color 0.2s;
  user-select: none;
}

.analyzer-char-counter.near-limit {
  color: var(--accent-color);
}

.analyzer-char-counter.at-limit {
  color: var(--color-danger);
  font-weight: 600;
}

/* The attach/file bar below the textarea. The selector line for this rule
   was missing (a pre-existing bug — the declarations were orphaned after a
   blank line, so the bar rendered completely unstyled and an extra stray
   `}` unbalanced the stylesheet). Restored so the bar gets its intended
   flex layout, padding, and top border — this also contributes to the
   attach control finally matching the rest of the UI. */
.analyzer-file-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  min-height: 44px;
}

.attach-btn {
  /* Secondary-action styling — deliberately NOT a full accent fill (that's
     reserved for the primary Analyze button), but aligned to the same theme:
     matches --border-light, the 8px radius used by .submit-btn, a subtle
     elevated background so it reads as a real button rather than plain text,
     and an accent-tinted hover consistent with the rest of the UI. */
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--surface-raised);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  flex-shrink: 0;
}

.attach-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background-color: var(--accent-glow);
}

.attach-btn:active {
  transform: translateY(1px);
}

.attach-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ── Theme toggle (Auto / Light / Dark) ──────────────────────────────────
   Injected into <nav> by script.js (injectThemeToggle) rather than hardcoded
   into all 38 HTML pages, mirroring how injectAuthModal() already injects
   shared UI. A real <button>, not a link — it doesn't navigate anywhere, it
   changes local state, so a button is the correct semantic element and
   needs no href/preventDefault dance. */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.3rem 0.7rem;
  border-radius: 20px;   /* pill shape — visually distinct from the squarer attach-btn */
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background-color: var(--accent-glow);
}

/* Footer mount: give the toggle its own centred row above the footer text. */
.theme-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.4rem;
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.theme-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.attach-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  flex: 1;
}

/* File preview items inside the bar — compact single-line */
#file-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.file-preview-item {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-raised); border: 1px solid var(--border-color);
  border-radius: 5px; padding: 0.25rem 0.6rem; font-size: 0.82rem;
  /* Mobile-portrait fix: without max-width the item could grow wider than
     the viewport when the filename was long, pushing the remove (✕) — the
     last child — off the right edge and out of reach (worked in landscape
     only because there was enough width). Constrain the item to its
     container and let the filename shrink instead of the row overflowing. */
  max-width: 100%;
  box-sizing: border-box;
}

.file-icon { font-size: 0.95rem; flex-shrink: 0; }
.file-name {
  color: var(--text-primary);
  /* was a fixed 180px which forced overflow on narrow screens; now it
     shrinks within the row so the remove button always stays visible. */
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-size { color: var(--text-muted); font-size: 0.76rem; white-space: nowrap; flex-shrink: 0; }
.file-remove {
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  transition: color 0.2s;
  /* Larger, always-visible tap target — the old `padding: 0 0.15rem` was
     far below the ~44px touch-target guideline and, combined with the
     overflow above, was easy to miss or unreachable on phones. flex-shrink:0
     guarantees it's never the element that gets squeezed out. */
  flex-shrink: 0;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  margin: -0.15rem -0.3rem -0.15rem 0;
}
.file-remove:hover { color: var(--accent-color); background: var(--accent-glow); }

.file-preview-item .file-icon   { font-size: 0.95rem; }

#file-result-section .result-box {
  margin-top: 1.5rem; background: var(--surface-raised); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 2rem; font-size: 1rem; color: var(--text-primary);
  line-height: 1.85; white-space: pre-wrap;
}

/* About strip */
.about-strip { margin-top: 5rem; padding: 3.5rem 0 2rem; border-top: 1px solid var(--border-color); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3.5rem; }

.about-block h3 {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem; color: var(--heading-color);
  text-transform: none; letter-spacing: 0;
  margin-bottom: 1.1rem; margin-top: 0;
}

.about-block p { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.8; }

/* Location reporting */
#location-reporting { margin-top: 3rem; margin-bottom: 2rem; }

.location-header h3 {
  font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 0.5rem; margin-top: 0;
  font-family: -apple-system, sans-serif; font-weight: 600;
}

.location-note { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.5rem; font-style: italic; }

.emergency-banner {
  background: rgba(184, 114, 82, 0.08);
  border: 1px solid rgba(184, 114, 82, 0.30);
  border-radius: 8px; padding: 1rem 1.5rem;
  margin-bottom: 2rem; font-size: 1rem; color: var(--text-primary); line-height: 1.6;
}

.emergency-note { color: var(--text-secondary); font-size: 0.88rem; }

.reporting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }

.reporting-primary h4,
.reporting-secondary h4,
.reporting-global h4 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 1rem; margin-top: 0; font-family: -apple-system, sans-serif;
}

.reporting-global { border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.report-item { margin-bottom: 1.2rem; }

.report-item a {
  display: block; color: var(--text-primary); text-decoration: none;
  font-size: 0.95rem; font-weight: 600; transition: color 0.3s;
}

.report-item a:hover { color: var(--accent-color); }
.report-detail { display: block; font-size: 0.84rem; color: var(--text-secondary); margin-top: 0.25rem; }

#emergency-info {
  font-size: 0.88rem; color: var(--text-secondary); padding: 0.9rem 1.2rem;
  border: 1px solid var(--border-color); border-radius: 8px;
  margin-top: 1rem; line-height: 1.7; background: var(--surface-color);
}

#result-section { margin-top: 2rem; }

/* ─── Accessibility ──────────────────────── */

/* Skip nav — visible only on keyboard focus, hidden otherwise */
.skip-nav {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--accent-color);
  color: var(--heading-color);
  padding: 0.7rem 1.2rem;
  border-radius: 0 0 8px 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.skip-nav:focus {
  top: 0;
  outline: none;
}

/* Global focus-visible — keyboard users see a clear warm ring */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Remove outline for mouse users (only show for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure nav links show focus ring */
nav a:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 4px;
  border-radius: 3px;
}

/* ─── Back to Top Button ─────────────────── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  color: var(--accent-color);
  /* font-size omitted — button uses an SVG arrow (stroke-width 2.8, 20×20) */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease, visibility 0.3s ease,
              transform 0.3s ease, border-color 0.3s ease,
              background 0.3s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background: var(--accent-glow);
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

#back-to-top:active {
  transform: translateY(0);
}

@media (max-width: 480px) {
  #back-to-top {
    bottom: 1.2rem;
    right: 1.2rem;
    width: 40px;
    height: 40px;
  }
}

/* ─── Final Words (r-recovery) ───────────── */
.final-words {
  text-align: left;
  max-width: 640px;
  margin: 0 auto 3.5rem;
  padding: 2.5rem 2.5rem 2rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-color);
  border-radius: 0 10px 10px 0;
  position: relative;
}

.final-words-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.final-words-quote {
  border: none;
  padding: 0;
  margin: 0;
}

.final-words-quote p {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 2;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 1.3rem;
}

.final-words-quote p:last-of-type {
  margin-bottom: 0;
}

.final-words-close {
  font-weight: 600;
  color: var(--heading-color) !important;
  font-size: 1.2rem !important;
}

.final-words-attribution {
  display: block;
  margin-top: 1.8rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
}

/* ─── Anchor Navigation (r-playbook) ─────── */
.anchor-nav {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.4rem;
  margin: 1.5rem 0 2.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.anchor-nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  padding-top: 0.15rem;
  flex-shrink: 0;
}

.anchor-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.anchor-nav-links a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--surface-raised);
  transition: color 0.3s, border-color 0.3s, background 0.3s;
  white-space: nowrap;
}

.anchor-nav-links a:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--accent-glow);
}

/* ─── Page Navigation (Prev / Next) ─────── */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  margin: 4rem 0 0;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-color);
}

.page-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.4rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: border-color 0.3s, background 0.3s, color 0.3s;
  max-width: 48%;
}

.page-nav-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--accent-glow);
}

.page-nav-prev { flex-direction: row; }
.page-nav-next { flex-direction: row-reverse; margin-left: auto; }

.page-nav-arrow {
  color: var(--accent-color);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.page-nav-prev:hover .page-nav-arrow { transform: translateX(-3px); }
.page-nav-next:hover .page-nav-arrow { transform: translateX(3px); }

.page-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-nav-ghost {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

@media (max-width: 480px) {
  .page-nav { flex-direction: column; }
  .page-nav-btn { max-width: 100%; }
  .page-nav-next { margin-left: 0; }
}

/* ─── Auth Modal ─────────────────────────────── */
#auth-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(14, 11, 9, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#auth-panel.open {
  display: flex;
}

.auth-modal {
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.auth-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.2s;
}

.auth-close:hover { color: var(--text-primary); }

.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.8rem;
}

.auth-tab {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.auth-tab:hover:not(.active) { color: var(--text-secondary); }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.auth-field label {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-field input {
  width: 100%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-field input::placeholder { color: var(--text-muted); }
.auth-field input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-glow); }

.auth-error {
  font-size: 0.85rem;
  color: var(--accent-color);
  min-height: 1.2em;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.auth-footer-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Nav auth links */
.nav-auth-link { color: var(--text-muted) !important; }
.nav-auth-link:hover { color: var(--accent-color) !important; }
.nav-signout { color: var(--accent-color) !important; }

/* Quota display — below analyze button */
.quota-display {
  text-align: center;
  margin-top: 0.65rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

/* Mobile nav */
@media (max-width: 768px) {
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.7rem; }
  p, li { font-size: 1.05rem; }
  .script-box { padding: 1.6rem; }
  .feedback-form-container { padding: 1.6rem; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .reporting-grid { grid-template-columns: 1fr; gap: 1.5rem; }

  nav {
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    justify-content: flex-start; gap: 0; padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }

  nav::-webkit-scrollbar { display: none; }

  nav a {
    flex-shrink: 0; padding: 0.9rem 1.1rem;
    font-size: 0.76rem; border-right: 1px solid var(--border-color);
  }

  nav a:last-child  { border-right: none; padding-right: 1.5rem; }
  nav a:first-child { padding-left: 1.5rem; }
}

@media (max-width: 480px) {
  body { padding: 0 1.2rem; }
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.4rem; }
  .fraud-categories { grid-template-columns: 1fr; }
  .analyzer { padding: 1.5rem; }
  .closing-statement p { font-size: 1.15rem; }
}


/* ===========================================
   SITE FOOTER  (shared — pricing, account, privacy)
=========================================== */

.site-footer {
  text-align: center;
  margin: 4rem 0 2rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.site-footer p { font-size: 0.85rem; margin-bottom: 0.5rem; }
.site-footer p:last-child { font-size: 0.8rem; margin-bottom: 0; }

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

.site-footer a:hover { color: var(--accent-hover); }


/* ===========================================
   PRICING PAGE
=========================================== */

/* ── Currency + cadence toggles ─────────── */

.pricing-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 2.5rem;
  margin: 2.5rem auto 3rem;
}

.toggle-group {
  display: flex;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.toggle-btn {
  padding: 0.5rem 1.2rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.toggle-btn.active {
  background: var(--accent-color);
  color: var(--heading-color);
  font-weight: 600;
}

.toggle-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.save-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  padding: 0 0.35em;
  font-size: 0.72em;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 0.3em;
  letter-spacing: 0.04em;
}

/* ── Pricing grid ────────────────────────── */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 960px;
  margin: 0 auto;
  align-items: start;
}

/* ── Pricing card ────────────────────────── */

.pricing-card {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease;
}

.pricing-card--featured {
  border-color: var(--accent-color);
  box-shadow: 0 0 32px -10px rgba(184, 114, 82, 0.2);
}

/* ── Plan badge (Most Popular) ───────────── */

.plan-badge {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-color);
  color: var(--heading-color);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.25rem 1rem;
  border-radius: 0 0 6px 6px;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Plan name label ─────────────────────── */

.plan-name {
  /* Override global p margin/size */
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.pricing-card--featured .plan-name {
  color: var(--accent-color);
}

/* ── Price display ───────────────────────── */

.plan-price-wrap {
  margin-bottom: 1.5rem;
}

.plan-price-main {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--heading-color);
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 1.1;
}

.price-period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.plan-price-sub {
  /* Override global p margin/size */
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  margin-bottom: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 1.1em;
}

.plan-price-free {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 1.1;
}

/* ── Feature list ────────────────────────── */

.plan-features {
  list-style: none;
  padding: 0;          /* override global ul padding-left: 2rem */
  margin: 0 0 1.75rem;
  flex: 1;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.plan-features li {
  /* Override global li size/margin */
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  padding: 0.32rem 0;
  margin-bottom: 0;    /* override global li margin-bottom */
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.plan-features li:last-child {
  border-bottom: none;
}

.feat-icon {
  font-style: normal;
  font-size: 0.78rem;
  flex-shrink: 0;
  margin-top: 0.18rem;
  opacity: 0.8;
  color: var(--accent-color);
}

.feat-dim {
  color: var(--text-secondary);
  opacity: 0.55;
}

.feat-dim .feat-icon {
  color: var(--text-muted);
}

/* ── Plan buttons ────────────────────────── */

.plan-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 7px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease, background 0.2s ease,
              color 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.02em;
  align-self: auto; /* override .submit-btn align-self: flex-start */
}

.plan-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.plan-btn--primary {
  background: var(--accent-color);
  color: var(--heading-color);
}

.plan-btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.plan-btn--secondary {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.plan-btn--secondary:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.plan-btn--current {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: default;
  font-weight: 500;
}

.plan-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Pricing footnote ────────────────────── */

.pricing-note {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin: 2rem auto 0;
  max-width: 520px;
  line-height: 1.8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Override global p margin inside .pricing-note */
.pricing-note p { margin-bottom: 0; font-size: 0.82rem; }
.pricing-note a  { color: var(--text-muted); text-decoration: underline; }

/* ── Checkout status message ─────────────── */

.checkout-status {
  text-align: center;
  font-size: 0.87rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 1.25rem auto 0;
  max-width: 500px;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  display: none;
  line-height: 1.5;
}

.checkout-status.error {
  display: block;
  background: rgba(var(--color-danger-tint-rgb), 0.12);
  border: 1px solid rgba(var(--color-danger-tint-rgb), 0.28);
  color: var(--color-danger-soft);
}

.checkout-status.success {
  display: block;
  background: rgba(var(--color-success-tint-rgb), 0.12);
  border: 1px solid rgba(var(--color-success-tint-rgb), 0.28);
  color: var(--color-success);
}

.checkout-status.info {
  display: block;
  background: var(--accent-glow);
  border: 1px solid rgba(184, 114, 82, 0.3);
  color: var(--accent-hover);
}

/* ── Post-payment confirming overlay ─────── */

.confirming-overlay {
  display: none;       /* shown via .active class */
  position: fixed;
  inset: 0;
  background: rgba(14, 11, 9, 0.94);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.confirming-overlay.active {
  display: flex;
}

.confirming-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(184, 114, 82, 0.2);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.confirming-title {
  /* Override h2 global margin-top: 4.5rem */
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.4rem;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--heading-color);
  border: none;
  padding: 0;
}

.confirming-sub {
  /* Override global p */
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 380px;
  line-height: 1.7;
  margin-bottom: 0;
}

.confirming-btn {
  padding: 0.65rem 2rem;
  border-radius: 7px;
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.confirming-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ── Refill credits callout ──────────────── */

.refill-callout {
  display: none;       /* shown via .visible class */
  max-width: 600px;
  margin: 2.5rem auto 0;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.4rem 1.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.refill-callout.visible {
  display: flex;
}

.refill-callout-text {
  flex: 1;
  min-width: 180px;
}

/* Override h3 global inside callout */
.refill-callout-text h3 {
  font-size: 0.95rem;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--heading-color);
  margin: 0 0 0.3rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* Override p global inside callout */
.refill-callout-text p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  line-height: 1.55;
}

.refill-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--heading-color);
  font-family: "Georgia", "Times New Roman", serif;
  white-space: nowrap;
}

.refill-price span {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Pricing responsive ──────────────────── */

@media (max-width: 760px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }

  /* On mobile, featured card doesn't need vertical breathing room
     for the badge — it's inline with the other cards */
  .pricing-card--featured {
    padding-top: 2.5rem;
  }
}

@media (max-width: 480px) {
  .refill-callout {
    flex-direction: column;
    align-items: flex-start;
  }

  .refill-callout .plan-btn {
    width: 100%;
  }
}


/* ===========================================
   ACCOUNT PAGE
=========================================== */

/* ── Loading skeleton ────────────────────── */

.account-loading {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
}

.account-loading .confirming-spinner {
  margin: 0 auto 1.5rem;
}

/* ── Account page grid ───────────────────── */

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ── Account card — extends .script-box ─── */
/* Use class="script-box account-card" in HTML */

.account-card {
  /* .script-box provides bg, border, border-radius, padding.
     This class refines spacing and removes hover border shift. */
  margin-bottom: 0;
  padding: 2rem;
}

/* Override script-box h3 inside account cards */
.account-card h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

/* ── Tier badge ──────────────────────────── */

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
}

.tier-badge--free {
  background: rgba(107, 93, 80, 0.15);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.tier-badge--personal {
  background: var(--accent-glow);
  border-color: rgba(184, 114, 82, 0.35);
  color: var(--accent-hover);
}

.tier-badge--professional {
  background: rgba(184, 114, 82, 0.18);
  border-color: rgba(184, 114, 82, 0.5);
  color: var(--heading-color);
}

/* ── Account meta rows (label / value pairs) */

.account-meta {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.account-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.account-meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.account-meta-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
}

.account-meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

/* ── Usage meters ────────────────────────── */

.usage-items {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.usage-item-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.usage-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.usage-value {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  white-space: nowrap;
}

.usage-bar {
  height: 6px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-color);
  opacity: 0.5;
  transition: width 0.5s ease, opacity 0.3s ease, background 0.3s ease;
}

.usage-bar-fill--warning {
  opacity: 0.75;
}

.usage-bar-fill--critical {
  opacity: 1;
  background: var(--accent-color);
}

.usage-caption {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin-top: 0.35rem;
}

/* Refill row — no bar, just a summary line */
.usage-item--refill {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.usage-item--refill .usage-label { color: var(--text-secondary); }
.usage-item--refill .usage-value { color: var(--accent-hover); }

/* ── Account actions ─────────────────────── */

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.account-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.3rem;
  border-radius: 7px;
  border: 1px solid var(--accent-color);
  background: var(--accent-glow);
  color: var(--accent-hover);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.account-action-link:hover {
  background: rgba(184, 114, 82, 0.18);
  color: var(--heading-color);
}

.account-action-link--secondary {
  border-color: var(--border-light);
  background: transparent;
  color: var(--text-secondary);
}

.account-action-link--secondary:hover {
  border-color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.account-signout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  padding: 0.65rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
  margin-left: auto;
}

.account-signout-btn:hover { color: var(--text-secondary); }

/* ── Account upgrade callout ─────────────── */

.account-upgrade-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--accent-glow);
  border: 1px solid rgba(184, 114, 82, 0.25);
  border-radius: 8px;
}

.account-upgrade-callout p {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  line-height: 1.55;
}

/* ── Error state ─────────────────────────── */

.account-error {
  text-align: center;
  padding: 3rem 1rem;
}

.account-error p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin-bottom: 1.2rem;
}

/* ── Account responsive ──────────────────── */

@media (max-width: 700px) {
  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .account-signout-btn {
    margin-left: 0;
    text-align: center;
  }

  .account-upgrade-callout {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ── Auth submit button (full-width in modal context) ────────────────── */
/* Avoids inline style="width:100%" on submit buttons inside .auth-modal  */
.auth-submit-btn { width: 100%; }


/* ===========================================
   CHECKOUT SUCCESS & CANCEL PAGES
=========================================== */

/* ── Shared: centered single-card layout ─── */

.checkout-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 3rem 1rem 5rem;
  min-height: 60vh;
}

.checkout-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 3rem 2.5rem 2.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ── State blocks inside the card ───────── */
/* Each state is shown/hidden via the hidden attribute */

.checkout-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ── Status icon circle ──────────────────── */

.checkout-icon-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.75rem;
  font-size: 1.7rem;
  flex-shrink: 0;
}

.checkout-icon-circle--spinning {
  /* Reuses the confirming-spinner style but larger */
  border: 3px solid rgba(184, 114, 82, 0.18);
  border-top-color: var(--accent-color);
  animation: spin 0.9s linear infinite;
  font-size: 0;   /* hide any text inside */
}

.checkout-icon-circle--success {
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  animation: checkout-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.checkout-icon-circle--neutral {
  border: 2px solid var(--border-light);
  color: var(--text-muted);
}

.checkout-icon-circle--cancel {
  border: 2px solid var(--border-light);
  color: var(--text-muted);
}

@keyframes checkout-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Headings & body copy inside card ───── */
/* Override global h2 (margin-top: 4.5rem, border-bottom) and p (font-size: 1.1rem) */

.checkout-heading {
  font-size: 1.5rem;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--heading-color);
  font-weight: 400;
  margin: 0 0 0.85rem;
  line-height: 1.3;
  border: none;
  padding: 0;
}

.checkout-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  margin: 0 0 0.5rem;
  max-width: 380px;
}

.checkout-body:last-of-type { margin-bottom: 0; }

/* ── Polling progress bar ────────────────── */

.poll-progress {
  width: 100%;
  max-width: 320px;
  height: 3px;
  background: var(--surface-color);
  border-radius: 2px;
  overflow: hidden;
  margin: 1.75rem auto 0;
}

.poll-progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 2px;
  opacity: 0.6;
  /* Fills over 90 seconds — matches the JS poll timeout */
  animation: poll-fill 90s linear forwards;
}

@keyframes poll-fill {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ── Tier reveal chip (shown in success state) */

.checkout-tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-glow);
  border: 1px solid rgba(184, 114, 82, 0.35);
  color: var(--accent-hover);
  margin-bottom: 1.5rem;
  animation: checkout-pop 0.5s 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* ── Action buttons / links inside card ──── */

.checkout-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  width: 100%;
}

.checkout-primary-btn {
  display: inline-block;
  padding: 0.8rem 2.2rem;
  background: var(--accent-color);
  color: var(--heading-color);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
  width: 100%;
  text-align: center;
  max-width: 280px;
}

.checkout-primary-btn:hover { background: var(--accent-hover); color: var(--heading-color); }

.checkout-secondary-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.checkout-secondary-link:hover { color: var(--text-secondary); }

/* ── Divider line between actions ───────── */

.checkout-divider {
  width: 100%;
  max-width: 280px;
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0;
}

/* ── Cancel page — "no charge" callout ──── */

.no-charge-note {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  margin-bottom: 1.75rem;
  letter-spacing: 0.02em;
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 560px) {
  .checkout-card {
    padding: 2.25rem 1.5rem 2rem;
  }

  .checkout-heading { font-size: 1.3rem; }
}


/* ===========================================
   QUOTA DISPLAY & UPGRADE NUDGE  (Phase 6)
=========================================== */

/* Link shown inside the quota-display paragraph when remaining is low */
.quota-upgrade-link {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
  transition: color 0.2s;
}

.quota-upgrade-link:hover { color: var(--accent-hover); }

/* Link shown inside .result-box error messages — e.g. "View plans →" */
.result-link {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.result-link:hover { color: var(--accent-hover); }

/* ── Post-upgrade flash banner ─────────────
   Injected by checkUpgradeParam() when index.html
   is loaded with ?upgraded=1 from checkout-success. */

.upgrade-success-banner {
  background: rgba(var(--color-success-tint-rgb), 0.10);
  border: 1px solid rgba(var(--color-success-tint-rgb), 0.28);
  border-radius: 8px;
  padding: 0.85rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-success);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  animation: banner-slide-in 0.3s ease both;
}

.upgrade-success-banner a {
  color: var(--color-success);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.upgrade-success-banner a:hover { color: var(--color-success-hover); }

@keyframes banner-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ===========================================
   PRIVACY / POLICY PAGES
=========================================== */

/* Active nav link on the current page */
.nav-current { color: var(--heading-color); }

/* "Last updated" meta line below the subtitle */
.policy-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   OTP AUTH MODAL — Phase 7 rework
   Two-step flow (email → code) replaces the old tab-based login/register.
   The tab styles remain in the file for any future use; they are simply not
   rendered because .auth-tabs is no longer in the HTML.
   ───────────────────────────────────────────────────────────────────────── */

/* Step headings ─────────────────────────────────────────────────────────── */
.auth-heading {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.45rem;
  line-height: 1.3;
  padding-right: 1.8rem; /* clear the × close button */
}

.auth-subheading {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 1.6rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-subheading strong {
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-all;
}

/* Code input — large, centred, monospaced ─────────────────────────────── */
#otp-code {
  text-align: center;
  font-size: 1.7rem;
  letter-spacing: 0.35em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0.85rem 1rem;
  /* slightly taller than standard inputs to give the digits space */
}

#otp-code::placeholder {
  letter-spacing: 0.2em;
  font-size: 1.4rem;
  color: var(--text-muted);
  opacity: 0.5;
}

/* Footer links inside the OTP form ──────────────────────────────────────── */
.auth-footer-note a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.auth-footer-note a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Referral code section ─────────────────────────────────────────────────── */
#otp-referral-wrap {
  margin-top: 0;
  animation: otp-fade-in 0.18s ease;
}

@keyframes otp-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── PRICING: auto-detected currency note (replaces the manual INR/USD toggle) ─ */
.currency-note {
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin: 0 0 0.2rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  order: -1;           /* always renders above the toggle group */
}

/* ── Saved Analyses history page (Phase 7) ───────────────────────────────── */
/* Uses existing design tokens; leans on .account-card / .auth-field /
   .account-actions for the base look, adding only history-specific layout. */

.history-filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 0.85rem;
  align-items: end;
}
.history-filters .auth-field { margin: 0; }

.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.4rem 0 0.2rem;
}

.history-row { margin-top: 1rem; }

.history-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.history-risk {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}
.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-type {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.35rem 0 1rem;
}

.history-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0.9rem 0 0.4rem;
}

.history-signals {
  margin: 0 0 0.6rem;
  padding-left: 1.4rem;
}
.history-signals li {
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.history-text {
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin: 0 0 0.4rem;
}

.history-row-actions { margin-top: 1rem; }
.history-row-status:empty { display: none; }

@media (max-width: 640px) {
  .history-filters { grid-template-columns: 1fr; }
}

/* ── Conversations / chat page (Phase 7) ─────────────────────────────────── */

.conv-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-primary);
}
.conv-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.conv-composer-meta {
  display: flex;
  justify-content: flex-end;
  margin: 0.35rem 0 0.2rem;
}
.conv-char-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Thread list items */
.conv-thread-item {
  margin-top: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.05s;
}
.conv-thread-item:hover { border-color: var(--accent-color); }
.conv-thread-item:active { transform: scale(0.995); }
.conv-thread-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.conv-thread-item-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.conv-type-chip {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  background: var(--surface-raised);
}

/* Single-thread view */
.conv-thread-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.conv-thread-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.conv-thread-card { margin-top: 0; }

.conv-messages {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.2rem 0.1rem 0.4rem;
  margin-bottom: 1rem;
}

.conv-msg {
  max-width: 85%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}
.conv-msg--user {
  align-self: flex-end;
  background: var(--accent-glow);
  border-color: var(--accent-color);
}
.conv-msg--assistant {
  align-self: flex-start;
  background: var(--surface-raised);
}
.conv-msg-text {
  margin: 0;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.conv-msg-risk {
  margin: 0 0 0.6rem;
}

.conv-msg-risk-label {
  margin: 0 0 0.35rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--risk-active);
}

.conv-msg-risk-score {
  font-family: -apple-system, sans-serif;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  margin-left: 0.15rem;
}

/* Slimmer than the analyse-page scale — a chat turn is a secondary reading,
   not the primary verdict, so it echoes the treatment at lower weight. */
.conv-scale {
  display: flex;
  gap: 2px;
  max-width: 190px;
}

.conv-tick {
  flex: 1;
  height: 4px;
  border-radius: 1px;
  background: var(--border-color);
}
.conv-tick[data-on="1"] { background: var(--tick-color); }
.conv-msg-signals {
  margin: 0.5rem 0 0;
  padding-left: 1.3rem;
}
.conv-msg-signals li {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.conv-turn-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.8rem;
  text-align: center;
}

/* ── Non-refundable payment notice (pricing page) ─────────────────────────── */
.pricing-refund-notice {
  max-width: 760px;
  margin: 2rem auto 0.75rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-color);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.65;
  text-align: left;
}
.pricing-refund-notice strong { color: var(--text-primary); }

.refill-refund-note {
  margin: 0.2rem 0 0;
  font-size: 0.74rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Auth consent checkbox (Terms + Privacy gate) ─────────────────────────── */
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.9rem 0 0.2rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
  cursor: pointer;
}
.auth-consent input[type="checkbox"] {
  flex: 0 0 auto;
  /* Nudge down so the box aligns with the first line of text rather than
     floating above it on smaller type sizes. */
  margin-top: 0.18rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-color);
  cursor: pointer;
}
.auth-consent a {
  color: var(--accent-hover);
  text-decoration: underline;
}
.auth-consent a:hover { color: var(--accent-color); }

/* ── Promo code redemption (plans page) ───────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.promo-callout {
  max-width: 760px;
  margin: 2.5rem auto 0;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface-raised);
  text-align: left;
}
.promo-callout h3 {
  margin: 0 0 0.4rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  color: var(--text-primary);
}
.promo-callout-text p {
  margin: 0 0 1rem;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.promo-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}
.promo-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.promo-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.promo-status {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  line-height: 1.55;
}
.promo-status:empty { display: none; }
.promo-status--success { color: var(--color-success); }
.promo-status--error   { color: var(--color-danger); }

/* ─────────────────────────────────────────────────────────────────────────────
   SHARE PROMPT — shown below a completed analysis

   Deliberately quieter than the result box: lighter background, no accent
   border, smaller type. The analysis is what the user came for; the request
   sits underneath it and should not compete for attention or read as an ad.
   ───────────────────────────────────────────────────────────────────────── */
.share-prompt {
  margin-top: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.share-prompt__lead {
  font-family: Georgia, serif;
  font-size: 1.02rem;
  color: var(--text-primary);
  margin: 0 0 0.4rem;
  line-height: 1.5;
}

.share-prompt__body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0 0 1.15rem;
  line-height: 1.6;
  max-width: 46ch;
}

.share-prompt__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.share-btn {
  display: inline-block;
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-family: -apple-system, sans-serif;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
  /* Fixed min-width so the "Link copied" confirmation does not resize the
     button and shift the row while the user is looking at it. */
  min-width: 7.5rem;
  text-align: center;
}

.share-btn:hover,
.share-btn:focus-visible {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.share-btn--primary {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.share-btn--primary:hover,
.share-btn--primary:focus-visible {
  background: var(--accent-color);
  color: var(--bg-color);
}

@media (max-width: 560px) {
  .share-prompt { padding: 1.25rem 1.25rem; }
  .share-prompt__actions { gap: 0.5rem; }
  .share-btn { flex: 1 1 auto; min-width: 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SAVE-TO-HISTORY ROW

   The opt-in checkbox and the View History link share one line: checkbox left,
   link pushed to the right edge. The link is revealed independently of the row
   — the row appears for any signed-in user, but the link only once they
   actually have saved analyses, so it never leads to an empty page.
   ───────────────────────────────────────────────────────────────────────── */
.save-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.save-history-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0;
}

.view-history-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.view-history-link:hover,
.view-history-link:focus-visible {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

/* On narrow screens the two stack rather than crowd each other. */
@media (max-width: 480px) {
  .save-history-row { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
  .view-history-link { align-self: flex-end; }
}

/* Tier limit feedback under the attach bar — shown by _addFiles() when a
   selection exceeds the plan's file count or combined size. */
.file-limit-msg {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--accent-color);
  flex-basis: 100%;
}

/* ═════════════════════════════════════════════════════════════════════════════
   ANALYSIS RESULT

   The rating is what the person came for, so it gets the weight and everything
   else stays quiet. The scale itself is the one bold element: ten segments,
   each coloured by the band it belongs to, filled up to the reading. That
   teaches the scale rather than decorating it — you see not only "9" but that
   9 sits inside a Critical band beginning at 8, which is information the PDF
   already prints as a footnote and the screen previously omitted.
   ═══════════════════════════════════════════════════════════════════════════ */

.analysis {
  margin-top: 1.5rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

/* ── Verdict header ──────────────────────────────────────────────────────── */
.analysis__verdict {
  padding: 1.75rem 1.75rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.analysis__eyebrow {
  font-family: -apple-system, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.analysis__rating {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
}

.analysis__band {
  font-family: Georgia, serif;
  font-size: 1.9rem;
  line-height: 1.1;
  font-weight: 600;
  color: var(--risk-active);
  margin: 0;
}

.analysis__score {
  font-family: -apple-system, sans-serif;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}
.analysis__score b { color: var(--risk-active); font-size: 1.35rem; font-weight: 600; }

/* ── The scale ───────────────────────────────────────────────────────────── */
.analysis__scale {
  display: flex;
  gap: 3px;
  margin: 0 0 0.55rem;
}

.analysis__tick {
  flex: 1;
  height: 7px;
  border-radius: 2px;
  background: var(--border-color);
  transition: background-color 0.2s ease;
}
.analysis__tick[data-on="1"] { background: var(--tick-color); }

.analysis__bands {
  display: flex;
  font-family: -apple-system, sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.analysis__bands span { text-align: center; }
.analysis__bands span[data-active="1"] { color: var(--risk-active); font-weight: 600; }

.analysis__pattern {
  font-family: -apple-system, sans-serif;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 1.15rem 0 0;
}

/* ── Body sections ───────────────────────────────────────────────────────── */
.analysis__section { padding: 1.5rem 1.75rem; }
.analysis__section + .analysis__section { border-top: 1px solid var(--border-color); }

/* Signals are full sentences, not tags, so they stay a list — pills would
   truncate them. The marker carries the severity colour. */
.analysis__signals { list-style: none; margin: 0; padding: 0; }

.analysis__signals li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.7rem;
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--text-primary);
}
.analysis__signals li:last-child { margin-bottom: 0; }

/* ── Evidence: verbatim quotes pulled from the user's own message ─────────── */
.analysis__evidence { list-style: none; margin: 0; padding: 0; }
.analysis__evidence li {
  border-left: 3px solid var(--accent-color);
  padding: 0.5rem 0 0.5rem 1rem;
  margin-bottom: 0.8rem;
  font-family: "Georgia", "Times New Roman", serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.analysis__evidence li:last-child { margin-bottom: 0; }

/* ── High-risk emergency banner (rating >= 8 only) ────────────────────────── */
.analysis__emergency {
  background: var(--accent-glow);
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
}
.analysis__emergency strong { color: var(--accent-hover); }


.analysis__signals li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--risk-active);
}

.analysis__none {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Measure capped for readability — the previous full-width block was the main
   reason the analysis read as a wall.
   Set in ch but tuned by measurement, not by the nominal number: 1ch is the
   width of the ZERO glyph, which in this face is wider than the average
   character, so 68ch actually rendered ~79 characters per line. 60ch lands at
   roughly 70, inside the comfortable 60-75 range. */
.analysis__prose { max-width: 60ch; }
.analysis__prose p { margin: 0 0 1rem; line-height: 1.8; font-size: 1rem; }
.analysis__prose p:last-child { margin-bottom: 0; }

.analysis__prose ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.analysis__prose ol li {
  margin-bottom: 0.6rem;
  line-height: 1.7;
  padding-left: 0.2rem;
}
.analysis__prose ol li::marker {
  color: var(--accent-color);
  font-weight: 600;
}

/* ── Motion: one short orchestrated reveal, not scattered effects. The
   audience may have just been told they are being defrauded, so this stays
   restrained. ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .analysis { animation: analysis-in 0.32s ease-out both; }
  .analysis__tick { animation: tick-in 0.22s ease-out both; }
  @keyframes analysis-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes tick-in {
    from { opacity: 0; transform: scaleX(0.4); }
    to   { opacity: 1; transform: none; }
  }
}

@media (max-width: 560px) {
  .analysis__verdict { padding: 1.35rem 1.25rem 1.2rem; }
  .analysis__section { padding: 1.25rem; }
  .analysis__band    { font-size: 1.55rem; }
  .analysis__bands   { font-size: 0.6rem; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   FOLLOW-UP BLOCK — questions the model still has, plus an answer box.

   Sits inside the analysis card as its own section so it reads as part of the
   result rather than a separate feature bolted underneath.
   ───────────────────────────────────────────────────────────────────────── */
.followup__questions {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
}

.followup__questions li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.55rem;
  font-family: Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--text-primary);
}
.followup__questions li:last-child { margin-bottom: 0; }

.followup__questions li::before {
  content: "?";
  position: absolute;
  left: 0;
  top: 0;
  font-family: -apple-system, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
}

.followup__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.97rem;
  line-height: 1.6;
  resize: vertical;
}
.followup__input:focus-visible {
  outline: none;
  border-color: var(--accent-color);
}
.followup__input::placeholder { color: var(--text-muted); }

.followup__error {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--color-danger);
}

.followup__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.followup__send {
  padding: 0.6rem 1.2rem;
  font-family: -apple-system, sans-serif;
  font-size: 0.9rem;
  color: var(--bg-color);
  background: var(--accent-color);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.followup__send:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.followup__send:disabled { opacity: 0.6; cursor: default; }

.followup__quota {
  margin: 0;
  font-family: -apple-system, sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .followup__foot { flex-direction: column; align-items: stretch; }
  .followup__send { width: 100%; }
  .followup__quota { text-align: center; }
}

/* Where a follow-up answer is stored. Shown because answers are saved with no
   per-message opt-out, and the wording differs depending on whether the
   analysis itself was saved. */
.followup__note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Follow-up threads listed inside a History entry. */
.history-followups {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.history-followups li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.history-followup-link {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.history-followup-link:hover,
.history-followup-link:focus-visible { border-bottom-color: var(--accent-color); }

.history-followup-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
