/**
 * Immigration Study Suite — Exam Clarity
 * Optimized: no blur/orbs, minimal motion, high contrast, fast paint
 */
:root {
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-ui: 'Source Sans 3', system-ui, -apple-system, sans-serif;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #1e3a8a;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --accent: #b45309;
  --accent-soft: #fffbeb;

  --blue: #1d4ed8;
  --purple: #6d28d9;
  --teal: #0f766e;
  --red: #b91c1c;
  --brown: #92400e;
  --green: #15803d;

  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --radius-lg: 16px;
  --t: 0.15s ease;
  --context-w: 420px;
  --page-max: min(100vw - 2rem, 1920px);
  --header-sticky-h: 0px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body.app-shell {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.app-header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 14px 20px 16px;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.brand-mark svg { width: 26px; height: 26px; }

.app-brand { flex: 1; min-width: 180px; }

.brand-eyebrow {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-brand h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-brand .tagline {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  max-width: 48ch;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.nav-link:hover { background: var(--primary-soft); }

.meta-pill {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.meta-pill.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #fcd34d;
}

.hypo-rail {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.hypo-rail-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}

.hypo-rail-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.hypo-rail-hint { font-size: 0.75rem; color: var(--muted); }

.hypo-bar-wrap {
  position: relative;
}

.hypo-bar-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 4px;
  width: 36px;
  background: linear-gradient(to left, var(--surface) 30%, transparent);
  pointer-events: none;
}

.hypo-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.hypo-bar .hypo-btn {
  scroll-snap-align: start;
}

.hypo-btn {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 12px;
  min-height: 36px;
  min-width: 7.5rem;
  max-width: 11rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  line-height: 1.25;
  transition: background var(--t), border-color var(--t), color var(--t);
}

.hypo-btn-kind {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hypo-btn-name {
  display: block;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
}

.hypo-btn.active .hypo-btn-name {
  color: inherit;
  opacity: 0.85;
}

.hypo-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

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

/* Page */
.page-body {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

.section-label--spaced { margin-top: 32px; }

/* Case block */
.case-analysis-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.case-analysis-head {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.4fr);
  gap: 20px 32px;
  align-items: end;
  padding: 18px 22px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.case-analysis-sub {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  max-width: 42ch;
}

.exam-progress-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.exam-progress-track {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.exam-progress-steps {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  gap: 6px;
  min-width: min(100%, 520px);
}

.exam-progress-steps li {
  flex: 1;
  position: relative;
  text-align: center;
  padding: 30px 2px 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--t), background var(--t);
}

.exam-progress-steps li::before {
  content: attr(data-step);
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 2px solid var(--border-strong);
  color: var(--muted);
}

.exam-progress-steps li:not(:last-child)::after { display: none; }

.step-name {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
}

.exam-progress-steps li.done {
  background: #f0fdf4;
  border-color: #86efac;
}

.exam-progress-steps li.done::before {
  background: #dcfce7;
  border-color: var(--green);
  color: var(--green);
}

.exam-progress-steps li.done .step-name { color: var(--green); }

.exam-progress-steps li.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.exam-progress-steps li.active::before {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.exam-progress-steps li.active .step-name {
  color: var(--primary);
  font-weight: 700;
}

.exam-progress-steps li[data-step="4"].active { background: #fef2f2; border-color: #fca5a5; }
.exam-progress-steps li[data-step="4"].active::before { background: var(--red); border-color: var(--red); color: #fff; }
.exam-progress-steps li[data-step="4"].active .step-name { color: var(--red); }
.exam-progress-steps li[data-step="5"].active { background: #fffbeb; border-color: #fcd34d; }
.exam-progress-steps li[data-step="5"].active::before { background: var(--brown); border-color: var(--brown); color: #fff; }
.exam-progress-steps li[data-step="6"].active { background: #f0fdf4; border-color: #86efac; }
.exam-progress-steps li[data-step="6"].active::before { background: var(--green); border-color: var(--green); color: #fff; }

/* (legacy analysis-row/splitter/toolbar for old split removed) */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.breadcrumb .crumb-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb .crumb-current { color: var(--text); font-weight: 700; }
.breadcrumb .sep { opacity: 0.35; }

.nav-controls { display: flex; gap: 8px; }

.nav-btn {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.nav-btn:hover:not(:disabled) { background: var(--surface-2); }

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

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

.kbd-hint { font-size: 0.6875rem; color: var(--muted); }

.kbd-hint kbd {
  font-size: 0.625rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Tree */
.tree-zone { min-height: 140px; }

.tree-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px 22px;
  border-left: 4px solid var(--blue);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tree-card.cat-citizenship { border-left-color: var(--blue); }
.tree-card.cat-niv { border-left-color: var(--purple); }
.tree-card.cat-iv { border-left-color: var(--teal); }
.tree-card.cat-inad { border-left-color: var(--red); }
.tree-card.cat-rem { border-left-color: var(--brown); }
.tree-card.cat-nat { border-left-color: var(--green); }
.tree-card.cat-terminal { border-left-color: var(--muted); }

#treeContainer.tree-enter {
  animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Clean: tighter 8–12px scale, less nesting depth on cards */
.app-shell--clean .tree-card {
  padding: 18px 20px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  border-radius: 10px;
}
.app-shell--clean .tree-question { margin-bottom: 10px; }
.app-shell--clean .tree-body { margin-bottom: 14px; line-height: 1.55; }
.app-shell--clean .choices { gap: 8px; }
.app-shell--clean .choices-label { margin-bottom: 8px; }
.app-shell--clean .step-badge { margin-bottom: 10px; padding: 3px 8px; }

.step-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.tree-question {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  color: var(--text);
}

.tree-body {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 18px;
}

.tree-body p { margin: 0 0 8px; }

.choices-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.choice-btn {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}

.choice-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

.choice-btn.yes { border-color: #86efac; background: #f0fdf4; }
.choice-btn.no { border-color: #fca5a5; background: #fef2f2; }
.choice-btn.branch { border-color: #93c5fd; background: #eff6ff; }

.choice-kbd {
  font-size: 0.625rem;
  font-weight: 700;
  opacity: 0.5;
  margin-right: 4px;
}

.choices.is-guided { position: relative; }
.choices.is-guided::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  pointer-events: none;
}

.choices.is-guided .choice-btn {
  pointer-events: none;
  opacity: 0.35;
}

.rule-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 0.8125rem;
  margin: 10px 0;
}

.hidden { display: none !important; }

.guided-notice {
  font-size: 0.8125rem;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid #fcd34d;
  border-radius: 8px;
  margin-bottom: 14px;
}

.hypo-walkthrough {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface-2);
}

.walk-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px 0;
  overflow: hidden;
}

.walk-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.walk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.hypo-walk-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.hypo-walk-btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* (legacy non-clean split layout styles removed — current uses --clean split + sticky context-panel) */

/* Category accent on context (applies to clean rules-panel too via shared class) */
.context-panel[class*="cat-ctx-"],
.rules-panel[class*="cat-ctx-"] {
  border-top: none;
}

.ctx-block {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.ctx-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 9px 12px;
  background: var(--surface-2);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
}

.ctx-block-head::after {
  content: '▾';
  font-size: 0.75rem;
  opacity: 0.55;
  transition: transform var(--t);
}

.ctx-block:not(.is-open) .ctx-block-head::after {
  transform: rotate(-90deg);
}

.ctx-block:not(.is-open) .ctx-block-body {
  display: none;
}

.ctx-block:not(.is-open) .ctx-block-head {
  border-bottom: none;
}

.ctx-block-body {
  padding: 10px 12px;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.ctx-block--cite .ctx-block-body { font-weight: 400; color: var(--text); }

.ctx-block--supplement { border-color: #c4b5fd; }
.ctx-block--supplement .ctx-block-head { background: #f5f3ff; color: var(--purple); }

.supplement-intro,
.ina-supplement-gap,
.ina-supplement-statute {
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 0 0 10px;
}

.supplement-gap-lead {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 8px;
}

.ina-supplement-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ina-supplement-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-left: 4px solid var(--purple);
}

.ina-supplement-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
}

.ina-supplement-card-head { margin-bottom: 8px; }

/* INA § 101 subsection definitions */
.def101-quote-group {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
}
.def101-quote-group-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
  margin: 0 0 0.75rem;
}
.source-quote--def101 {
  border-left-color: var(--accent-def, #7c3aed);
}
.ina-supplement-card--def101 {
  border-left: 3px solid var(--accent-def, #7c3aed);
}
.def101-statute-quote {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface-raised, #f8fafc);
  border-radius: 6px;
  border-left: 3px solid var(--accent-def, #7c3aed);
}
.def101-statute-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #64748b);
  margin: 0 0 0.35rem;
}
.def101-statute-text {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  line-height: 1.55;
  margin: 0;
}
.def101-related {
  font-size: 0.875rem;
  margin: 0 0 0.65rem;
  line-height: 1.5;
}
.ctx-block--def101 .ctx-block-head {
  color: var(--accent-def, #7c3aed);
}

.library-cite-plain,
.link-chip--plain {
  color: var(--text-muted, #64748b);
  font-size: 0.875rem;
}
.link-chip--plain {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border: 1px dashed var(--border-subtle, #cbd5e1);
  border-radius: 4px;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.supplement-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.supplement-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.supplement-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.supplement-term {
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--text);
}

.supplement-role {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}

.supplement-role--definition { background: #f0fdfa; color: var(--teal); }
.supplement-role--elements { background: var(--primary-soft); color: var(--primary); }
.supplement-role--procedure { background: #f5f3ff; color: var(--purple); }
.supplement-role--policy { background: var(--accent-soft); color: var(--brown); }
.supplement-role--bars { background: #fef2f2; color: var(--red); }

.supplement-cite {
  font-size: 0.75rem;
  margin-bottom: 6px;
}

.supplement-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text);
}

.source-quotes-body { display: flex; flex-direction: column; gap: 12px; }

.source-quote {
  margin: 0;
  padding: 10px 12px 10px 14px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
}

.source-quote--cfr {
  border-left-color: var(--teal);
  background: #f0fdfa;
}

.source-quote--cfr .source-quote-cite { color: var(--teal); }

.source-quote--fam {
  border-left-color: var(--brown);
  background: var(--accent-soft);
}

.source-quote--fam .source-quote-cite { color: var(--brown); }

.source-quote--pm {
  border-left-color: var(--purple);
  background: #f5f3ff;
}

.source-quote--pm .source-quote-cite { color: var(--purple); }

.agency-cite-link {
  color: var(--accent, #1e4d6b);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agency-cite-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.72em;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.source-quote-lii--muted {
  color: var(--muted);
  font-style: italic;
}

.agency-index-intro { font-size: 0.8125rem; margin: 0 0 10px; }
.agency-index-count { font-size: 0.75rem; margin: 0 0 12px; color: var(--muted); }
.agency-index-h4 { font-size: 0.75rem; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.agency-index-list { margin: 0 0 8px; padding-left: 1.2rem; font-size: 0.8125rem; }
.agency-index-muted { color: var(--muted); font-size: 0.85em; }

.dual-cite {
  display: block;
  line-height: 1.45;
}

.dual-cite-block .dual-cite {
  font-style: normal;
}

.dual-cite-ina .cornell-statute-link--ina {
  font-weight: 700;
  font-size: 1.02em;
}

.dual-cite-usc .cornell-statute-link--usc {
  font-weight: 500;
  font-size: 0.88em;
}

.dual-cite-sep {
  color: var(--ink-muted, #5c6570);
  font-weight: 400;
}

.dual-cite-desc {
  display: block;
  margin-top: 2px;
  font-size: 0.78em;
  font-weight: 400;
  color: var(--ink-muted, #5c6570);
}

.cornell-statute-link {
  color: var(--accent, #1e4d6b);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cornell-statute-link:hover {
  color: var(--accent-strong, #0f3a52);
}

.source-quote-lii {
  margin: 8px 0 0;
  font-size: 0.72rem;
}

.source-quote-lii a {
  font-weight: 600;
}

.source-quote-cite {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  font-style: normal;
  margin-bottom: 6px;
}

.source-quote-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  font-weight: 500;
  color: var(--text);
}

.citation-key {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-muted, #4a5568);
  background: var(--surface-elevated, #f7f5f0);
  border-left: 3px solid var(--accent, #1e4d6b);
  border-radius: 0 6px 6px 0;
}

.cite-parallel {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: normal;
  color: var(--ink-muted, #5c6570);
}

.source-quote-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.cite-fallback {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--blue);
  margin: 0;
}

.statute-quote {
  margin: 12px 0;
  padding: 10px 12px 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.statute-quote cite {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-style: normal;
  margin-bottom: 6px;
}

.routing-lead { font-weight: 700; margin-bottom: 6px; }

.routing-officer {
  font-size: 0.875rem;
  margin: 0 0 12px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}

.routing-table,
.agency-table,
.check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.routing-table th,
.routing-table td,
.agency-table th,
.agency-table td,
.check-table th,
.check-table td {
  border: 1px solid var(--border);
  padding: 7px 9px;
  text-align: left;
  vertical-align: top;
}

.routing-table th,
.check-table th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 0.6875rem;
}

.routing-note {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 6px;
}

.source-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin: 2px 4px 2px 0;
}

.source-tag--ina { background: var(--primary-soft); color: var(--blue); }
.source-tag--8cfr { background: #f0fdf4; color: var(--green); }
.source-tag--22cfr { background: var(--accent-soft); color: var(--accent); }
.source-tag--fam { background: #fef2f2; color: var(--red); }
.source-tag--pm { background: #f5f3ff; color: var(--purple); }

.context-link-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;
}

.link-chip {
  display: flex;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.link-chip:hover { background: var(--primary-soft); }

.link-chip::after { content: '→'; margin-left: auto; opacity: 0.4; }

/* Lower sections */
.exam-checklist,
.resources-panel,
.library-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.resources-panel,
.library-panel { margin-top: 24px; }

.library-panel.is-loading {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.exam-checklist h2,
.resources-panel h2,
.library-panel h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
}

.red-flags {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fef2f2;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  font-size: 0.8125rem;
}

.suite-links { font-size: 0.8125rem; margin-bottom: 12px; }
.suite-links a { color: var(--blue); font-weight: 600; margin-right: 12px; }

.anchor-box {
  font-size: 0.8125rem;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  margin-bottom: 12px;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 14px;
  font-size: 0.75rem;
}

.outline-section {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.outline-toggle {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  background: var(--surface-2);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.outline-toggle:hover { background: var(--border); }

.outline-toggle .chev { font-size: 0.625rem; opacity: 0.5; transition: transform var(--t); }
.outline-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

.outline-body {
  display: none;
  padding: 10px 14px 14px;
  font-size: 0.8125rem;
  border-top: 1px solid var(--border);
}

.outline-body.open { display: block; }

.outline-body a { color: var(--blue); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.library-footer-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sidebar-note {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.app-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Accessibility */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hypo-btn:focus-visible,
.nav-btn:focus-visible,
.nav-link:focus-visible,
.choice-btn:focus-visible,
.outline-toggle:focus-visible,
.ctx-block-head:focus-visible,
.link-chip:focus-visible,
.crumb-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 4px;
}

.table-scroll:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}

.check-table tbody tr:nth-child(even) {
  background: var(--surface-2);
}

.check-table td:first-child {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.library-loading {
  margin: 12px 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.case-analysis-block {
  scroll-margin-top: 12px;
}

#treeContainer {
  scroll-margin-top: 80px;
}

@media (min-width: 901px) {
  .case-analysis-head {
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 0 var(--border);
  }

  .app-header {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  }
}

@media (max-width: 900px) {
  .case-analysis-head {
    grid-template-columns: 1fr;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 0 var(--border);
  }

  .context-panel {
    position: static;
    width: 100% !important;
    max-width: none;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  }

  .page-body { padding: 16px; }

  .brand-row { gap: 10px; }
  .app-brand h1 { font-size: 1.2rem; }
  .hypo-rail-hint { display: none; }

  .exam-progress-steps li {
    min-width: 72px;
    flex: 0 0 auto;
  }
}

@media (max-width: 540px) {
  .choices { grid-template-columns: 1fr; }
  .library-grid { grid-template-columns: 1fr; }
  .tree-question { font-size: 1.1rem; }
  .glossary-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #treeContainer.tree-enter {
    animation: none;
  }

  .exam-progress-steps li,
  .choice-btn,
  .hypo-btn {
    transition: none;
  }
}

@media print {
  .app-header, .hypo-rail, .context-panel, .nav-controls, .app-footer { display: none !important; }
  body { background: #fff; }
}

/* —— Clean decision tree: fluid desktop width (no narrow mobile column on large screens) —— */
.app-shell--clean {
  /* Exam Clarity light — use web fonts now loaded in HTML */
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-ui: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --layout-gutter: clamp(16px, 2vw, 48px);
  --layout-max: calc(100vw - 2 * var(--layout-gutter));
  --page-max: var(--layout-max);
  --context-w: 380px;
  --header-sticky-h: 3.75rem;
}

.app-shell--clean.app-shell {
  width: 100%;
}

.app-shell--clean .app-header--compact {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-shell--clean .app-header-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 10px var(--layout-gutter) 8px;
  display: flex;
  align-items: baseline;
  gap: 8px 16px;
  box-sizing: border-box;
}

.app-shell--clean .header-main h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--primary);
}

.app-shell--clean .header-sub {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.app-shell--clean .hypo-rail {
  margin: 0 0 12px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.app-shell--clean .hypo-rail-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.app-shell--clean .hypo-bar-wrap::after {
  background: linear-gradient(to left, var(--surface-2) 30%, transparent);
}

.app-shell--clean .hypo-btn--clear {
  border-style: dashed;
}

.app-shell--clean .page-main {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 20px var(--layout-gutter) 40px;
  box-sizing: border-box;
}

.app-shell--clean .tree-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
}

.app-shell--clean .tree-toolbar .breadcrumb {
  flex: 1 1 12rem;
  min-width: 0;
}

.app-shell--clean .tree-zone {
  /* Transparent container; the rendered .tree-card inside provides surface + category accent */
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Context panel (rules) base; desktop media adds sticky + width */
.app-shell--clean .context-panel {
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  position: static;
  align-self: auto;
  max-height: none;
  overflow: visible;
  border-left: none;
  margin-top: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.app-shell--clean .page-main-workspace {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

/* Main workspace tabs — full-height analysis OR rules (not stacked). */
.app-shell--clean .workspace-tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0 var(--layout-gutter);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-shell--clean .workspace-tab {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 16px;
  margin: 0;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.app-shell--clean .workspace-tab:hover {
  color: var(--text);
}

.app-shell--clean .workspace-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.app-shell--clean .page-main-workspace--tabbed {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

.app-shell--clean .page-main:has(.page-main-workspace--tabbed) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 12px;
  padding-bottom: 16px;
  box-sizing: border-box;
  /* Bounded height so the rules panel can scroll inside the tab */
  height: calc(100dvh - var(--header-sticky-h, 3.75rem));
  max-height: calc(100dvh - var(--header-sticky-h, 3.75rem));
  overflow: hidden;
}

.app-shell--clean .workspace-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.app-shell--clean .workspace-panel.is-active {
  display: flex;
  flex-direction: column;
}

.app-shell--clean .workspace-panel--analysis {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-shell--clean .workspace-panel--analysis .analysis-primary--focus {
  flex: 1;
}

.app-shell--clean .workspace-panel--rules {
  overflow: hidden;
}

.app-shell--clean .workspace-panel--rules .rules-panel--tabbed {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-height: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: none;
}

.app-shell--clean .workspace-panel--rules .rules-panel-top {
  flex-shrink: 0;
  padding: 16px 18px 12px;
}

.app-shell--clean .workspace-panel--rules .rules-panel-title {
  font-size: 1.125rem;
  margin-bottom: 12px;
}

.app-shell--clean .workspace-panel--rules .rules-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 24px;
  scrollbar-width: thin;
}

.app-shell--clean .analysis-primary {
  width: 100%;
}

.app-shell--clean .analysis-primary--focus {
  flex: 1 1 auto;
  overflow-x: hidden;
}

/* Rules always below the tree — full width under "Step-by-step rules". */
.app-shell--clean .rules-panel--below {
  width: 100%;
  max-width: none;
  flex: none;
  position: static;
  max-height: none;
  overflow: visible;
}

.app-shell--clean .rules-panel--scroll {
  flex: 0 0 auto;
  max-height: 20vh;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.app-shell--clean .rules-panel--scroll .rules-panel-top {
  flex-shrink: 0;
  padding: 10px 14px 8px;
}

.app-shell--clean .rules-panel--scroll .rules-panel-title {
  font-size: 1rem;
  margin-bottom: 8px;
}

.app-shell--clean .rules-panel--scroll .rules-chip {
  padding: 4px 8px;
  font-size: 0.625rem;
}

.app-shell--clean .rules-panel--scroll .rules-panel-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(20vh - 5.5rem);
  padding: 10px 14px 14px;
  scrollbar-width: thin;
}

@media (max-width: 720px) {
  .app-shell--clean .page-main:has(.page-main-workspace--tabbed) {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .app-shell--clean .page-main-workspace--tabbed {
    min-height: min(72dvh, 640px);
  }

  .app-shell--clean .workspace-panel--rules .rules-panel-body {
    max-height: min(68dvh, 600px);
  }

  .app-shell--clean .workspace-tab {
    padding: 10px 12px;
    font-size: 0.8125rem;
  }
}

@media (min-width: 820px) {
  .app-shell--clean .choices {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .app-shell--clean .tree-question {
    font-size: clamp(1.25rem, 1.5vw, 1.5rem);
  }
}

/* Step-by-step rules panel — light Exam Clarity, sticky rail on desktop */
.app-shell--clean .rules-panel {
  background: var(--surface);
  border-color: var(--border);
  padding: 0;
  overflow: hidden;
}

.app-shell--clean .rules-panel-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 14px 16px 12px;
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-shell--clean .rules-panel-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
  order: 1;
}

.app-shell--clean .rules-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  order: 2;
  width: 100%;
}

.app-shell--clean .rules-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 600;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.app-shell--clean .rules-chip-num {
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: 0.5625rem;
  font-weight: 800;
  color: var(--muted);
}

.app-shell--clean .rules-chip.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.app-shell--clean .rules-chip.is-active .rules-chip-num {
  background: #fff;
  border-color: #fff;
  color: var(--primary);
}

.app-shell--clean .rules-chip.is-done {
  border-color: #86efac;
  color: #166534;
  background: #f0fdf4;
}

.app-shell--clean .rules-chip.is-done .rules-chip-num {
  background: #86efac;
  border-color: #86efac;
  color: #166534;
}

.app-shell--clean .rules-panel-body {
  padding: 14px 16px 18px;
  width: 100%;
  box-sizing: border-box;
}

.app-shell--clean .rules-question {
  margin: 0 0 28px;
  padding: 0 0 28px;
  border: none;
  border-radius: 0;
  background: none;
  border-bottom: 1px solid var(--border);
}

.app-shell--clean .rules-question--intro {
  background: none;
}

.app-shell--clean .rules-question-meta {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.app-shell--clean .rules-question-text {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.app-shell--clean .rules-question-lead {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
}

.app-shell--clean .rules-question-sub {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.app-shell--clean .rules-branches {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}

.app-shell--clean .rules-branch {
  display: block;
  padding: 12px 0;
  font-size: 0.875rem;
  line-height: 1.55;
  background: none;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}

.app-shell--clean .rules-branch:last-child {
  border-bottom: none;
}

.app-shell--clean .rules-branch-key {
  display: inline;
  margin-right: 0.35em;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-shell--clean .rules-branch--yes .rules-branch-key {
  color: var(--green);
}

.app-shell--clean .rules-branch--no .rules-branch-key {
  color: var(--primary);
}

.app-shell--clean .rules-sources-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-shell--clean .rules-citations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.app-shell--clean:not(.app-shell--calm) .rule-card--ina-catalog {
  border-top-color: #0f766e;
}

.app-shell--clean:not(.app-shell--calm) .rule-card--ina-catalog .rule-card-tag {
  background: #0f766e;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-body {
  max-height: none;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step {
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px rgba(30, 58, 138, 0.12);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step-title {
  margin: 0;
  padding: 12px 14px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step-title::-webkit-details-marker {
  display: none;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step-title::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step[open] .ina-catalog-step-title::before {
  transform: rotate(90deg);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step-inner {
  padding: 0 14px 14px;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-shell--clean:not(.app-shell--calm) .ina-statute-row {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-step.is-active .ina-statute-row {
  border-color: #bfdbfe;
}

.app-shell--clean:not(.app-shell--calm) .ina-statute-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 6px;
}

.app-shell--clean:not(.app-shell--calm) .ina-statute-cite {
  font-weight: 700;
  font-size: 0.8125rem;
}

.app-shell--clean:not(.app-shell--calm) .ina-statute-title {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}

.app-shell--clean:not(.app-shell--calm) .ina-statute-text {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text);
  font-style: italic;
}

.app-shell--clean:not(.app-shell--calm) .ina-statute-lii {
  margin: 0;
  font-size: 0.75rem;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-def101 {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-def101-title {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7c3aed;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-def101-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-supplements {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-supplements-title {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

.app-shell--clean:not(.app-shell--calm) .ina-catalog-supplements .ina-supplement-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-shell--clean:not(.app-shell--calm) .rule-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.app-shell--clean:not(.app-shell--calm) .rule-card--ina {
  border-top: 3px solid var(--primary);
}

.app-shell--clean:not(.app-shell--calm) .rule-card--secondary {
  border-top: 3px solid var(--muted);
}

.app-shell--clean:not(.app-shell--calm) .rule-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.app-shell--clean:not(.app-shell--calm) .rule-card-tag {
  font-size: 0.5625rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
}

.app-shell--clean:not(.app-shell--calm) .rule-card--secondary .rule-card-tag {
  background: #64748b;
}

.app-shell--clean:not(.app-shell--calm) .rule-card-label {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
}

.app-shell--clean:not(.app-shell--calm) .rule-card-body {
  padding: 12px 14px 14px;
}

.app-shell--clean:not(.app-shell--calm) .rule-card-body .source-quote {
  margin: 0 0 12px;
  padding: 0;
  border: none;
  background: transparent;
}

.app-shell--clean:not(.app-shell--calm) .rule-card-body .source-quote:last-child {
  margin-bottom: 0;
}

.app-shell--clean .rules-more {
  margin-top: 16px;
  font-size: 0.875rem;
}

.app-shell--clean .rules-more summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 0;
}

.app-shell--clean:not(.app-shell--calm) .rules-empty {
  margin: 0;
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.app-shell--clean:not(.app-shell--calm) .rules-panel[data-exam-step="4"] .rules-panel-top {
  border-bottom-color: #f87171;
}

.app-shell--clean:not(.app-shell--calm) .rules-panel[data-exam-step="4"] .rules-chip.is-active .rules-chip-num {
  background: var(--red);
}

.app-shell--clean:not(.app-shell--calm) .context-body-inner {
  padding: 0;
  overflow: visible;
  flex: none;
  width: 100%;
}

.app-shell--clean .dual-cite-block,
.app-shell--clean .source-quote-text,
.app-shell--clean .supplement-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.app-shell--clean .law-summary-tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.5625rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: middle;
}

.app-shell--clean .source-quote--summary .source-quote-text,
.app-shell--clean:not(.app-shell--calm) .ina-statute-text,
.app-shell--clean:not(.app-shell--calm) .def101-statute-text {
  font-style: normal;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.app-shell--clean:not(.app-shell--calm) .def101-statute-quote--summary {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.app-shell--clean:not(.app-shell--calm) .def101-statute-quote--summary .def101-statute-label {
  margin: 0 0 4px;
  font-size: 0.5625rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-shell--clean .choices {
  width: 100%;
  grid-template-columns: 1fr;
}

.app-shell--clean .choice-btn {
  width: 100%;
  max-width: none;
  text-align: left;
  box-sizing: border-box;
}

.app-shell--clean:not(.app-shell--calm) .context-callout {
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.app-shell--clean:not(.app-shell--calm) .context-callout--hypo {
  border-left-color: var(--accent);
}

.app-shell--clean .sources-details {
  margin-top: 12px;
  font-size: 0.875rem;
}

.app-shell--clean .sources-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.app-shell--clean .sources-details-body {
  margin-top: 10px;
}

.app-shell--clean .sources-details .def101-quote-group-title {
  display: none;
}

.app-shell--clean .citation-key--compact {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.app-shell--clean .source-quote {
  margin: 0 0 10px;
  padding: 10px 12px;
}

.app-shell--clean .ina-supplement-card {
  margin-bottom: 10px;
}

.app-shell--clean .ctx-block--cite .ctx-block-body {
  display: block;
}

.app-shell--clean .ctx-block:not(.is-open) .ctx-block-body {
  display: none;
}

.app-shell--clean .ctx-block--cite:not(.is-open) .ctx-block-body {
  display: block;
}

.app-shell--clean .guided-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  font-size: 0.875rem;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid #fcd34d;
}

.app-shell--clean .hypo-walkthrough {
  margin-bottom: 12px;
  padding: 12px 14px;
  font-size: 0.875rem;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 540px) {
  .app-shell--clean .header-main {
    flex: 1 1 100%;
  }

  .app-shell--clean .rules-branches {
    grid-template-columns: 1fr;
  }
}

.cite-order-rule {
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
}

.sources-tier-title {
  margin: 14px 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sources-tier-title--ina {
  color: var(--primary);
  margin-top: 0;
}

.sources-tier-title--guidance {
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* Forum block: see forum-routing.css (typography layout, no info cards) */

