/**
 * Premium study UI — calm, modern, full-width
 * Linear / Vercel sensibility: hierarchy via type & space, not boxes
 */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.app-shell--calm {
  --font-display: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-ui: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --text: #18181b;
  --muted: #71717a;
  --muted-2: #a1a1aa;
  --border: rgba(24, 24, 27, 0.08);
  --border-strong: rgba(24, 24, 27, 0.14);

  --primary: #3f3f46;
  --primary-hover: #18181b;
  --primary-soft: rgba(24, 24, 27, 0.04);
  --accent: #5b6eae;
  --accent-soft: rgba(91, 110, 174, 0.08);

  --blue: #5b6eae;
  --purple: #7c6b9e;
  --teal: #4d8a7a;
  --red: #c45c5c;
  --brown: #9a7b5a;
  --green: #4a8f62;

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 4px 24px rgba(24, 24, 27, 0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t: 0.18s var(--ease);
  --layout-gutter: clamp(24px, 3vw, 64px);
  --workspace-max: min(100%, calc(100vw - 2 * var(--layout-gutter)));
  --header-sticky-h: 3.75rem;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --header-sticky-h: 4.25rem;
}

.app-shell--calm .skip-link:focus {
  top: 12px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.app-shell--calm .skip-link--rules:focus {
  top: 52px;
}

.app-shell--calm .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell--calm #contextBody:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.app-shell--calm.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-feature-settings: 'kern' 1, 'liga' 1;
}

/* —— Header —— */
.app-shell--calm .app-header--compact {
  background: rgba(247, 247, 245, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.app-shell--calm .app-header-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--space-3) var(--layout-gutter) var(--space-2);
  box-sizing: border-box;
}

.app-shell--calm .header-main h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
  line-height: 1.4;
}

/* —— Page —— */
.app-shell--calm .page-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--space-2) var(--layout-gutter) var(--space-5);
  align-items: stretch;
  box-sizing: border-box;
}

.app-shell--calm .page-main:has(.page-main-workspace--tabbed) {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: var(--space-3);
  padding-bottom: var(--space-2);
  height: calc(100dvh - var(--header-sticky-h) - 40px);
  max-height: calc(100dvh - var(--header-sticky-h) - 40px);
  overflow: hidden;
}

/* Tabs — understated segmented control */
.app-shell--calm .workspace-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin: 0 0 var(--space-4);
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.app-shell--calm .workspace-tab {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 9px 18px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--t), background var(--t);
}

.app-shell--calm .workspace-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.app-shell--calm .workspace-tab:active {
  transform: none;
}

.app-shell--calm .workspace-tab.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.app-shell--calm .workspace-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Workspace shell */
.app-shell--calm .page-main-workspace--tabbed {
  width: 100%;
  max-width: var(--workspace-max);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.app-shell--calm .analysis-primary {
  padding: var(--space-5) var(--space-4);
}

@media (min-width: 900px) {
  .app-shell--calm .analysis-primary {
    padding: var(--space-6) clamp(var(--space-4), 4vw, 56px);
  }
}

/* Hypo strip */
.app-shell--calm .hypo-rail {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .hypo-rail-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: var(--space-2);
}

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

.app-shell--calm .hypo-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  font-size: 0.8125rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--t), background var(--t), color var(--t);
}

.app-shell--calm .hypo-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell--calm .hypo-btn:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.app-shell--calm .hypo-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  box-shadow: none;
}

.app-shell--calm .hypo-btn--clear {
  background: transparent;
  color: var(--muted);
}

/* Toolbar */
.app-shell--calm .tree-toolbar {
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

.app-shell--calm .breadcrumb {
  font-size: 0.8125rem;
  color: var(--muted);
}

.app-shell--calm .breadcrumb .crumb-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--t);
}

.app-shell--calm .breadcrumb .crumb-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.app-shell--calm .ctx-block-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell--calm .breadcrumb .crumb-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.app-shell--calm .nav-btn {
  padding: 8px 14px;
  min-height: 44px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--t), background var(--t);
}

.app-shell--calm .nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell--calm .nav-btn:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  background: var(--surface-2);
  border-color: var(--border-strong);
}

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

.app-shell--calm .nav-btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Tree — no accent bar, no card box */
.app-shell--calm .tree-card,
.app-shell--calm .tree-card[class*='cat-'] {
  padding: 0;
  margin: 0;
  border: none;
  border-left: none !important;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.app-shell--calm .tree-card:hover {
  box-shadow: none;
}

.app-shell--calm .step-badge {
  display: inline-block;
  margin: 0 0 var(--space-2);
  padding: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 0;
}

.app-shell--calm .tree-question {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-3);
  color: var(--text);
  max-width: 42rem;
}

.app-shell--calm .tree-body {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 var(--space-5);
  max-width: 52rem;
}

.app-shell--calm .choices-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: var(--space-2);
}

.app-shell--calm .choices {
  gap: var(--space-2);
}

@media (min-width: 900px) {
  .app-shell--calm .choices {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.app-shell--calm .choice-btn {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--t), background var(--t);
}

.app-shell--calm .choice-btn:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.app-shell--calm .choice-btn:active {
  transform: none;
  background: var(--primary-soft);
}

.app-shell--calm .choice-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell--calm .choice-btn.yes,
.app-shell--calm .choice-btn.no,
.app-shell--calm .choice-btn.branch {
  background: var(--surface);
  border-color: var(--border);
}

.app-shell--calm .choice-btn.yes:hover {
  border-color: rgba(74, 143, 98, 0.45);
}

.app-shell--calm .choice-btn.no:hover {
  border-color: rgba(196, 92, 92, 0.4);
}

.app-shell--calm .choice-btn.branch:hover {
  border-color: rgba(91, 110, 174, 0.45);
}

.app-shell--calm #treeContainer.tree-enter {
  animation: premiumFade 0.35s var(--ease);
}

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

.app-shell--calm .guided-notice,
.app-shell--calm .hypo-walkthrough {
  padding: 0 0 var(--space-3);
  margin: 0 0 var(--space-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

/* —— Rules panel —— */
.app-shell--calm .workspace-panel--rules .rules-panel--tabbed {
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.app-shell--calm .rules-panel-top {
  padding: var(--space-5) var(--space-4) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 900px) {
  .app-shell--calm .rules-panel-top {
    padding: var(--space-6) clamp(var(--space-4), 4vw, 56px) var(--space-4);
  }
}

.app-shell--calm .rules-panel-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.app-shell--calm .rules-ribbon {
  gap: 6px;
  flex-wrap: wrap;
}

.app-shell--calm .rules-chip {
  padding: 8px 12px;
  min-height: 44px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--t), background var(--t), color var(--t);
}

.app-shell--calm .rules-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell--calm .rules-chip:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.app-shell--calm .rules-chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  box-shadow: none;
}

.app-shell--calm .rules-chip.is-active .rules-chip-num {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.app-shell--calm .rules-chip.is-done {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.app-shell--calm .rules-chip-num {
  width: 1.125rem;
  height: 1.125rem;
  font-size: 0.625rem;
  background: var(--surface-2);
  border: none;
}

.app-shell--calm .workspace-panel--rules .rules-panel-body {
  padding: var(--space-5) var(--space-4) var(--space-6);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 900px) {
  .app-shell--calm .workspace-panel--rules .rules-panel-body {
    padding: var(--space-5) clamp(var(--space-4), 4vw, 56px) var(--space-6);
  }
}

/* Step banner — typography only */
.app-shell--calm .rules-question {
  margin: 0 0 var(--space-5);
  padding: 0 0 var(--space-5);
  border: none;
  background: none;
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .rules-question-meta {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: var(--space-2);
}

.app-shell--calm .rules-question-text {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-shell--calm .rules-question-lead {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
}

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

.app-shell--calm .rules-branches {
  margin-top: var(--space-3);
}

.app-shell--calm .rules-branch {
  padding: var(--space-2) 0;
  border: none;
  background: none;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.55;
}

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

.app-shell--calm .rules-branch-key {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* INA catalog — flat disclosure list */
.app-shell--calm .ina-catalog-step {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .ina-catalog-step.is-active {
  background: none;
  box-shadow: none;
}

.app-shell--calm .ina-catalog-step-title {
  padding: var(--space-3) 0;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.app-shell--calm .ina-catalog-step[open] .ina-catalog-step-title {
  color: var(--text);
}

.app-shell--calm .ina-catalog-step.is-active .ina-catalog-step-title {
  color: var(--accent);
}

.app-shell--calm .ina-catalog-body {
  padding: 0 0 var(--space-4);
}

/* Rule / source cards — de-boxed */
.app-shell--calm .rule-card,
.app-shell--calm .rule-card--ina,
.app-shell--calm .rule-card--secondary,
.app-shell--calm .rule-card--ina-catalog,
.app-shell--calm .rule-card--def101 {
  margin: 0 0 var(--space-5);
  padding: 0 0 var(--space-5);
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  overflow: visible;
}

.app-shell--calm .rule-card-head {
  display: block;
  padding: 0 0 var(--space-2);
  margin: 0;
  background: none !important;
  border: none !important;
  border-bottom: none !important;
}

.app-shell--calm .rule-card-tag {
  display: inline;
  margin-right: 0.5em;
  padding: 0;
  border-radius: 0;
  background: none !important;
  color: var(--muted-2);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.app-shell--calm .rule-card-label {
  display: inline;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.app-shell--calm .rule-card-body {
  padding: 0;
}

.app-shell--calm .source-quote,
.app-shell--calm .source-quote--ina,
.app-shell--calm .source-quote--cfr,
.app-shell--calm .source-quote--fam,
.app-shell--calm .source-quote--pm,
.app-shell--calm .statute-quote {
  margin: 0 0 var(--space-3);
  padding: 0;
  border: none;
  border-left: none !important;
  background: none !important;
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

.app-shell--calm .source-quote-cite,
.app-shell--calm .statute-quote cite {
  display: block;
  margin: 0 0 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-style: normal;
}

.app-shell--calm .source-quote-text {
  color: var(--text);
}

/* §101 definitions — flat (no left-bar info boxes) */
.app-shell--calm .def101-statute-quote,
.app-shell--calm .def101-statute-quote--summary {
  margin: 0 0 var(--space-3);
  padding: 0 0 var(--space-3);
  border: none !important;
  border-left: none !important;
  background: none !important;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .def101-statute-quote:last-child,
.app-shell--calm .def101-statute-quote--summary:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: var(--space-2);
}

.app-shell--calm .def101-statute-label {
  margin: 0 0 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.app-shell--calm .def101-statute-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
  font-style: normal;
}

.app-shell--calm .def101-quote-group {
  margin: 0 0 var(--space-4);
  padding: 0;
  border: none;
}

.app-shell--calm .def101-quote-group-title {
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.app-shell--calm .source-quote--def101 {
  border-left: none !important;
  background: none !important;
}

.app-shell--calm .ina-catalog-def101 {
  margin: var(--space-4) 0 0;
  padding: var(--space-4) 0 0;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  border-radius: 0;
}

.app-shell--calm .ina-catalog-def101-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.app-shell--calm .ina-catalog-def101-inner {
  padding: 0;
}

.app-shell--calm .context-callout,
.app-shell--calm .context-callout--hypo {
  margin: var(--space-3) 0 0;
  padding: 0;
  border: none !important;
  border-left: none !important;
  background: none !important;
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
}

.app-shell--calm .ctx-block--def101 .ctx-block-head {
  background: none !important;
}

/* Rules panel: neutral step accents (no red step-4 chrome) */
.app-shell--calm .rules-panel[data-exam-step] .rules-panel-top {
  border-bottom-color: var(--border);
}

.app-shell--calm .rules-panel[data-exam-step] .rules-chip.is-active .rules-chip-num {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.app-shell--calm .workspace-panel--rules .rules-panel-body.context-body-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.app-shell--calm .ctx-block {
  margin: 0 0 var(--space-4);
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .ctx-block-head {
  padding: var(--space-2) 0;
  font-size: 0.8125rem;
  font-weight: 600;
  background: none;
  transition: color var(--t);
}

.app-shell--calm .ctx-block-head:hover {
  color: var(--accent);
  background: none;
}

.app-shell--calm .ctx-block-body {
  padding: 0 0 var(--space-3);
}

.app-shell--calm .rule-box {
  margin: var(--space-3) 0;
  padding: 0;
  border: none;
  border-left: none !important;
  background: none;
  font-size: 0.875rem;
  color: var(--muted);
}

.app-shell--calm .routing-officer,
.app-shell--calm .routing-pitfall {
  border: none;
  border-left: none !important;
  background: none;
  padding: 0;
}

.app-shell--calm .routing-table th,
.app-shell--calm .routing-table td,
.app-shell--calm .agency-table th,
.app-shell--calm .agency-table td {
  border-color: var(--border);
  padding: 10px 12px 10px 0;
}

.app-shell--calm .routing-table thead th,
.app-shell--calm .agency-table thead th {
  background: none;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-bottom: 1px solid var(--border-strong);
}

.app-shell--calm .source-tag {
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
}

.app-shell--calm .rules-empty {
  border: none;
  border-radius: 0;
  padding: var(--space-4) 0;
  font-style: normal;
  color: var(--muted);
}

.app-shell--calm .forum-routing {
  padding-top: var(--space-5);
  margin-bottom: var(--space-5);
}

/* Scrollbars */
.app-shell--calm .workspace-panel--analysis,
.app-shell--calm .workspace-panel--rules .rules-panel-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 24, 27, 0.15) transparent;
}

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

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

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

  .app-shell--calm .analysis-primary {
    padding: var(--space-4) var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell--calm .app-header--compact {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg);
  }

  .app-shell--calm .choice-btn:hover,
  .app-shell--calm .hypo-btn:hover,
  .app-shell--calm .nav-btn:hover:not(:disabled),
  .app-shell--calm .rules-chip:hover {
    transform: none;
  }

  .app-shell--calm #treeContainer.tree-enter {
    animation: none;
  }
}

/* 2026 workspace rebuild */
.app-shell--calm {
  --font-display: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-ui: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #e8edf1;
  --surface: #ffffff;
  --surface-2: #f2f5f8;
  --surface-3: #e9f1f0;
  --ink: #17212c;
  --text: #17212c;
  --muted: #586575;
  --muted-2: #8893a1;
  --border: rgba(22, 32, 46, 0.12);
  --border-strong: rgba(22, 32, 46, 0.20);
  --primary: #15564b;
  --primary-hover: #0f4137;
  --primary-soft: #d7e8e2;
  --accent: #2360a6;
  --accent-soft: #e3ecf8;
  --gold: #8a6f3a;
  --blue: #2360a6;
  --purple: #5b5a98;
  --teal: #176b5f;
  --red: #9a4555;
  --brown: #4d6273;
  --green: #2f6f54;
  --shadow-sm: 0 1px 2px rgba(22, 32, 46, 0.07);
  --shadow-md: 0 18px 45px rgba(22, 32, 46, 0.14);
  --radius: 8px;
  --radius-lg: 8px;
  --layout-gutter: clamp(16px, 2.6vw, 44px);
  --header-sticky-h: 76px;
  --space-1: 8px;
  --space-2: 14px;
  --space-3: 20px;
  --space-4: 28px;
  --space-5: 40px;
  --space-6: 56px;
}

.app-shell--calm.app-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(238, 241, 238, 0) 260px),
    var(--bg);
}

.app-shell--calm .app-header--compact {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(22, 32, 46, 0.03);
}

.app-shell--calm .app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-sticky-h);
  padding: 12px var(--layout-gutter);
}

.app-shell--calm .brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-shell--calm .brand-sigil {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(29, 79, 69, 0.24);
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1;
}

.app-shell--calm .brand-eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .header-main h1 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
}

.app-shell--calm .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-shell--calm .header-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.app-shell--calm .header-actions a:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.app-shell--calm .page-main:has(.page-main-workspace--tabbed) {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  height: calc(100dvh - var(--header-sticky-h));
  max-height: calc(100dvh - var(--header-sticky-h));
  padding: 16px var(--layout-gutter);
}

.app-shell--calm .study-overview {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(520px, 1.28fr);
  gap: 18px;
  align-items: stretch;
}

.app-shell--calm .overview-copy,
.app-shell--calm .step-strip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
}

.app-shell--calm .overview-copy {
  padding: 14px 16px;
}

.app-shell--calm .overview-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .overview-copy p {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.app-shell--calm .step-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

.app-shell--calm .step-strip li {
  display: grid;
  gap: 5px;
  align-content: center;
  min-height: 68px;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.15;
}

.app-shell--calm .step-strip li:last-child {
  border-right: none;
}

.app-shell--calm .step-strip span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--primary);
  font-size: 0.72rem;
}

.app-shell--calm .workspace-tabs {
  justify-self: start;
  margin: 0;
  padding: 4px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.app-shell--calm .workspace-tab {
  min-height: 38px;
  padding: 8px 15px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.app-shell--calm .workspace-tab.is-active {
  background: var(--primary);
  color: #ffffff;
}

.app-shell--calm .page-main-workspace--tabbed {
  width: 100%;
  max-width: none;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.app-shell--calm .workspace-panel,
.app-shell--calm .analysis-primary,
.app-shell--calm .analysis-layout,
.app-shell--calm .decision-surface {
  min-height: 0;
}

.app-shell--calm .workspace-panel--analysis.is-active {
  height: 100%;
}

.app-shell--calm .analysis-primary {
  height: 100%;
  padding: 0;
}

.app-shell--calm .analysis-layout {
  display: grid;
  grid-template-columns: minmax(230px, 292px) minmax(0, 1fr);
  height: 100%;
}

.app-shell--calm .practice-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #f2f5f8, #eef5ef);
}

.app-shell--calm .rail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.app-shell--calm .rail-heading strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
}

.app-shell--calm .rail-label {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .hypo-rail {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
}

.app-shell--calm .hypo-bar-wrap {
  height: 100%;
  min-height: 0;
}

.app-shell--calm .hypo-bar-wrap::after {
  display: none;
}

.app-shell--calm .hypo-bar {
  display: grid;
  gap: 8px;
  max-height: 100%;
  overflow: auto;
  padding: 0 2px 4px 0;
  scroll-snap-type: none;
}

.app-shell--calm .hypo-btn {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 58px;
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(22, 32, 46, 0.14);
  color: var(--text);
}

.app-shell--calm .hypo-btn-kind {
  color: inherit;
  font-size: 0.76rem;
}

.app-shell--calm .hypo-btn-name {
  color: var(--muted);
  font-size: 0.69rem;
}

.app-shell--calm .hypo-btn:hover {
  background: #ffffff;
  border-color: var(--primary);
}

.app-shell--calm .hypo-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.app-shell--calm .decision-surface {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.app-shell--calm .tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(242, 245, 248, 0.78);
}

.app-shell--calm .breadcrumb {
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  color: var(--muted);
}

.app-shell--calm .breadcrumb .crumb-current {
  color: var(--text);
}

.app-shell--calm .breadcrumb .crumb-link {
  color: var(--primary);
  font-weight: 800;
}

.app-shell--calm .nav-btn {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.app-shell--calm .nav-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.app-shell--calm .tree-zone {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: clamp(22px, 4vw, 54px);
}

.app-shell--calm .tree-card,
.app-shell--calm .tree-card[class*='cat-'] {
  display: grid;
  max-width: 980px;
  min-height: min(560px, calc(100dvh - 350px));
  align-content: start;
  padding: 0;
  margin: 0 auto;
  border: none !important;
  background: transparent;
}

.app-shell--calm .step-badge {
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.app-shell--calm .tree-question {
  max-width: 780px;
  margin-bottom: 18px;
  color: var(--text);
  font-size: clamp(1.8rem, 4vw, 3.15rem);
  letter-spacing: 0;
}

.app-shell--calm .tree-body {
  max-width: 820px;
  margin-bottom: 28px;
  color: #33403c;
  font-size: clamp(0.98rem, 1.25vw, 1.08rem);
  line-height: 1.7;
}

.app-shell--calm .tree-body ul,
.app-shell--calm .tree-body ol {
  padding-left: 1.25rem;
}

.app-shell--calm .tree-body li + li {
  margin-top: 4px;
}

.app-shell--calm .rule-box,
.app-shell--calm .statute-quote {
  border-radius: 8px;
}

.app-shell--calm .tree-card .rule-box {
  padding: 12px 14px;
  border: 1px solid rgba(155, 77, 46, 0.2) !important;
  background: var(--accent-soft);
  color: #493229;
}

.app-shell--calm .tree-card .statute-quote {
  padding: 12px 14px;
  border: 1px solid rgba(29, 79, 69, 0.17) !important;
  background: var(--surface-3) !important;
  color: #2d3835;
}

.app-shell--calm .choices-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.app-shell--calm .choices {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-width: 980px;
}

.app-shell--calm .choice-btn {
  position: relative;
  min-height: 68px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  line-height: 1.28;
  text-align: left;
}

.app-shell--calm .choice-btn::after {
  content: '›';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-size: 1.25rem;
}

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

.app-shell--calm .choice-btn.yes,
.app-shell--calm .choice-btn.no,
.app-shell--calm .choice-btn.branch {
  background: #ffffff;
}

.app-shell--calm .choice-btn.yes {
  border-left: 5px solid var(--green);
}

.app-shell--calm .choice-btn.no {
  border-left: 5px solid var(--red);
}

.app-shell--calm .choice-btn.branch {
  border-left: 5px solid var(--blue);
}

.app-shell--calm .choice-kbd {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  opacity: 1;
}

.app-shell--calm .hypo-walkthrough,
.app-shell--calm .guided-notice {
  margin: 0;
  padding: 13px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--text);
}

.app-shell--calm .walk-progress {
  height: 7px;
  border-radius: 999px;
  background: rgba(29, 79, 69, 0.15);
}

.app-shell--calm .walk-progress-fill {
  background: var(--primary);
}

.app-shell--calm .hypo-walk-btn {
  min-height: 38px;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 800;
}

.app-shell--calm .hypo-walk-btn.secondary {
  background: #ffffff;
}

.app-shell--calm .workspace-panel--rules.is-active,
.app-shell--calm .workspace-panel--rules .rules-panel--tabbed {
  height: 100%;
}

.app-shell--calm .workspace-panel--rules .rules-panel--tabbed {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--surface);
}

.app-shell--calm .rules-panel-top {
  padding: 20px 22px;
  background: var(--surface-2);
}

.app-shell--calm .rules-panel-title {
  margin-bottom: 14px;
  color: var(--accent);
  font-weight: 900;
}

.app-shell--calm .rules-ribbon {
  display: flex;
  gap: 8px;
}

.app-shell--calm .rules-chip {
  min-height: 42px;
  border-radius: 8px;
  background: #ffffff;
  font-weight: 800;
}

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

.app-shell--calm .workspace-panel--rules .rules-panel-body {
  padding: clamp(24px, 4vw, 52px);
}

.app-shell--calm .rules-question-text {
  color: var(--text);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: 0;
}

.app-shell--calm .forum-routing__title {
  letter-spacing: 0;
}

.app-shell--calm .ctx-block,
.app-shell--calm .rule-card,
.app-shell--calm .rule-card--ina,
.app-shell--calm .rule-card--secondary,
.app-shell--calm .rule-card--ina-catalog,
.app-shell--calm .rule-card--def101,
.app-shell--calm .ina-catalog-step {
  border-bottom-color: rgba(22, 32, 46, 0.12);
}

.app-shell--calm .ctx-block-head,
.app-shell--calm .ina-catalog-step-title {
  color: var(--text);
  font-weight: 800;
}

.app-shell--calm a {
  color: var(--blue);
}

@media (max-width: 1120px) {
  .app-shell--calm .study-overview {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .analysis-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .app-shell--calm .tree-question {
    font-size: clamp(1.6rem, 4vw, 2.45rem);
  }
}

@media (max-width: 820px) {
  .app-shell--calm .app-header-inner {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }

  .app-shell--calm .header-actions {
    justify-content: flex-start;
  }

  .app-shell--calm .page-main:has(.page-main-workspace--tabbed) {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .app-shell--calm .study-overview {
    display: none;
  }

  .app-shell--calm .step-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell--calm .analysis-layout {
    display: flex;
    flex-direction: column;
  }

  .app-shell--calm .practice-rail {
    order: 2;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .app-shell--calm .decision-surface {
    order: 1;
  }

  .app-shell--calm .hypo-bar {
    display: flex;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .app-shell--calm .hypo-btn {
    width: min(74vw, 250px);
    flex: 0 0 auto;
  }

  .app-shell--calm .tree-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell--calm.app-shell--clean .tree-toolbar .breadcrumb,
  .app-shell--calm .tree-toolbar .breadcrumb {
    flex: 0 0 auto;
  }

  .app-shell--calm .nav-controls {
    justify-content: flex-start;
  }

  .app-shell--calm .tree-zone {
    overflow: visible;
    padding: 24px 18px 34px;
  }

  .app-shell--calm .tree-card {
    min-height: 0;
  }

  .app-shell--calm .choices {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .workspace-panel--rules .rules-panel-body {
    max-height: none;
  }
}

@media (max-width: 520px) {
  .app-shell--calm .brand-sigil {
    width: 36px;
    height: 36px;
  }

  .app-shell--calm .header-actions a {
    min-height: 34px;
    padding-inline: 9px;
  }

  .app-shell--calm .workspace-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .app-shell--calm .workspace-tab {
    padding-inline: 8px;
  }

  .app-shell--calm .practice-rail {
    padding: 14px;
  }

  .app-shell--calm .tree-question {
    font-size: 1.55rem;
  }
}

/* Analyzer-only refinement */
.app-shell--calm .header-actions,
.app-shell--calm .study-overview,
.app-shell--calm .workspace-tabs,
.app-shell--calm .practice-rail,
.app-shell--calm .hypo-rail,
.app-shell--calm .hypo-walkthrough,
.app-shell--calm .guided-notice {
  display: none !important;
}

.app-shell--calm .app-header-inner {
  justify-content: flex-start;
}

.app-shell--calm .page-main:has(.analyzer-workspace) {
  display: block;
  height: calc(100dvh - var(--header-sticky-h));
  max-height: calc(100dvh - var(--header-sticky-h));
  padding: 18px var(--layout-gutter);
  overflow: hidden;
}

.app-shell--calm .analyzer-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 0;
  height: 100%;
  min-height: 0;
}

.app-shell--calm .analyzer-workspace .workspace-panel {
  min-height: 0;
  overflow: hidden;
}

.app-shell--calm .analyzer-workspace .workspace-panel--analysis {
  border-right: 1px solid var(--border);
}

.app-shell--calm .analyzer-workspace .workspace-panel--rules {
  display: block;
  background: #fbfcfe;
}

.app-shell--calm .analyzer-workspace .analysis-primary,
.app-shell--calm .analyzer-workspace .decision-surface {
  height: 100%;
}

.app-shell--calm .analyzer-workspace .tree-toolbar {
  min-height: 64px;
  background: rgba(242, 245, 248, 0.92);
}

.app-shell--calm .analyzer-workspace .tree-zone {
  height: calc(100% - 64px);
  padding: clamp(28px, 4vw, 60px);
}

.app-shell--calm .analyzer-workspace .tree-card {
  max-width: 900px;
  min-height: 0;
  margin: 0;
}

.app-shell--calm .analyzer-workspace .tree-question {
  max-width: 820px;
  font-size: clamp(2rem, 4vw, 3.35rem);
}

.app-shell--calm .analyzer-workspace .tree-body {
  max-width: 820px;
  font-size: clamp(1rem, 1.25vw, 1.12rem);
}

.app-shell--calm .starter-prompts {
  margin: 0 0 28px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f2f5f8;
}

.app-shell--calm .starter-prompts__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.app-shell--calm .starter-prompts__head span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .starter-prompts__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-shell--calm .starter-prompts__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.app-shell--calm .starter-prompt {
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-shell--calm .starter-prompt:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.app-shell--calm .starter-prompt:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app-shell--calm .starter-prompt strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.app-shell--calm .starter-prompt span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.app-shell--calm .analyzer-workspace .choices {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.app-shell--calm .analyzer-workspace .rules-panel--tabbed {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

.app-shell--calm .analyzer-workspace .rules-panel-top {
  padding: 18px;
  background: #f2f5f8;
}

.app-shell--calm .analyzer-workspace .rules-panel-title {
  margin-bottom: 12px;
}

.app-shell--calm .analyzer-workspace .rules-ribbon {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.app-shell--calm .analyzer-workspace .rules-chip {
  justify-content: flex-start;
  width: 100%;
}

.app-shell--calm .analyzer-workspace .rules-panel-body {
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
}

@media (max-width: 1100px) {
  .app-shell--calm .analyzer-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  }

  .app-shell--calm .starter-prompts__grid {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .starter-prompt {
    min-height: 0;
  }
}

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

  .app-shell--calm .analyzer-workspace {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .app-shell--calm .analyzer-workspace .workspace-panel {
    overflow: visible;
  }

  .app-shell--calm .analyzer-workspace .workspace-panel--analysis {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .app-shell--calm .analyzer-workspace .tree-zone {
    height: auto;
    overflow: visible;
    padding: 24px 18px 34px;
  }

  .app-shell--calm .analyzer-workspace .rules-panel--tabbed {
    display: block;
    height: auto;
  }

  .app-shell--calm .analyzer-workspace .rules-panel-body {
    max-height: none;
    overflow: visible;
    padding: 22px 18px 34px;
  }

  .app-shell--calm .starter-prompts__head {
    display: block;
  }

  .app-shell--calm .starter-prompts__head p {
    margin-top: 4px;
  }
}

/* Single-surface case analyzer */
.app-shell--calm .page-main:has(.analyzer-workspace) {
  height: calc(100dvh - var(--header-sticky-h));
  max-height: calc(100dvh - var(--header-sticky-h));
  padding: 10px clamp(10px, 1.2vw, 20px);
  overflow: hidden;
}

.app-shell--calm .analyzer-workspace {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--surface);
}

.app-shell--calm .analyzer-workspace .workspace-panel--analysis {
  height: 100%;
  border-right: none;
}

.app-shell--calm .analyzer-workspace .workspace-panel--rules,
.app-shell--calm .analyzer-workspace .rules-panel,
.app-shell--calm .analyzer-workspace .rules-panel-top,
.app-shell--calm .analyzer-workspace .rules-panel-body {
  display: none !important;
}

.app-shell--calm .analyzer-workspace .tree-toolbar {
  min-height: 58px;
  padding: 12px 16px;
  background: rgba(242, 245, 248, 0.9);
}

.app-shell--calm .analyzer-workspace .tree-zone {
  height: calc(100% - 58px);
  padding: clamp(14px, 2vw, 28px);
  overflow: auto;
}

.app-shell--calm .analyzer-workspace .tree-card {
  max-width: 980px;
  margin: 0 auto;
}

.app-shell--calm .analyzer-workspace .tree-question {
  max-width: 880px;
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.app-shell--calm .analyzer-workspace .tree-body {
  max-width: 860px;
}

.app-shell--calm .compact-resources {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.app-shell--calm .compact-resources__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.app-shell--calm .compact-resources__head span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .compact-resources__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-shell--calm .compact-resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.app-shell--calm .compact-resource-card {
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.app-shell--calm .compact-resource-card h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell--calm .compact-resource-card p,
.app-shell--calm .compact-resource-fallback {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.app-shell--calm .compact-resource-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.app-shell--calm .compact-resource-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}

.app-shell--calm .compact-resource-detail {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.app-shell--calm .compact-resource-detail summary {
  cursor: pointer;
  padding: 11px 14px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.app-shell--calm .compact-resource-detail__body {
  padding: 0 14px 14px;
}

.app-shell--calm .compact-resource-detail__body .rules-sources-wrap,
.app-shell--calm .compact-resource-detail__body .rules-citations,
.app-shell--calm .compact-resource-detail__body .rule-card {
  margin-bottom: 0;
}

.app-shell--calm .compact-resource-detail__body .rule-card {
  padding-bottom: 14px;
}

.app-shell--calm .compact-resource-detail__body .source-quote,
.app-shell--calm .compact-resource-detail__body .statute-quote {
  font-size: 0.84rem;
}

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

  .app-shell--calm .analyzer-workspace {
    height: auto;
  }

  .app-shell--calm .analyzer-workspace .workspace-panel--analysis {
    height: auto;
  }

  .app-shell--calm .analyzer-workspace .tree-zone {
    height: auto;
    overflow: visible;
    padding: 22px 18px 32px;
  }

  .app-shell--calm .compact-resource-grid {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .compact-resource-card {
    min-height: 0;
  }

  .app-shell--calm .compact-resources__head {
    display: block;
  }

  .app-shell--calm .compact-resources__head p {
    margin-top: 4px;
  }
}

/* Case Analysis Canvas */
.app-shell--calm .canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(242, 245, 248, 0.9);
}

.app-shell--calm .canvas-toolbar h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 600;
  letter-spacing: 0;
}

.app-shell--calm .canvas-eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .analyzer-workspace .tree-zone {
  height: calc(100% - 76px);
}

.app-shell--calm .case-canvas {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.app-shell--calm .case-snapshot,
.app-shell--calm .issue-checklist,
.app-shell--calm .analysis-notes {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.app-shell--calm .case-snapshot,
.app-shell--calm .issue-checklist {
  padding: 14px;
}

.app-shell--calm .case-snapshot__head,
.app-shell--calm .section-head,
.app-shell--calm .analysis-notes__head {
  margin-bottom: 14px;
}

.app-shell--calm .case-snapshot__head span,
.app-shell--calm .section-head span,
.app-shell--calm .analysis-notes__head span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .case-snapshot__head p,
.app-shell--calm .section-head p,
.app-shell--calm .analysis-notes__head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.app-shell--calm .snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.app-shell--calm .snapshot-field {
  display: grid;
  gap: 6px;
}

.app-shell--calm .snapshot-field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell--calm .snapshot-field select {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.app-shell--calm .issue-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
}

.app-shell--calm .issue-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color var(--t), background var(--t);
}

.app-shell--calm .issue-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.app-shell--calm .issue-card--possible {
  border-left: 5px solid var(--blue);
}

.app-shell--calm .issue-card--clear {
  border-left: 5px solid var(--green);
}

.app-shell--calm .issue-card--problem {
  border-left: 5px solid var(--red);
}

.app-shell--calm .issue-card__main {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-shell--calm .issue-card__num,
.app-shell--calm .issue-card__title {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .issue-card__main strong {
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.25;
}

.app-shell--calm .issue-card__main small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.app-shell--calm .issue-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-shell--calm .status-pill {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.app-shell--calm .status-pill.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.app-shell--calm .analysis-notes {
  padding: 16px;
}

.app-shell--calm .analysis-notes__head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  letter-spacing: 0;
}

.app-shell--calm .analysis-note-body {
  max-width: none;
  color: #33403c;
  font-size: 1rem;
  line-height: 1.65;
}

.app-shell--calm .analysis-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.app-shell--calm .analysis-notes__head,
.app-shell--calm .analysis-note-body,
.app-shell--calm .related-issues {
  grid-column: 1;
}

.app-shell--calm .analysis-notes .compact-resources {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.app-shell--calm .analysis-notes .compact-resource-grid {
  grid-template-columns: 1fr;
}

.app-shell--calm .analysis-note-body p {
  margin: 0 0 10px;
}

.app-shell--calm .analysis-note-body ul,
.app-shell--calm .analysis-note-body ol {
  padding-left: 1.25rem;
}

.app-shell--calm .related-issues {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.app-shell--calm .related-issues > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .related-issues div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-shell--calm .related-issues button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 980px) {
  .app-shell--calm .snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell--calm .issue-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell--calm .analysis-notes {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .analysis-notes__head,
  .app-shell--calm .analysis-note-body,
  .app-shell--calm .related-issues,
  .app-shell--calm .analysis-notes .compact-resources {
    grid-column: auto;
    grid-row: auto;
  }

  .app-shell--calm .analysis-notes .compact-resources {
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  .app-shell--calm .canvas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell--calm .analyzer-workspace .tree-zone {
    height: auto;
    padding: 12px;
  }

  .app-shell--calm .snapshot-grid,
  .app-shell--calm .issue-grid {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .case-snapshot,
  .app-shell--calm .issue-checklist,
  .app-shell--calm .analysis-notes {
    padding: 16px;
  }
}

/* Practical Case Analysis Workbench */
.app-shell--calm .analysis-page-main {
  flex: 1 1 auto;
  padding: 0;
  background:
    linear-gradient(90deg, rgba(242, 245, 248, 0.72), rgba(255, 255, 255, 0.96) 26%, rgba(255, 255, 255, 0.96));
}

.app-shell--calm .analysis-workbench,
.app-shell--calm .analysis-workbench__mount,
.app-shell--calm .case-workbench {
  min-height: 0;
}

.app-shell--calm .analysis-workbench {
  width: 100%;
}

.app-shell--calm .case-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.app-shell--calm .case-bar {
  display: grid;
  grid-template-columns: minmax(210px, 0.55fr) minmax(0, 2.8fr) auto;
  gap: 14px;
  align-items: end;
  padding: 14px var(--layout-gutter);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
}

.app-shell--calm .case-bar__title {
  display: grid;
  gap: 2px;
}

.app-shell--calm .case-bar__title span,
.app-shell--calm .issue-rail__head span,
.app-shell--calm .active-analysis__head span,
.app-shell--calm .active-analysis__rule span,
.app-shell--calm .compact-resources__head span {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .case-bar__title strong {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.25;
}

.app-shell--calm .case-bar__fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.app-shell--calm .snapshot-field {
  display: grid;
  gap: 5px;
}

.app-shell--calm .snapshot-field span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell--calm .snapshot-field select {
  width: 100%;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
}

.app-shell--calm .clear-analysis-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(159, 76, 47, 0.34);
  border-radius: 7px;
  background: rgba(159, 76, 47, 0.1);
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.app-shell--calm .workbench-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.68fr) minmax(420px, 1.42fr) minmax(300px, 0.9fr);
  min-height: 0;
  height: 100%;
}

.app-shell--calm .issue-rail,
.app-shell--calm .active-analysis,
.app-shell--calm .resource-aside {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.app-shell--calm .issue-rail {
  padding: 18px 14px 22px var(--layout-gutter);
  border-right: 1px solid var(--border);
  background: rgba(242, 245, 248, 0.55);
}

.app-shell--calm .issue-rail__head {
  margin-bottom: 12px;
}

.app-shell--calm .issue-rail__head p,
.app-shell--calm .active-analysis__head p,
.app-shell--calm .compact-resources__head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.app-shell--calm .issue-list {
  display: grid;
  gap: 6px;
}

.app-shell--calm .issue-row {
  border-bottom: 1px solid rgba(203, 212, 221, 0.76);
}

.app-shell--calm .issue-row.is-selected {
  border-bottom-color: rgba(43, 91, 79, 0.32);
}

.app-shell--calm .issue-row__main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 11px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-shell--calm .issue-row__main:hover,
.app-shell--calm .issue-row.is-selected .issue-row__main {
  background: rgba(43, 91, 79, 0.08);
}

.app-shell--calm .issue-row__num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.app-shell--calm .issue-row.is-selected .issue-row__num {
  background: var(--primary);
  color: #ffffff;
}

.app-shell--calm .issue-row__copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-shell--calm .issue-row__title {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .issue-row__copy strong {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.25;
}

.app-shell--calm .issue-row__state {
  justify-self: end;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.app-shell--calm .issue-row--possible .issue-row__state {
  border-color: rgba(21, 101, 192, 0.28);
  color: #1565c0;
}

.app-shell--calm .issue-row--clear .issue-row__state {
  border-color: rgba(27, 94, 32, 0.28);
  color: #1b5e20;
}

.app-shell--calm .issue-row--problem .issue-row__state {
  border-color: rgba(154, 69, 85, 0.3);
  color: #893a4a;
}

.app-shell--calm .issue-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 8px 10px 51px;
}

.app-shell--calm .status-pill {
  min-height: 26px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.app-shell--calm .status-pill.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.app-shell--calm .active-analysis {
  padding: clamp(22px, 3vw, 42px);
  background: rgba(255, 255, 255, 0.96);
}

.app-shell--calm .active-analysis__head {
  max-width: 780px;
  margin-bottom: 18px;
}

.app-shell--calm .active-analysis__head h2 {
  margin: 5px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.02;
}

.app-shell--calm .active-analysis__rule {
  max-width: 780px;
  margin-bottom: 20px;
  padding: 13px 15px;
  border-left: 4px solid var(--primary);
  background: rgba(43, 91, 79, 0.07);
}

.app-shell--calm .active-analysis__rule p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.5;
}

.app-shell--calm .analysis-note-body {
  max-width: 820px;
  color: #33403c;
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  line-height: 1.7;
}

.app-shell--calm .analysis-note-body p {
  margin: 0 0 12px;
}

.app-shell--calm .analysis-note-body ul,
.app-shell--calm .analysis-note-body ol {
  padding-left: 1.25rem;
}

.app-shell--calm .related-issues {
  max-width: 820px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.app-shell--calm .related-issues > span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .related-issues div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-shell--calm .related-issues button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--primary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.app-shell--calm .resource-aside {
  padding: 22px var(--layout-gutter) 22px 18px;
  border-left: 1px solid var(--border);
  background: rgba(250, 248, 242, 0.78);
}

.app-shell--calm .resource-aside .compact-resources {
  margin: 0;
  padding: 0;
  border: 0;
}

.app-shell--calm .resource-aside .compact-resources__head {
  display: block;
  margin-bottom: 12px;
}

.app-shell--calm .resource-aside .compact-resource-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.app-shell--calm .resource-aside .compact-resource-card {
  min-height: 0;
  padding: 12px;
  border: 1px solid rgba(203, 212, 221, 0.8);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.app-shell--calm .resource-aside .compact-resource-card h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell--calm .resource-aside .compact-resource-card p,
.app-shell--calm .resource-aside .compact-resource-fallback {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.48;
}

.app-shell--calm .resource-aside .compact-resource-detail {
  margin-top: 10px;
  border: 1px solid rgba(203, 212, 221, 0.8);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.62);
}

.app-shell--calm .resource-aside .compact-resource-detail summary {
  padding: 10px 12px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
}

.app-shell--calm .resource-aside .compact-resource-detail__body {
  padding: 0 12px 12px;
}

@media (max-width: 1000px) {
  .app-shell--calm .analysis-page-main {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .app-shell--calm .analysis-workbench,
  .app-shell--calm .analysis-workbench__mount,
  .app-shell--calm .case-workbench {
    height: auto;
  }

  .app-shell--calm .case-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .app-shell--calm .workbench-grid {
    grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
    height: auto;
  }

  .app-shell--calm .resource-aside {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    border-left: 0;
    padding-left: var(--layout-gutter);
  }

  .app-shell--calm .resource-aside .compact-resource-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell--calm .case-bar {
    padding: 14px 14px;
  }

  .app-shell--calm .case-bar__fields {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .workbench-grid {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .active-analysis {
    order: 1;
  }

  .app-shell--calm .issue-rail {
    order: 2;
  }

  .app-shell--calm .resource-aside {
    order: 3;
  }

  .app-shell--calm .issue-rail {
    max-height: none;
    padding: 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .app-shell--calm .active-analysis {
    padding: 22px 16px;
  }

  .app-shell--calm .active-analysis__head h2 {
    font-size: clamp(1.9rem, 10vw, 2.55rem);
  }

  .app-shell--calm .resource-aside {
    padding: 18px 14px 26px;
  }

  .app-shell--calm .resource-aside .compact-resource-grid {
    grid-template-columns: 1fr;
  }
}

/* Lawyer Six-Step Analysis Desk */
.app-shell--calm .analysis-page-main {
  padding: 0;
  background: #ffffff;
}

.app-shell--calm .analysis-workbench,
.app-shell--calm .analysis-workbench__mount,
.app-shell--calm .lawyer-desk {
  min-height: 0;
}

.app-shell--calm .lawyer-desk {
  display: grid;
  grid-template-columns: minmax(158px, 0.25fr) minmax(440px, 1.22fr) minmax(310px, 1fr);
  width: 100%;
  background: linear-gradient(90deg, rgba(242, 245, 248, 0.78), #ffffff 26%, rgba(250, 248, 242, 0.82));
}

.app-shell--calm .lawyer-step-nav,
.app-shell--calm .lawyer-reading-desk,
.app-shell--calm .lawyer-source-stack {
  min-width: 0;
}

.app-shell--calm .lawyer-step-nav {
  padding: 16px 8px 22px clamp(8px, 1vw, 14px);
  border-right: 1px solid var(--border);
  background: rgba(242, 245, 248, 0.72);
}

.app-shell--calm .lawyer-step-nav__head,
.app-shell--calm .lawyer-reading-head,
.app-shell--calm .lawyer-source-stack__head {
  margin-bottom: 14px;
}

.app-shell--calm .lawyer-step-nav__head span,
.app-shell--calm .lawyer-reading-head span,
.app-shell--calm .lawyer-current-issue > span,
.app-shell--calm .subissue-list > span,
.app-shell--calm .lawyer-source-stack__head span {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .lawyer-step-nav__head p,
.app-shell--calm .lawyer-reading-head p,
.app-shell--calm .lawyer-source-stack__head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.app-shell--calm .lawyer-step-list {
  display: grid;
  gap: 4px;
}

.app-shell--calm .lawyer-step-btn {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px 6px;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid rgba(203, 212, 221, 0.76);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-shell--calm .lawyer-step-btn:hover,
.app-shell--calm .lawyer-step-btn.is-active {
  background: rgba(43, 91, 79, 0.08);
}

.app-shell--calm .lawyer-step-btn span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
}

.app-shell--calm .lawyer-step-btn.is-active span {
  background: var(--primary);
  color: #ffffff;
}

.app-shell--calm .lawyer-step-btn strong {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  font-size: 0.66rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell--calm .lawyer-step-btn small {
  display: -webkit-box;
  grid-column: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--muted);
  overflow: hidden;
  font-size: 0.66rem;
  line-height: 1.28;
}

.app-shell--calm .lawyer-reading-desk {
  padding: clamp(12px, 1.8vw, 24px);
  background: rgba(255, 255, 255, 0.96);
}

.app-shell--calm .lawyer-reading-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  max-width: 880px;
}

.app-shell--calm .lawyer-reading-head__title {
  min-width: 0;
}

.app-shell--calm .lawyer-reading-head h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.34rem, 2.05vw, 1.92rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.04;
}

.app-shell--calm .expected-answer {
  max-width: 760px;
  margin-top: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(203, 212, 221, 0.86);
  border-radius: 7px;
  background: rgba(250, 248, 242, 0.72);
}

.app-shell--calm .expected-answer__question {
  margin: 0;
  color: var(--text);
  font-size: clamp(0.9rem, 1vw, 0.98rem);
  font-weight: 800;
  line-height: 1.28;
}

.app-shell--calm .expected-answer__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.app-shell--calm .expected-answer-btn {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.app-shell--calm .expected-answer-btn:hover,
.app-shell--calm .expected-answer-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.app-shell--calm .expected-answer__facts {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(203, 212, 221, 0.82);
}

.app-shell--calm .expected-answer__facts span {
  display: block;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .expected-answer__facts p {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 0.79rem;
  line-height: 1.3;
}

.app-shell--calm .expected-answer__facts ul {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.28;
}

.app-shell--calm .expected-answer__facts.is-empty p {
  color: var(--muted);
}

.app-shell--calm .lawyer-reading-point {
  margin-top: 5px;
  font-size: 0.76rem;
  line-height: 1.28;
}

.app-shell--calm .step-flow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.app-shell--calm .flow-btn {
  display: grid;
  gap: 2px;
  min-width: 76px;
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-shell--calm .flow-btn span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .flow-btn strong {
  color: var(--primary);
  font-size: 0.8rem;
  line-height: 1.15;
}

.app-shell--calm .flow-btn--next {
  border-color: rgba(43, 91, 79, 0.38);
  background: rgba(43, 91, 79, 0.08);
}

.app-shell--calm .flow-btn--exception {
  border-color: rgba(159, 76, 47, 0.32);
  background: rgba(159, 76, 47, 0.08);
}

.app-shell--calm .flow-btn:disabled {
  cursor: default;
  opacity: 0.58;
}

.app-shell--calm .lawyer-current-issue {
  max-width: 880px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.app-shell--calm .lawyer-current-issue h3 {
  margin: 3px 0 7px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.06rem, 1.55vw, 1.42rem);
  font-weight: 600;
  line-height: 1.14;
}

.app-shell--calm .lawyer-current-issue .analysis-note-body {
  max-width: none;
  color: #33403c;
  font-size: clamp(0.84rem, 0.95vw, 0.93rem);
  line-height: 1.42;
}

.app-shell--calm .lawyer-current-issue .analysis-note-body p {
  margin: 0 0 5px;
}

.app-shell--calm .lawyer-current-issue .analysis-note-body ul,
.app-shell--calm .lawyer-current-issue .analysis-note-body ol {
  padding-left: 1.25rem;
}

.app-shell--calm .subissue-list {
  max-width: 900px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.app-shell--calm .subissue-list > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.app-shell--calm .subissue-list button {
  display: grid;
  gap: 3px;
  min-height: 46px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-shell--calm .subissue-list button.is-active {
  border-color: rgba(43, 91, 79, 0.55);
  background: rgba(43, 91, 79, 0.08);
}

.app-shell--calm .subissue-list button strong {
  color: var(--primary);
  font-size: 0.72rem;
}

.app-shell--calm .subissue-list button small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.22;
}

@media (min-width: 761px) {
  .app-shell--calm .subissue-list > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell--calm .subissue-list button {
    min-height: 34px;
    align-content: center;
  }

  .app-shell--calm .subissue-list button small {
    display: none;
  }
}

.app-shell--calm .lawyer-source-stack {
  padding: 22px var(--layout-gutter) 28px 18px;
  border-left: 1px solid var(--border);
  background: rgba(250, 248, 242, 0.82);
}

.app-shell--calm .reading-panel {
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid rgba(203, 212, 221, 0.86);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
}

.app-shell--calm .reading-panel h3 {
  margin: 0 0 9px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell--calm .reading-line {
  padding-top: 9px;
  border-top: 1px solid rgba(203, 212, 221, 0.7);
}

.app-shell--calm .reading-line:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.app-shell--calm .reading-line + .reading-line {
  margin-top: 9px;
}

.app-shell--calm .reading-line cite {
  display: block;
  color: var(--primary);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.35;
}

.app-shell--calm .source-focus {
  color: var(--text);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: rgba(43, 91, 79, 0.42);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.app-shell--calm .reading-line p,
.app-shell--calm .reading-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.48;
}

.app-shell--calm .lawyer-full-source {
  margin-top: 12px;
  border: 1px solid rgba(203, 212, 221, 0.86);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
}

.app-shell--calm .lawyer-full-source summary {
  padding: 11px 13px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.app-shell--calm .lawyer-full-source > div {
  padding: 0 13px 13px;
}

.app-shell--calm .lawyer-full-source .source-quote,
.app-shell--calm .lawyer-full-source .statute-quote {
  font-size: 0.84rem;
}

@media (max-width: 1000px) {
  .app-shell--calm .analysis-page-main {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .app-shell--calm .analysis-workbench,
  .app-shell--calm .analysis-workbench__mount,
  .app-shell--calm .lawyer-desk {
    height: auto;
  }

  .app-shell--calm .lawyer-desk {
    grid-template-columns: minmax(176px, 0.38fr) minmax(0, 1.42fr);
  }

  .app-shell--calm .lawyer-source-stack {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    border-left: 0;
    padding-left: var(--layout-gutter);
  }

  .app-shell--calm .lawyer-source-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .app-shell--calm .lawyer-source-stack__head,
  .app-shell--calm .lawyer-full-source {
    grid-column: 1 / -1;
  }

  .app-shell--calm .reading-panel {
    margin-bottom: 0;
  }
}

@media (max-width: 760px) {
  .app-shell--calm .lawyer-desk {
    display: flex;
    flex-direction: column;
  }

  .app-shell--calm .lawyer-step-nav {
    order: 1;
    padding: 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .app-shell--calm .lawyer-reading-desk {
    order: 2;
    padding: 22px 16px;
  }

  .app-shell--calm .lawyer-reading-head {
    display: grid;
    gap: 14px;
  }

  .app-shell--calm .step-flow-actions {
    justify-content: stretch;
  }

  .app-shell--calm .flow-btn {
    min-width: 0;
    flex: 1 1 120px;
  }

  .app-shell--calm .lawyer-source-stack {
    order: 3;
    display: block;
    padding: 18px 14px 28px;
  }

  .app-shell--calm .lawyer-reading-head h2 {
    font-size: clamp(1.95rem, 10vw, 2.65rem);
  }

  .app-shell--calm .subissue-list > div {
    grid-template-columns: 1fr;
  }
}

/* ===== Library shelf — every Library PDF as rule cards (generated data) ===== */

.app-shell--calm .library-shelf {
  max-width: 1180px;
  margin: 18px auto 40px;
  padding: clamp(14px, 2vw, 26px);
  border: 1px solid rgba(203, 212, 221, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.app-shell--calm .library-shelf__head {
  margin-bottom: 10px;
}

.app-shell--calm .library-shelf__kicker {
  display: inline-block;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-shell--calm .library-shelf__head h2 {
  margin: 4px 0 2px;
  font-size: 1.18rem;
}

.app-shell--calm .library-shelf__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.app-shell--calm .library-shelf__q {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: rgba(43, 91, 79, 0.06);
  font-size: 0.82rem;
}

.app-shell--calm .library-shelf__layer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell--calm .library-shelf__layer span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(43, 91, 79, 0.1);
  color: var(--primary);
  font-size: 0.66rem;
}

.app-shell--calm .lib-entry {
  margin: 0 0 8px;
  border: 1px solid rgba(203, 212, 221, 0.9);
  border-radius: 10px;
  background: #ffffff;
}

.app-shell--calm .lib-entry[open] {
  border-color: rgba(29, 79, 69, 0.4);
}

.app-shell--calm .lib-entry > summary {
  display: grid;
  grid-template-columns: minmax(150px, max-content) 1fr;
  gap: 2px 12px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.app-shell--calm .lib-entry > summary::-webkit-details-marker {
  display: none;
}

.app-shell--calm .lib-entry > summary:hover {
  background: rgba(43, 91, 79, 0.05);
}

.app-shell--calm .lib-entry > summary strong {
  color: var(--primary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.app-shell--calm .lib-entry > summary span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell--calm .lib-entry > summary em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
}

.app-shell--calm .lib-entry[open] > summary span,
.app-shell--calm .lib-entry > summary:hover span {
  white-space: normal;
}

.app-shell--calm .lib-entry__body {
  padding: 2px 14px 12px;
  border-top: 1px dashed rgba(203, 212, 221, 0.9);
  font-size: 0.82rem;
  line-height: 1.55;
}

.app-shell--calm .lib-entry__rule {
  margin: 10px 0 8px;
}

.app-shell--calm .lib-entry__elements {
  margin: 0 0 8px;
  padding-left: 20px;
}

.app-shell--calm .lib-entry__elements li {
  margin: 0 0 4px;
}

.app-shell--calm .lib-entry__quote {
  margin: 8px 0;
  padding: 7px 10px;
  border-left: 3px solid rgba(29, 79, 69, 0.45);
  border-radius: 0 8px 8px 0;
  background: rgba(43, 91, 79, 0.05);
  color: var(--text);
  font-size: 0.78rem;
}

.app-shell--calm .lib-entry__field {
  margin: 6px 0;
  color: var(--text);
  font-size: 0.78rem;
}

.app-shell--calm .lib-entry__note {
  margin: 10px 0 6px;
  padding: 8px 10px;
  border-left: 3px solid #9a4555;
  border-radius: 0 8px 8px 0;
  background: rgba(154, 69, 85, 0.06);
  font-size: 0.78rem;
}

.app-shell--calm .lib-entry__pdf {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.app-shell--calm .lib-entry__pdf code {
  font-size: 0.66rem;
}

@media (max-width: 760px) {
  .app-shell--calm .lib-entry > summary {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .lib-entry > summary span {
    white-space: normal;
  }
}

/* ══════════════════════════════════════════════════════════
   UI/UX v2 — collapsible source panels, layer badges
   ══════════════════════════════════════════════════════════ */

/* Collapsible reading panels (details/summary) */
.app-shell--calm details.reading-panel {
  padding: 0;
  overflow: hidden;
}

.app-shell--calm details.reading-panel[open] {
  border-color: rgba(29, 79, 69, 0.28);
}

.app-shell--calm .reading-panel__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 13px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  border-radius: inherit;
}

.app-shell--calm .reading-panel__summary::-webkit-details-marker { display: none; }

.app-shell--calm .reading-panel__summary::before {
  content: '▶';
  flex-shrink: 0;
  color: var(--muted-2);
  font-size: 0.55rem;
  transition: transform 0.15s;
}

.app-shell--calm details.reading-panel[open] .reading-panel__summary::before {
  transform: rotate(90deg);
}

.app-shell--calm .reading-panel__summary:hover {
  background: rgba(43, 91, 79, 0.05);
}

.app-shell--calm .reading-panel__title {
  flex: 1;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell--calm .reading-panel__count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(43, 91, 79, 0.11);
  color: #2a6b5b;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0;
}

.app-shell--calm .reading-panel__body {
  padding: 4px 13px 11px;
  border-top: 1px solid rgba(203, 212, 221, 0.7);
}

/* Layer badges */
.app-shell--calm .reading-line__meta {
  margin: 6px 0 2px;
}

.app-shell--calm .reading-layer-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Cool, desaturated badge family — five distinguishable tones, one palette.
   Doubled class (.reading-layer-badge.reading-layer-badge--x) raises specificity
   so the badge text colour wins inside library-card summaries too. */
.app-shell--calm .reading-layer-badge.reading-layer-badge--statute,
.app-shell--calm .reading-layer-badge.reading-layer-badge--framework {
  background: rgba(21, 107, 95, 0.13);
  color: #155349;
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--8-cfr-dhs,
.app-shell--calm .reading-layer-badge.reading-layer-badge--22-cfr-dos {
  background: rgba(35, 96, 166, 0.12);
  color: #1f568f;
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--fam-dos-guidance {
  background: rgba(77, 98, 115, 0.14);
  color: #41566a;
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--uscis-policy-manual {
  background: rgba(91, 90, 152, 0.13);
  color: #4c4b84;
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--case-law {
  background: rgba(154, 69, 85, 0.13);
  color: #893a4a;
}

/* Library shelf — when nested inside source stack */
.app-shell--calm .lawyer-source-stack .library-shelf {
  margin: 0;
  padding: clamp(10px, 1vw, 16px);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
  background: rgba(242, 245, 248, 0.6);
}

/* Collapsible wrapper for library shelf inside source panel */
.app-shell--calm .library-shelf-wrap {
  margin-top: 10px;
}

.app-shell--calm .library-shelf-wrap > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid rgba(203, 212, 221, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.app-shell--calm .library-shelf-wrap > summary::-webkit-details-marker { display: none; }

.app-shell--calm .library-shelf-wrap > summary::before {
  content: '▶';
  color: var(--muted-2);
  font-size: 0.55rem;
  transition: transform 0.15s;
}

.app-shell--calm .library-shelf-wrap[open] > summary::before {
  transform: rotate(90deg);
}

.app-shell--calm .library-shelf-wrap > summary:hover {
  background: rgba(43, 91, 79, 0.05);
}

.app-shell--calm .library-shelf-wrap > summary .reading-panel__count {
  margin-left: auto;
}

.app-shell--calm .library-shelf-wrap[open] > summary {
  border-radius: 8px 8px 0 0;
}

.app-shell--calm .library-shelf-wrap[open] > .library-shelf {
  border: 1px solid rgba(203, 212, 221, 0.86);
}

/* Sources header — step meta line */
.app-shell--calm .source-step-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

/* ══════════════════════════════════════════════════════════
   UI/UX v3 — Professional lawyer desk: practical source panel
   Research basis: Westlaw CoCounsel / lazarev.agency / adamfard.com
   Key principles applied:
     · Progressive disclosure (line-clamp, expand on demand)
     · Dense-but-scannable (layer left-borders, flat accordion)
     · Cognitive load reduction (sticky header, total count)
     · Professional typography (tighter spacing, clear cite)
   ══════════════════════════════════════════════════════════ */

/* ── Source stack: remove top padding, header owns spacing ── */
.app-shell--calm .lawyer-source-stack {
  padding: 0 0 32px;
}

/* ── Source header (sticky model removed — page now scrolls as a document) ── */
.app-shell--calm .lawyer-source-stack__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 16px 9px;
  margin-bottom: 0;
  border-bottom: 2px solid rgba(203, 212, 221, 0.9);
  background: rgba(242, 245, 248, 0.97);
}

/* ── Flatten reading panels into accordion strips ── */
.app-shell--calm .reading-panel {
  margin-bottom: 0;
  padding: 0;
  border: none;
  border-bottom: 1px solid rgba(203, 212, 221, 0.65);
  border-radius: 0;
  background: transparent;
}

.app-shell--calm details.reading-panel[open] {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(196, 205, 215, 0.75);
}

/* ── Layer-type left-border accent: visual hierarchy at a glance ── */
.app-shell--calm details.reading-panel--primary     { border-left: 3px solid #2a7a6a; }
.app-shell--calm details.reading-panel--regulations { border-left: 3px solid #3a509c; }
.app-shell--calm details.reading-panel--agency      { border-left: 3px solid #7a5c26; }
.app-shell--calm details.reading-panel--doctrine    { border-left: 3px solid #922a2a; }
.app-shell--calm details.reading-panel--practice    { border-left: 3px solid #5a6a6a; }

/* ── Tighter summary row ── */
.app-shell--calm .reading-panel__summary {
  padding: 8px 13px 8px 11px;
}

/* ── Panel body: tighter ── */
.app-shell--calm .reading-panel__body {
  padding: 2px 13px 10px 13px;
  border-top: 1px solid rgba(203, 212, 221, 0.45);
}

/* ── Line-clamp source text: lawyers scan cites, expand library for full text ── */
.app-shell--calm .reading-line p {
  font-size: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Cite: slightly smaller for density, keep bold ── */
.app-shell--calm .reading-line cite {
  font-size: 0.75rem;
}

/* ── Reading line: tighter spacing ── */
.app-shell--calm .reading-line {
  padding-top: 7px;
}

.app-shell--calm .reading-line + .reading-line {
  margin-top: 7px;
}

/* ── Specificity fix: step-meta and total-count override the generic span rule ── */
.app-shell--calm .lawyer-source-stack__head .source-step-meta {
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}

/* ── Total source count chip in header ── */
.app-shell--calm .source-total-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-shell--calm .lawyer-source-stack__head .source-total-count {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}

.app-shell--calm .source-total-count strong {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(43, 91, 79, 0.12);
  color: #2a6b5b;
  font-size: 0.59rem;
  font-weight: 800;
}

/* ── Library shelf: flatten into same accordion style ── */
.app-shell--calm .library-shelf-wrap {
  margin-top: 0;
  border-top: 1px solid rgba(203, 212, 221, 0.65);
  border-left: 3px solid #9b7c3d;
}

.app-shell--calm .library-shelf-wrap > summary {
  border: none;
  border-radius: 0;
  background: transparent;
}

.app-shell--calm .library-shelf-wrap[open] > summary {
  border-bottom: 1px solid rgba(203, 212, 221, 0.5);
  background: rgba(255, 255, 255, 0.55);
}

/* ── Middle desk: explicit right border ── */
.app-shell--calm .lawyer-reading-desk {
  border-right: 1px solid var(--border);
}

/* ── Analysis body: 68-char measure, comfortable reading ── */
.app-shell--calm .analysis-note-body {
  max-width: 68ch;
  margin-top: 10px;
}

/* ══════════════════════════════════════════════════════════
   v4 — Two-zone source panel (consolidates v3 in source order)
   Design standards (redesign-skill + taste-skill, dense sidebar):
     · weight ≤600, one uppercase eyebrow, sentence-case headings
     · single interactive accent (var(--accent)); layer color lives
       only on badges — no per-group left-border hues
     · 8px / 999px radius system; tabular numerals; ≥0.72rem floor
     · no mid-sentence truncation; disclosure is the collapse
     · visible focus rings; reduced-motion guard
   ══════════════════════════════════════════════════════════ */

/* Header: one eyebrow, accurate derived count line */
.app-shell--calm .lawyer-source-stack__head > span:first-child {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.app-shell--calm .lawyer-source-stack__head .source-total-count {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.app-shell--calm .source-total-count strong {
  display: inline;
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Group headings: sentence case, no 900 weight */
.app-shell--calm .reading-panel__title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.app-shell--calm .reading-panel__count,
.app-shell--calm .library-shelf-wrap > summary .reading-panel__count {
  min-width: 18px;
  height: 16px;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--primary-soft);
  color: var(--primary);
}

/* Layer identity lives only on the badge — drop the v3 per-group hues */
.app-shell--calm details.reading-panel--primary,
.app-shell--calm details.reading-panel--regulations,
.app-shell--calm details.reading-panel--agency,
.app-shell--calm details.reading-panel--doctrine,
.app-shell--calm details.reading-panel--practice {
  border-left: 0;
}
.app-shell--calm .library-shelf-wrap {
  border-left: 0;
}

/* No truncation — full text, disclosure handles density */
.app-shell--calm .reading-line p {
  font-size: 0.82rem;
  line-height: 1.5;
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
}
.app-shell--calm .reading-line cite {
  font-size: 0.8rem;
  font-weight: 600;
}
.app-shell--calm .reading-line--fallback p {
  color: var(--muted);
  font-style: italic;
}

/* Layer badge: readable floor, sentence-ish caps kept short */
.app-shell--calm .reading-layer-badge {
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* —— Zone A: keyed rule cards —— */
.app-shell--calm .source-zone--keyed {
  padding: 12px 14px 4px;
}
.app-shell--calm .source-zone__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.app-shell--calm .source-zone__note {
  margin: -4px 0 10px;
  font-size: 0.72rem;
  color: var(--muted);
}
.app-shell--calm .source-empty {
  margin: 10px 14px 0;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  background: var(--primary-soft);
}
.app-shell--calm .source-empty code {
  font-size: 0.72rem;
}

/* Library card: single-row summary (badge + cite + title) */
.app-shell--calm .lib-entry {
  border-radius: var(--radius);
}
.app-shell--calm .lib-entry > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  grid-template-columns: none;
}
.app-shell--calm .lib-entry__cite {
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: normal;
}
.app-shell--calm .lib-entry__title {
  flex: 1 1 100%;
  min-width: 0;
  color: var(--text);
  font-size: 0.8rem;
  white-space: normal;
}
.app-shell--calm .lib-entry__forum {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

/* External-source row inside a card: cite link + PDF chips */
.app-shell--calm .lib-entry__sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
}

/* External cite links — one accent, arrow affordance */
.app-shell--calm .src-ext {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s var(--ease, ease), color 0.18s var(--ease, ease);
}
.app-shell--calm .src-ext::after {
  content: " \2197";
  font-size: 0.85em;
  opacity: 0.7;
}
.app-shell--calm .src-ext:hover {
  border-bottom-color: var(--accent);
}
.app-shell--calm .reading-line cite .src-ext {
  font-weight: 600;
}

/* Local PDF chips */
.app-shell--calm .lib-pdf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.18s var(--ease, ease), border-color 0.18s var(--ease, ease);
}
.app-shell--calm .lib-pdf-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.app-shell--calm .lib-pdf-chip__tag {
  flex: none;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.app-shell--calm .lib-pdf-chip--plain,
.app-shell--calm .lib-pdf-chip--offline {
  color: var(--muted);
  border-style: dashed;
  cursor: default;
}
.app-shell--calm .lib-pdf-chip--offline:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
.app-shell--calm .lib-pdf-chip--offline .lib-pdf-chip__tag {
  background: var(--primary-soft);
  color: var(--muted);
}

/* —— Zone B: step library filter + browse —— */
.app-shell--calm .lib-filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 4px;
}
.app-shell--calm .lib-filter {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}
.app-shell--calm .lib-filter::placeholder {
  color: var(--muted-2);
}
.app-shell--calm .lib-filter-count {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.app-shell--calm .lib-layer-group[hidden] {
  display: none;
}
.app-shell--calm .source-empty--filter {
  margin: 8px 14px 12px;
}

/* Library shelf summary: sentence-case label */
.app-shell--calm .library-shelf-wrap > summary span:first-child {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* Browse-list layer dividers: quiet, not 800-weight eyebrows */
.app-shell--calm .library-shelf__layer {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.app-shell--calm .library-shelf__layer span {
  font-variant-numeric: tabular-nums;
}

/* —— Cross-reference: clickable cites in the middle analysis prose —— */
.app-shell--calm .lawyer-reading-desk .cite-ref {
  appearance: none;
  margin: 0;
  padding: 0 1px;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 2px;
  transition: background 0.15s var(--ease, ease), border-color 0.15s var(--ease, ease);
}
.app-shell--calm .lawyer-reading-desk .cite-ref:hover {
  background: var(--accent-soft);
  border-bottom-color: var(--accent);
}
.app-shell--calm .lawyer-reading-desk .cite-ref::after {
  content: "\2192";  /* → : "jump to source" affordance */
  margin-left: 2px;
  font-size: 0.82em;
  opacity: 0;
  transition: opacity 0.15s var(--ease, ease);
}
.app-shell--calm .lawyer-reading-desk .cite-ref:hover::after,
.app-shell--calm .lawyer-reading-desk .cite-ref:focus-visible::after {
  opacity: 0.75;
}
.app-shell--calm .lawyer-reading-desk .cite-ref:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reveal cue: a gentle ring that pulses AROUND the target and fades.
   It never alters the element's own background or covers its text, so
   there's no flicker/snap when the animation ends. */
.app-shell--calm .lawyer-source-stack .is-cite-target {
  position: relative;
}
.app-shell--calm .lawyer-source-stack .is-cite-target::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius) + 2px);
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px var(--primary-soft);
  animation: citeTargetPulse 1.1s var(--ease, ease) forwards;
}
@keyframes citeTargetPulse {
  0% { opacity: 0; }
  16% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell--calm .lawyer-source-stack .is-cite-target::after {
    animation: none;
    opacity: 1;
  }
}

/* Focus + motion (currently absent on the panel) */
.app-shell--calm .lawyer-source-stack a:focus-visible,
.app-shell--calm .lawyer-source-stack summary:focus-visible,
.app-shell--calm .lib-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.app-shell--calm .lib-filter:focus-visible {
  border-color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  .app-shell--calm .src-ext,
  .app-shell--calm .lib-pdf-chip {
    transition: none;
  }
}

/* ══════════════════════════════════════════════════════════
   v4 type scale — one coherent 4-step ramp for the source panel
   Replaces the ~10 ad-hoc sizes with: read-content 14px, labels
   13.4px, meta 12px, micro 11.2px. Reading content is the largest
   because that is what the user actually reads.
   ══════════════════════════════════════════════════════════ */
.app-shell--calm .lawyer-source-stack {
  /* crisper text + sensible OpenType features for statute numbers */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  --src-micro: 0.7rem;    /* 11.2px — badges, chips, forum, dividers, counts */
  --src-meta: 0.75rem;    /* 12px   — eyebrow, count line, panel/zone titles */
  --src-label: 0.84rem;   /* 13.4px — cites, card titles */
  --src-read: 0.875rem;   /* 14px   — reading text, rule text, quotes */
}

/* read-content: the text the user actually reads — largest, most air */
.app-shell--calm .reading-line p,
.app-shell--calm .lib-entry__rule {
  font-size: var(--src-read);
  line-height: 1.58;
}
.app-shell--calm .lib-entry__quote {
  font-size: calc(var(--src-read) - 0.02rem);
  line-height: 1.55;
}
.app-shell--calm .lib-entry__elements,
.app-shell--calm .lib-entry__field,
.app-shell--calm .lib-entry__note {
  font-size: calc(var(--src-read) - 0.025rem);
  line-height: 1.55;
}

/* labels: cites + card titles — emphasized but not body-sized.
   Summary-scoped selectors beat the base `.lib-entry > summary strong/span`
   specificity so lib cites match reading cites. */
.app-shell--calm .reading-line cite,
.app-shell--calm .lib-entry > summary .lib-entry__cite,
.app-shell--calm .lib-entry > summary .lib-entry__title {
  font-size: var(--src-label);
  line-height: 1.42;
}

/* meta: eyebrow, count line, section titles, filter input */
.app-shell--calm .lawyer-source-stack__head > span:first-child,
.app-shell--calm .lawyer-source-stack__head .source-total-count,
.app-shell--calm .reading-panel__title,
.app-shell--calm .source-zone__title,
.app-shell--calm .library-shelf-wrap > summary span:first-child,
.app-shell--calm .lib-filter {
  font-size: var(--src-meta);
}
.app-shell--calm .lib-filter { line-height: 1.4; }

/* micro: badges, chips, forum line, dividers, source-zone note, counts */
.app-shell--calm .reading-layer-badge,
.app-shell--calm .lib-pdf-chip,
.app-shell--calm .lib-entry__forum,
.app-shell--calm .library-shelf__layer,
.app-shell--calm .source-zone__note,
.app-shell--calm .lib-filter-count,
.app-shell--calm .reading-panel__count {
  font-size: var(--src-micro);
}
.app-shell--calm .lib-pdf-chip__tag {
  font-size: calc(var(--src-micro) - 0.1rem);
}

/* tabular numerals everywhere a count/section number appears */
.app-shell--calm .lawyer-source-stack {
  font-variant-numeric: tabular-nums;
}
/* …but keep prose proportional so body text reads naturally */
.app-shell--calm .reading-line p,
.app-shell--calm .lib-entry__rule,
.app-shell--calm .lib-entry__quote,
.app-shell--calm .lib-entry__field,
.app-shell--calm .lib-entry__elements {
  font-variant-numeric: normal;
}

/* ══════════════════════════════════════════════════════════
   v5 — Premium polish pass (redesign-skill audit + 2026 trends)
   · Header presence + context + honest meta
   · Warm grain + tinted-soft depth (anti-flat)
   · Shape-lock (one radius), motivated entry motion
   · Focus rings + press feedback on every control (a11y)
   Scoped to .app-shell--calm; reduced-motion respected.
   ══════════════════════════════════════════════════════════ */

/* —— Header: give the wordmark presence, add context + meta —— */
.app-shell--calm .header-main h1 {
  font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.6rem);
  letter-spacing: -0.012em;
  line-height: 1.05;
}
.app-shell--calm .header-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.005em;
}
.app-shell--calm .header-meta {
  margin: 0;
  color: var(--muted-2);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .app-shell--calm .header-meta { display: none; }
}
.app-shell--calm .brand-sigil {
  box-shadow: 0 1px 2px rgba(29, 79, 69, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* —— Warm grain: a faint paper tooth over flat surfaces. Kept extremely
   low (≈1% effective) so it never muddies the reading text. —— */
.app-shell--calm::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

/* —— Depth: tinted-soft elevation where it communicates hierarchy —— */
.app-shell--calm .source-zone--keyed .lib-entry {
  box-shadow: 0 1px 2px rgba(29, 79, 69, 0.05), 0 4px 14px -8px rgba(29, 79, 69, 0.14);
}
.app-shell--calm .source-zone--keyed .lib-entry[open] {
  box-shadow: 0 2px 6px rgba(29, 79, 69, 0.07), 0 10px 26px -12px rgba(29, 79, 69, 0.2);
}
.app-shell--calm .lawyer-step-btn.is-active {
  box-shadow: inset 2px 0 0 var(--primary);
}

/* —— Shape-lock: one radius system (was a stray 7px) —— */
.app-shell--calm .lawyer-step-btn { border-radius: var(--radius); }

/* —— Press feedback + hover on every control —— */
.app-shell--calm .lawyer-step-btn,
.app-shell--calm .subissue-list button,
.app-shell--calm .expected-answer-btn,
.app-shell--calm .flow-btn {
  transition: background 0.18s var(--ease, ease), box-shadow 0.18s var(--ease, ease),
    transform 0.12s var(--ease, ease), border-color 0.18s var(--ease, ease);
}
.app-shell--calm .lawyer-step-btn:active,
.app-shell--calm .subissue-list button:active,
.app-shell--calm .expected-answer-btn:active,
.app-shell--calm .flow-btn:not(:disabled):active {
  transform: translateY(1px);
}

/* —— Focus rings across the app (panel already had them) —— */
.app-shell--calm .lawyer-step-btn:focus-visible,
.app-shell--calm .subissue-list button:focus-visible,
.app-shell--calm .expected-answer-btn:focus-visible,
.app-shell--calm .flow-btn:focus-visible,
.app-shell--calm .cite-ref:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* —— Motivated entry motion: middle + sources fade as the issue changes —— */
@keyframes calmContentIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.app-shell--calm .lawyer-current-issue,
.app-shell--calm .lawyer-source-stack {
  animation: calmContentIn 0.3s var(--ease, ease) both;
}
.app-shell--calm .lawyer-source-stack { animation-delay: 0.04s; }
@media (prefers-reduced-motion: reduce) {
  .app-shell--calm .lawyer-current-issue,
  .app-shell--calm .lawyer-source-stack { animation: none; }
}

/* ══════════════════════════════════════════════════════════
   v6 — Left nav as a premium vertical step-rail
   · Connecting spine through the step markers (flow, not a list)
   · Legible type (was 0.66rem), calmer eyebrow weight (no 900)
   · Refined number markers with clear current state
   ══════════════════════════════════════════════════════════ */

/* Calm the eyebrow weight epidemic (900 → 600) across section heads */
.app-shell--calm .lawyer-step-nav__head span,
.app-shell--calm .lawyer-reading-head span,
.app-shell--calm .lawyer-current-issue > span,
.app-shell--calm .subissue-list > span {
  font-weight: 600;
  letter-spacing: 0.07em;
}

/* The rail: a hairline spine linking the step markers */
.app-shell--calm .lawyer-step-list {
  position: relative;
  gap: 2px;
}
.app-shell--calm .lawyer-step-list::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: var(--border-strong);
  border-radius: 2px;
}

/* Markers sit above the spine; opaque so they mask the line */
.app-shell--calm .lawyer-step-btn {
  position: relative;
  z-index: 1;
  align-items: center;
  padding: 9px 8px;
  gap: 4px 10px;
}
.app-shell--calm .lawyer-step-btn span {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 0.18s var(--ease, ease), color 0.18s var(--ease, ease),
    border-color 0.18s var(--ease, ease);
}
.app-shell--calm .lawyer-step-btn:hover span {
  border-color: var(--primary);
  color: var(--primary);
}
.app-shell--calm .lawyer-step-btn.is-active span {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Legible step labels (were 0.66rem) */
.app-shell--calm .lawyer-step-btn strong {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
}
.app-shell--calm .lawyer-step-btn.is-active strong {
  color: var(--primary);
}
.app-shell--calm .lawyer-step-btn small {
  font-size: 0.74rem;
  line-height: 1.35;
}

/* The active row reads as the current stop, not a heavy block */
.app-shell--calm .lawyer-step-btn.is-active {
  background: var(--primary-soft);
  box-shadow: none;
}

/* ══════════════════════════════════════════════════════════
   v7 — Footer step-pager (replaces floating Next/Jump buttons)
   Anchored to the bottom of the reading column, so it also
   fills the column's trailing whitespace.
   ══════════════════════════════════════════════════════════ */

/* Make the reading column a flex column so the pager can sit at the bottom */
.app-shell--calm .lawyer-reading-desk {
  display: flex;
  flex-direction: column;
}

.app-shell--calm .step-pager {
  margin-top: auto;            /* push to the bottom of the reading column */
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.app-shell--calm .pager-spacer { flex: 1 1 0; }
.app-shell--calm .pager-jump {
  flex: 0 0 auto;
  align-self: center;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.18s var(--ease, ease), background 0.18s var(--ease, ease);
}
.app-shell--calm .pager-jump:hover { color: var(--accent); background: var(--accent-soft); }

.app-shell--calm .pager-btn {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  transition: background 0.18s var(--ease, ease), border-color 0.18s var(--ease, ease),
    box-shadow 0.18s var(--ease, ease), transform 0.12s var(--ease, ease);
}
.app-shell--calm .pager-btn:active { transform: translateY(1px); }
.app-shell--calm .pager-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-shell--calm .pager-btn__dir {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}
.app-shell--calm .pager-btn strong {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Previous — quiet ghost, left-aligned */
.app-shell--calm .pager-btn--prev {
  align-items: flex-start;
  text-align: left;
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}
.app-shell--calm .pager-btn--prev:hover { background: var(--primary-soft); border-color: var(--primary); }
.app-shell--calm .pager-btn--prev .pager-btn__dir { color: var(--muted); }

/* Continue — the primary action, filled, right-aligned, pushed to the right */
.app-shell--calm .pager-btn--next,
.app-shell--calm .pager-btn--restart {
  margin-left: auto;
  align-items: flex-end;
  text-align: right;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(29, 79, 69, 0.12), 0 6px 16px -10px rgba(29, 79, 69, 0.5);
}
.app-shell--calm .pager-btn--next:hover,
.app-shell--calm .pager-btn--restart:hover { background: var(--primary-hover); }
.app-shell--calm .pager-btn--next .pager-btn__dir,
.app-shell--calm .pager-btn--restart .pager-btn__dir { color: rgba(255, 255, 255, 0.82); }

/* Mobile: stack full-width, primary first */
@media (max-width: 640px) {
  .app-shell--calm .step-pager { flex-wrap: wrap; }
  .app-shell--calm .pager-spacer { display: none; }
  .app-shell--calm .pager-btn { flex: 1 1 100%; align-items: flex-start; text-align: left; }
  .app-shell--calm .pager-btn--next, .app-shell--calm .pager-btn--restart { margin-left: 0; order: -1; }
  .app-shell--calm .pager-jump { flex: 1 1 100%; text-align: center; }
}

/* ══════════════════════════════════════════════════════════
   v9 — De-slop pass: kill the AI-template tells
   · Eyebrows recede to quiet chrome (not loud azure on every block)
   · The question + cards stop being bordered boxes
   · Heading hierarchy: step title (serif) vs sub-question (sans)
   · Cap the heavy-weight epidemic; remove the mid-column void
   ══════════════════════════════════════════════════════════ */

/* 1 — Eyebrows: quiet muted micro-labels, not azure shouts above every block */
.app-shell--calm .lawyer-step-nav__head span,
.app-shell--calm .lawyer-reading-head span,
.app-shell--calm .lawyer-current-issue > span,
.app-shell--calm .subissue-list > span,
.app-shell--calm .expected-answer__facts span {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.67rem;
  letter-spacing: 0.05em;
}
/* keep ONE accented eyebrow — the Sources panel title — for orientation */
.app-shell--calm .lawyer-source-stack__head > span:first-child {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* 2 — The expected-answer is a question + a row of choices, not a tinted box */
.app-shell--calm .expected-answer {
  max-width: 640px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
}
.app-shell--calm .expected-answer__question {
  font-size: 1rem;
  font-weight: 600;
}
.app-shell--calm .expected-answer-btn {
  font-weight: 600;
  border-color: var(--border-strong);
}
.app-shell--calm .expected-answer__facts { border-top-color: var(--border); }

/* 3 — Sub-question reads as working text (sans), not a second serif display title */
.app-shell--calm .lawyer-current-issue h3 {
  font-family: var(--font-ui);
  font-size: clamp(1.02rem, 1.1vw, 1.18rem);
  font-weight: 600;
  letter-spacing: -0.004em;
  line-height: 1.3;
}

/* 4 — Issue files: light chips, not heavy white cards */
.app-shell--calm .subissue-list button {
  border-color: var(--border);
  background: transparent;
  border-radius: var(--radius);
}
.app-shell--calm .subissue-list button:hover { background: var(--surface-2); }
.app-shell--calm .subissue-list button strong { font-weight: 600; }

/* 5 — Source cards: lean on soft shadow + spacing, drop the hard border */
.app-shell--calm .source-zone--keyed .lib-entry { border-color: var(--border); }
.app-shell--calm .expected-answer__question { line-height: 1.3; }

/* 6 — Remove the mid-column void: pager follows content, not pinned to the floor */
.app-shell--calm .step-pager { margin-top: clamp(22px, 4vh, 40px); }

/* 7 — Tame remaining heavy weights (taste: hierarchy via size/colour, not 900) */
.app-shell--calm .lawyer-step-btn span { font-weight: 600; }
.app-shell--calm .reading-panel__title,
.app-shell--calm .source-zone__title { font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   v10 — Restraint pass (Linear / Stripe-docs direction)
   One clean sans (Geist), flat surfaces, dividers over cards,
   quiet columns. Less chrome = more professional.
   ══════════════════════════════════════════════════════════ */

/* Geist display wants tight tracking at large sizes */
.app-shell--calm .header-main h1,
.app-shell--calm .lawyer-reading-head h2 {
  letter-spacing: -0.02em;
  font-weight: 600;
}
.app-shell--calm .lawyer-reading-head h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  line-height: 1.08;
}

/* Drop the paper-grain overlay — restraint, not texture */
.app-shell--calm::after { content: none; }

/* Flatten source cards: no floating shadow, single hairline, flush stacking */
.app-shell--calm .source-zone--keyed .lib-entry,
.app-shell--calm .source-zone--keyed .lib-entry[open] {
  box-shadow: none;
  border: 1px solid var(--border);
}

/* Quiet the columns: near-uniform surfaces separated by hairlines, not tints */
.app-shell--calm .lawyer-step-nav { background: transparent; }
.app-shell--calm .lawyer-source-stack__head { background: rgba(255, 255, 255, 0.9); }
.app-shell--calm.app-shell { background: var(--bg); }

/* Brand sigil: flat, no inner-glow shadow */
.app-shell--calm .brand-sigil { box-shadow: none; }

/* Active step: a clean filled marker + faint row, no halo ring */
.app-shell--calm .lawyer-step-btn.is-active span { box-shadow: none; }

/* PDF + external chips: flatter */
.app-shell--calm .lib-pdf-chip { box-shadow: none; }

/* ══════════════════════════════════════════════════════════
   v11 — Button system: one crafted, consistent language
   All buttons: 8px rect, smooth states, real press feedback.
   Primary = filled teal w/ highlight + lift · Secondary = crisp
   ghost · Toggles = soft-select. Tags/badges stay pills (distinct).
   ══════════════════════════════════════════════════════════ */
.app-shell--calm .expected-answer-btn,
.app-shell--calm .subissue-list button,
.app-shell--calm .pager-btn {
  border-radius: var(--radius);
  transition: background 0.15s var(--ease, ease), border-color 0.15s var(--ease, ease),
    color 0.15s var(--ease, ease), box-shadow 0.15s var(--ease, ease), transform 0.1s var(--ease, ease);
}

/* Answer toggles — Yes / No / Unclear */
.app-shell--calm .expected-answer-btn {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}
.app-shell--calm .expected-answer-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.app-shell--calm .expected-answer-btn:active { transform: translateY(1px); }
.app-shell--calm .expected-answer-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(21, 86, 75, 0.25);
}

/* Issue-file selector — tab-like chips */
.app-shell--calm .subissue-list button {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.app-shell--calm .subissue-list button:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.app-shell--calm .subissue-list button:active { transform: translateY(1px); }
.app-shell--calm .subissue-list button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.app-shell--calm .subissue-list button.is-active strong { color: var(--primary); }

/* Primary action — Continue / Start over: crafted fill */
.app-shell--calm .pager-btn--next,
.app-shell--calm .pager-btn--restart {
  background: linear-gradient(180deg, #1c6354 0%, var(--primary) 100%);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(21, 86, 75, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.app-shell--calm .pager-btn--next:hover,
.app-shell--calm .pager-btn--restart:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px -3px rgba(21, 86, 75, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}
.app-shell--calm .pager-btn--next:active,
.app-shell--calm .pager-btn--restart:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(21, 86, 75, 0.3);
}

/* Secondary action — Previous: crisp ghost, matches primary height */
.app-shell--calm .pager-btn--prev {
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.app-shell--calm .pager-btn--prev:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════
   v13 — Remove the template tells at the source
   · Kill the "label over every block" pattern (not just its colour)
   · De-box the sources into a divider-separated list
   · Lighten the issue-file selector (fill, not borders)
   ══════════════════════════════════════════════════════════ */

/* 1 — Drop the redundant in-content eyebrows entirely */
.app-shell--calm .lawyer-reading-head span,      /* "STEP N"  → H2 + nav already say it */
.app-shell--calm .lawyer-current-issue > span {  /* "NATIONALITY SCREEN" → H3 + active chip say it */
  display: none;
}
/* "Issue files" becomes a quiet functional label, not an uppercase eyebrow */
.app-shell--calm .subissue-list > span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

/* 2 — Sources: a clean list of disclosures separated by hairlines, not a stack of cards */
.app-shell--calm .source-zone--keyed .lib-entry,
.app-shell--calm .library-shelf .lib-entry {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin: 0;
}
.app-shell--calm .source-zone--keyed .lib-entry:last-child,
.app-shell--calm .library-shelf .lib-entry:last-child {
  border-bottom: 0;
}
.app-shell--calm .lib-entry > summary { padding: 10px 2px; }
.app-shell--calm .lib-entry__body { padding: 2px 2px 12px; }

/* 3 — Issue-file selector: soft fills, not bordered cards */
.app-shell--calm .subissue-list button {
  border-color: transparent;
  background: var(--surface-2);
  box-shadow: none;
}
.app-shell--calm .subissue-list button:hover {
  border-color: transparent;
  background: var(--surface-3);
}
.app-shell--calm .subissue-list button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: none;
}

/* v14 — Sources header removed; give the panel top breathing room */
.app-shell--calm .lawyer-source-stack { padding-top: 16px; }

/* v16 — Step 1 jus soli / jus sanguinis teaching fork (comparison table) */
.app-shell--calm .fork-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: 0.84rem;
  line-height: 1.45;
}
.app-shell--calm .fork-table caption {
  text-align: left;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.app-shell--calm .fork-table th,
.app-shell--calm .fork-table td {
  text-align: left;
  vertical-align: top;
  padding: 9px 16px 9px 0;
  border-bottom: 1px solid var(--border);
}
.app-shell--calm .fork-table thead th {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.app-shell--calm .fork-table thead th em { font-style: italic; }
.app-shell--calm .fork-table tbody th[scope="row"] {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
  width: 1%;
  padding-right: 20px;
}
.app-shell--calm .fork-table tbody td { color: var(--ink); }
.app-shell--calm .fork-table tbody tr:last-child th,
.app-shell--calm .fork-table tbody tr:last-child td { border-bottom: none; }
@media (max-width: 460px) {
  .app-shell--calm .fork-table,
  .app-shell--calm .fork-table thead,
  .app-shell--calm .fork-table tbody,
  .app-shell--calm .fork-table tr,
  .app-shell--calm .fork-table th,
  .app-shell--calm .fork-table td { display: block; }
  .app-shell--calm .fork-table thead { display: none; }
  .app-shell--calm .fork-table tbody th[scope="row"] {
    width: auto;
    border-bottom: none;
    padding: 10px 0 2px;
  }
  .app-shell--calm .fork-table tbody td { padding: 2px 0; border-bottom: none; }
  .app-shell--calm .fork-table tbody td:first-of-type::before { content: "Jus soli — "; color: var(--muted-2); font-style: italic; }
  .app-shell--calm .fork-table tbody td:last-of-type::before { content: "Jus sanguinis — "; color: var(--muted-2); font-style: italic; }
  .app-shell--calm .fork-table tbody tr { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
}

/* =========================================================================
   v17 — Step rail relocated to a hide-on-scroll TOP BAR; desk → 2 columns
   (Analysis | sticky Sources); fixed-height workbench → normal page scroll.
   ========================================================================= */
.app-shell--calm { --stepbar-h: 50px; }

/* Document scrolls normally (re-assert the removed fixed-height model so
   neither duplicate .analysis-page-main block can resurface it). */
.app-shell--calm .analysis-page-main { height: auto; max-height: none; overflow: visible; }
.app-shell--calm .analysis-workbench,
.app-shell--calm .analysis-workbench__mount,
.app-shell--calm .lawyer-desk { height: auto; min-height: 0; }
.app-shell--calm .lawyer-reading-desk { overflow: visible; }

/* Anchor / skip-link / scrollIntoView jumps clear the sticky header + bar. */
html { scroll-padding-top: 130px; } /* ≈ header (76) + step bar (50) + 4 */

/* Desk: two columns; the rail spans full width as its own top row. */
.app-shell--calm .lawyer-desk {
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  align-items: start;
}

/* ── Step rail as a full-width sticky TOP BAR, below the sticky site header ── */
.app-shell--calm .lawyer-step-nav {
  grid-column: 1 / -1;
  position: sticky;
  top: var(--header-sticky-h);
  z-index: 40;
  padding: 7px clamp(12px, 1.6vw, 24px);
  border-right: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow-x: auto;
  transition: transform 0.26s var(--ease, ease);
}
/* Hidden state lives on the STABLE #treeContainer (survives every re-render). */
.app-shell--calm #treeContainer.nav-hidden .lawyer-step-nav {
  transform: translateY(calc(-100% - var(--header-sticky-h)));
}
/* Drop the eyebrow head so the bar stays one shallow row. */
.app-shell--calm .lawyer-step-nav .lawyer-step-nav__head { display: none; }

/* Step list → one horizontal row of the six step buttons. */
.app-shell--calm .lawyer-step-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  min-width: max-content;
}
/* Vertical connector spine → horizontal hairline centred on the markers. */
.app-shell--calm .lawyer-step-list::before {
  left: 18px;
  right: 18px;
  top: 50%;
  bottom: auto;
  width: auto;
  height: 2px;
  transform: translateY(-50%);
}
/* Buttons sit side-by-side instead of full-width stacked rows. */
.app-shell--calm .lawyer-step-btn {
  width: auto;
  flex: 0 0 auto;
  border-bottom: 0;
  align-items: center;
  padding: 6px 12px;
}
.app-shell--calm .lawyer-step-btn small { display: none; }
/* Active step reads as an underline on a horizontal bar (soft fill still applies). */
.app-shell--calm .lawyer-step-btn.is-active { box-shadow: inset 0 -2px 0 var(--primary); }
/* Focus ring as an inset shadow so the overflow-x:auto bar can't clip the outline. */
.app-shell--calm .lawyer-step-nav .lawyer-step-btn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ── Sources column tracks Analysis: sticky under the bar ── */
.app-shell--calm .lawyer-source-stack {
  position: sticky;
  top: calc(var(--header-sticky-h) + var(--stepbar-h));
  align-self: start;
  max-height: calc(100dvh - var(--header-sticky-h) - var(--stepbar-h));
  overflow-y: auto;
  animation: none; /* was sticky + re-sliding on every render — disable entry slide */
}

/* ── ≤1000px: keep 2-col (analysis | sticky sources); override the old 3-col
   collapse rules so Sources stays the right column rather than full-width. ── */
@media (max-width: 1000px) {
  .app-shell--calm .lawyer-desk {
    grid-template-columns: minmax(0, 1.5fr) minmax(250px, 1fr);
  }
  .app-shell--calm .lawyer-source-stack {
    grid-column: auto;
    border-top: 0;
    display: block;
  }
  .app-shell--calm .lawyer-reading-desk { border-right: 1px solid var(--border); }
}

/* ── ≤760px: stack (rail / analysis / sources); rail wraps; sources un-sticks ── */
@media (max-width: 760px) {
  .app-shell--calm .lawyer-step-nav { overflow-x: visible; }
  .app-shell--calm .lawyer-step-list { flex-wrap: wrap; min-width: 0; }
  .app-shell--calm .lawyer-step-list::before { display: none; }
  .app-shell--calm .lawyer-step-btn strong { white-space: normal; }
  .app-shell--calm .lawyer-source-stack {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .app-shell--calm .lawyer-reading-desk { border-right: 0; }
}

/* ── Reduced motion: no slide on hide / reveal ── */
@media (prefers-reduced-motion: reduce) {
  .app-shell--calm .lawyer-step-nav { transition: none; }
}
