/* ==========================================================================
   Pro Se Step Navigator — styles.css
   WCAG 2.1 AA compliant, 4.5:1 contrast minimum
   ========================================================================== */

/* ---------- Self-hosted fonts ----------
   woff2 committed to /fonts/ — no external font requests at runtime.
   Previously these loaded from Google Fonts (fonts.googleapis.com /
   fonts.gstatic.com), the only third-party dependency in the app and a
   privacy leak inconsistent with the sibling tools' strict CSP. */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/AtkinsonHyperlegible-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/AtkinsonHyperlegible-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Lexend';
  src: url('/fonts/Lexend.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ---------- High-legibility font ----------
   Atkinson Hyperlegible (self-hosted above) is the ACTIVE high-legibility
   face: Settings → Reading font → "High-legibility" renders it with zero
   network requests. A previous OpenDyslexic @font-face scaffold was removed
   here — its WOFF2s were never bundled (the /fonts/ dir ships only Atkinson +
   Lexend), so the rules pointed at files that don't exist and could never
   activate. Everything stays self-hosted (font-src 'self'). */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
[data-motion="reduced"] * { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
/* Pure-CSS honor of the OS "reduce motion" setting. The JS in app.js mirrors
   this into data-motion, but that only takes effect once the module graph has
   loaded and run; this media query suppresses motion from first paint and even
   if app.js never runs (offline-stale shell, script error). The explicit
   data-motion="full" override lets a user who has OS reduce-motion ON still opt
   back into animation via the in-app control. */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) { scroll-behavior: auto; }
  html:not([data-motion="full"]) *,
  html:not([data-motion="full"]) *::before,
  html:not([data-motion="full"]) *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Tokens (light) ---------- */
:root {
  --c-bg:        #f8f6f2;
  --c-surface:   #ffffff;
  --c-surface-2: #edf0f4;
  --c-border:    #ddd9d2;
  --c-text:      #1c1c1c;
  --c-text-muted:#5c5850;
  --c-primary:   #2e6388;
  --c-primary-h: #234d6a;
  /* White-text FILL token. In light it is identical to --c-primary, so light
     mode renders byte-for-byte the same. Dark repoints it to a darker cerulean
     (see the dark block) so white text on the fill clears WCAG AA 4.5:1, while
     --c-primary stays the lighter shade used for text/links/accents. */
  --c-primary-bg:  #2e6388;
  --c-primary-bg-h:#234d6a;
  --c-primary-lt:#e6eef6;
  --c-secondary: #2e6da4;
  --c-focus:     #005fcc;
  --c-warn-bg:   #fffbeb;
  --c-warn-bdr:  #b45309;
  --c-warn-text: #6b3c00;
  /* White-text warn FILL (calm-mode .overdue-badge). Same reasoning as
     --c-danger-fill below: dark mode's --c-warn-bdr is a light amber for
     borders/text, not a white-text-safe fill. Identical to --c-warn-bdr
     in light, so light mode is unchanged. */
  --c-warn-fill: #b45309;
  --c-success:   #166534;
  --c-success-bg:#dcfce7;
  --c-danger:    #991b1b;
  --c-danger-bg: #fee2e2;
  /* White-text danger FILL (.btn-danger, .toast-error). Kept separate from
     --c-danger because dark uses --c-danger as a LIGHT red for text/borders on
     tinted backgrounds; a white-text fill needs a DARK red instead. Identical
     to --c-danger in light, so light mode is unchanged. */
  --c-danger-fill: #991b1b;
  --c-federal:   #2e6388;
  --c-state:     #4a3800;
  --c-radius:    6px;
  --c-radius-lg: 10px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,.1);
  --trans:       .15s ease;
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
  --c-bg:        #0e1117;
  --c-surface:   #161b27;
  --c-surface-2: #1e2433;
  --c-border:    #2c3040;
  --c-text:      #e8e5df;
  --c-text-muted:#9e9b95;
  --c-primary:   #4a90d9;
  --c-primary-h: #3a7bc8;
  /* Darker FILL for white text. White on #4a90d9 is only 3.34:1 (fails AA);
     white on #1f5a82 is ~7.4:1. Every white-text-on-primary surface (top-bar,
     footer, .btn-primary, step badges, segmented-control active, jurisdiction
     chip) points here in dark, while --c-primary above keeps serving as the
     lighter text/link/accent color that reads on the dark page background. */
  --c-primary-bg:  #1f5a82;
  --c-primary-bg-h:#17455f;
  --c-primary-lt:#102a1c;
  --c-secondary: #5ba3d9;
  --c-focus:     #60a5fa;
  --c-warn-bg:   #2d1a00;
  --c-warn-bdr:  #f59e0b;
  --c-warn-text: #fde68a;
  /* Darker amber for white-text fills: white on #f59e0b is 2.15:1 (fails
     AA); white on #b45309 (light mode's own value) is 5.02:1. Found via
     [data-calm="on"] .overdue-badge -- the overdue-deadline badge, of all
     things, was under-contrast for anyone running calm mode + dark mode
     together. */
  --c-warn-fill: #b45309;
  --c-success:   #4ade80;
  --c-success-bg:#052e16;
  --c-danger:    #f87171;
  --c-danger-bg: #3b0f0f;
  /* Darker red for white-text fills: white on #f87171 is 2.76:1 (fails AA);
     white on #b91c1c is ~6.5:1. --c-danger above stays the lighter red used
     as text/border on the tinted --c-danger-bg surfaces. */
  --c-danger-fill: #b91c1c;
  --c-federal:   #60a5fa;
  --c-state:     #fbbf24;
}

/* ---------- High contrast mode ---------- */
[data-contrast="high"] {
  --c-text:       #000;
  --c-text-muted: #1a1a1a;
  --c-border:     #000;
  --c-surface:    #fff;
  --c-bg:         #fff;
  --c-primary:    #0b3d6b;
  --c-primary-lt: #e6eef6;
  --c-focus:      #000;
}
[data-contrast="high"][data-theme="dark"] {
  --c-text:       #fff;
  --c-text-muted: #eee;
  --c-border:     #fff;
  --c-surface:    #000;
  --c-bg:         #000;
  --c-primary:    #60a5fa;
  --c-focus:      #fff;
}

/* ---------- Typography ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* High-legibility toggle (Settings → Reading font). data-font lives on <html>;
   the selector targets <body> because body carries its own explicit
   font-family above, which an inherited value on <html> could not override.
   Stack: Atkinson Hyperlegible (self-hosted, active) → system fallbacks. */
[data-font="hyperlegible"] body {
  font-family: 'Atkinson Hyperlegible', system-ui,
               -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.05rem; font-weight: 700; }
a  { color: var(--c-primary); }
a:hover { text-decoration: underline; }
p  { margin-bottom: .5rem; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
  background: var(--c-surface);
  color: var(--c-text);
  padding: .5rem 1rem;
  border: 2px solid var(--c-focus);
  border-radius: var(--c-radius);
  z-index: 9999;
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---------- Screen reader only ---------- */
.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;
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.top-bar {
  background: var(--c-primary-bg);
  color: #fff;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.top-bar-inner {
  max-width: 64rem;
  margin: 0 auto;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .35rem 0;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
  white-space: nowrap;
  /* WCAG 2.5.5 — ≥44×44 hit area. */
  min-height: 2.75rem;
  padding: 0 .4rem;
  border-radius: var(--c-radius);
}
.site-logo:hover { text-decoration: none; opacity: .9; }
.logo-text { display: none; }
@media (min-width: 400px) { .logo-text { display: inline; } }

/* Quick exit — deliberately the highest-contrast, most urgent-looking
   control in the header (solid red, not the translucent-white pill style
   every other header chip uses) so it reads as "the emergency button" at
   a glance, not just another nav item. First in DOM order too — see
   index.html for why. ≥44px hit area (WCAG 2.5.5), same as every other
   header control. */
.quick-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 44px;
  padding: 0 .75rem;
  border: none;
  border-radius: var(--c-radius);
  /* --c-danger-fill, not --c-danger: the latter is the lighter red meant
     for text/borders on a tinted background and fails AA contrast for
     white text in dark mode (2.77:1) -- caught by npm run a11y. -fill is
     the darker variant .btn-danger / .toast-error already use for
     exactly this white-on-solid-red case. */
  background: var(--c-danger-fill);
  color: #fff;
  font-weight: 700;
  font-size: .8125rem;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.quick-exit-btn:hover,
.quick-exit-btn:focus-visible { background: #7a1616; }
.quick-exit-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Static jurisdiction context chip — mirrors the sibling federal app's
   "Houston Division" chip so the two apps read as a family. Fitted to this
   app's navy top-bar (translucent white, like the other header controls). */
.jurisdiction-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem .7rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
  cursor: default;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  max-width: 16rem;
  min-height: 44px;
}
.jurisdiction-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jurisdiction-chip-short { display: none; }
@media (max-width: 560px) {
  .jurisdiction-chip-full { display: none; }
  .jurisdiction-chip-short { display: inline; }
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--c-radius);
  color: #fff;
  cursor: pointer;
  font-size: .875rem;
  padding: .35rem .75rem;
  white-space: nowrap;
  transition: background var(--trans);
  /* WCAG 2.5.5 — ≥44×44 hit area. */
  min-height: 2.75rem;
  min-width: 2.75rem;
}
.nav-btn:hover { background: rgba(255,255,255,.25); }
.nav-label { display: none; }
@media (min-width: 480px) { .nav-label { display: inline; } }

/* The header nav (Favorites / Deadlines) is a flex row. Without this it
   defaults to a block and its two buttons stack vertically, doubling the
   header height (and ballooning it at large zoom). */
.top-bar-inner > nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.top-controls {
  display: flex;
  /* wrap so the icon controls never clip off-screen at large font sizes */
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: .35rem;
  margin-left: auto;
}
.icon-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--c-radius);
  color: #fff;
  cursor: pointer;
  font-size: .9rem;
  /* WCAG 2.5.5 — ≥44×44 hit area (was 2.5rem / 40px). */
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans);
}
.icon-btn:hover { background: rgba(255,255,255,.15); }
.icon-btn:focus-visible { outline: 3px solid #fff; }

/* ==========================================================================
   Layout
   ========================================================================== */
main { flex: 1; }
.view-container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ==========================================================================
   Disclaimer banner
   ========================================================================== */
.disclaimer-banner {
  background: var(--c-warn-bg);
  border: 2px solid var(--c-warn-bdr);
  border-radius: var(--c-radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  color: var(--c-warn-text);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.disclaimer-banner strong { color: var(--c-warn-text); }

/* ==========================================================================
   Backup reminder (home screen — court-picker.js)
   ========================================================================== */
.backup-reminder {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: .5rem .75rem;
  align-items: center;
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border-left: 4px solid var(--c-warn-bdr);
  border-radius: var(--c-radius);
  padding: .65rem .85rem;
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}
.backup-reminder-icon { font-size: 1.4rem; align-self: start; padding-top: .1rem; }
.backup-reminder-body strong { display: block; margin-bottom: .15rem; color: var(--c-warn-text); }
.backup-reminder-cta {
  white-space: nowrap;
  font-weight: 600;
  color: var(--c-warn-text);
  /* WCAG 2.5.5 — "Back up now →" CTA needs >=44x44 hit area. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .65rem;
}
.backup-reminder-cta:hover { text-decoration: underline; }
.backup-reminder-dismiss {
  background: transparent;
  border: 0;
  color: var(--c-warn-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border-radius: .25rem;
  /* WCAG 2.5.5 — x dismiss needs >=44x44; explicit width/height to
     defeat parent grid shrinking. */
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.backup-reminder-dismiss:hover { background: color-mix(in srgb, var(--c-warn-bdr) 15%, transparent); }
.backup-reminder-dismiss:focus-visible { outline: 2px solid var(--c-warn-bdr); outline-offset: 2px; }
@media (max-width: 480px) {
  .backup-reminder {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon body dismiss" ".    cta  cta";
  }
  .backup-reminder-icon { grid-area: icon; }
  .backup-reminder-body { grid-area: body; }
  .backup-reminder-dismiss { grid-area: dismiss; }
  .backup-reminder-cta { grid-area: cta; justify-self: start; }
}

/* Immediate-physical-safety notice (file-protective-order only). Deliberately
   uses --c-danger (not --c-warn, which the app reserves for procedural
   deadline urgency) so a reader never confuses "call 911" with "your filing
   deadline is close" — the two are visually distinct kinds of urgency. */
.safety-banner {
  background: var(--c-danger-bg);
  border: 2px solid var(--c-danger-fill);
  border-radius: var(--c-radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  color: var(--c-danger);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.safety-banner strong { display: block; margin-bottom: .25rem; color: var(--c-danger); }
.safety-banner a { color: var(--c-danger); font-weight: 700; text-decoration: underline; }
/* Spanish orientation card — readable by Spanish speakers (the audience the
   English-only "other languages" footer signpost couldn't reach). */
.lang-orient {
  margin-bottom: 1rem;
  padding: .6rem .85rem;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  font-size: .875rem;
}
.lang-orient p { margin: 0; line-height: 1.55; }
.lang-orient a { color: var(--c-primary); font-weight: 600; }
/* Stronger emphasis variant — used by the deadlines view when the user
   has overdue reminders, so the "these are not legal deadlines" note
   reads as more urgent. */
.disclaimer-banner--warn {
  border-color: var(--c-danger, #c0392b);
  border-width: 2px;
  box-shadow: 0 0 0 1px var(--c-danger, #c0392b) inset;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .55rem 1.1rem;
  border: 2px solid transparent;
  border-radius: var(--c-radius);
  cursor: pointer;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--trans), border-color var(--trans), color var(--trans);
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
}
.btn-primary   { background: var(--c-primary-bg); color: #fff; border-color: var(--c-primary-bg); }
.btn-primary:hover { background: var(--c-primary-bg-h); border-color: var(--c-primary-bg-h); }
.btn-secondary { background: transparent; color: var(--c-primary); border-color: var(--c-primary); }
.btn-secondary:hover { background: var(--c-primary-lt); }
.btn-ghost     { background: transparent; color: var(--c-text-muted); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-danger    { background: var(--c-danger-fill); color: #fff; border-color: var(--c-danger-fill); }
/* WCAG 2.5.5 — .btn-sm previously overrode .btn min-height down to 36px;
   bumped to 44px so chrome action rows (Back / Share / Save / Print /
   wizard nav) all meet AAA touch-target. Padding adjusted slightly to
   keep the button proportions tight. */
.btn-sm        { padding: .5rem 1rem; font-size: .875rem; min-height: 44px; min-width: 44px; }

/* ==========================================================================
   Case-type triage (landing — above the court picker)
   ========================================================================== */
.case-type-triage {
  margin: 0 0 1.5rem;
  padding: 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: .5rem;
}
.case-type-triage-title {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--c-primary, #2e6388);
}
.case-type-triage-sub {
  margin: 0 0 .85rem;
  font-size: .9rem;
  line-height: 1.45;
  color: var(--c-text);
}
.case-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: .6rem;
}
.case-type-card {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  /* Allow this grid item to shrink below its min-content so a single-column
     track (minmax(auto,1fr)) can't force the card wider than the viewport at
     high zoom. Prevents the ~16px horizontal overflow on small screens. */
  min-width: 0;
  padding: .75rem .85rem;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: .5rem;
  text-decoration: none;
  color: var(--c-text);
  min-height: 4rem;
  transition: background var(--trans), border-color var(--trans), transform var(--trans);
}
.case-type-card:hover { background: #dbeafe; border-color: #93c5fd; transform: translateY(-1px); }
.case-type-card:focus-visible {
  outline: 3px solid var(--c-primary, #2e6388);
  outline-offset: 2px;
}
.case-type-card-icon { font-size: 1.5rem; flex: 0 0 auto; line-height: 1.1; }
.case-type-card-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.case-type-card-label { font-weight: 600; font-size: .95rem; color: var(--c-primary, #2e6388); }
.case-type-card-sub { font-size: .8rem; color: var(--c-text-muted, #475569); line-height: 1.35; }

@media (max-width: 480px) { .case-type-grid { grid-template-columns: 1fr; } }

@media (prefers-color-scheme: dark) {
  [data-theme="dark"] .case-type-triage,
  [data-theme="system"] .case-type-triage { background: #1e293b; border-color: #334155; }
  [data-theme="dark"] .case-type-card,
  [data-theme="system"] .case-type-card { background: #0f172a; border-color: #334155; color: #e2e8f0; }
  [data-theme="dark"] .case-type-card:hover,
  [data-theme="system"] .case-type-card:hover { background: #1e293b; border-color: #60a5fa; }
  [data-theme="dark"] .case-type-card-label,
  [data-theme="system"] .case-type-card-label { color: #93c5fd; }
}
/* Dark mode: cards LIFT off the panel (panel darker, cards lighter).
   The prior values had cards (#0f172a) darker than the panel (#1e293b)
   which made them visually recede instead of standing out. */
[data-theme="dark"] .case-type-triage {
  background: #0f172a;
  border-color: #1e3a8a;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .08);
}
[data-theme="dark"] .case-type-card {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}
[data-theme="dark"] .case-type-card:hover { background: #334155; border-color: #60a5fa; }
[data-theme="dark"] .case-type-card-label { color: #93c5fd; }
[data-theme="dark"] .case-type-triage-title { color: #93c5fd; }

/* ==========================================================================
   Step heading
   ========================================================================== */
.step-heading {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--c-text);
}
.step-num-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--c-primary-bg);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ==========================================================================
   Search / filter row
   ========================================================================== */
.search-row {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.search-input {
  flex: 1;
  min-width: 0;
  padding: .55rem .85rem;
  border: 2px solid var(--c-border);
  border-radius: var(--c-radius);
  font-size: .9375rem;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color var(--trans);
}
.search-input:focus-visible { border-color: var(--c-focus); outline: 3px solid var(--c-focus); outline-offset: 1px; }
.type-select {
  padding: .5rem .75rem;
  border: 2px solid var(--c-border);
  border-radius: var(--c-radius);
  font-size: .9rem;
  color: var(--c-text);
  background: var(--c-surface);
  cursor: pointer;
}

/* ==========================================================================
   Court cards
   ========================================================================== */
.court-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.court-card {
  width: 100%;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  padding: .85rem 1rem;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  display: block;
}
.court-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); }
.court-card:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.court-card-inner { display: flex; align-items: center; gap: .75rem; justify-content: space-between; }
.court-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.court-name { font-weight: 700; font-size: .9375rem; color: var(--c-text); }
.court-location { font-size: .8125rem; color: var(--c-text-muted); }
.court-type-badge {
  flex-shrink: 0;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 100px;
  white-space: nowrap;
}
.badge-federal { background: var(--c-primary-lt); color: var(--c-federal); }
.badge-state   { background: #fff9e6; color: var(--c-state); }
[data-theme="dark"] .badge-state { background: #2d1a00; }

/* ==========================================================================
   Action cards
   ========================================================================== */
.action-list { display: flex; flex-direction: column; gap: .5rem; }
.action-card {
  width: 100%;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  padding: .85rem 1rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: .75rem;
  justify-content: space-between;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.action-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); }
.action-card-body { flex: 1; min-width: 0; }
.action-name { display: block; font-weight: 700; font-size: .9375rem; color: var(--c-text); }
.action-desc { display: block; font-size: .8125rem; color: var(--c-text-muted); margin-top: .15rem; }
.action-arrow { color: var(--c-text-muted); font-size: 1.2rem; flex-shrink: 0; }

/* ==========================================================================
   Selected court badge
   ========================================================================== */
.selected-court-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--c-primary-lt);
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
  border-radius: 100px;
  padding: .2rem .75rem;
  font-size: .875rem;
  font-weight: 600;
  max-width: 24rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Steps screen
   ========================================================================== */
.steps-header { margin-bottom: 1.25rem; }
.steps-header h1 { font-size: 1.35rem; }
.steps-subtitle { color: var(--c-text-muted); font-size: .9rem; margin-top: .25rem; }

.steps-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.step-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: .85rem;
  align-items: flex-start;
}
.step-item.completed { border-color: var(--c-success); background: var(--c-success-bg); }
[data-theme="dark"] .step-item.completed { background: #052e16; border-color: #4ade80; }
.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--c-primary-lt);
  color: var(--c-primary);
  font-size: .875rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .1rem;
}
.step-item.completed .step-number { background: var(--c-success-bg); color: var(--c-success); }
.step-body { flex: 1; min-width: 0; }
/* white-space: pre-line preserves author-inserted newlines (used to break a
   dense list of legal defenses into one-per-line) while still collapsing
   ordinary runs of spaces. Existing single-paragraph step text contains no
   newlines, so it renders identically. */
.step-text { font-size: .9375rem; line-height: 1.55; margin-bottom: .4rem; white-space: pre-line; }
.step-source {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8125rem;
  color: var(--c-secondary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  /* WCAG 2.5.5 — these "Source: ..." links sit on their own visual
     line under each step and aren't text-flow inline; give them a
     proper 44px hit area via padding. */
  min-height: 2.75rem;
  padding: .5rem 0;
}
.step-source:hover { border-bottom-color: var(--c-secondary); }
.step-source::after { content: " ↗"; font-size: .75rem; }
.step-check {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: .25rem;
  cursor: pointer;
  accent-color: var(--c-success);
}
/* WCAG 2.5.5 — the checkbox itself can't reliably grow past 1.25rem
   (browser-controlled native rendering), so the LABEL wrapping it
   is the actual hit target. Inline style on the label sets layout;
   this class adds the WCAG-conformant minimum size. Applied via
   render/steps.js. */
.step-check-label {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .35rem .4rem;
  border-radius: var(--c-radius);
}
.step-check-label:hover { background: var(--c-surface-2); }

/* ---------- Generic warning banner ---------- */
.generic-warning {
  background: #eff6ff;
  border: 2px solid #2563eb;
  border-radius: var(--c-radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: #1e40af;
  margin-bottom: 1rem;
}
[data-theme="dark"] .generic-warning { background: #102a1c; border-color: #60a5fa; color: #93c5fd; }

/* ---------- Panel sections ---------- */
.panel-section { margin-bottom: 1.5rem; }
.panel-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .65rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--c-border);
}
.help-resource {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: .75rem 1rem;
  margin-bottom: .5rem;
}
.help-resource-name { font-weight: 700; font-size: .9375rem; display: block; margin-bottom: .2rem; }
.help-resource-desc { font-size: .875rem; color: var(--c-text-muted); margin-bottom: .35rem; }
.help-resource-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.cost-badge {
  font-size: .75rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 100px;
  background: var(--c-success-bg);
  color: var(--c-success);
  white-space: nowrap;
}
.cost-badge.low-cost { background: #fef9c3; color: #713f12; }
[data-theme="dark"] .cost-badge.low-cost { background: #2d1a00; color: #fde68a; }

.mistake-item {
  background: var(--c-surface);
  border-left: 3px solid var(--c-warn-bdr);
  padding: .65rem .85rem;
  margin-bottom: .5rem;
  border-radius: 0 var(--c-radius) var(--c-radius) 0;
  font-size: .9rem;
}
.mistake-text { font-weight: 600; margin-bottom: .2rem; }
.mistake-fix { font-size: .8125rem; color: var(--c-text-muted); margin-bottom: .2rem; }

/* ==========================================================================
   Favorites
   ========================================================================== */
.fav-list { display: flex; flex-direction: column; gap: .5rem; }
.fav-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  /* Favorites/history rows are rendered as <button> elements. A button does
     NOT inherit text color by default — it falls back to the UA "buttontext"
     (black), which passes on the light surface but fails on the dark page
     (black on #0e1117 = 1.11:1). Force inheritance so the row text tracks the
     themed --c-text in both modes. */
  color: inherit;
}
.fav-card-body { flex: 1; min-width: 0; color: inherit; }
.fav-court-name { font-weight: 700; font-size: .9375rem; }
.fav-action-name { font-size: .8125rem; color: var(--c-text-muted); margin-top: .1rem; }
.fav-date { font-size: .75rem; color: var(--c-text-muted); margin-top: .2rem; }

/* ==========================================================================
   Home screen extras
   ========================================================================== */
.home-section { margin-top: 2rem; }
.home-section-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--c-text-muted);
  margin-bottom: .65rem;
}

/* ==========================================================================
   Modals
   ========================================================================== */
/* Native <dialog>. Opened with showModal(), it lives in the browser's top
   layer — above the fixed bottom-nav with no z-index juggling — and brings
   focus trapping, Esc-to-close, and inert background for free (replacing the
   old .modal-backdrop div + custom JS focus trap). The inner .modal-card
   carries the visible surface; the dialog uses the same opaque surface (not
   transparent) so an a11y scanner can resolve the background of text inside a
   top-layer <dialog> reliably. The dimmed overlay is the ::backdrop. */
dialog.modal {
  border: none;
  padding: 0;
  background: var(--c-surface);
  color: inherit;
  margin: auto;                       /* center in the viewport */
  max-width: calc(100vw - 2rem);      /* gutter on small screens */
  max-height: calc(100dvh - 2rem);
  border-radius: var(--c-radius-lg);  /* match .modal-card; dialog hugs it */
  overflow: visible;
}
dialog.modal::backdrop { background: rgba(0,0,0,.55); }
/* Subtle entrance, only when the user hasn't asked to reduce motion. The
   in-app data-motion="reduced" override is also honored via the global
   animation-duration clamp near the top of this file. The dialog animates
   ONLY transform — never opacity: a fading dialog is partly transparent
   mid-animation, and an a11y scanner that samples then composites the text
   lighter and reports false color-contrast failures. The fade lives on the
   ::backdrop, behind the opaque card, where it can't affect text contrast. */
@media (prefers-reduced-motion: no-preference) {
  dialog.modal[open]           { animation: modal-pop .16s ease-out; }
  dialog.modal[open]::backdrop { animation: modal-fade .16s ease-out; }
}
@keyframes modal-pop  { from { transform: translateY(8px); } to { transform: none; } }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--c-surface);
  border-radius: var(--c-radius-lg);
  padding: 1.75rem;
  max-width: 34rem;
  width: 100%;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card--wide { max-width: 44rem; }
.modal-title { font-size: 1.3rem; margin-bottom: .25rem; }
.modal-subtitle {
  margin: 0 0 .85rem;
  font-size: .85rem;
  color: var(--c-text-muted);
  line-height: 1.4;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.modal-header h2 { font-size: 1.15rem; margin-bottom: 0; }
.modal-close {
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  cursor: pointer;
  font-size: 1rem;
  color: var(--c-text-muted);
  padding: .2rem .5rem;
  flex-shrink: 0;
  min-width: 2rem;
  min-height: 2rem;
}
.modal-close:hover { background: var(--c-surface-2); }
.modal-actions { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* ==========================================================================
   Shortcuts modal
   ========================================================================== */
.shortcut-list { list-style: none; }
.shortcut-row { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--c-border); }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row dt { flex-shrink: 0; }
kbd {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: .1rem .4rem;
  font-family: monospace;
  font-size: .875rem;
  color: var(--c-text);
}

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-section { margin-bottom: 1.5rem; border-bottom: 1px solid var(--c-border); padding-bottom: 1.25rem; }
.settings-section:last-child { border-bottom: none; }
/* Now an <h2> (was <p>) for real document structure a screen reader can
   navigate by heading. margin-top pinned so the swap changes nothing
   visually — browsers give h2/p different default top margins. */
.settings-section-title { font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-muted); margin-top: 0; margin-bottom: .85rem; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.settings-label { font-size: .9375rem; font-weight: 600; }
.settings-desc { font-size: .8125rem; color: var(--c-text-muted); margin-top: .15rem; }
.btn-group { display: flex; gap: .3rem; flex-wrap: wrap; }
.btn-group .btn { min-height: 44px; }
.btn-group .btn.active { background: var(--c-primary-bg); color: #fff; border-color: var(--c-primary-bg); }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-host {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}
.toast {
  background: var(--c-text);
  color: var(--c-bg);
  padding: .65rem 1rem;
  border-radius: var(--c-radius);
  font-size: .9rem;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .65rem;
  max-width: 24rem;
}
.toast-success { background: var(--c-success); color: #fff; }
.toast-warn    { background: #b45309; color: #fff; }
.toast-error   { background: var(--c-danger-fill); color: #fff; }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--c-text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; color: var(--c-text); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--c-primary-bg);
  color: rgba(255,255,255,.85);
  padding: 1.25rem 1rem;
  margin-top: auto;
}
.footer-disclaimer {
  max-width: 56rem;
  margin: 0 auto .5rem;
  font-size: .875rem;
  line-height: 1.5;
  font-style: italic;
}
.footer-links {
  max-width: 56rem;
  margin: 0 auto;
  font-size: .8125rem;
}
.footer-links a { color: rgba(255,255,255,.85); }
.footer-links a:hover { color: #fff; }
.footer-langs {
  max-width: 56rem;
  margin: .75rem auto 0;
  padding-top: .75rem;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: .8125rem;
  line-height: 1.55;
  color: rgba(255,255,255,.85);
}
.footer-langs a { color: rgba(255,255,255,.95); text-decoration: underline; }
.footer-langs span { white-space: nowrap; }

.footer-unofficial {
  max-width: 56rem;
  margin: 0 auto .5rem;
  font-size: .8125rem;
  line-height: 1.5;
  color: rgba(255,255,255,.85);
}
.footer-unofficial strong { color: #fff; font-weight: 700; }
.footer-identity {
  max-width: 56rem;
  margin: .75rem auto 0;
  padding-top: .75rem;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: .8125rem;
  line-height: 1.55;
  color: rgba(255,255,255,.85);
}
.footer-identity a { color: rgba(255,255,255,.95); text-decoration: underline; }
.footer-identity a:hover { color: #fff; }

.lang-signpost {
  margin: .85rem 0;
  padding: .65rem .85rem;
  border-left: 3px solid var(--c-primary, #2e6388);
  background: rgba(26, 58, 107, .05);
  font-size: .875rem;
  line-height: 1.55;
}
.lang-signpost span { white-space: nowrap; }

/* ==========================================================================
   External link indicator
   ========================================================================== */
a[target="_blank"]::after {
  content: " ↗";
  font-size: .75em;
  vertical-align: super;
}
a[target="_blank"].no-ext-icon::after { content: ''; }

/* ==========================================================================
   Save-to-favorites button
   ========================================================================== */
.btn-save-fav { display: flex; align-items: center; gap: .4rem; }
.btn-save-fav[aria-pressed="true"] { background: #fef9c3; color: #713f12; border-color: #b45309; }
[data-theme="dark"] .btn-save-fav[aria-pressed="true"] { background: #2d1a00; color: #fde68a; border-color: #f59e0b; }

/* ==========================================================================
   Page header
   ========================================================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin: 0; }

/* ==========================================================================
   Alert
   ========================================================================== */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--c-radius);
  font-size: .9rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.alert-info { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
[data-theme="dark"] .alert-info { background: #102a1c; border-color: #60a5fa; color: #93c5fd; }

/* ==========================================================================
   Recoverable error panel (route error boundary + boot-failure fallback)
   ========================================================================== */
.route-error {
  max-width: 38rem;
  margin: 2.5rem auto;
  padding: 1.5rem 1.5rem 1.75rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid #d97706;
  border-radius: var(--c-radius);
  box-shadow: var(--c-shadow, 0 1px 3px rgba(0,0,0,.08));
}
.route-error-title { font-size: 1.15rem; margin-bottom: .65rem; }
.route-error-body  { color: var(--c-text-muted); line-height: 1.55; margin-bottom: 1rem; }
.route-error-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  color: var(--c-text-muted);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: .55rem .7rem;
  margin-bottom: 1.1rem;
  overflow-wrap: anywhere;
}
.route-error-actions { display: flex; gap: .65rem; flex-wrap: wrap; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 480px) {
  .view-container { padding: 1rem .75rem; }
  .modal-card { padding: 1.25rem; }
  h1 { font-size: 1.25rem; }
  .step-item { gap: .6rem; }
}
@media (min-width: 640px) {
  .search-row { flex-wrap: nowrap; }
}

/* ==========================================================================
   Quick-filter chips (court picker)
   ========================================================================== */
.quick-chips {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.quick-chips-label {
  font-size: .8125rem;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.quick-chip {
  padding: .35rem .85rem;
  border: 1.5px solid var(--c-border);
  border-radius: 100px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans), color var(--trans);
  /* WCAG 2.5.5 — ≥44×44 hit area (was 30px min-height). */
  min-height: 2.75rem;
  min-width: 2.75rem;
  display: inline-flex;
  align-items: center;
}
.quick-chip[hidden] { display: none; }
.quick-chip:hover { border-color: var(--c-primary); background: var(--c-primary-lt); color: var(--c-primary); }
.quick-chip.active,
.quick-chip[aria-pressed="true"] { background: var(--c-primary-bg); border-color: var(--c-primary-bg); color: #fff; }
.quick-chip-clear { border-style: dashed; color: var(--c-text-muted); }
.quick-chip-clear:hover { background: var(--c-danger-bg); border-color: var(--c-danger); color: var(--c-danger); }

/* ==========================================================================
   Progress bar (steps screen)
   ========================================================================== */
.progress-wrap { margin-bottom: 1rem; }
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8125rem;
  color: var(--c-text-muted);
  margin-bottom: .3rem;
}
.progress-pct { font-weight: 700; color: var(--c-primary); }
.progress-track {
  height: 8px;
  background: var(--c-surface-2);
  border-radius: 100px;
  border: 1px solid var(--c-border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--c-success);
  border-radius: 100px;
  transition: width .35s ease;
}

/* ==========================================================================
   Steps toolbar (hide-completed toggle, etc.)
   ========================================================================== */
.steps-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8125rem;
  color: var(--c-text-muted);
  cursor: pointer;
  user-select: none;
}
.toggle-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--c-primary);
  cursor: pointer;
}

/* ==========================================================================
   Step action row (copy + note buttons)
   ========================================================================== */
.step-actions-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .4rem;
  flex-wrap: wrap;
}
.step-meta-btn {
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  color: var(--c-text-muted);
  font-size: .75rem;
  padding: .35rem .65rem;
  cursor: pointer;
  /* WCAG 2.5.5 — ≥44×44 hit area (was 28px min-height). These buttons
     stack under each step (Note / Deadline / Copy) and are the main
     per-step interaction surface for touch. */
  min-height: 2.75rem;
  min-width: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.step-meta-btn:hover { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-primary); }
.btn-copy-step { font-size: .85rem; }

/* ==========================================================================
   Per-step note textarea
   ========================================================================== */
.step-note-wrap { margin-top: .5rem; }
.step-note-area {
  width: 100%;
  padding: .5rem .65rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius);
  font-size: .875rem;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  resize: vertical;
  line-height: 1.5;
  transition: border-color var(--trans);
}
.step-note-area:focus-visible { border-color: var(--c-focus); outline: 3px solid var(--c-focus); outline-offset: 1px; }
.step-note-area::placeholder { color: var(--c-text-muted); opacity: .8; }
[data-theme="dark"] .step-note-area { background: var(--c-surface-2); }

/* Print: hide interactive elements that don't make sense on paper */
@media print {
  .steps-toolbar, .step-actions-row, .btn-save-fav,
  .toast-host, .top-bar, .site-footer { display: none !important; }
  .step-note-wrap { display: block !important; }
  .step-note-area { border: 1px solid #ccc; resize: none; }
  .wizard-nav, .step-deadline-wrap { display: none !important; }
}

/* ==========================================================================
   Overdue badge on the ★ Favorites nav button
   ========================================================================== */
.nav-btn { position: relative; }
.overdue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 .28rem;
  background: #c0392b;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 100px;
  margin-left: .3rem;
  line-height: 1;
}
/* Without this, `display: inline-flex` above defeats the user-agent
   `[hidden] { display: none }` rule and the badge shows its literal
   "0" text content even when JS sets badge.hidden = true. Same shape
   as the .modal-backdrop[hidden] fix in PR #5. */
.overdue-badge[hidden] { display: none; }

/* ==========================================================================
   Service-worker "update available" banner
   ========================================================================== */
.sw-update-banner {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: .75rem;
  max-width: calc(100vw - 2rem);
  padding: .65rem .65rem .65rem 1rem;
  background: var(--c-text, #1a2233);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  font-size: .9rem;
}
.sw-update-banner-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-update-banner-dismiss {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  /* WCAG 2.5.5 — ≥44×44 hit area, matching the other dismiss buttons. */
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
}
.sw-update-banner-dismiss:hover { color: #fff; background: rgba(255,255,255,.12); }

/* ---------- PWA install nudge ----------
   Background uses --c-primary-bg, the same audited-contrast fill as
   .btn-primary/.top-bar (white text ~7.4:1 in both themes), so this new
   banner inherits verified AA contrast instead of a fresh unaudited color. */
.pwa-install-banner {
  position: fixed;
  bottom: 1rem;
  left: .5rem;
  right: .5rem;
  z-index: 1200;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: .5rem .65rem;
  align-items: center;
  background: var(--c-primary-bg);
  color: #fff;
  padding: .65rem .85rem;
  border-radius: .4rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  font-size: .9rem;
  line-height: 1.4;
  max-width: 480px;
  margin: 0 auto;
}
.pwa-install-icon { font-size: 1.4rem; align-self: start; padding-top: .1rem; }
.pwa-install-text strong { display: block; }
.pwa-install-banner .btn-primary {
  background: #fff;
  color: var(--c-primary-bg);
  border-color: #fff;
  font-weight: 700;
}
.pwa-install-banner .btn-primary:hover { background: #dbeafe; }
.pwa-install-dismiss {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: .8;
  border-radius: 50%;
  /* WCAG 2.5.5 — >=44x44 hit area, matching the other dismiss buttons. */
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pwa-install-dismiss:hover { opacity: 1; background: rgba(255,255,255,.15); }
.pwa-install-dismiss:focus-visible { outline: 2px solid #fff; outline-offset: 2px; opacity: 1; }

/* ==========================================================================
   Deadline badge on a step item
   ========================================================================== */
.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 100px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  margin-bottom: .35rem;
}
.deadline-badge--overdue {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border-color: var(--c-danger);
}
.deadline-badge--soon {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border-color: var(--c-warn-bdr);
}

/* Step row tinting for overdue / upcoming */
.step-item.deadline-overdue  { border-left: 3px solid var(--c-danger); }
.step-item.deadline-upcoming { border-left: 3px solid var(--c-warn-bdr); }

/* Persistent "strict deadline" marker. Shown ALWAYS on jurisdictional /
   most-missed steps, independent of the days-left color (which shows calm
   green when a deadline is weeks out). Danger palette + icon + text, so it
   never depends on color alone. Contrast holds in both themes: the --c-danger
   text on the --c-danger-bg tint clears AA in light and dark. */
.step-strict-flag,
.deadline-strict-flag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: 700;
  border-radius: 100px;
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border: 1px solid var(--c-danger);
}
.step-strict-flag {
  font-size: .78rem;
  padding: .25rem .6rem;
  margin-bottom: .5rem;
  line-height: 1.35;
}
.deadline-strict-flag {
  font-size: .72rem;
  padding: .1rem .5rem;
  margin-top: .25rem;
  align-self: flex-start;
}

/* ==========================================================================
   Deadline summary banner (on steps screen)
   ========================================================================== */
.deadline-summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding: .6rem .85rem;
  border-radius: var(--c-radius);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  margin-bottom: .85rem;
  font-size: .85rem;
}
.deadline-summary--overdue {
  background: var(--c-danger-bg);
  border-color: var(--c-danger);
}
.deadline-overdue-pill {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border: 1px solid var(--c-danger);
  border-radius: 100px;
  padding: .1rem .55rem;
  font-size: .78rem;
  font-weight: 700;
}
.deadline-upcoming-pill {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border: 1px solid var(--c-warn-bdr);
  border-radius: 100px;
  padding: .1rem .55rem;
  font-size: .78rem;
  font-weight: 700;
}
.deadline-today-pill {
  background: var(--c-primary-lt);
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
  border-radius: 100px;
  padding: .1rem .55rem;
  font-size: .78rem;
  font-weight: 700;
}

/* ==========================================================================
   Per-step deadline date picker
   ========================================================================== */
.step-deadline-wrap {
  margin-top: .5rem;
  padding: .6rem .75rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-surface-2);
}
.step-deadline-inner {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.step-deadline-label {
  font-size: .8125rem;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.step-deadline-input {
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: .28rem .55rem;
  font-size: .875rem;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color var(--trans);
}
.step-deadline-input:focus-visible {
  border-color: var(--c-focus);
  outline: 3px solid var(--c-focus);
  outline-offset: 1px;
}
[data-theme="dark"] .step-deadline-input { background: var(--c-surface); color: var(--c-text); }
.step-deadline-note {
  margin-top: .35rem;
  font-size: .75rem;
  color: var(--c-text-muted);
  font-style: italic;
}

/* ==========================================================================
   Wizard mode
   ========================================================================== */
.wizard-nav[hidden] { display: none; }
.wizard-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
  padding: .65rem;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
}
.wizard-pos {
  font-size: .9rem;
  font-weight: 600;
  color: var(--c-text);
  min-width: 8rem;
  text-align: center;
  aria-live: polite;
}

/* In wizard mode, hide non-current steps */
#steps-list.wizard-mode .step-item[data-wizard-hidden="true"] {
  display: none;
}

/* ==========================================================================
   Home screen — favorite card progress
   ========================================================================== */
.fav-progress-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .4rem;
}
.fav-progress-track {
  flex: 1;
  height: 4px;
  background: var(--c-surface-2);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--c-border);
}
.fav-progress-fill {
  height: 100%;
  background: var(--c-primary);
  border-radius: 100px;
  transition: width .3s ease;
}
.fav-progress-pct {
  font-size: .7rem;
  color: var(--c-text-muted);
  min-width: 2.5rem;
  text-align: right;
  flex-shrink: 0;
}

/* ==========================================================================
   Home screen — upcoming deadlines panel
   ========================================================================== */
.deadline-home-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.deadline-home-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .85rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  text-decoration: none;
  color: inherit;
  transition: background var(--trans), border-color var(--trans);
  flex-wrap: wrap;
}
.deadline-home-row:hover { background: var(--c-surface-2); border-color: var(--c-primary); }
.deadline-home-row:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.deadline-home-meta {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.deadline-home-court {
  font-size: .75rem;
  font-weight: 700;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.deadline-home-action {
  font-size: .875rem;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deadline-home-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .2rem;
  flex-shrink: 0;
}
.deadline-home-date {
  font-size: .8rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

/* ==========================================================================
   Glossary modal
   ========================================================================== */
.glossary-search-wrap {
  margin-bottom: .85rem;
}
.glossary-search {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius);
  font-size: .9375rem;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color var(--trans);
}
.glossary-search:focus-visible {
  border-color: var(--c-focus);
  outline: 3px solid var(--c-focus);
  outline-offset: 1px;
}
[data-theme="dark"] .glossary-search { background: var(--c-surface-2); }

.glossary-list {
  max-height: 55vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
/* The entries live in a real <dl> (so <dt>/<dd> satisfy WCAG/axe dlitem);
   it carries the column layout the container used to apply to them directly. */
.glossary-dl {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.glossary-entry {
  padding: .75rem 0;
  border-bottom: 1px solid var(--c-border);
}
.glossary-entry:last-child { border-bottom: none; }
.glossary-term {
  font-weight: 700;
  font-size: .9375rem;
  color: var(--c-text);
  margin-bottom: .3rem;
}
.glossary-def {
  font-size: .875rem;
  color: var(--c-text-muted);
  line-height: 1.55;
}
.glossary-source {
  display: inline-block;
  margin-top: .3rem;
  font-size: .78rem;
  color: var(--c-secondary);
  text-decoration: none;
}
.glossary-source:hover { text-decoration: underline; }
.glossary-source:focus-visible { outline: 2px solid var(--c-focus); border-radius: 2px; }
.glossary-empty {
  padding: 1rem 0;
  color: var(--c-text-muted);
  font-size: .9rem;
}
.glossary-loading {
  padding: 1rem 0;
  color: var(--c-text-muted);
  font-size: .9rem;
}


/* ==========================================================================
   Deadlines view
   ========================================================================== */
.deadlines-group {
  margin-bottom: 1.75rem;
}
.deadlines-group-title {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
  margin: 0 0 .6rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--c-border);
}
.deadlines-group-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.deadline-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 1rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
}
.deadline-row:hover,
.deadline-row:focus-visible {
  border-color: var(--c-focus);
  background: var(--c-surface-2);
  outline: none;
}
.deadline-row:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
.deadline-row--overdue {
  border-color: var(--c-danger);
  background: color-mix(in srgb, var(--c-danger) 5%, var(--c-surface));
}
.deadline-row--overdue:hover,
.deadline-row--overdue:focus-visible {
  border-color: var(--c-danger);
  background: color-mix(in srgb, var(--c-danger) 10%, var(--c-surface));
}
.deadline-row-date {
  flex-shrink: 0;
  min-width: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
}
.deadline-row-datenum {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.1;
}
.deadline-row-daylabel {
  font-size: .7rem;
  color: var(--c-text-muted);
  text-align: center;
  line-height: 1.2;
}
.deadline-row-daylabel--overdue {
  color: var(--c-danger);
  font-weight: 600;
}
.deadline-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.deadline-row-court {
  font-size: .75rem;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deadline-row-action {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deadline-row-step {
  font-size: .8rem;
  color: var(--c-text-muted);
}
.deadline-row-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.deadline-row-arrow {
  font-size: 1.1rem;
  color: var(--c-text-muted);
}

/* Toolbar separator between toggles and action buttons */
.toolbar-sep {
  width: 1px;
  height: 1.4rem;
  background: var(--c-border);
  margin: 0 .1rem;
  flex-shrink: 0;
}

/* ==========================================================================
   Completion banner — shown when all steps are done
   ========================================================================== */
.completion-banner {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: var(--c-success-bg);
  color: var(--c-success);
  border: 1.5px solid var(--c-success);
  border-radius: var(--radius-lg, 8px);
  padding: .85rem 1rem;
  margin: .75rem 0;
  font-size: .9375rem;
  animation: slide-in .25s ease;
}
[data-motion="reduced"] .completion-banner { animation: none; }

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

.completion-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: .1rem; }
.completion-body { flex: 1; }
.completion-body strong { display: block; margin-bottom: .2rem; }
.completion-body p { font-size: .875rem; margin: 0; opacity: .9; }
.completion-close { margin-left: auto; flex-shrink: 0; align-self: flex-start; }

/* ==========================================================================
   Steps header actions row
   ========================================================================== */
.steps-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

/* ==========================================================================
   About page
   ========================================================================== */
.about-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg, 8px);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.about-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: .65rem;
}
.about-section p { font-size: .9375rem; line-height: 1.65; color: var(--c-text); }
.about-version { font-size: .8125rem; color: var(--c-text-muted); margin-bottom: .6rem; }

.about-legal-box {
  background: var(--c-warn-bg);
  border: 1px solid var(--c-warn-bdr);
  border-radius: 6px;
  padding: .85rem 1rem;
  font-size: .9rem;
  color: var(--c-warn-text);
  line-height: 1.6;
}
.about-legal-box p { margin-bottom: .5rem; color: var(--c-warn-text); }
.about-legal-box p:last-child { margin-bottom: 0; }

.about-list {
  padding-left: 1.25rem;
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--c-text);
}
.about-list a { color: var(--c-secondary); }

.about-stats-row {
  display: flex;
  gap: 1.5rem;
  margin-top: .65rem;
}
.about-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: .65rem 1.25rem;
  min-width: 5rem;
}
.about-stat-num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1;
}
.about-stat-lbl {
  font-size: .75rem;
  color: var(--c-text-muted);
  margin-top: .25rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ==========================================================================
   Utility classes (extracted from former inline style="" attributes)
   --------------------------------------------------------------------------
   These exist so the production CSP can drop 'unsafe-inline' from style-src.
   Every rule here reproduces exactly one inline style declaration that used
   to live in index.html / app.js / render/*.js. Single-property, reusable,
   and intentionally last in the file so they win ties with component rules
   (equal 0,1,0 specificity, later source order) — exactly as the inline
   styles they replace did. Naming: u-<prop>-<value*100 in rem> (em/px noted).
   ========================================================================== */

/* display / flexbox */
.u-flex          { display: flex; }
.u-inline-flex   { display: inline-flex; }
.u-flex-col      { flex-direction: column; }
.u-items-center  { align-items: center; }
.u-wrap          { flex-wrap: wrap; }
.u-flex-1        { flex: 1; }
.u-flex-shrink-0 { flex-shrink: 0; }
.u-hidden        { display: none; }

/* gap */
.u-gap-20 { gap: .2rem; }
.u-gap-50 { gap: .5rem; }
.u-gap-65 { gap: .65rem; }
.u-gap-75 { gap: .75rem; }

/* margin-top */
.u-mt-20  { margin-top: .2rem; }
.u-mt-50  { margin-top: .5rem; }
.u-mt-75  { margin-top: .75rem; }
.u-mt-100 { margin-top: 1rem; }
.u-mt-125 { margin-top: 1.25rem; }
.u-mt-150 { margin-top: 1.5rem; }

/* margin-bottom */
.u-mb-40  { margin-bottom: .4rem; }
.u-mb-50  { margin-bottom: .5rem; }
.u-mb-65  { margin-bottom: .65rem; }
.u-mb-75  { margin-bottom: .75rem; }
.u-mb-100 { margin-bottom: 1rem; }
.u-mb-125 { margin-bottom: 1.25rem; }
.u-mb-200 { margin-bottom: 2rem; }

/* margin (other edges) */
.u-ml-50 { margin-left: .5rem; }
.u-my-85 { margin-top: .85rem; margin-bottom: .85rem; }

/* padding */
.u-p-0      { padding: 0; }
.u-p-20-50  { padding: .2rem .5rem; }
.u-p-75-100 { padding: .75rem 1rem; }
.u-pt-125   { padding-top: 1.25rem; }

/* font-size */
.u-fs-70    { font-size: .7rem; }
.u-fs-75    { font-size: .75rem; }
.u-fs-80    { font-size: .8rem; }
.u-fs-08em  { font-size: .8em; }
.u-fs-8125  { font-size: .8125rem; }
.u-fs-85    { font-size: .85rem; }
.u-fs-875   { font-size: .875rem; }
.u-fs-90    { font-size: .9rem; }
.u-fs-9375  { font-size: .9375rem; }
.u-fs-100   { font-size: 1rem; }
.u-fs-105em { font-size: 1.05em; }
.u-fs-110   { font-size: 1.1rem; }

/* font-weight / style */
.u-fw-600 { font-weight: 600; }
.u-fw-700 { font-weight: 700; }
.u-italic { font-style: italic; }

/* line-height */
.u-lh-155 { line-height: 1.55; }
.u-lh-160 { line-height: 1.6; }

/* color */
.u-muted  { color: var(--c-text-muted); }
.u-danger { color: var(--c-danger); }

/* text */
.u-ta-left    { text-align: left; }
.u-td-none    { text-decoration: none; }
.u-uppercase  { text-transform: uppercase; }
.u-ls-03      { letter-spacing: .03em; }
.u-list-none  { list-style: none; }

/* cursor */
.u-cursor-pointer { cursor: pointer; }

/* background / border / radius */
.u-bg-none   { background: none; }
.u-bd-none   { border: none; }
.u-bd-border { border: 1px solid var(--c-border); }
.u-bt-border { border-top: 1px solid var(--c-border); }
.u-radius-lg { border-radius: var(--c-radius-lg); }

/* sizing */
.u-w-full  { width: 100%; }
.u-maxw-28 { max-width: 28rem; }

/* --------------------------------------------------------------------------
   Reading measure
   --------------------------------------------------------------------------
   Cap long-form prose to a comfortable line length so it doesn't stretch the
   full 56rem content column on wide screens. The measure is font-relative
   (~68 characters) and hard-capped at 47.5rem (~760px) so a wide user font
   (Atkinson / Lexend) can't blow past it. Applied ONLY to flowing prose —
   the step-walkthrough text (.step-text, via the reading-measure class) and
   the About / reference pages — never to the triage cards, the header,
   tables, or grid layouts, which need the full width. Kept together so the
   measure lives in exactly one place. */
.reading-measure,
.about-section p,
.about-list,
.about-legal-box {
  max-width: min(68ch, 47.5rem);
}
.reading-measure { line-height: 1.55; }

/* noscript notice — hardcoded colors are intentional: it renders before any
   theme JS runs and must stay legible with CSS variables unavailable. */
.noscript-note {
  margin: 1rem;
  padding: 1rem;
  border-left: 4px solid #b91c1c;
  background: #fef2f2;
  color: #1c2b3a;
}

/* Companion-app banner. Moved here from an inline <style> block in
   index.html: the production CSP is style-src 'self' with no
   'unsafe-inline', which refuses inline <style> elements just as it
   refuses inline style="" attributes. */
.migration-banner {
  margin: 0;
  padding: .5rem 1rem;
  background: #2e6388;
  color: #fff;
  font-size: .8125rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.15);
  line-height: 1.4;
}
.migration-banner a {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}
.migration-banner strong { font-weight: 700; }
.migration-banner .sub {
  display: block;
  font-size: .8rem;
  opacity: .85;
  margin-top: .15rem;
}

/* Optional-passphrase fields for encrypted export/import (Settings → Your data). */
.backup-field {
  display: block;
  margin: .6rem 0 .25rem;
}
.backup-field-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  margin-bottom: .25rem;
}
.backup-passphrase {
  width: 100%;
  max-width: 24rem;
  padding: .5rem .65rem;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .9375rem;
}
.backup-field-hint {
  margin: .1rem 0 .5rem;
  max-width: 34rem;
  font-size: .8125rem;
  color: var(--c-text-muted);
}

/* ==========================================================================
   Calm mode  —  Settings → Calm mode → On  (data-calm="on" on <html>)
   --------------------------------------------------------------------------
   Softens the ANXIETY PRESENTATION of deadlines: the alarm-red "overdue"
   styling is recoloured to the calmer amber "warn" palette, and the
   all-steps-complete celebration is muted.

   LEGAL-SAFETY INVARIANT (do not break): calm mode changes tone/colour ONLY.
   It must NEVER hide, defer, or alter a deadline date, a countdown, an overdue
   count, or a "days left" / "days overdue" label — a missed answer or eviction
   deadline is catastrophic. Every rule below touches only colour / background
   / border / weight / animation. There is deliberately NO display:none, no
   visibility, no opacity, and no content change on any element that carries
   deadline information, so all dates and day-counts remain fully visible.
   ========================================================================== */
[data-calm="on"] .overdue-badge {
  background: var(--c-warn-fill);
  color: #fff;
}
[data-calm="on"] .deadline-badge--overdue,
[data-calm="on"] .deadline-overdue-pill,
[data-calm="on"] .deadline-summary--overdue {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border-color: var(--c-warn-bdr);
}
[data-calm="on"] .deadline-row-daylabel--overdue,
[data-calm="on"] .u-danger {
  color: var(--c-warn-text);
}
[data-calm="on"] .step-item.deadline-overdue {
  border-left-color: var(--c-warn-bdr);
}
[data-calm="on"] .deadline-row--overdue,
[data-calm="on"] .deadline-row--overdue:hover,
[data-calm="on"] .deadline-row--overdue:focus-visible {
  border-color: var(--c-warn-bdr);
  background: color-mix(in srgb, var(--c-warn-bdr) 6%, var(--c-surface));
}
[data-calm="on"] .disclaimer-banner--warn {
  border-color: var(--c-warn-bdr);
  box-shadow: none;
}
/* Mute the celebratory completion banner (score/pressure): drop the slide-in. */
[data-calm="on"] .completion-banner { animation: none; }

/* ==========================================================================
   Focus mode  —  Settings → Focus mode → On  (data-focus="on" on <html>)
   --------------------------------------------------------------------------
   Hides the top-bar/migration-banner/footer chrome so a reader can
   concentrate on one page without distraction. !important because this is
   a mode override that must win regardless of any other display logic.
   ========================================================================== */
[data-focus="on"] .top-bar,
[data-focus="on"] .migration-banner,
[data-focus="on"] .site-footer {
  display: none !important;
}
/* Clear the fixed exit-focus button so it never overlaps the first line
   of page content (the disclaimer banner sits flush at the top otherwise). */
[data-focus="on"] .view-container { padding-top: 3.25rem; }
.focus-mode-exit {
  display: none;
  position: fixed;
  top: .6rem;
  right: .6rem;
  z-index: 1200;
  gap: .35rem;
  align-items: center;
  padding: .5rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: .85rem;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  cursor: pointer;
  /* WCAG 2.5.5 — the sole way out of focus mode needs a generous target. */
  min-height: 44px;
}
[data-focus="on"] .focus-mode-exit { display: inline-flex; }
.focus-mode-exit:hover { background: var(--c-surface-2); }
.focus-mode-exit:focus-visible { outline: 2px solid var(--c-primary-bg); outline-offset: 2px; }

/* ==========================================================================
   Read-aloud "🔊 Listen" control
   ========================================================================== */
/* Subtle active highlight while the page is being read aloud. */
#btn-listen[aria-pressed="true"] { background: rgba(255,255,255,.28); }
/* Present-but-disabled state (no system voice available, e.g. headless). */
#btn-listen:disabled { opacity: .55; cursor: not-allowed; }

/* ==========================================================================
   Progress-bar clarity note (steps screen)
   ========================================================================== */
.progress-hint {
  margin-top: .4rem;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--c-text-muted);
}

/* ==========================================================================
   Collapsible reference sections (native <details>/<summary>)
   --------------------------------------------------------------------------
   Zero-JS, keyboard-accessible, CSP-safe. Used to break long supplementary
   panels (e.g. "Common mistakes") into scannable, tap-to-open pieces. Never
   wrap a time-critical deadline or required step in one of these — those stay
   visible.
   ========================================================================== */
.collapse {
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-surface);
  overflow: hidden;
}
.collapse > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1rem;
  min-height: 2.75rem;              /* WCAG 2.5.5 tap area */
  font-weight: 700;
  font-size: .95rem;
  color: var(--c-text);
}
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary::before {
  content: "▸";
  color: var(--c-primary);
  font-size: .8em;
  flex-shrink: 0;
}
.collapse[open] > summary::before { content: "▾"; }
.collapse > summary:hover { background: var(--c-surface-2); }
.collapse > summary:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: -3px;
}
.collapse-body { padding: 0 1rem 1rem; }

/* ==========================================================================
   Flow diagram (inline eviction-timeline SVG) + its links
   --------------------------------------------------------------------------
   Colours are bound to the app's --c-* theme variables so the diagram stays
   legible in light, dark, and high-contrast modes with no hardcoded fills and
   no inline style="". See render/steps.js evictionTimelineHtml().
   ========================================================================== */
.flow-diagram {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.15rem;
  margin: 0 0 1.25rem;
}
.flow-diagram-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
  margin-bottom: .75rem;
}
/* The eviction and debt-answer timelines share one visual grammar; both SVGs
   are styled by this grouped ruleset. See render/steps.js evictionTimelineHtml()
   and debtTimelineHtml(). */
.evict-timeline,
.debt-timeline {
  display: block;
  width: 100%;
  max-width: 22rem;
  height: auto;
  margin: 0;
  color: var(--c-text);
}
.evict-timeline text,
.debt-timeline text { font-family: inherit; }
.evict-timeline .tl-line,
.debt-timeline .tl-line   { stroke: var(--c-border); stroke-width: 2.5; }
.evict-timeline .tl-dot,
.debt-timeline .tl-dot    { fill: var(--c-primary); }
.evict-timeline .tl-num,
.debt-timeline .tl-num    { fill: var(--c-surface); font-size: 13.5px; font-weight: 700; }
.evict-timeline .tl-label,
.debt-timeline .tl-label  { fill: var(--c-text); font-size: 14px; font-weight: 700; }
/* Condition sub-label (e.g. the eviction step-5 "only if you appealed with a
   Statement of Inability, not a bond" qualifier, or the debt "by the END of the
   14th day after service" line) — smaller and muted so the box stays scannable
   while carrying the constraint the plain-text fallback + step text also state. */
.evict-timeline .tl-label--cond,
.debt-timeline .tl-label--cond { fill: var(--c-text-muted); font-size: 11px; font-weight: 600; }
.evict-timeline .tl-pill,
.debt-timeline .tl-pill   { fill: var(--c-primary-lt); }
.evict-timeline .tl-pill-text,
.debt-timeline .tl-pill-text { fill: var(--c-primary); font-size: 11.5px; font-weight: 600; }
/* Critical deadlines (the two eviction 5-day windows, the debt 14-day answer
   window) are flagged in warn colour. */
.evict-timeline .tl-pill--warn,
.debt-timeline .tl-pill--warn { fill: var(--c-warn-bg); stroke: var(--c-warn-bdr); stroke-width: 1; }
.evict-timeline .tl-pill-text--warn,
.debt-timeline .tl-pill-text--warn { fill: var(--c-warn-text); }

.flow-fallback { margin-top: .65rem; }
.flow-fallback-lead {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  margin-bottom: .35rem;
}
.flow-fallback-list {
  padding-left: 1.2rem;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--c-text);
}
.flow-fallback-list li { margin-bottom: .3rem; }

.flow-links {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-top: .85rem;
}
.flow-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.75rem;             /* WCAG 2.5.5 tap area */
  padding: .5rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-surface);
  color: var(--c-secondary);
  font-size: .875rem;
  text-decoration: none;
}
.flow-link:hover { background: var(--c-surface-2); border-color: var(--c-primary); }
.flow-link:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 1px; }

/* ==========================================================================
   About page — collapsible reference sections
   --------------------------------------------------------------------------
   Reuses the .about-section shell (so existing selectors/tests still match)
   but zeroes its padding and lets the <summary>/body pad instead.
   ========================================================================== */
.about-details { padding: 0; overflow: hidden; }
.about-details > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1rem 1.5rem;
  min-height: 2.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-primary);
}
.about-details > summary::-webkit-details-marker { display: none; }
.about-details > summary::before {
  content: "▸";
  font-size: .8em;
  flex-shrink: 0;
}
.about-details[open] > summary::before { content: "▾"; }
.about-details > summary:hover { background: var(--c-surface-2); }
.about-details > summary:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: -3px;
}
.about-details-body { padding: 0 1.5rem 1.25rem; }
