/**
 * 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 {

  /* Müller-Brockmann grid tokens (cols-v20) — single source of truth */
  --grid-cols: 2;
  --grid-bl: 8px;
  --grid-lh: 24px;
  --grid-gutter: clamp(12px, 1.2vw, 18px);
  --grid-margin: clamp(20px, 2.5vw, 48px);
  --grid-guide-col: rgba(29, 79, 69, 0.06);
  --grid-guide-edge: rgba(29, 79, 69, 0.28);
  --grid-guide-base: rgba(29, 79, 69, 0.14);
  --grid-guide-base-min: rgba(29, 79, 69, 0.05);
}

.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;

  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);
  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;
  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-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;

  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 {
  max-width: var(--workspace-max);

  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.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;
}

.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);
  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-'] {
  margin: 0;
  border: none;
  border-left: none !important;
  border-radius: 0;
  box-shadow: none;
}

.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);
  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);
  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;
}

.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-framework-step] .rules-panel-top {
  border-bottom-color: var(--border);
}

.app-shell--calm .rules-panel[data-framework-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;
  /* Bright neutral palette: white canvas, crisp ink, soft gray surfaces. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --surface-3: #f3f6f9;
  --ink: #111827;
  --text: #111827;
  --muted: #4b5563;
  --muted-2: #646e7c;   /* WCAG AA: ≥4.5:1 on white and the light surfaces */
  --border: rgba(17, 24, 39, 0.12);
  --border-strong: rgba(17, 24, 39, 0.22);
  --primary: #28584c;
  --primary-hover: #1f473e;
  --primary-soft: rgba(40, 88, 76, 0.10);
  --accent: #9b5b1f;
  --accent-soft: rgba(155, 91, 31, 0.12);
  --gold: #9b6b27;
  --blue: #3f647f;
  --purple: #6e5f86;
  --teal: #2c6a5d;
  --red: #93424b;
  --brown: #755a3c;
  --green: #3d6f4e;
  --shadow-sm: 0 1px 2px rgba(74, 64, 49, 0.08);
  --shadow-md: 0 18px 45px rgba(74, 64, 49, 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;

  /* ── Type scale (cols-v71) — one role-based system. Reading tier is the hero;
     sources tier is intentionally denser. Harmonize WITHIN a tier; never flatten. ── */
  --fs-read: 0.9375rem;   --lh-read: 1.65;   /* reading-desk prose, tree body (15px) */
  --fs-src: 0.8125rem;    --lh-src: 1.55;    /* all Sources-panel prose (13px) */
  --fs-btn: 0.8125rem;                        /* control / button text (13px) */
  --fs-label: 0.6875rem;  --ls-label: 0.08em; --fw-label: 700;  /* uppercase eyebrows (700 = heaviest loaded weight) */
  --fs-micro: 0.625rem;   --ls-micro: 0.04em; /* counts, badges */
  --fs-hero: clamp(1.8rem, 4vw, 3.15rem);              /* tree question */
  --fs-title: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);  --lh-title: 1.08;  /* step title / panel head */
  --fs-h3: clamp(1.02rem, 1.1vw, 1.18rem);          --lh-h3: 1.3;      /* issue / sub-question heading */
}

.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 {

  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 .tool-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 .tool-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 .tool-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 .tool-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 .page-main:has(.analyzer-workspace) {
  display: block;

  padding: 18px var(--layout-gutter);
}

.app-shell--calm .analyzer-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 0;
  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 {
  gap: 6px;
}

.app-shell--calm .snapshot-field span {
  font-size: 0.72rem;

}

.app-shell--calm .snapshot-field select {
  min-height: 42px;
  border-radius: 8px;
  background: var(--surface);

}

.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 {

  gap: 6px;
}

.app-shell--calm .status-pill {
  min-height: 30px;
  padding: 5px 8px;

  background: var(--surface);

  font-size: 0.72rem;

}

.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;
  font-size: var(--fs-read);
  line-height: var(--lh-read);
}

.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 .related-issues {
  margin-top: 16px;
  padding-top: 14px;
}

.app-shell--calm .related-issues > span {
  margin-bottom: 8px;
  font-size: 0.72rem;

}

.app-shell--calm .related-issues button {

  border-radius: 8px;
  background: var(--surface);

}

@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;
  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-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 .lawyer-desk {
  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__title > span:not(.cite-ref-wrap),
.app-shell--calm .lawyer-current-issue > span:not(.cite-ref-wrap),
.app-shell--calm .subissue-list > span,
.app-shell--calm .lawyer-source-stack__head span {
  color: var(--accent);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: var(--ls-label);
  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;
  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;
  font-size: 0.62rem;
  font-weight: 900;
}

.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;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-strong);
}

.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-weight: 600;
  letter-spacing: 0;
}

/* Right-column header — Library title + global search (scrolls with column; hidden on scroll-down). */
.app-shell--calm .lawyer-source-head {
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: var(--source-wash, #faf8f2);
}
.app-shell--calm .lawyer-source-head > span {
  display: block;
  color: var(--accent);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}
.app-shell--calm .lawyer-source-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: var(--lh-title);
}
.app-shell--calm .lawyer-source-head__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-strong);
}
.app-shell--calm .library-search-label {
  color: var(--accent);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Global Library search (right-column header) */
.app-shell--calm .library-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}
.app-shell--calm .library-search {
  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;
  line-height: 1.4;
}
.app-shell--calm .library-search::placeholder {
  color: var(--muted-2);
}
.app-shell--calm .library-search-count {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.app-shell--calm .library-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.app-shell--calm .library-search-results[hidden] {
  display: none;
}
.app-shell--calm .library-search-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.app-shell--calm .library-search-hit:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}
.app-shell--calm .library-search-hit__cite {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.3;
}
.app-shell--calm .library-search-hit__title {
  font-size: 0.74rem;
  color: var(--text);
  line-height: 1.35;
}
.app-shell--calm .library-search-hit__meta {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.app-shell--calm .library-search-empty {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.4;
}
.app-shell--calm .library-search:focus-visible,
.app-shell--calm .library-search-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}/* Hide entire Library header on scroll-down — fully gone, no fade/ghost. */

.app-shell--calm .lawyer-source-head__officer {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: var(--fs-src);
  line-height: 1.45;
}
.app-shell--calm .lawyer-source-head__officer > span {
  color: var(--muted-2);
  font-weight: 600;
}

.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;
  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: 0;
}

.app-shell--calm .lawyer-current-issue h3 {
  margin: 3px 0 7px;
  color: var(--text);
  font-family: var(--font-display);

}

.app-shell--calm .lawyer-current-issue .analysis-note-body {
  max-width: none;
  color: #33403c;

}

.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__groups {
  flex-direction: column;
  gap: calc(var(--grid-bl) * 2);
  margin-top: 6px;
}

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

.app-shell--calm .subissue-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-shell--calm .subissue-group--solo .subissue-btn {
  width: 100%;
}

.app-shell--calm .subissue-btn--compact {
  min-height: 34px;
  padding: 5px 10px;
}

.app-shell--calm .subissue-btn--compact strong {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text);
}

.app-shell--calm .subissue-btn--compact.is-active strong {
  color: var(--primary);
  font-weight: 600;
}

.app-shell--calm .subissue-list button,
.app-shell--calm .subissue-list .subissue-btn {
  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 button {
    min-height: 34px;
    align-content: center;
  }

  .app-shell--calm .subissue-list button small:not(.subissue-btn__cite) {
    display: none;
  }
}

.app-shell--calm .lawyer-source-stack {
  padding: 22px var(--layout-gutter) 28px 18px;
  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);
  }
}

/* ===== 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);
}

/* One-line explainer under the "Step library" disclosure (Zone B of the sources panel). */
.app-shell--calm .library-shelf__subtitle {
  margin: 0.1rem 0 0.6rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.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-radius: 8px;
  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-radius: 8px;
  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__currency {
  margin: 8px 0 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border-left: 3px solid rgba(43, 91, 79, 0.45);
  background: rgba(43, 91, 79, 0.06);
  font-size: 0.78rem;
  color: var(--text);
}

.app-shell--calm .lib-entry__note {
  margin: 10px 0 6px;
  padding: 8px 10px;
  border-radius: 8px;
  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);
}

/* Abbreviations key (acronym glossary) — Sources panel, mirrors the step-library disclosure */
.app-shell--calm .source-acronyms {
  margin-top: 10px;
}
.app-shell--calm .source-acronyms > 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 .source-acronyms > summary::-webkit-details-marker { display: none; }
.app-shell--calm .source-acronyms > summary::before {
  content: '▶';
  color: var(--muted-2);
  font-size: 0.55rem;
  transition: transform 0.15s;
}
.app-shell--calm .source-acronyms[open] > summary::before { transform: rotate(90deg); }
.app-shell--calm .source-acronyms > summary:hover { background: rgba(43, 91, 79, 0.05); }
.app-shell--calm .source-acronyms[open] > summary { border-radius: 8px 8px 0 0; }
.app-shell--calm .source-acronyms__body {
  border: 1px solid rgba(203, 212, 221, 0.86);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.5);
  padding: 2px 13px 12px;
}
.app-shell--calm .source-acronyms__body .library-shelf__subtitle { margin-top: 0.55rem; }
.app-shell--calm .acronym-group__title {
  margin: 0.7rem 0 0.3rem;
  font-size: var(--src-meta, 0.8rem);
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.app-shell--calm .acronym-list { margin: 0; }
.app-shell--calm .acronym-row {
  display: grid;
  grid-template-columns: 4.8rem 1fr;
  gap: 10px;
  padding: 3px 0;
  font-size: var(--src-read, 0.93rem);
  line-height: 1.4;
}
.app-shell--calm .acronym-row dt {
  margin: 0;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.app-shell--calm .acronym-row dd { margin: 0; color: var(--muted); }

/* 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);
}

/* Per-layer colored left-border accents removed (generic template chrome) — the
   panel summary labels already name each layer (Primary law, Regulations, …). */

/* ── 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;
  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);
}

.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;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.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 —— */
/* Citations use the brand colour (link-like) so they are visually distinct from
   amber defined-terms (glossary-like). Two affordances, two unmistakable looks. */
/* ── Practice traps ──────────────────────────────────────────────
   Inline ⚠ badge in node prose (.trap-ref) reveals the flagged library
   card (.lib-entry--trap). Warning hue (#9b5b1f = the --warning-soft
   token's color), distinct from the green cite-ref and amber wiki-term. */
.app-shell--calm .trap-ref {
  appearance: none;
  margin: 0 1px;
  padding: 1px 7px 1px 6px;
  border: 1px solid color-mix(in srgb, #9b5b1f 45%, transparent);
  border-radius: 999px;
  background: var(--warning-soft);
  font: inherit;
  font-size: 0.86em;
  font-weight: 600;
  line-height: 1.2;
  color: #9b5b1f;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s var(--ease, ease), border-color 0.15s var(--ease, ease);
}
.app-shell--calm .trap-ref:hover {
  background: color-mix(in srgb, #9b5b1f 20%, transparent);
  border-color: color-mix(in srgb, #9b5b1f 70%, transparent);
}
.app-shell--calm .trap-ref:focus-visible {
  outline: 2px solid #9b5b1f;
  outline-offset: 2px;
}
.app-shell--calm .lib-entry--trap {
  border-left: 3px solid #9b5b1f;
  background: var(--warning-soft);
}
.app-shell--calm .lib-entry__trap-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #9b5b1f;
  color: #fff;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}
.app-shell--calm .trap-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.app-shell--calm .trap-row__label {
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9b5b1f;
  margin-right: 2px;
}
/* Procedural "filing sequence" block — green/action accent, distinct from amber traps. */
.app-shell--calm .proc-block {
  margin-top: 16px;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.app-shell--calm .proc-block__title {
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}
.app-shell--calm .proc-block__steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.94em;
}
.app-shell--calm .proc-block__steps li { line-height: 1.5; }
/* Evidence checklist — neutral block, green ✓ bullets; the documents to gather. */
.app-shell--calm .evid-block {
  margin-top: 16px;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 6px;
}
.app-shell--calm .evid-block__title {
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.app-shell--calm .evid-block__items {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.94em;
}
.app-shell--calm .evid-block__items li {
  line-height: 1.5;
  padding-left: 22px;
  position: relative;
}
.app-shell--calm .evid-block__items li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary);
  font-weight: 700;
}

.app-shell--calm .cite-ref {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 500;
  color: color-mix(in srgb, var(--primary) 85%, var(--text));
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 42%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 2px;
  transition: color 0.15s var(--ease, ease), text-decoration-color 0.15s var(--ease, ease), background 0.15s var(--ease, ease);
}
.app-shell--calm .cite-ref:hover {
  color: var(--primary);
  text-decoration-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.app-shell--calm .cite-ref:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.app-shell--calm .cite-ref-wrap {
  display: inline;
  white-space: normal;
}

/* —— Floating citation tooltip (replaces the old inline .cite-ref-desc block) —— */
.cite-tip {
  position: fixed;
  z-index: 200;
  max-width: min(340px, calc(100vw - 16px));   /* never overflow a narrow viewport */
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Abbreviation popover (tap/click an .abbr-gloss to read its full term — works on touch
   where hover does not). Mirrors .cite-tip; compact, single line. */
.abbr-tip {
  position: fixed;
  z-index: 200;
  max-width: min(280px, calc(100vw - 16px));
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.82rem;
  line-height: 1.4;
}
.cite-tip[hidden] { display: none; }
.cite-tip__summary { margin: 0; color: var(--text); }
.cite-tip__src {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
}
.cite-tip__src[hidden] { display: none; }
.cite-tip__forum,
.cite-tip__xref,
.cite-tip__ilp {
  margin: 0.45rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
}
.cite-tip__forum[hidden],
.cite-tip__xref[hidden],
.cite-tip__ilp[hidden] { display: none; }
.cite-tip__label {
  font-weight: 700;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-right: 0.3rem;
}
.cite-tip__more { margin: 0.45rem 0 0; }
.cite-tip__more[hidden] { display: none; }
.cite-tip__more > summary {
  cursor: pointer;
  list-style: revert;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}
.cite-tip__more-body {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}
.cite-tip__elist { margin: 0; padding-left: 1.1em; white-space: normal; }
.cite-tip__elist li { margin: 0.15rem 0; }

.app-shell--calm .cite-ref.is-open {
  color: var(--ink);
}

/* 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 .reading-line,
.app-shell--calm .lawyer-source-stack .lib-entry,
.app-shell--calm .lawyer-source-stack .ina-supplement-card {
  position: relative;
}
.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.74rem;   /* 11.8px — badges, chips, forum, dividers, counts */
  --src-meta: 0.8rem;     /* 12.8px — eyebrow, count line, panel/zone titles */
  --src-label: 0.88rem;   /* 14.1px — cites, card titles */
  --src-read: 0.93rem;    /* 14.9px — 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__currency,
.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.06rem);
}

/* 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 .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__title > span:not(.cite-ref-wrap),
.app-shell--calm .lawyer-current-issue > span:not(.cite-ref-wrap),
.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;
  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-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 {

  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);
  color: var(--text);
}
.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 .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__title > span:not(.cite-ref-wrap),
.app-shell--calm .lawyer-current-issue > span:not(.cite-ref-wrap),
.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 {
  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: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.004em;
  line-height: var(--lh-h3);
}

/* 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 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: var(--fs-title);
  line-height: var(--lh-title);
}

/* 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); }

/* 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 */

/* 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 {

  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 {
  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__title > span:not(.cite-ref-wrap),      /* "STEP N"  → H2 + nav already say it */
.app-shell--calm .lawyer-current-issue > span:not(.cite-ref-wrap) {  /* "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 — Comparison / analysis tables (no narrative prose) */
.app-shell--calm .fork-table,
.app-shell--calm .analysis-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: 0.84rem;
  line-height: 1.45;
}
.app-shell--calm .analysis-table thead th:first-child,
.app-shell--calm .analysis-table tbody th[scope="row"] { width: 30%; }
.app-shell--calm .fork-table caption,
.app-shell--calm .analysis-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,
.app-shell--calm .analysis-table th,
.app-shell--calm .analysis-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,
.app-shell--calm .analysis-table thead th {
  font-size: 0.84rem;
  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"],
.app-shell--calm .analysis-table tbody th[scope="row"] {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-2);
  width: 1%;
  padding-right: 20px;
}
.app-shell--calm .analysis-table tbody th[scope="row"] { white-space: normal; }
.app-shell--calm .fork-table tbody td,
.app-shell--calm .analysis-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,
.app-shell--calm .analysis-table tbody tr:last-child th,
.app-shell--calm .analysis-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,
  .app-shell--calm .analysis-table,
  .app-shell--calm .analysis-table thead,
  .app-shell--calm .analysis-table tbody,
  .app-shell--calm .analysis-table tr,
  .app-shell--calm .analysis-table th,
  .app-shell--calm .analysis-table td { display: block; }
  .app-shell--calm .fork-table thead,
  .app-shell--calm .analysis-table thead { display: none; }
  .app-shell--calm .fork-table tbody th[scope="row"],
  .app-shell--calm .analysis-table tbody th[scope="row"] {
    width: auto;
    border-bottom: none;
    padding: 10px 0 2px;
  }
  .app-shell--calm .fork-table tbody td,
  .app-shell--calm .analysis-table tbody td { padding: 2px 0; border-bottom: none; }
  .app-shell--calm .analysis-table tbody tr { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 6px; }
  .app-shell--calm .fork-table--compare tbody tr { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  .app-shell--calm .fork-table--compare tbody td:first-of-type::before { content: attr(data-col) " — "; color: var(--muted-2); }
}

/* =========================================================================
   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);
}

/* ── Step rail as a full-width sticky TOP BAR, below the sticky site header ── */
.app-shell--calm .lawyer-step-nav {
  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 */
}

/* Re-assert: hide whole Library header on scroll-down (no translucent sticky ghost). */
.app-shell--calm #treeContainer.nav-hidden .lawyer-source-head,
.app-shell--calm #treeContainer.source-search-hidden .lawyer-source-head {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── ≤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; }
}

/* =========================================================================
   cols-v18 — lawyer UI cleanup
   · 60/40 column split with gutter
   · no step-rail connector spine
   · pager inset from Sources column
   · question-only step prompts (no answer widget box)
   ========================================================================= */

.app-shell--calm .lawyer-desk {
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
}

.app-shell--calm .lawyer-step-list::before {
  display: none;
}

.app-shell--calm .lawyer-step-question {
  margin: 8px 0 0;
  max-width: 68ch;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: clamp(0.92rem, 1.05vw, 1rem);
  font-weight: 500;
  line-height: 1.45;
}

.app-shell--calm .step-pager {
  max-width: 100%;
  box-sizing: border-box;
  padding-right: clamp(12px, 1.5vw, 20px);
  justify-content: flex-start;
  gap: 10px 12px;
}

.app-shell--calm .pager-jump {
  margin-left: auto;
  margin-right: 8px;
}

.app-shell--calm .pager-btn--next,
.app-shell--calm .pager-btn--restart {
  margin-left: 0;
  flex: 0 1 auto;
  max-width: min(280px, 42%);
}

@media (max-width: 1000px) {
  .app-shell--calm .lawyer-desk {
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr);
  }
}

@media (max-width: 640px) {
  .app-shell--calm .pager-jump { margin-left: 0; margin-right: 0; }
  .app-shell--calm .pager-btn--next,
  .app-shell--calm .pager-btn--restart { max-width: none; }
}

/* =========================================================================
   cols-v19 — 58/42 columns + minimal step rail
   · analysis 2.9fr / sources 2.1fr
   · active step = filled number circle only (no pill, no tab line)
   · rail padding aligned to layout gutter
   ========================================================================= */

.app-shell--calm .lawyer-desk {
  grid-template-columns: minmax(0, 2.9fr) minmax(300px, 2.1fr);
  column-gap: clamp(20px, 2.5vw, 36px);
}

.app-shell--calm .lawyer-step-nav {
  padding: 5px var(--layout-gutter);
}

.app-shell--calm .lawyer-step-btn:hover,
.app-shell--calm .lawyer-step-btn.is-active {
  background: transparent;
  box-shadow: none;
}

.app-shell--calm .lawyer-step-btn.is-active span {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

@media (max-width: 1000px) {
  .app-shell--calm .lawyer-desk {
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 1fr);
    column-gap: clamp(16px, 2vw, 28px);
  }
}

/* =========================================================================
   cols-v20 — Müller-Brockmann 12-column grid (engineering only)
   · analysis 1/8 · sources 8/13 · shared tokens · dev grid overlay
   ========================================================================= */

.app-shell--calm .lawyer-desk {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  align-items: start;
}

.app-shell--calm .lawyer-step-nav {
  padding: 5px 0;
  /* Breathing room below the step bar; both columns sit in the next grid row,
     so this keeps the two header rules aligned while pushing them down. */
  margin-bottom: calc(var(--grid-bl) * 2);
}

.app-shell--calm .lawyer-reading-desk {
  grid-column: 1 / 8;
  padding: var(--grid-bl) 0 calc(var(--grid-bl) * 3);
}

.app-shell--calm .lawyer-source-stack {
  grid-column: 8 / 13;
  /* No top pad: the wash box (.lawyer-source-head, 11px inner top) sits flush to
     the column top so the Library rule aligns with the step-heading rule. */
  padding: 0 0 calc(var(--grid-bl) * 3);
}

.app-shell--calm .lawyer-reading-head {
  margin-bottom: calc(var(--grid-bl) * 2);
}

.app-shell--calm .lawyer-step-question {
  margin-top: var(--grid-bl);
}

.app-shell--calm .lawyer-reading-point {
  margin-top: var(--grid-bl);
}

.app-shell--calm .lawyer-current-issue h3 {
  line-height: calc(var(--grid-bl) * 4);
}

/* Dev grid overlay — same box as content (MB §2.2) */
.app-shell--calm .grid-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.26s var(--ease, ease);
}

.app-shell--calm.grid-on .grid-guides {
  opacity: 1;
}

.app-shell--calm .grid-guides__cols {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  column-gap: var(--grid-gutter);
}

.app-shell--calm .grid-guides__col {
  background: var(--grid-guide-col);
  box-shadow: inset 1px 0 0 var(--grid-guide-edge), inset -1px 0 0 var(--grid-guide-edge);
}

@media (max-width: 1000px) {
  .app-shell--calm .lawyer-desk {
    --grid-gutter: clamp(16px, 2vw, 28px);
  }
}

@media (max-width: 760px) {
}

@media (prefers-reduced-motion: reduce) {
  .app-shell--calm .grid-guides { transition: none; }
}

/* =========================================================================
   cols-v21 — chrome alignment + optical type + baseline sources
   · single horizontal inset (header ↔ rail ↔ desk)
   · full-bleed sticky step rail
   · minimal active step (no legacy underline)
   ========================================================================= */

.app-shell--calm .analysis-page-main {
  padding-inline: 0;
  overflow-x: clip;
}

.app-shell--calm .lawyer-step-nav {
  margin-inline: calc(-1 * var(--grid-margin));
  padding: 5px var(--grid-margin);
}

.app-shell--calm .lawyer-step-btn.is-active,
.app-shell--calm .lawyer-step-nav .lawyer-step-btn.is-active {
  background: transparent;
  box-shadow: none;
}

.app-shell--calm .lawyer-reading-head h2 {
  margin-left: var(--optical-nudge, 0);
}

.app-shell--calm .lawyer-source-stack__head {
  margin-bottom: calc(var(--grid-bl) * 2);
}

.app-shell--calm .lawyer-source-stack .library-shelf-wrap {
  margin-bottom: var(--grid-bl);
}

.app-shell--calm .lawyer-source-stack .lib-entry {
  margin-bottom: var(--grid-bl);
}

.app-shell--calm .lawyer-source-stack .lib-entry > summary {
  padding-top: var(--grid-bl);
  padding-bottom: var(--grid-bl);
}

.app-shell--calm .grid-guides__rows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(to bottom, var(--grid-guide-base) 0 1px, transparent 1px var(--grid-lh)),
    repeating-linear-gradient(to bottom, var(--grid-guide-base-min) 0 1px, transparent 1px var(--grid-bl));
}

@media (max-width: 760px) {
  .app-shell--calm .lawyer-step-nav {
    margin-inline: calc(-1 * var(--grid-margin));
  }
}

/* =========================================================================
   cols-v22 — remove phantom middle: 2-track desk, tighter gutter/margin
   · no empty grid tracks between analysis and sources
   · 6fr / 5fr ≈ 55/45 (sources column widened cols-v43)
   ========================================================================= */

.app-shell--calm .lawyer-desk {
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  column-gap: var(--grid-gutter);
  padding-inline: var(--grid-margin);
}

.app-shell--calm .lawyer-step-nav {
  grid-column: 1 / -1;
}

.app-shell--calm .lawyer-reading-desk,
.app-shell--calm .lawyer-source-stack {
  grid-column: auto;
}

.app-shell--calm .lawyer-source-stack {
  padding-left: 0;
  padding-right: 0;
}

.app-shell--calm .lawyer-reading-desk {
  border-right: 0;
}

@media (max-width: 1000px) {
  .app-shell--calm .lawyer-desk {
    --grid-gutter: clamp(10px, 1vw, 14px);
  }

  .app-shell--calm .lawyer-reading-desk {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .app-shell--calm .lawyer-desk {
    grid-template-columns: 1fr;
  }

  .app-shell--calm .lawyer-reading-desk,
  .app-shell--calm .lawyer-source-stack {
    grid-column: 1 / -1;
  }
}

/* =========================================================================
   cols-v24 — source-bundle issue groups + single token authority
   · shared-source issues: one visible section bar + compact chips
   · removed duplicate zinc tokens from file head (2026 block is sole palette)
   ========================================================================= */

.app-shell--calm .subissue-group:not(.subissue-group--solo) {
  padding: calc(var(--grid-bl) * 1.5) calc(var(--grid-bl) * 1.5) calc(var(--grid-bl) * 2);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.62);
}

.app-shell--calm .subissue-group__bar {
  margin: 0 0 calc(var(--grid-bl) * 1.5);
  padding: 0 0 calc(var(--grid-bl) * 0.75);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .subissue-group__items {
  gap: calc(var(--grid-bl) * 0.75);
}

.app-shell--calm .subissue-btn--compact {
  border-color: rgba(22, 32, 46, 0.1);
  background: rgba(255, 255, 255, 0.92);
}

.app-shell--calm .subissue-btn--compact.is-active {
  border-color: rgba(21, 86, 75, 0.45);
  background: var(--primary-soft);
}

.app-shell--calm .subissue-group--solo .subissue-btn.is-active {
  border-color: rgba(21, 86, 75, 0.45);
  background: var(--primary-soft);
}

.app-shell--calm .subissue-list button strong,
.app-shell--calm .subissue-btn--compact.is-active strong {
  color: var(--primary);
}

/* =========================================================================
   cols-v25 — About tab + onboarding (how to use)
   ========================================================================= */

.app-shell--calm .framework-view-chrome {
  padding: calc(var(--grid-bl) * 2) var(--grid-margin) 0;
}

.app-shell--calm .framework-view-tabs {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.app-shell--calm .framework-view-tab {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 9px 18px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

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

.app-shell--calm .framework-view-tab.is-active {
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

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

.app-shell--calm .framework-about-panel {
  padding: calc(var(--grid-bl) * 3) var(--grid-margin) calc(var(--grid-bl) * 6);
}

.app-shell--calm .framework-about {
  max-width: 72rem;
}

.app-shell--calm .framework-about__intro h2 {
  margin: 0 0 calc(var(--grid-bl) * 2);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.2;
}

.app-shell--calm .framework-about__lede {
  max-width: 68ch;
  margin: 0 0 calc(var(--grid-bl) * 2);
  font-size: clamp(0.92rem, 1.05vw, 1rem);
  line-height: 1.55;
}

.app-shell--calm .framework-about__intro p {
  max-width: 68ch;
  margin: 0 0 calc(var(--grid-bl) * 2);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

.app-shell--calm .framework-about__steps,
.app-shell--calm .framework-about__use {
  margin-top: calc(var(--grid-bl) * 4);
  padding-top: calc(var(--grid-bl) * 3);
  border-top: 1px solid var(--border);
}

.app-shell--calm .framework-about__steps h3,
.app-shell--calm .framework-about__use h3 {
  margin: 0 0 calc(var(--grid-bl) * 1.5);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-shell--calm .framework-about__overview {
  max-width: 68ch;
  margin: 0 0 calc(var(--grid-bl) * 3);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}

.app-shell--calm .framework-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--grid-bl) * 1.5);
}

.app-shell--calm .framework-step-card__btn {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: calc(var(--grid-bl) * 1.5);
  align-items: start;
  width: 100%;
  min-height: 44px;
  padding: calc(var(--grid-bl) * 1.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}

.app-shell--calm .framework-step-card__btn:hover {
  border-color: rgba(21, 86, 75, 0.35);
  background: rgba(255, 255, 255, 0.96);
}

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

.app-shell--calm .framework-step-card__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
}

.app-shell--calm .framework-step-card__body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.app-shell--calm .framework-step-card__unit {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.app-shell--calm .framework-step-card__title {
  font-size: 0.78rem;
  color: var(--muted);
}

.app-shell--calm .framework-step-card__q {
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

.app-shell--calm .framework-step-card__summary {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
}

.app-shell--calm .framework-about__tips {
  max-width: 68ch;
  margin: 0 0 calc(var(--grid-bl) * 3);
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.app-shell--calm .framework-about__tips li + li {
  margin-top: calc(var(--grid-bl) * 0.75);
}

.app-shell--calm .framework-about__start {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 calc(var(--grid-bl) * 2.5);
  border: 1px solid rgba(21, 86, 75, 0.35);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.app-shell--calm .framework-about__start:hover {
  background: rgba(215, 232, 226, 0.95);
}

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

@media (max-width: 760px) {
  .app-shell--calm .framework-step-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   cols-v26 — About: editorial outline, not card dashboard
   ========================================================================= */

.app-shell--calm .framework-view-tabs {
  gap: calc(var(--grid-bl) * 2);
  padding: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.app-shell--calm .framework-view-tab {
  padding: calc(var(--grid-bl) * 1.25) 0;
  min-height: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  box-shadow: none;
}

.app-shell--calm .framework-view-tab.is-active {
  color: var(--primary);
  background: transparent;
  border-bottom-color: var(--primary);
  box-shadow: none;
}

.app-shell--calm .framework-about {
  max-width: 42rem;
}

.app-shell--calm .framework-about__lede--secondary {
  font-size: 0.86rem;
}

.app-shell--calm .framework-about__inline {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.app-shell--calm .framework-outline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-shell--calm .framework-outline__item + .framework-outline__item {
  border-top: 1px solid var(--border);
}

.app-shell--calm .framework-outline__block {
  margin: 0;
}

.app-shell--calm .framework-outline__summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: calc(var(--grid-bl) * 1.5);
  align-items: baseline;
  padding: calc(var(--grid-bl) * 1.5) 0;
  cursor: pointer;
  list-style: none;
}

.app-shell--calm .framework-outline__summary::-webkit-details-marker {
  display: none;
}

.app-shell--calm .framework-outline__num {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.app-shell--calm .framework-outline__head {
  display: grid;
  gap: 2px;
}

.app-shell--calm .framework-outline__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.app-shell--calm .framework-outline__body {
  padding: 0 0 calc(var(--grid-bl) * 2) calc(var(--grid-bl) * 3.5);
  max-width: 58ch;
}

.app-shell--calm .framework-outline__q {
  margin: 0 0 calc(var(--grid-bl) * 1);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.app-shell--calm .framework-outline__note {
  margin: 0 0 calc(var(--grid-bl) * 1.5);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.app-shell--calm .framework-outline__open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.app-shell--calm .framework-step-list,
.app-shell--calm .framework-step-card__btn,
.app-shell--calm .framework-about__start,
.app-shell--calm .framework-about__use {
  display: none;
}

/* =========================================================================
   cols-v27 — Definition chain wired into the live sources panel:
   "what the law says → INA gap → secondary source → officer's manual",
   the Lexis treatise per issue, and clickable officer-manual cites.
   ========================================================================= */

/* New source zones reuse the keyed-zone padding + eyebrow title. */
.app-shell--calm .source-zone--definitions,
.app-shell--calm .source-zone--lexis {
  padding: 12px 14px 6px;
}
.app-shell--calm .source-context > summary {
  min-height: 44px;
  padding: 12px 0;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.app-shell--calm .source-context > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.app-shell--calm .lib-entry__verification {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.5;
}
.app-shell--calm .lib-entry__verification a {
  color: var(--primary);
  text-underline-offset: 0.15em;
}

.app-shell--calm .source-zone--definitions + .source-zone--lexis,
.app-shell--calm .source-zone--definitions .def-chain + .def-chain {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

/* "Deciding officer" caption — quiet, with a small eyebrow label. */
.app-shell--calm .source-zone__officer {
  margin: -2px 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
}
.app-shell--calm .source-zone__officer span {
  margin-right: 6px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2, var(--muted));
}
.app-shell--calm .source-zone--forum {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08));
}
.app-shell--calm .source-forum-line {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
}

/* Vertical rhythm between the statute block and the gap-filler block. */
.app-shell--calm .def-chain { margin: 0; }
.app-shell--calm .def-chain--statute { margin-bottom: 4px; }

/* Tame the (globally-styled) supplement/def cards for the narrow sources column:
   flat surfaces, hairline separation, no heavy boxes — matches the calm system. */
.app-shell--calm .source-zone--definitions .ina-supplement-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.app-shell--calm .source-zone--definitions .ina-supplement-card {
  position: relative; /* anchor the .is-cite-target pulse ring when revealed from a cite click */
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  scroll-margin-top: 140px; /* clear the sticky header + step bar on cite-reveal scroll */
}
.app-shell--calm .source-zone--definitions .ina-supplement-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}
.app-shell--calm .source-zone--definitions .ina-supplement-gap,
.app-shell--calm .source-zone--definitions .ina-supplement-statute,
.app-shell--calm .source-zone--definitions .supplement-gap-lead,
.app-shell--calm .source-zone--definitions .def101-statute-text,
.app-shell--calm .source-zone--definitions .supplement-text {
  font-size: 0.78rem;
  line-height: 1.5;
}
.app-shell--calm .def101-related-block {
  margin: 2px 0 12px;
}
.app-shell--calm .def101-related-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.4;
  color: var(--text);
}
.app-shell--calm .def101-related-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-shell--calm .def101-relationship {
  padding: 10px 11px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--accent-soft, transparent));
  border: 1px solid var(--border);
}
.app-shell--calm .def101-relationship-line {
  margin: 0 0 7px;
  font-size: 0.8rem;
  line-height: 1.58;
  color: var(--text);
}
.app-shell--calm .def101-relationship-line strong {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
}
.app-shell--calm .def101-related-cite {
  margin: 3px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 0.73rem;
  line-height: 1.5;
  color: var(--muted, var(--text));
}
.app-shell--calm .def101-related-cite strong {
  color: var(--muted-2, var(--muted));
  font-size: 0.69rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
}
.app-shell--calm .source-zone--definitions .supplement-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-shell--calm .source-zone--definitions .supplement-item {
  padding: 8px 10px;
  border: 0;
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  background: var(--bg, transparent);
}

/* Lexis treatise chips reuse the local-PDF chip system. */
.app-shell--calm .lexis-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Officer-manual cites are now links (FAM included): match the external-link look. */
.app-shell--calm .agency-cite-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s var(--ease, ease);
}
.app-shell--calm .agency-cite-link:hover { border-bottom-color: var(--accent); }
.app-shell--calm .agency-cite-sub {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}

/* =========================================================================
   cols-v30 — Minimal source wire: cite-ref only (editorial underline in cols-v29 block above)
   ========================================================================= */

.app-shell--calm .lib-entry__xref-links {
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.45;
}

/* =========================================================================
   cols-v33 — ILP chapter badges on library cards only (no step treatise line)
   ========================================================================= */

.app-shell--calm .lib-entry__ilp {
  flex-shrink: 0;
  margin-right: 0.35rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.9;
}

/* =========================================================================
   cols-v41 — Bright neutral cleanup
   Removes the warm page wash; restores a cleaner white canvas while
   keeping the readability and source-panel hierarchy from cols-v40.
   ========================================================================= */

.app-shell--calm {
  --focus-ring: #9b5b1f;
  --paper-wash: var(--surface);
  --paper-panel: var(--surface);
  --source-wash: var(--surface);
  --success-soft: rgba(61, 111, 78, 0.12);
  --warning-soft: rgba(155, 91, 31, 0.12);
  --danger-soft: rgba(147, 66, 75, 0.10);
  --info-soft: rgba(63, 100, 127, 0.12);
}

.app-shell--calm.app-shell {
  background: var(--bg);
  color: var(--text);
}

.app-shell--calm .app-header--compact,
.app-shell--calm .lawyer-step-nav {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-color: var(--border);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
}

.app-shell--calm .brand-sigil {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--surface));
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #fff), var(--primary));
  color: #fffdf8;
}

.app-shell--calm .framework-view-tabs,
.app-shell--calm .workspace-tabs {
  background: color-mix(in srgb, var(--surface-2) 84%, var(--surface));
  border-color: var(--border);
}

.app-shell--calm .framework-view-tab:hover,
.app-shell--calm .workspace-tab:hover {
  background: var(--surface);
}

.app-shell--calm .framework-view-tab.is-active,
.app-shell--calm .workspace-tab.is-active {
  color: var(--primary);
  background: var(--surface);
  border-bottom-color: var(--primary);
  box-shadow: none;
}

.app-shell--calm .analysis-page-main {
  background: transparent;
}

.app-shell--calm .analysis-workbench {
  background: transparent;
}

.app-shell--calm .lawyer-desk {
  background: var(--surface);
}

.app-shell--calm .lawyer-reading-desk {
  background: var(--paper-panel);
}

.app-shell--calm .lawyer-source-stack {
  background: var(--source-wash);
}

.app-shell--calm .lawyer-source-stack__head {
  background: color-mix(in srgb, var(--source-wash) 90%, var(--surface));
  border-bottom-color: var(--border);
}

.app-shell--calm .lawyer-reading-head h2,
.app-shell--calm .lawyer-current-issue h3 {
  color: var(--text);
}

.app-shell--calm .lawyer-step-question,
.app-shell--calm .lawyer-current-issue .analysis-note-body,
.app-shell--calm .analysis-note-body {
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
}

.app-shell--calm .lawyer-current-issue .analysis-note-body {
  font-size: var(--fs-read);
  line-height: var(--lh-read);
}

.app-shell--calm .lawyer-step-btn {
  border-bottom-color: var(--border);
  color: var(--text);
}

.app-shell--calm .lawyer-step-btn:hover,
.app-shell--calm .lawyer-step-btn.is-active,
.app-shell--calm .subissue-list button:hover,
.app-shell--calm .subissue-list button.is-active {
  background: var(--primary-soft);
}

.app-shell--calm .lawyer-step-btn span,
.app-shell--calm .issue-row__num,
.app-shell--calm .status-pill,
.app-shell--calm .expected-answer-btn,
.app-shell--calm .flow-btn,
.app-shell--calm .subissue-list button,
.app-shell--calm .subissue-btn--compact,
.app-shell--calm .pager-btn--prev,
.app-shell--calm .framework-step-card__btn,
.app-shell--calm .related-issues button {
  background: var(--surface);
  border-color: var(--border);
}

.app-shell--calm .lawyer-step-btn.is-active span,
.app-shell--calm .expected-answer-btn.is-selected,
.app-shell--calm .status-pill.is-active,
.app-shell--calm .pager-btn--next,
.app-shell--calm .pager-btn--restart {
  background: var(--primary);
  border-color: var(--primary);
  color: #fffdf8;
}

.app-shell--calm .pager-btn--next,
.app-shell--calm .pager-btn--restart {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 88%, #fff), var(--primary));
  box-shadow: 0 1px 2px rgba(40, 88, 76, 0.20);
}

.app-shell--calm .pager-btn--next:hover,
.app-shell--calm .pager-btn--restart:hover {
  background: var(--primary-hover);
  box-shadow: 0 5px 14px -8px rgba(40, 88, 76, 0.55);
}

.app-shell--calm .expected-answer,
.app-shell--calm .subissue-group:not(.subissue-group--solo),
.app-shell--calm .resource-aside,
.app-shell--calm .source-zone--definitions,
.app-shell--calm .source-zone--lexis {
  background: transparent;
}

.app-shell--calm .expected-answer__facts,
.app-shell--calm .subissue-list,
.app-shell--calm .subissue-group__bar,
.app-shell--calm .step-pager,
.app-shell--calm .source-zone--definitions + .source-zone--lexis,
.app-shell--calm .source-zone--definitions .def-chain + .def-chain {
  border-color: var(--border);
}

.app-shell--calm .reading-panel,
.app-shell--calm details.reading-panel[open],
.app-shell--calm .library-shelf-wrap,
.app-shell--calm .source-zone--keyed .lib-entry,
.app-shell--calm .library-shelf .lib-entry {
  background: transparent;
  border-color: var(--border);
  box-shadow: none;
}

.app-shell--calm .reading-panel__summary:hover,
.app-shell--calm .library-shelf-wrap > summary:hover,
.app-shell--calm .lib-entry > summary:hover {
  background: color-mix(in srgb, var(--primary-soft) 70%, transparent);
}

.app-shell--calm .reading-panel__body,
.app-shell--calm .reading-line,
.app-shell--calm .library-shelf-wrap,
.app-shell--calm .library-shelf-wrap[open] > summary,
.app-shell--calm .lib-entry,
.app-shell--calm .lib-entry__body,
.app-shell--calm .lib-entry__quote,
.app-shell--calm .lib-entry__note {
  border-color: var(--border);
}

.app-shell--calm .source-zone--definitions .ina-supplement-card {
  background: var(--surface);
  border-color: var(--border);
}

.app-shell--calm .source-zone--definitions .ina-supplement-gap,
.app-shell--calm .source-zone--definitions .ina-supplement-statute,
.app-shell--calm .source-zone--definitions .def101-statute-text,
.app-shell--calm .source-zone--definitions .supplement-text,
.app-shell--calm .def101-relationship-line,
.app-shell--calm .source-forum-line {
  font-size: 0.84rem;
  line-height: 1.6;
}

.app-shell--calm .def101-relationship {
  background: var(--surface);
  border-color: var(--border);
}

.app-shell--calm .source-zone--definitions .supplement-item {
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
  border-left-color: var(--border-strong);
}

.app-shell--calm .reading-line p,
.app-shell--calm .lib-entry__rule,
.app-shell--calm .lib-entry__quote,
.app-shell--calm .lib-entry__elements,
.app-shell--calm .lib-entry__field,
.app-shell--calm .lib-entry__note {
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
}

.app-shell--calm .reading-line cite,
.app-shell--calm .lib-entry__cite,
.app-shell--calm .lib-entry > summary .lib-entry__cite,
.app-shell--calm .source-focus,
.app-shell--calm .agency-cite-link,
.app-shell--calm .src-ext,
.app-shell--calm .framework-about__inline,
.app-shell--calm .framework-outline__open {
  color: var(--accent);
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--statute,
.app-shell--calm .reading-layer-badge.reading-layer-badge--framework {
  background: var(--primary-soft);
  color: var(--primary);
}

.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: var(--info-soft);
  color: var(--blue);
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--fam-dos-guidance {
  background: var(--accent-soft);
  color: var(--accent);
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--uscis-policy-manual {
  background: rgba(110, 95, 134, 0.12);
  color: var(--purple);
}

.app-shell--calm .reading-layer-badge.reading-layer-badge--case-law {
  background: var(--danger-soft);
  color: var(--red);
}

.app-shell--calm .fork-table,
.app-shell--calm .analysis-table {
  font-size: 0.95rem;
  line-height: 1.55;
}

.app-shell--calm .fork-table caption,
.app-shell--calm .analysis-table caption {
  color: var(--muted);
  letter-spacing: 0.05em;
}

.app-shell--calm .fork-table thead th,
.app-shell--calm .analysis-table thead th {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.app-shell--calm .fork-table th,
.app-shell--calm .fork-table td,
.app-shell--calm .analysis-table th,
.app-shell--calm .analysis-table td {
  border-bottom-color: var(--border);
}

.app-shell--calm .fork-table tbody th[scope="row"],
.app-shell--calm .analysis-table tbody th[scope="row"] {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.app-shell--calm .fork-table tbody td,
.app-shell--calm .analysis-table tbody td {
  color: var(--text);
}

.app-shell--calm .framework-about-panel,
.app-shell--calm .framework-about,
.app-shell--calm .framework-step-card__btn {
  background: transparent;
}

.app-shell--calm .framework-step-card__btn:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.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 .pager-btn:focus-visible,
.app-shell--calm .cite-ref:focus-visible,
.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,
.app-shell--calm .framework-view-tab:focus-visible {
  outline-color: var(--focus-ring);
}

.app-shell--calm .lib-filter,
.app-shell--calm .snapshot-field select {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.app-shell--calm .clear-analysis-btn,
.app-shell--calm .flow-btn--exception {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  color: var(--accent);
}

.app-shell--calm .flow-btn--next {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
}

.app-shell--calm .issue-row--possible .issue-row__state {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--border));
  color: var(--blue);
}

.app-shell--calm .issue-row--clear .issue-row__state {
  border-color: color-mix(in srgb, var(--green) 30%, var(--border));
  color: var(--green);
}

.app-shell--calm .issue-row--problem .issue-row__state {
  border-color: color-mix(in srgb, var(--red) 30%, var(--border));
  color: var(--red);
}

@media (max-width: 760px) {
  .app-shell--calm .lawyer-desk {
    background: var(--paper-panel);
  }

  .app-shell--calm .lawyer-source-stack {
    background: var(--source-wash);
  }
}

/* =========================================================================
   cols-v44 — Sources: plain cites, inline details (no hyperlinks)
   ========================================================================= */
.app-shell--calm .lawyer-source-stack .agency-cite,
.app-shell--calm .lawyer-source-stack .dual-cite-ina,
.app-shell--calm .lawyer-source-stack .dual-cite-usc,
.app-shell--calm .lawyer-source-stack .source-quote-cite {
  font-weight: 600;
  color: var(--text);
}

.app-shell--calm .lawyer-source-stack .agency-cite-sub {
  display: none;
}

.app-shell--calm .lawyer-source-stack .lib-pdf-chip--plain {
  cursor: default;
  pointer-events: none;
}

.app-shell--calm .lawyer-source-stack .supplement-text,
.app-shell--calm .lawyer-source-stack .source-quote-text,
.app-shell--calm .lawyer-source-stack .lib-entry__rule {
  color: var(--text);
}

/* =========================================================================
   cols-v45 — issue selector above analysis: sticky strip, source-aware chips
   ========================================================================= */

.app-shell--calm .subissue-list--sticky {
  position: sticky;
  top: 0;
  z-index: 12;
  margin-top: 0;
  padding: 10px 0 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.app-shell--calm .subissue-list__label {
  margin-bottom: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.app-shell--calm .subissue-btn__badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(21, 86, 75, 0.12);
  color: var(--primary);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: middle;
}

.app-shell--calm .subissue-btn.is-active .subissue-btn__badge {
  background: rgba(21, 86, 75, 0.2);
}

.app-shell--calm .subissue-btn__approx {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted-2);
  line-height: 1;
}

.app-shell--calm .subissue-btn--compact .subissue-btn__cite {
  display: block;
}

@media (min-width: 761px) {
  .app-shell--calm .subissue-btn--compact {
    padding: 6px 10px 7px;
  }

  .app-shell--calm .subissue-btn--compact .subissue-btn__cite {
    display: block;
    font-size: 0.625rem;
  }
}

@media (max-width: 760px) {
  .app-shell--calm .subissue-list__groups {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    gap: 10px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell--calm .subissue-group {
    flex: 0 0 auto;
    min-width: min(100%, 280px);
    scroll-snap-align: start;
  }

  .app-shell--calm .subissue-group__items {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
  }

  .app-shell--calm .subissue-btn--compact {
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 220px;
  }

  .app-shell--calm .subissue-group--solo .subissue-btn {
    width: auto;
    min-width: 160px;
  }
}

/* =========================================================================
   cols-v47 — restore issue-file chips (above analysis); retire cols-v46 tab-only UI
   ========================================================================= */

.app-shell--calm .subissue-list--sticky {
  display: block;
}

.app-shell--calm .subissue-list__label {
  display: block;
}

.app-shell--calm .subissue-list__groups {
  display: flex;
}

.app-shell--calm .lawyer-reading-head .subissue-list--sticky {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

.app-shell--calm .subissue-group:not(.subissue-group--solo) {
  padding: 10px 12px 12px;
  border: 1px solid rgba(203, 212, 221, 0.55);
  border-radius: var(--radius);
  background: rgba(250, 252, 254, 0.72);
}

.app-shell--calm .subissue-list button strong,
.app-shell--calm .subissue-btn strong {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.app-shell--calm .subissue-btn__cite {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 1.25;
}

.app-shell--calm .lawyer-current-issue__question {
  display: block;
  margin: 0 0 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.4vw, 1.22rem);
  font-weight: 600;
  line-height: 1.2;
}

.app-shell--calm .lawyer-current-issue h3.lawyer-current-issue__question {
  display: block;
}

/* cols-v46 tab bar — removed from markup; hide if any stale DOM */
.app-shell--calm .subissue-tabs,
.app-shell--calm .subissue-tab-divider {
  display: none;
}

/* =========================================================================
   cols-v49 — issue files below analysis (retire sticky-above placement)
   ========================================================================= */

.app-shell--calm .subissue-list--below {
  display: block;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(203, 212, 221, 0.75);
}

.app-shell--calm .subissue-list--below .subissue-list__label {
  display: block;
  margin-bottom: 8px;
}

.app-shell--calm .subissue-list--below .subissue-list__groups {
  display: flex;
}

/* =========================================================================
   cols-v58 — Fit-to-screen: the analysis area scrolls within its OWN column
   (like the Sources panel), so the page itself never scrolls. Kills the
   awkward ~50px scroll on short analyses, and keeps the header + view tabs +
   step bar fixed. Desktop/tablet only (>760px); mobile keeps document scroll.
   ========================================================================= */
@media (min-width: 761px) {
  /* The analysis page becomes a fixed-height flex column under the sticky header;
     the view-tabs row auto-sizes and the workbench fills the rest. */
  .app-shell--calm .analysis-page-main {
    height: calc(100dvh - var(--header-sticky-h));
    max-height: calc(100dvh - var(--header-sticky-h));
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .app-shell--calm .analysis-workbench {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .app-shell--calm .analysis-workbench__mount {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  /* Desk: step bar (auto row) + the two columns (fill row). */
  .app-shell--calm .lawyer-desk {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
  }
  /* Both columns fill the content row and scroll INTERNALLY — no page scroll. */
  .app-shell--calm .lawyer-reading-desk,
  .app-shell--calm .lawyer-source-stack {
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Sources no longer needs to stick to a scrolling page. */
  .app-shell--calm .lawyer-source-stack {
    position: static;
    top: auto;
    align-self: stretch;
  }
  /* Step bar is row 1, always visible; the page can't scroll, so never hide it. */
  .app-shell--calm .lawyer-step-nav {
    position: static;
    transition: none;
  }
  .app-shell--calm #treeContainer.nav-hidden .lawyer-step-nav {
    transform: none;
  }
}

/* =========================================================================
   cols-v59 — "Issues in this step" always on screen: pin the step heading,
   the issue question, and a COMPACT issue-tab strip; only the prose body
   scrolls. Desktop/tablet only (>760px). Fixes having to scroll to see tabs.
   ========================================================================= */
@media (min-width: 761px) {
  /* The analysis column: heading + question + issue strip pinned; body scrolls. */
  .app-shell--calm .lawyer-reading-desk {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .app-shell--calm .lawyer-reading-desk > .lawyer-reading-head,
  .app-shell--calm .lawyer-reading-desk > .subissue-list {
    flex: 0 0 auto;
  }
  .app-shell--calm .lawyer-current-issue {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .app-shell--calm .lawyer-current-issue > .lawyer-current-issue__question {
    flex: 0 0 auto;
  }
  .app-shell--calm .lawyer-current-issue > .analysis-note-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
  }

  /* Compact the issue tabs: grouped chip strip instead of tall stacked boxes. */
  .app-shell--calm .subissue-list {
    margin-top: 0;
    padding-top: 10px;
    max-height: 40vh;          /* fallback internal scroll only if a step is very dense */
    overflow-y: auto;
  }
  .app-shell--calm .subissue-list__groups {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 6px;
  }
  .app-shell--calm .subissue-group:not(.subissue-group--solo) {
    border: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
  }
  .app-shell--calm .subissue-group__bar {
    margin: 0 0 4px;
    padding: 0;
    border-bottom: 0;
    font-size: 0.6rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted-2, var(--muted));
  }
  .app-shell--calm .subissue-group__items { gap: 5px; }
  .app-shell--calm .subissue-btn--compact { padding: 4px 9px 5px; min-height: auto; }
  /* Single-line chips — the cite line is the biggest height cost; drop it here. */
  .app-shell--calm .subissue-btn--compact .subissue-btn__cite { display: none; }
}

/* =========================================================================
   cols-v60 — Clearer two columns: wider Sources (right) column, a roomier
   gutter, and a full-height hairline divider between the two panes.
   Desktop/tablet only (>760px); mobile (stacked) unchanged.
   ========================================================================= */
@media (min-width: 761px) {
  .app-shell--calm .lawyer-desk {
    /* analysis ~47% | sources ~53% (was 6fr/5fr ≈ 55/45) */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    column-gap: clamp(28px, 3vw, 44px);
  }
  /* Full-height hairline separating the two fixed-height columns. */
  .app-shell--calm .lawyer-source-stack {
    border-left: 1px solid var(--border);
    padding-left: clamp(20px, 1.8vw, 32px);
  }
}

/* ═══ Wiki-term linking ═══════════════════════════════════════════════ */

/* Defined terms: brand-green like citations (per request), but a DOTTED underline +
   faint green wash keeps them distinguishable from citations' solid-underline links. */
.wiki-term {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: color-mix(in srgb, var(--primary) 78%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  color: color-mix(in srgb, var(--primary) 94%, var(--text));
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 3px;
  padding: 0 2px;
  transition: background 0.15s ease;
  font-weight: 600;
}
.wiki-term:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
}
.wiki-term:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

/* Inline abbreviation glossary (hover to recall the full term) — deliberately neutral &
   subtle so it reads as "definition on hover", not as a clickable green cite/term. */
.app-shell--calm .abbr-gloss {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: var(--muted-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
  color: inherit;
  background: none;
}
.app-shell--calm .abbr-gloss:hover {
  text-decoration-color: var(--muted);
}

/* Wire card styles (definition-wire.js) */
.definition-wire-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.wire-term-nav {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
.wire-term-nav__title {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wire-term-nav__chips,
.wire-related {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wire-term-nav__freshness {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--src-micro, 0.74rem);
  line-height: 1.35;
}
.wire-term-chip {
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 999px;
  background: var(--surface);
  color: color-mix(in srgb, var(--primary) 86%, var(--text));
  cursor: pointer;
  font: inherit;
  font-size: var(--src-meta, 0.8rem);
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 9px;
}
.wire-term-chip:hover,
.wire-term-chip:focus-visible {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  outline: none;
}
.wire-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}
/* .wire-card--disputed colored left accent removed — the "Disputed / grey area"
   badge already flags these cards. */
.wire-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.wire-card-title {
  font-weight: 600;
  font-size: 0.82rem;
  margin: 0;
}
.wire-card-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: oklch(0.58 0.14 55);
  background: oklch(0.98 0.02 80);
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.wire-card-embed {
  margin-top: 6px;
  padding: 8px 10px;
  background: oklch(0.98 0.005 250);
  border-radius: 6px;
  border: 1px solid oklch(0.93 0.005 250);
  font-size: 0.78rem;
}

.wire-card-body {
  margin: 6px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}
.wire-card-note {
  margin: 7px 0 0;
  color: var(--text);
  font-size: var(--src-read, 0.93rem);
  line-height: 1.5;
}
.wire-card-note--trap {
  color: color-mix(in srgb, oklch(0.48 0.12 45) 80%, var(--text));
}
.wire-pm-note {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: 7px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  color: var(--text);
  font-size: var(--src-meta, 0.8rem);
  line-height: 1.45;
}
.wire-pm-note__label {
  display: inline-block;
  margin-right: 6px;
  color: color-mix(in srgb, var(--primary) 88%, var(--text));
  font-size: var(--src-micro, 0.74rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wire-pm-note p {
  margin: 5px 0 0;
}
.wire-pm-note small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--src-micro, 0.74rem);
}
.wire-related {
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.wire-related > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.wire-term-chip--related {
  font-size: var(--src-micro, 0.74rem);
  padding: 3px 8px;
}

/* Source zone wrapper for wire cards */
.source-zone--wire {
  margin-top: 8px;
}

/* =========================================================================
   cols-v62 — Sources column gets a real title at top (mirrors the left
   column's titled structure). The lead "What the law says" zone title was
   only 12px / muted; promote it to a confident ~17px column header with a
   hairline rule. Kept below the 24px left reading-hero so sources still
   support rather than compete (design-system/product.md principle 3). Desktop + mobile.
   ========================================================================= */
.app-shell--calm .lawyer-source-stack .source-zone--definitions > .source-zone__title,
.app-shell--calm .lawyer-source-stack .source-zone--forum > .source-zone__title {
  font-size: 1.0625rem;            /* ~17px */
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* =========================================================================
   cols-v63 — "Graph ↗" view tab is an <a> (opens the source-relationship graph
   in a new tab). Anchors carry a default underline that <button> tabs don't, so
   reset it and match the button tabs' vertical centering.
   ========================================================================= */
.app-shell--calm a.framework-view-tab,
.app-shell--calm .framework-view-tab--link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ════════════════════════════════════════════════════════════
   cols-v71 — About panel: editorial refresh on the shared type tokens.
   Appended last so it wins the cascade over earlier About rules.
   ════════════════════════════════════════════════════════════ */
.app-shell--calm .framework-about {
  max-width: 46rem;
  margin: 0 auto;
}
.app-shell--calm .framework-about__eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}
.app-shell--calm .framework-about__intro h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: var(--lh-title);
  letter-spacing: -0.02em;
  color: var(--text);
}
.app-shell--calm .framework-about__lede {
  margin: 0 0 10px;
  max-width: 40rem;
  color: var(--text);
  font-size: var(--fs-read);
  line-height: var(--lh-read);
}
.app-shell--calm .framework-about__lede--secondary {
  color: var(--muted);
}
.app-shell--calm .framework-about__block {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.app-shell--calm .framework-about__block h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-h3);
  letter-spacing: -0.01em;
  text-transform: none;
}
.app-shell--calm .framework-about__overview {
  margin: 0 0 8px;
  max-width: 40rem;
  color: var(--muted);
  font-size: var(--fs-read);
  line-height: var(--lh-read);
}
.app-shell--calm .framework-about__note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 28px;
}
.app-shell--calm .framework-about__note h3 { margin-top: 0; }
.app-shell--calm .framework-about__note .framework-about__overview {
  margin-bottom: 0;
  color: var(--text);
}
/* Visible "what this step decides" descriptor in each outline item */
.app-shell--calm .framework-outline__blurb {
  display: block;
  margin-top: 4px;
  max-width: 40rem;
  color: var(--muted);
  font-size: var(--fs-src);
  font-weight: 400;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: 0;
}

/* ════════════════════════════════════════════════════════════
   cols-v76 — Wire-card "covers" line (source wayfinding); About
   panel scrollability + better horizontal use of space.
   Appended last so it wins the cascade over earlier rules.
   ════════════════════════════════════════════════════════════ */
.app-shell--calm .wire-card-covers {
  margin: 1px 0 0;
  font-size: var(--src-meta, 0.8rem);
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* About: was a narrow 46rem column with large empty margins. Widen the measure. */
.app-shell--calm .framework-about {
  max-width: 60rem;
}

@media (min-width: 761px) {
  /* The About view shares the fixed-height workbench (overflow:hidden) with the
     analysis mount, so it was clipped and could not scroll. Give it the same
     fill height and let it scroll internally. */
  .app-shell--calm .framework-about-panel {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

@media (min-width: 880px) {
  /* Lay the six-step outline in two columns to use the horizontal space and
     cut the vertical scroll. Per-item top rules read cleanly across columns. */
  .app-shell--calm .framework-outline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: calc(var(--grid-bl) * 5);
  }
  .app-shell--calm .framework-outline__item + .framework-outline__item {
    border-top: 0;
  }
  .app-shell--calm .framework-outline__item {
    border-top: 1px solid var(--border);
  }
}

/* ════════════════════════════════════════════════════════════
   cols-v77 — Cite tooltip "← Back" control (wiki-style navigation
   through cross-referenced definitions).
   ════════════════════════════════════════════════════════════ */
.app-shell--calm .cite-tip__back[hidden] {
  display: none;   /* explicit display below would otherwise override the [hidden] attr */
}
.app-shell--calm .cite-tip__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 8px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-2, var(--muted));
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.app-shell--calm .cite-tip__back:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.app-shell--calm .cite-tip__back:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════
   cols-v79 — About panel scroll on MOBILE. The earlier scroll fix
   (cols-v76) was @media(min-width:761px) — desktop only; on phones/tablets
   the About panel still relied on document scroll. Give it its OWN internal
   scroll, capped just below the header + view-tabs, so the whole page
   (incl. the disclaimer) is always reachable regardless of document scroll.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  .app-shell--calm .framework-about-panel {
    max-height: calc(100dvh - 116px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}

/* ════════════════════════════════════════════════════════════
   cols-v80 — About: 2-column editorial layout on wide screens so the
   content fills the width instead of a narrow centred measure with large
   empty side margins. Full-width intro; "how it works" + the six-step
   outline on the left; "sources & how they're verified" + the agency index
   on the right. Single column below 1000px (unchanged).
   ════════════════════════════════════════════════════════════ */
@media (min-width: 1000px) {
  .app-shell--calm .framework-about {
    max-width: 74rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: clamp(36px, 4vw, 64px);
    align-items: start;
  }
  .app-shell--calm .framework-about__intro { grid-column: 1 / -1; }
  .app-shell--calm .framework-about [aria-labelledby="about-method-heading"] { grid-column: 1; grid-row: 2; }
  .app-shell--calm .framework-about [aria-labelledby="about-steps-heading"]  { grid-column: 1; grid-row: 3; }
  .app-shell--calm .framework-about [aria-labelledby="about-sources-heading"] { grid-column: 2; grid-row: 2 / span 2; }
  /* The six-step outline goes single-column inside the half-width left column. */
  .app-shell--calm .framework-outline { grid-template-columns: 1fr; }
  .app-shell--calm .framework-outline__item { border-top: 0; }
  .app-shell--calm .framework-outline__item + .framework-outline__item { border-top: 1px solid var(--border); }
}

/* ════════════════════════════════════════════════════════════
   cols-v87 — Top-right link back to the main site (www.russkysong.com).
   Makes the header a flex row: brand left, site link right.
   ════════════════════════════════════════════════════════════ */
.app-shell--calm .app-header-inner {
  display: flex;
  flex-direction: row;          /* override the mobile column layout so the link stays top-right */
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-shell--calm .app-header-inner .brand-lockup {
  min-width: 0;                 /* let the brand shrink so the link fits on one row */
}
.app-shell--calm .app-header-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.app-shell--calm .app-header-link:hover {
  color: var(--primary);
  background: var(--surface);
}
.app-shell--calm .app-header-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.app-shell--calm .app-header-link__arrow {
  font-size: 0.85em;
  opacity: 0.7;
}

/* ════════════════════════════════════════════════════════════
   cols-v91 — Reclaim vertical space: tabs moved into the header
   row (markup), and the "Issues in this step" list tightened.
   ════════════════════════════════════════════════════════════ */
.app-shell--calm .app-header-inner .framework-view-tabs { flex: 0 0 auto; }

.app-shell--calm .subissue-list--below { margin-top: 8px; padding-top: 8px; }
.app-shell--calm .subissue-list--below .subissue-list__label {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.app-shell--calm .subissue-list--below .subissue-list__groups { gap: 9px; margin-top: 4px; }
.app-shell--calm .subissue-list--below .subissue-group {
  padding: 0;
  border: none;
  background: none;
}
.app-shell--calm .subissue-list--below .subissue-group__bar {
  font-size: 0.6rem;
  margin: 0 0 4px;
  padding: 0;
  border-bottom: none;
}
.app-shell--calm .subissue-list--below .subissue-group__items { gap: 5px; }
.app-shell--calm .subissue-list--below .subissue-btn,
.app-shell--calm .subissue-list--below .subissue-group__items button {
  min-height: 0;
  padding: 5px 11px;
  font-size: 0.82rem;
}

/* cols-v91 (cont.) — narrow screens: brand on its own row, tabs + site
   link wrap below it (the desktop one-row header is too tight on mobile). */
@media (max-width: 760px) {
  .app-shell--calm .app-header-inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .app-shell--calm .app-header-inner .brand-lockup { flex: 1 1 100%; }
  .app-shell--calm .app-header-inner .app-header-link { margin-left: auto; }
}

/* cols-v91 (cont.) — header reads logo → nav left, site link far right
   (centered tabs looked awkward floating between brand and link). */
.app-shell--calm .app-header-inner { justify-content: flex-start; }
.app-shell--calm .app-header-inner .framework-view-tabs { margin-left: 22px; }
.app-shell--calm .app-header-inner .app-header-link { margin-left: auto; }

/* cols-v91 (cont.) — align the header (logo + tabs) with the step rail and the
   analysis title below it. The header used --layout-gutter (clamp 16/2.6vw/44)
   while the content uses --grid-margin (clamp 20/2.5vw/48), so the left edges
   drifted 1–4px apart by width. Use the same gutter for both. */
.app-shell--calm .app-header-inner {
  padding-left: var(--grid-margin);
  padding-right: var(--grid-margin);
}

/* cols-v91 (cont.) — the step buttons have 12px left padding, so the "1" circle
   rendered at 48px while the logo + title sit at the content edge (--grid-margin,
   ~36px). Offset the rail by that padding so the first step number lines up. */
.app-shell--calm .lawyer-step-list { margin-left: -12px; }

/* cols-v91 (cont.) — distribute the 6 step tabs evenly across the full width
   instead of packing them left with empty space on the right. Step 1 stays
   flush-left (aligned with the logo); step 6 sits at the right edge. */
.app-shell--calm .lawyer-step-list { justify-content: space-between; }

/* ════════════════════════════════════════════════════════════
   cols-v92 — Matter working state + print + fixes
   1. Cite buttons inside step questions were caught by the 0.67rem
      eyebrow rule (`.lawyer-reading-head span`) and rendered near-invisible
      at ~10.7px next to the question text. Pin every cite wrapper to the
      size of its surrounding text.
   2. Visit markers: • on issue chips already opened, n/m progress on the
      step rail.
   3. Matter notes: collapsed notes bar under the step head.
   4. Print button + print stylesheet (analysis pane only).
   5. Mobile: step rail collapses to the active step; tap it to expand.
   ════════════════════════════════════════════════════════════ */

/* 2 — visited chips + step-rail progress */
.app-shell--calm .subissue-btn__visited {
  color: var(--primary);
  font-weight: 700;
  margin-right: 5px;
}
.app-shell--calm .subissue-btn.is-visited:not(.is-active) strong {
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}
/* small.lawyer-step-btn__progress outranks the `.lawyer-step-btn small
   { display:none }` rule that hides the old step subtitles */
.app-shell--calm small.lawyer-step-btn__progress {
  display: inline;
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 3 — matter notes bar */
.app-shell--calm .matter-notes {
  margin: calc(var(--grid-bl) * 1.5) 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 3%, transparent);
}
.app-shell--calm .matter-notes summary {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  list-style-position: inside;
}
.app-shell--calm .matter-notes summary:hover { color: var(--text); }
.app-shell--calm .matter-notes__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--primary);
  vertical-align: 1px;
}
.app-shell--calm .matter-notes__text {
  display: block;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--bg, #fff);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
}
.app-shell--calm .matter-notes__text:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.app-shell--calm .matter-notes__privacy {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted, #666);
}
.app-shell--calm .matter-notes__clear {
  appearance: none;
  margin: 0 12px 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: underline;
  cursor: pointer;
}
.app-shell--calm .matter-notes__clear:hover { color: var(--text); }

/* 4 — print button + print sheet */
.app-shell--calm .lawyer-reading-head { position: relative; }
.app-shell--calm .print-analysis-btn {
  position: absolute;
  top: 0;
  right: 0;
  appearance: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.app-shell--calm .print-analysis-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}
@media print {
  .app-shell--calm .app-header,
  .app-shell--calm .skip-links,
  .app-shell--calm .lawyer-step-nav,
  .app-shell--calm .lawyer-source-stack,
  .app-shell--calm .print-analysis-btn,
  .app-shell--calm .matter-notes__clear,
  .app-shell--calm .step-pager,
  .app-shell--calm .grid-guides {
    display: none !important;
  }
  .app-shell--calm .lawyer-desk { display: block; }
  .app-shell--calm .lawyer-reading-desk { max-width: none; }
  .app-shell--calm .matter-notes { border: 1px solid #999; }
  .app-shell--calm .matter-notes__text { border: 0; resize: none; }
  .app-shell--calm .matter-notes:not([open]) { display: none; }
}

/* 5 — mobile step rail: collapsed to the active step, tap to expand */
@media (max-width: 760px) {
  .app-shell--calm .lawyer-step-nav:not(.is-open) .lawyer-step-btn:not(.is-active) {
    display: none;
  }
  .app-shell--calm .lawyer-step-btn.is-active strong::after {
    content: "▾";
    padding-left: 8px;
    color: var(--muted);
    font-size: 0.7rem;
  }
  .app-shell--calm .lawyer-step-nav.is-open .lawyer-step-btn.is-active strong::after {
    content: "▴";
  }
}
