:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #16171b;
  --panel-raised: #202227;
  --panel-strong: #eeece5;
  --text: #eeece5;
  --muted: #a3a5aa;
  --line: #34363d;
  --accent: #a4b2bf;
  --accent-strong: #c4ccd3;
  --accent-soft: #22282e;
  --good: #94aa8e;
  --warn: #c3a153;
  --bad: #c4766d;
  --shadow: none;
  --mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
  --sans: "Segoe UI", Arial, sans-serif;
}
[data-theme="contrast"] {
  --bg: #08090a;
  --panel: #111216;
  --panel-raised: #23252b;
  --text: #ffffff;
  --muted: #c5c7cc;
  --line: #767b85;
  --accent: #c2d4e4;
  --accent-strong: #e0e9f1;
  --accent-soft: #28323a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 310px;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.no-outline .app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.no-outline .outline-panel {
  display: none;
}

.sidebar,
.outline-panel {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
}

.sidebar {
  border-radius: 3px;
  padding: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 62px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.kicker,
.save-status,
.outline-nav a {
  color: var(--muted);
}

.section-nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.section-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  overflow: hidden;
}

.section-item:hover,
.section-item.active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
}

.section-link,
.section-actions button {
  border: 0;
  background: transparent;
  color: var(--text);
}

.section-link {
  min-width: 0;
  padding: 13px 14px;
  text-align: left;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-actions {
  display: flex;
  gap: 2px;
  padding-right: 6px;
}

.section-actions button {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.section-actions button:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
}

.section-link[draggable="true"] {
  cursor: grab;
}

.section-link.is-dragging {
  cursor: grabbing;
  opacity: 0.54;
}

.section-link.drag-over-before {
  box-shadow: 0 -3px 0 var(--accent);
}

.section-link.drag-over-after {
  box-shadow: 0 3px 0 var(--accent);
}

.main-panel {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.kicker {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions,
.toolbar,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn,
.toolbar button,
.upload-btn {
  min-height: 40px;
  border-radius: 3px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #111;
}

.secondary-btn,
.ghost-btn {
  background: transparent;
}

.ghost-btn {
  width: 100%;
  margin-top: 16px;
}

.icon-btn {
  width: 42px;
  padding: 0;
}

.toolbar {
  position: sticky;
  top: 88px;
  z-index: 5;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: none;
}

.search-bar {
  position: sticky;
  top: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: none;
}

.search-bar {
  display: flex;
}

.search-bar input {
  flex: 1;
  min-width: 180px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--text);
}

.search-count,
.search-bar .save-status {
  min-width: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
}

.search-actions button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
}

.search-actions button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-actions button:disabled {
  cursor: not-allowed;
  color: color-mix(in srgb, var(--muted) 50%, transparent);
}

.toolbar button,
.upload-btn {
  height: 36px;
  min-height: 36px;
}

.toolbar button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.toolbar select {
  height: 36px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
}

#fontSize {
  min-width: 92px;
}

.underline {
  text-decoration: underline;
}

.divider {
  width: 1px;
  height: 28px;
  background: var(--line);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.upload-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.save-status {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 700;
}

.document-page {
  min-height: calc(100vh - 156px);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: clamp(28px, 5vw, 72px);
  background: var(--panel);
  box-shadow: var(--shadow);
  outline: none;
}

.document-page[contenteditable="true"] {
  caret-color: var(--accent);
}

.document-page :first-child {
  margin-top: 0;
}

.document-page h2 {
  margin: 2.3rem 0 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 2px solid var(--accent);
  color: var(--accent-strong);
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  letter-spacing: 0;
}

.document-page h3 {
  margin: 1.8rem 0 0.65rem;
  color: var(--accent);
  font-size: 1.15rem;
  letter-spacing: 0;
}

.document-page .document-highlight {
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 18%, transparent);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.document-page .search-hit {
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 42%, #ffffff);
  color: #111;
  padding: 0 0.12em;
}

.document-page .active-search-hit {
  background: #ffd166;
  color: #080604;
  box-shadow:
    0 0 0 2px #111,
    0 0 0 5px color-mix(in srgb, #ffd166 62%, transparent);
}

.document-page p,
.document-page li,
.document-page td,
.document-page th {
  font-size: 1rem;
  line-height: 1.78;
}

.document-page p:empty,
.document-page span:empty,
.document-page li:empty,
.document-page o\:p {
  display: none;
}

.document-page li > p {
  display: inline;
  margin: 0;
}

.document-page li > p + p {
  margin-left: 0.35rem;
}

.document-page ol,
.document-page ul {
  margin: 0.75rem 0 0.9rem 1.35rem;
  padding-left: 1.15rem;
}

.document-page li > ol,
.document-page li > ul {
  display: block;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.document-page li {
  margin: 0.12rem 0;
  padding-left: 0.2rem;
}

.document-page ol.alpha-list {
  margin-left: 2.75rem;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.document-page .manual-list-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 0.55rem;
  align-items: start;
  margin: 0.18rem 0;
  line-height: 1.55;
}

.document-page .manual-list-level-1 {
  margin-left: 3rem;
}

.document-page .manual-list-marker {
  font-weight: 700;
  text-align: right;
  user-select: none;
}

.document-page .manual-list-content {
  display: block;
  min-width: 0;
}

.document-page .manual-list-content:empty::after {
  content: "\00a0";
}

.document-page .manual-list-content:empty {
  display: block;
}

.document-page .law-article-heading {
  margin-top: 2.3rem;
}

.document-page .law-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  column-gap: 0.6rem;
  align-items: start;
  margin: 0.22rem 0;
  line-height: 1.58;
}

.document-page .law-row-level-1 {
  margin-left: 1.35rem;
}

.document-page .law-row-marker {
  font-weight: 800;
  text-align: right;
  user-select: none;
}

.document-page .law-row-content {
  display: block;
  min-width: 0;
}

.document-page .law-row-content:empty::after {
  content: "\00a0";
}

.document-page .law-row-content:empty {
  display: block;
}

.document-page ol + ol,
.document-page ul + ul,
.document-page ol + ul,
.document-page ul + ol {
  margin-top: -0.25rem;
}

.document-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-strong) 8%);
}

.document-page th,
.document-page td {
  border: 1px solid var(--line);
  padding: 14px 16px;
  vertical-align: top;
}

.document-page th {
  background: color-mix(in srgb, var(--panel) 84%, var(--panel-strong) 16%);
  text-align: left;
  font-weight: 800;
}

.document-page .law-table thead th {
  font-style: italic;
  text-align: center;
}

.document-page .law-table tbody th {
  width: 28%;
}

.document-page .law-table td {
  text-align: center;
}

.document-page img {
  max-width: 100%;
  border-radius: 3px;
  margin: 1rem 0;
}

.outline-panel {
  border-radius: 3px;
  padding: 22px;
}

.outline-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.outline-nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.outline-nav a {
  display: block;
  border-left: 3px solid transparent;
  padding: 8px 10px;
  text-decoration: none;
  line-height: 1.35;
}

.outline-nav a:hover {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.outline-nav .article-link {
  padding-left: 22px;
  font-size: 0.92rem;
}

.outline-nav .title-link {
  color: var(--text);
  font-weight: 800;
}

.modal {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.modal form {
  padding: 24px;
}

.modal h2 {
  margin: 0 0 8px;
}

.modal input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--text);
}

.error-text {
  min-height: 20px;
  color: #e74d3c;
  font-weight: 700;
}

body:not(.edit-mode) .editor-only {
  display: none;
}

body:not(.auth-mode) .auth-only {
  display: none;
}

body.auth-mode .guest-only {
  display: none;
}

body:not(.can-edit-mode) .admin-only {
  display: none;
}

.status-modal {
  width: min(760px, calc(100vw - 32px));
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.status-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-strong) 8%);
}

.status-item span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.status-item strong {
  overflow-wrap: anywhere;
}

.status-item.good strong {
  color: #47b36b;
}

.status-item.warn strong {
  color: var(--accent-strong);
}

.status-item.bad strong {
  color: #e74d3c;
}

.status-issues {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px;
}

.status-issues h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.status-issues ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .outline-panel {
    display: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
    padding: 12px;
  }

  .sidebar,
  .outline-panel {
    position: static;
    height: auto;
    margin-bottom: 14px;
  }

  .section-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-page {
    min-height: 60vh;
    padding: 24px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }
}

/* 90s NL — dark HUD / LSPD legal reference. */
html { scroll-padding-top: 160px; scrollbar-color: #474a52 var(--bg); }
body { font-family: var(--sans); font-size: 14px; }
button, input, select { font-family: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:is(button, a, input, select, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button { transition: background 120ms ease, border-color 120ms ease; }
button:hover { border-color: var(--muted); }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -70px; z-index: 50; background: var(--text); color: var(--bg); padding: 14px; }
.skip-link:focus { top: 12px; }
.system-bar { height: 76px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); padding: 0 28px; background: #101114; }
.system-brand { flex: 0 0 204px; color: var(--text); text-decoration: none; font: 38px/.95 Impact, "Arial Narrow", sans-serif; letter-spacing: -.6px; }
.system-brand span { font: 12px var(--mono); letter-spacing: 2px; border-left: 1px solid #50525a; padding-left: 13px; margin-left: 5px; vertical-align: middle; }
.system-identity { display: grid; gap: 6px; }
.system-identity strong { font: 11px var(--mono); text-transform: uppercase; letter-spacing: 1.6px; }
.system-identity span { color: var(--muted); font: 10px var(--mono); letter-spacing: .4px; text-transform: uppercase; }
.system-tag { display: flex; align-items: center; gap: 9px; margin-left: auto; font: 10px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.status-square { width: 6px; height: 6px; background: var(--accent); }
.mobile-nav-toggle, .outline-toggle { display: none; }
.app-shell { grid-template-columns: 224px minmax(0, 1fr) 260px; gap: 24px; padding: 26px 28px 32px; max-width: 1800px; margin: auto; min-height: calc(100vh - 76px); align-items: start; }
.no-outline .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
.no-outline .main-panel { max-width: 1150px; }
.sidebar, .outline-panel { top: 22px; height: calc(100vh - 126px); max-height: 960px; background: var(--panel); box-shadow: none; border-radius: 3px; }
.sidebar { display: flex; flex-direction: column; padding: 20px 12px 16px; }
.brand { gap: 12px; padding: 2px 7px 22px; }
.department-mark { display: block; width: 72px; height: 72px; object-fit: contain; border-radius: 3px; flex-shrink: 0; }
.brand strong { font: 600 19px/1.1 var(--sans); letter-spacing: 2px; }
.brand span { margin-top: 7px; color: var(--muted); font: 9px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .6px; }
.nav-caption { display: flex; justify-content: space-between; color: var(--muted); font: 10px var(--mono); letter-spacing: 1.6px; text-transform: uppercase; padding: 0 8px; margin: 24px 0 12px; }
.nav-caption span { color: var(--text); letter-spacing: .5px; }
.section-nav { margin-top: 0; gap: 5px; counter-reset: section; }
.section-item { border-radius: 2px; flex-shrink: 0; }
.section-item:hover { background: var(--panel-raised); border-color: var(--line); }
.section-item.active { border-color: #4b5158; background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
.section-link { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 10px; font-size: 12px; font-weight: 500; line-height: 1.4; }
.section-link::before { counter-increment: section; content: counter(section, decimal-leading-zero); flex: 0 0 19px; color: var(--muted); font: 10px var(--mono); }
.section-item.active .section-link::before { color: var(--accent-strong); }
.section-actions button { width: 23px; font-size: 10px; }
.sidebar-footer { margin-top: auto; padding: 40px 8px 0; }
.progress-label { display: flex; justify-content: space-between; color: var(--muted); text-transform: uppercase; font: 9px var(--mono); letter-spacing: 1px; }
.reading-segments { display: flex; gap: 3px; margin: 12px 0 18px; }
.reading-segments i { height: 7px; flex: 1; background: #2b2d33; border: 1px solid #3a3d44; border-radius: 1px; }
.reading-segments i.filled { background: #b7bab5; border-color: #b7bab5; }
.terminal-label { display: block; border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font: 8px/1.5 var(--mono); letter-spacing: 1px; }
.topbar { min-height: 77px; margin: 0 0 22px; gap: 12px; }
.kicker { font: 10px/1.5 var(--mono); letter-spacing: 1.5px; margin-bottom: 8px; }
.topbar h1 { font-size: 34px; font-weight: 600; letter-spacing: -.8px; line-height: 1.15; }
.page-description { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.topbar-actions { gap: 6px; justify-content: flex-end; }
.primary-btn, .secondary-btn, .ghost-btn, .icon-btn, .toolbar button, .upload-btn { min-height: 36px; padding: 0 12px; font: 11px var(--mono); border-radius: 3px; }
.primary-btn { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.secondary-btn { background: var(--panel); }
.secondary-btn:hover { background: var(--panel-raised); }
.contrast-btn { color: var(--muted); }
.contrast-btn span { padding-right: 5px; }
.contrast-btn[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }
.register-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) 1.25fr; border: 1px solid var(--line); border-radius: 3px; margin-bottom: 16px; background: var(--panel); }
.register-summary > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; min-width: 0; }
.register-summary > div + div { border-left: 1px solid var(--line); }
.register-summary span { font: 9px var(--mono); letter-spacing: .8px; color: var(--muted); text-transform: uppercase; }
.register-summary strong { font: 11px var(--mono); white-space: nowrap; }
.register-mode strong { color: var(--accent); }
.search-bar { top: 12px; min-height: 56px; padding: 7px 12px; gap: 10px; margin-bottom: 18px; background: var(--panel); border-radius: 3px; box-shadow: none; }
.search-icon { width: 19px; height: 19px; color: var(--muted); flex: 0 0 auto; }
.search-bar input { border: 0; min-width: 70px; background: transparent; padding: 0 4px; height: 38px; font-size: 13px; }
.search-bar input::placeholder { color: var(--muted); opacity: 1; }
.search-bar input:focus-visible { outline-offset: 0; }
.search-shortcut { border: 1px solid var(--line); padding: 2px 6px; font: 11px var(--mono); color: var(--muted); }
.search-bar .save-status { font: 10px var(--mono); min-width: 0; margin-left: 0; }
.search-actions { padding-left: 6px; }
.search-actions button { height: 30px; width: 27px; }
.document-frame { border: 1px solid var(--line); border-radius: 3px; background: var(--panel); overflow: clip; }
.document-caption { display: flex; justify-content: space-between; gap: 15px; padding: 13px 28px; background: #191a1e; border-bottom: 1px solid var(--line); font: 9px var(--mono); letter-spacing: 1px; color: var(--muted); }
.document-page { border: 0; border-radius: 0; min-height: 45vh; padding: 32px clamp(24px, 3vw, 48px) 48px; box-shadow: none; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.document-page h2 { font: 600 23px/1.3 var(--sans); color: var(--text); border-bottom: 1px solid #53565b; padding-bottom: 15px; margin: 44px 0 26px; letter-spacing: -.3px; scroll-margin-top: 100px; }
.document-page h3 { font: 600 15px/1.5 var(--sans); color: var(--accent-strong); border-left: 2px solid #65717b; padding: 4px 0 4px 12px; margin: 29px 0 14px; scroll-margin-top: 100px; }
body:not(.edit-mode) .document-page :is(h2, h3) :is(span, font) { font-size: inherit !important; font-family: inherit !important; color: inherit !important; }
.document-page p, .document-page li, .document-page td, .document-page th { font-size: 14px; line-height: 1.75; }
.document-page .law-row { grid-template-columns: 1.5rem minmax(0,1fr); gap: 10px; margin: 8px 0; line-height: 1.75; }
.document-page .law-row-marker, .document-page .manual-list-marker { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 400; padding-top: 3px; }
.document-page .law-row-level-1 { margin-left: 24px; }
.document-page strong { font-weight: 600; }
.document-page table { background: #1b1d21; font-variant-numeric: tabular-nums; }
.document-page th { background: #25282e; }
.document-page th, .document-page td { padding: 10px 12px; }
.document-page a { color: var(--accent-strong); text-underline-offset: 3px; }
.document-page .search-hit { background: #c3ab73; color: #111214; border-radius: 1px; }
.document-page .active-search-hit { background: #e0c781; color: #111214; box-shadow: 0 0 0 2px #c3a153; }
.document-page .document-highlight { border-radius: 2px; background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.document-end { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 28px; border-top: 1px solid var(--line); color: var(--muted); font: 10px var(--mono); }
.outline-panel { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.outline-header { padding: 21px 18px 18px; border-bottom: 1px solid var(--line); }
.outline-header .kicker { display: flex; justify-content: space-between; }
.index-symbol { color: var(--text); font-size: 15px; line-height: 1; }
.outline-header h2 { font-size: 16px; font-weight: 500; }
.outline-hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.outline-nav { display: block; overflow: auto; margin: 0; padding: 10px 10px 20px; scroll-behavior: auto; }
.outline-nav a { padding: 7px 8px; border-left-width: 2px; font-size: 11px; line-height: 1.5; border-radius: 0 2px 2px 0; }
.outline-nav .title-link { font: 10px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .65px; margin: 18px 0 7px; color: var(--text); }
.outline-nav .title-link:first-child { margin-top: 4px; }
.outline-nav .article-link { padding-left: 14px; font-size: 11px; }
.outline-nav a[aria-current="location"] { color: var(--accent-strong); border-left-color: var(--accent); background: var(--accent-soft); }
.toolbar { top: 80px; background: var(--panel); box-shadow: none; }
.toolbar select { font-size: 11px; font-weight: 400; min-width: 115px; }
.status-item.good strong { color: var(--good); }
.status-item.warn strong { color: var(--warn); }
.status-item.bad strong, .error-text { color: var(--bad); }
.modal h2 { font-size: 22px; font-weight: 500; }
@media (min-width: 1700px) { .app-shell { grid-template-columns: 240px minmax(0,1fr) 290px; gap: 32px; } }
@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 204px minmax(0,1fr) 225px; gap: 18px; padding-left: 20px; padding-right: 20px; }
  .no-outline .app-shell { grid-template-columns: 204px minmax(0,1fr); }
  .register-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .register-summary .register-mode { display: none; }
  .register-summary > div { gap: 6px; padding: 12px 10px; }
  .document-caption { padding-left: 24px; padding-right: 24px; }
  .topbar-actions { max-width: 175px; }
  .contrast-btn { font-size: 10px; }
}
@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 204px minmax(0,1fr); }
  .outline-toggle { display: inline-block; }
  .no-outline .outline-toggle { display: none; }
  .outline-panel { display: none; position: fixed; right: 20px; top: 90px; bottom: 20px; height: auto; width: 310px; z-index: 12; border-color: var(--accent); }
  .outline-open .outline-panel { display: flex; }
  .topbar-actions { max-width: 210px; }
  .system-tag { display: none; }
}
@media (max-width: 780px) {
  .system-bar { height: 70px; padding: 0 16px; gap: 18px; }
  .system-brand { flex-basis: auto; font-size: 31px; }
  .system-brand span { font-size: 9px; padding-left: 8px; margin-left: 2px; }
  .system-identity { flex: 1; gap: 4px; }
  .system-identity strong { font-size: 8px; letter-spacing: .6px; line-height: 1.5; }
  .system-identity span { font-size: 8px; line-height: 1.5; }
  .mobile-nav-toggle { display: inline-block; flex-shrink: 0; }
  .app-shell { display: block; padding: 20px 16px; }
  .sidebar { display: none; position: relative; top: auto; height: auto; max-height: none; margin-bottom: 20px; padding: 14px; }
  .nav-open .sidebar { display: flex; }
  .sidebar .brand, .sidebar-footer { display: none; }
  .nav-caption { margin: 2px 0 14px; }
  .section-nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .section-link { min-height: 44px; }
  .topbar { align-items: flex-start; flex-direction: row; gap: 10px; min-height: 70px; margin-bottom: 20px; }
  .topbar h1 { font-size: 29px; }
  .topbar .kicker { font-size: 8px; letter-spacing: 1px; }
  .page-description { font-size: 11px; max-width: 210px; line-height: 1.6; }
  .topbar-actions { flex-shrink: 0; max-width: 145px; gap: 5px; }
  .topbar-actions .secondary-btn { padding: 0 9px; font-size: 10px; min-height: 32px; }
  .register-summary > div { display: grid; gap: 7px; padding: 12px; }
  .register-summary span { font-size: 8px; }
  .register-summary strong { font-size: 12px; }
  .search-bar { flex-wrap: wrap; gap: 4px 7px; padding: 7px 9px; top: 6px; }
  .search-bar input { font-size: 12px; }
  .search-shortcut { display: none; }
  .search-bar .save-status { font-size: 9px; }
  .search-actions { gap: 0; padding-left: 4px; }
  .search-actions button { width: 26px; height: 32px; }
  .document-caption { padding: 12px 18px; font-size: 8px; }
  .document-page { padding: 24px 18px 34px; min-height: 45vh; font-size: 14px; }
  .document-page h2 { font-size: 21px; }
  .document-page h3 { font-size: 14px; }
  .document-page .law-row { grid-template-columns: 1.1rem minmax(0,1fr); gap: 8px; }
  .document-page .law-row-level-1 { margin-left: 13px; }
  .document-page table { display: block; max-width: 100%; overflow-x: auto; }
  .document-page th, .document-page td { padding: 9px; font-size: 12px; }
  .document-end { padding: 16px 18px; font-size: 9px; }
  .document-end button { font-size: 10px; }
  .outline-panel { right: 16px; top: 80px; width: min(340px,calc(100vw - 32px)); margin-bottom: 0; }
  .toolbar { top: 82px; max-height: 35vh; overflow: auto; }
}
@media (max-width: 400px) {
  .system-identity span { display: none; }
  .system-identity strong { max-width: 120px; }
  .system-bar { gap: 12px; }
  .topbar-actions { max-width: 100px; }
  .section-nav { grid-template-columns: 1fr; }
  .search-bar .save-status { order: 3; flex-basis: 100%; text-align: left; padding: 1px 0 3px 26px; }
  .search-bar .save-status:empty { display: none; }
  .search-bar input { max-width: calc(100% - 115px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@media print {
  .system-bar, .sidebar, .outline-panel, .topbar-actions, .register-summary, .search-bar, .toolbar, .document-end { display: none !important; }
  .app-shell { display: block !important; padding: 0; }
  body, .document-page, .document-frame, .document-caption { background: white; color: black; border: 0; }
  .document-page :is(h2,h3,p,li,td,th,a,.law-row-marker), .kicker, .page-description { color: black; }
  .document-page h3 { border-left-color: #777; }
}

/* Article search and the publication workflow share the register's restrained panels. */
[hidden] { display: none !important; }
.search-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: -2px 0 20px; }
.search-filters label, .article-actions label, #publishForm label { display: grid; gap: 7px; font-size: 11px; color: var(--muted); }
.search-filters label:not(.favorites-filter) { flex: 1; min-width: 160px; }
.search-filters select, .article-actions select, #publishForm input, #publishForm textarea { width: 100%; min-height: 38px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 3px; padding: 8px 10px; font: inherit; }
.search-filters .favorites-filter { display: flex; align-items: center; min-height: 38px; }
.search-results { margin-bottom: 20px; padding: 16px; border: 1px solid var(--line); background: var(--panel); border-radius: 3px; }
#resultCount { margin: 0 0 12px; font: 11px var(--mono, monospace); color: var(--muted); }
#resultList { max-height: 390px; overflow-y: auto; }
.result-item { display: grid; gap: 8px; width: 100%; text-align: left; background: transparent; color: var(--text); padding: 15px 10px; border: 0; border-top: 1px solid var(--line); cursor: pointer; }
.result-item:hover, .result-item:focus-visible { background: var(--panel-raised); }
.result-context { color: var(--muted); font: 9px var(--mono, monospace); text-transform: uppercase; line-height: 1.6; }
.result-excerpt { color: var(--muted); font-size: 12px; line-height: 1.7; }
.publication-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; font-size: 11px; }
#versionLabel { margin-right: auto; color: var(--muted); }
#versionLabel.is-draft { color: #c6a269; }
.article-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border: 1px solid var(--line); margin-bottom: 14px; position: sticky; top: 80px; z-index: 12; background: var(--panel); }
.edit-mode .article-actions { position: static; }
.article-actions > strong { flex-basis: 100%; font-size: 12px; line-height: 1.7; }
.article-actions label { flex-basis: 100%; }
.reader-notice { color: var(--muted); font-size: 12px; line-height: 1.7; }
.reader-notice:empty { display: none; }
#copyFallback { width: 100%; min-height: 90px; }
.publication-modal { width: min(1160px, calc(100vw - 32px)); max-width: 1160px; max-height: 90vh; overflow-y: auto; padding: 24px; background: var(--panel); color: var(--text); }
.publication-modal h2 { font-size: 21px; }
.publication-modal summary { cursor: pointer; padding: 12px 0; }
.publication-modal li { font-size: 12px; line-height: 1.8; }
.publication-modal p { line-height: 1.7; font-size: 12px; }
.error-message { color: #d6a09a; }
.version-change { border-bottom: 1px solid var(--line); margin: 12px 0; }
.version-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.version-compare > div { min-width: 0; }
.version-document { max-height: 440px; overflow: auto; font-size: 12px; line-height: 1.7; padding: 15px; border: 1px solid var(--line); }
.version-document img { max-width: 100%; height: auto; }
.version-document td, .version-document th { padding: 6px; border: 1px solid var(--line); }
.version-document h2, .version-document h3 { font-family: var(--sans); font-size: 16px; line-height: 1.6; }
.changed-passages { max-height: 280px; overflow-y: auto; margin-bottom: 18px; }
.changed-passages p { padding: 10px; border-left: 2px solid; }
.passage-removed { border-color: #aa7974; background: #302323; }
.passage-added { border-color: #829585; background: #222d26; }
#publishForm { display: grid; gap: 16px; margin: 24px 0; padding: 20px; background: var(--panel-raised); }
#publishForm textarea { min-height: 84px; resize: vertical; }
#publishForm button { justify-self: start; }
.history-row { display: grid; gap: 8px; padding: 16px 0; border-top: 1px solid var(--line); font-size: 12px; }
.history-row button { justify-self: start; }
.history-row small { color: var(--muted); }
@media (max-width: 780px) {
  .search-filters { gap: 10px; }
  .search-filters label:not(.favorites-filter) { flex-basis: 100%; }
  .publication-modal { padding: 15px; }
  .version-compare { grid-template-columns: 1fr; }
  .version-document { max-height: 270px; }
}
@media print {
  .search-filters, .search-results, .publication-bar, .article-actions, .reader-notice, #copyFallback { display: none !important; }
  h2, h3 { break-after: avoid; }
  tr { break-inside: avoid; }
}
