:root {
  color-scheme: light;
  --bg: #fff; --bg-elev: #f7f8f8; --ink: #1f2937; --ink-soft: #4b5563;
  --muted: #6a737b; --muted-2: #9ca3af; --hair: rgba(31,41,55,.08); --hair-strong: rgba(31,41,55,.16);
  --accent: #00728f; --accent-soft: #a9d5df; --accent-2: #185384; --highlight: rgba(0,114,143,.075);
  --serif: 'Iowan Old Style', Charter, Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  --radius: 3px; --radius-lg: 6px; --header-height: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark; --bg: #0b1014; --bg-elev: #141a20; --ink: #e5e9ee; --ink-soft: #b4bcc4;
    --muted: #8a949e; --muted-2: #727e89; --hair: rgba(229,233,238,.09); --hair-strong: rgba(229,233,238,.18);
    --accent: #3e9fb2; --accent-soft: #1d4a55; --accent-2: #65b3c3; --highlight: rgba(62,159,178,.12);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark; --bg: #0b1014; --bg-elev: #141a20; --ink: #e5e9ee; --ink-soft: #b4bcc4;
  --muted: #8a949e; --muted-2: #727e89; --hair: rgba(229,233,238,.09); --hair-strong: rgba(229,233,238,.18);
  --accent: #3e9fb2; --accent-soft: #1d4a55; --accent-2: #65b3c3; --highlight: rgba(62,159,178,.12);
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
.article-heading, .provision-block, .footnotes p { scroll-margin-top: calc(var(--header-height) + 20px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
button, a, input, select, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
svg { width: 18px; height: 18px; flex-shrink: 0; }
p { margin: 0 0 12px; }
h1, h2, h3 { font-weight: 500; }
h1 { font: 28px/1.25 var(--serif); margin: 0 0 20px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 20px; z-index: 100; padding: 8px 16px; background: var(--bg); border: 1px solid var(--accent); }
.skip-link:focus { top: 8px; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: var(--header-height); padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--hair-strong); }
.identity, .utilities, .reading-actions { display: flex; align-items: center; }
.identity { flex-shrink: 0; }
.brand { white-space: nowrap; font-size: 18px; font-weight: 650; letter-spacing: -.035em; }
.tabs { display: flex; align-self: stretch; gap: 22px; }
.tab { font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count { font-size: 10px; color: var(--muted); }
.document-status { font-size: 11px; color: var(--muted); white-space: nowrap; }
.search-box { position: relative; margin-left: auto; width: clamp(180px, 20vw, 340px); }
.search-field { display: flex; align-items: center; gap: 8px; padding: 5px 9px; background: var(--bg-elev); border: 1px solid var(--hair-strong); border-radius: var(--radius); }
.search-field svg { width: 14px; color: var(--muted); }
.search-field input { min-width: 0; width: 100%; border: 0; background: transparent; font-size: 13px; }
.search-field input::placeholder { color: var(--muted); }
kbd { font: 11px var(--mono); color: var(--muted); }
.utilities { gap: 18px; flex-shrink: 0; }
.theme-select { border: 0; background: var(--bg); color: var(--ink-soft); font-size: 12px; max-width: 75px; cursor: pointer; }
.text-button { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); }
.text-button svg { width: 12px; height: 12px; }
.text-button:hover, summary:hover { color: var(--accent); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: var(--radius); color: var(--muted); }
.icon-button:hover { color: var(--accent); background: var(--highlight); }
.icon-button svg { width: 15px; height: 15px; }
.mobile-menu, .sidebar-close { display: none; }
.document-source { position: relative; font-size: 12px; }
summary { cursor: pointer; color: var(--ink-soft); }
.source-popover { position: absolute; right: 0; top: calc(100% + 16px); width: 330px; padding: 20px; background: var(--bg); border: 1px solid var(--hair-strong); border-radius: var(--radius); box-shadow: 0 8px 24px #00000012; font-size: 13px; }
.source-popover p:first-child { font-weight: 500; }
.workspace { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100dvh - var(--header-height)); align-items: start; }
.workspace.definition-open { grid-template-columns: 240px minmax(0, 1fr) 360px; }
.sidebar { position: sticky; top: var(--header-height); height: calc(100dvh - var(--header-height)); overflow-y: auto; border-right: 1px solid var(--hair-strong); padding: 16px 12px 24px; scrollbar-width: thin; scrollbar-color: var(--hair-strong) transparent; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 8px 12px; }
.contents-jumps { display: flex; gap: 16px; font-size: 12px; }
.contents-jumps a { color: var(--ink-soft); }
.contents-jumps a:hover, .contents-jumps a.active { color: var(--accent); }
.contents-section-heading { font: 600 12px/1.5 var(--sans); margin: 14px 8px 8px; color: var(--ink-soft); }
.eyebrow { font-size: 12px; font-weight: 500; color: var(--muted); }
.chapter-group { margin-bottom: 14px; }
.chapter-group summary { position: relative; list-style: none; padding: 4px 18px 5px 8px; line-height: 1.4; }
.chapter-group summary::-webkit-details-marker { display: none; }
.chapter-group summary::after { content: ''; position: absolute; top: 9px; right: 5px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); width: 5px; height: 5px; transform: rotate(-45deg); }
.chapter-group[open] summary::after { transform: rotate(45deg); }
.chapter-group:has(.active) > summary .eyebrow { color: var(--accent); }
.chapter-group .eyebrow { display: inline; font-size: 11px; }
.chapter-title { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 2px 0; }
.contents-item { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 8px; padding: 5px 8px 5px 6px; font-size: 12px; line-height: 1.4; border-left: 2px solid transparent; color: var(--ink-soft); }
.contents-item:hover, .contents-definition:hover { background: var(--bg-elev); color: var(--ink); }
.contents-item.active, .contents-definition.active { border-left-color: var(--accent); background: var(--highlight); color: var(--accent); }
.item-number { color: var(--muted); font: 11px/1.55 var(--sans); white-space: nowrap; }
.contents-item.active .item-number { color: var(--accent); }
.contents-definition { display: block; padding: 6px 8px; font-size: 12px; border-left: 2px solid transparent; }
.reader { min-width: 0; width: 100%; max-width: 884px; margin: 0 auto; padding: 24px 32px 60px; outline: none; }
.chapter-heading { font: 600 13px/1.5 var(--sans); color: var(--ink-soft); margin: 32px 0 14px; padding: 10px 0; border-top: 1px solid var(--hair-strong); }
.document-section-heading { font: 600 13px/1.5 var(--sans); color: var(--ink-soft); margin: 36px 0 16px; padding-top: 16px; border-top: 1px solid var(--hair-strong); }
.reader > .document-section-heading:nth-child(2) { margin-top: 0; padding-top: 0; border-top: 0; }
.document-section-heading + .chapter-heading { margin-top: 0; padding-top: 0; border-top: 0; }
.section-heading { font: 500 13px/1.5 var(--sans); margin: 18px 0 14px; color: var(--muted); }
.provision { margin: 0 0 26px; }
.provision + .provision { border-top: 1px solid var(--hair); padding-top: 20px; }
.article-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.article-heading { font: 24px/1.3 var(--serif); letter-spacing: -.02em; margin: 0; flex: 1; min-width: 0; outline: none; }
.article-heading:focus-visible { outline: 2px solid var(--accent); }
.reading-actions { gap: 6px; white-space: nowrap; flex-shrink: 0; }
.reading-actions .text-button { font-size: 11px; color: var(--muted); }
.legal-text { font-size: 16px; line-height: 1.6; }
.provision-block { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; margin: 0 0 12px; outline: none; }
.provision-block p { margin: 0; }
.provision-block:focus, .search-match { background: var(--highlight); }
.paragraph-number { font: 11px/2.3 var(--mono); color: var(--muted); align-self: start; }
.paragraph-number:hover { color: var(--accent); }
.silent-anchor { opacity: 0; }
.provision-block:hover .silent-anchor, .silent-anchor:focus { opacity: 1; }
.list-point { padding-left: 20px; grid-template-columns: 28px minmax(0,1fr); }
.defined-term { text-decoration: underline; text-decoration-color: var(--hair-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.defined-term:hover, .defined-term[aria-expanded='true'] { color: var(--accent); text-decoration-color: var(--accent); }
.article-reference { color: var(--accent); }
.article-reference:hover { text-decoration: underline; text-underline-offset: 3px; }
.external-reference { border-bottom: 1px dotted var(--hair-strong); }
.external-reference:hover { color: var(--accent); }
.legal-text sup { margin-left: 2px; font: 10px var(--mono); color: var(--accent); }
.footnotes { margin: 16px 0 0; padding-top: 10px; border-top: 1px solid var(--hair); }
.footnotes p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 8px 0; overflow-wrap: anywhere; }
.footnote-number { margin-right: 8px; font-family: var(--mono); }
.context-panel { position: sticky; top: var(--header-height); max-height: calc(100dvh - var(--header-height)); overflow: auto; padding: 24px; border-left: 1px solid var(--hair-strong); scrollbar-width: thin; scrollbar-color: var(--hair-strong) transparent; }
.panel-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.definition-title { flex: 1; font: 24px/1.3 var(--serif); letter-spacing: -.02em; margin: 0; overflow-wrap: anywhere; }
.definition-text { font-size: 14px; line-height: 1.6; }
.definition-source { margin: 18px 0; padding-top: 12px; border-top: 1px solid var(--hair); }
.source-citation { display: flex; gap: 6px; align-items: baseline; color: var(--accent); font-size: 12px; margin: 8px 0; }
.source-citation svg { height: 11px; width: 11px; }
.source-citation:hover { text-decoration: underline; }
.source-details { font-size: 12px; color: var(--muted); }
.source-details summary { margin-bottom: 8px; }
.source-details p { margin-bottom: 6px; }
.definition-note { border-left: 2px solid var(--accent-soft); padding-left: 10px; font-size: 12px; color: var(--ink-soft); margin: 16px 0; }
.related-terms, .occurrences { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 12px; }
.related-term { display: block; color: var(--accent); margin-top: 8px; }
.related-term:hover { text-decoration: underline; }
.occurrence { display: block; border-bottom: 1px solid var(--hair); padding: 8px 0; }
.occurrence:hover { color: var(--accent); }
.occurrence-title { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }
.muted { color: var(--muted); }
.glossary-row { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--hair); padding: 10px 0; }
.glossary-row > div { flex: 1; }
.glossary-term { font-size: 15px; }
.glossary-source, .origin-label { font-size: 11px; color: var(--muted); }
.glossary-source { display: block; }
.glossary-row svg { width: 14px; color: var(--muted); }
.glossary-row:hover, .glossary-row.selected { color: var(--accent); }
.search-results { position: absolute; right: 0; top: calc(100% + 8px); width: min(580px, calc(100vw - 32px)); max-height: min(680px, calc(100dvh - var(--header-height) - 24px)); overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border: 1px solid var(--hair-strong); border-radius: var(--radius); box-shadow: 0 8px 24px #00000012; }
.search-heading { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; background: var(--bg); border-bottom: 1px solid var(--hair); padding: 8px 16px; font-size: 12px; color: var(--muted); }
.search-result { display: block; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.search-result:hover, .search-result:focus { background: var(--bg-elev); outline-offset: -3px; }
.result-title { font-size: 14px; font-weight: 500; }
.result-category { display: block; font-size: 11px; color: var(--muted); }
.search-result p { color: var(--ink-soft); font-size: 12px; margin: 4px 0 0; line-height: 1.5; }
mark { background: var(--highlight); color: inherit; }
.empty-state { padding: 16px; font-size: 13px; }
.shade { position: fixed; inset: 0; background: #0005; z-index: 40; }
.overlay-open { overflow: hidden; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--bg); border-radius: var(--radius); display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 12px; max-width: calc(100vw - 30px); }
.boot-message { margin: 10vh auto; text-align: center; color: var(--muted); }
@media (min-width: 1700px) {
  .workspace { grid-template-columns: 280px minmax(0,1fr); }
  .workspace.definition-open { grid-template-columns: 280px minmax(0,1fr) 360px; }
}
@media (max-width: 1350px) {
  .app-header { gap: 18px; padding: 0 18px; }
  .document-status { display: none; }
  .utilities { gap: 12px; }
  .reader { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 1100px) {
  .workspace, .workspace.definition-open { grid-template-columns: 220px minmax(0,1fr); }
  .context-panel.is-definition { position: fixed; top: 0; bottom: 0; right: 0; height: 100dvh; max-height: 100dvh; width: 370px; max-width: 90vw; background: var(--bg); z-index: 50; }
  .tabs { gap: 16px; }
  .tab-count { display: none; }
  .search-box { width: clamp(140px, 20vw, 240px); }
  .document-source > summary { font-size: 0; }
  .document-source > summary::after { content: 'Source'; font-size: 12px; }
  .source-popover summary { font-size: inherit; }
}
@media (max-width: 850px) and (min-width: 701px) {
  .app-header { gap: 12px; padding: 0 14px; }
  .brand { font-size: 16px; }
  .tabs { gap: 12px; }
  .tab { font-size: 12px; }
  .utilities { gap: 8px; }
  .theme-select { max-width: 65px; font-size: 11px; }
}
@media (max-width: 700px) {
  :root { --header-height: 98px; }
  .app-header { display: grid; grid-template-columns: 1fr auto; grid-template-rows: 48px 49px; gap: 0 12px; padding: 0 16px; }
  .identity { gap: 6px; grid-column: 1; grid-row: 1; }
  .brand { font-size: 18px; }
  .mobile-menu { display: inline-flex; margin-left: -6px; }
  .utilities { grid-column: 2; grid-row: 1; gap: 12px; }
  .tabs { grid-row: 2; grid-column: 1; gap: 15px; }
  .tab { font-size: 12px; }
  .search-box { grid-row: 2; grid-column: 2; width: 112px; margin: 0; }
  .search-field { padding: 4px 6px; gap: 4px; }
  .search-field input { font-size: 12px; }
  .search-field kbd { display: none; }
  .search-results { position: fixed; top: var(--header-height); left: 16px; right: 16px; width: auto; }
  .source-popover { position: fixed; top: 48px; left: 16px; right: 16px; width: auto; max-height: calc(100dvh - 64px); overflow-y: auto; }
  .workspace, .workspace.definition-open { display: block; }
  .sidebar { display: none; }
  .sidebar.nav-open { display: block; position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); height: 100dvh; background: var(--bg); z-index: 50; padding: 16px; }
  .sidebar-close { display: inline-flex; }
  .contents-item { padding-top: 9px; padding-bottom: 9px; }
  .reader { padding: 16px 18px 40px; }
  .chapter-heading { font-size: 12px; margin-bottom: 10px; }
  .article-heading { font-size: 22px; }
  .article-header { gap: 6px; margin-bottom: 12px; }
  .reading-actions { gap: 2px; }
  .legal-text { font-size: 15px; }
  .provision-block { gap: 5px; grid-template-columns: 18px minmax(0,1fr); }
  .list-point { padding-left: 10px; grid-template-columns: 25px minmax(0,1fr); }
  .paragraph-number { font-size: 10px; }
  .context-panel.is-definition { top: auto; bottom: 0; width: 100%; max-width: 100%; height: auto; max-height: 85dvh; padding: 20px; border: 1px solid var(--hair-strong); border-radius: 6px 6px 0 0; }
  .glossary-row .origin-label { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .defined-term, .contents-item { transition: color .12s, background-color .12s; } }
@media print {
  .app-header, .sidebar, .context-panel, .reading-actions, .shade, .toast { display: none !important; }
  .workspace, .workspace.definition-open { display: block; }
  .reader { max-width: none; padding: 0; }
  .defined-term, .external-reference { text-decoration: none; border: 0; }
  .article-header { break-after: avoid; }
  body { color: #000; background: #fff; }
}
