:root {
  --bg: #f7f7f4;
  --panel: #ffffff;
  --ink: #171a18;
  --muted: #626b66;
  --line: #d9ddd7;
  --accent: #12664f;
  --accent-2: #c08a2d;
  --danger: #9a3412;
  --soft: #e8f1ec;
  --shadow: 0 18px 50px rgba(22, 28, 24, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.topbar {
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(247, 247, 244, .92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 1px; }

.topnav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a:hover { color: var(--ink); }

.pilot-banner {
  border-bottom: 1px solid rgba(18, 102, 79, .18);
  background: #edf4f0;
}

.pilot-banner-inner {
  width: min(1320px, calc(100% - 32px));
  min-height: 54px;
  margin: 0 auto;
  padding: 9px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.pilot-status,
.pilot-promise {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  white-space: nowrap;
}

.pilot-status {
  min-height: 28px;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(18, 102, 79, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: var(--accent);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.pilot-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 102, 79, .1);
}

.pilot-banner p {
  margin: 0;
  color: #405049;
  font-size: 13px;
  line-height: 1.45;
}

.pilot-banner p strong {
  color: var(--ink);
  font-weight: 790;
}

.pilot-promise {
  gap: 7px;
  color: #375047;
  font-size: 11px;
  font-weight: 740;
}

.pilot-promise span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
}

main { width: min(1320px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 28px;
  align-items: start;
  padding: 34px 0 30px;
}

.hero > * { min-width: 0; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 790px;
  font-size: 36px;
  line-height: 1.12;
  font-weight: 790;
  margin-bottom: 18px;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 19px;
  margin-bottom: 28px;
}

.search-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(22, 28, 24, .05);
  padding: 16px;
  border-radius: 8px;
}

.search-shell label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-row input {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 102, 79, .14);
}

.search-row button, .query-chips button, .ghost {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.search-row button {
  min-width: 132px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  font-weight: 760;
}

.search-row button:hover { background: #0e5743; }
.search-row button:disabled { opacity: .76; cursor: wait; }

.query-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.query-chips button {
  background: var(--soft);
  color: #24483d;
  padding: 0 12px;
  font-size: 13px;
}

.query-chips button:hover { border-color: rgba(18, 102, 79, .35); }

.search-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: #3e4641;
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
  margin: 0;
}

.check-option input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.corpus-panel {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fbfbf8;
  border-radius: 8px;
  padding: 28px;
}

.corpus-panel > .eyebrow { margin-bottom: 12px; }
.corpus-promise {
  display: block;
  max-width: 330px;
  font-size: 36px;
  line-height: 1.12;
  font-weight: 790;
}
.corpus-support {
  max-width: 290px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.corpus-panel.coverage-preview {
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #fbfbf8 0%, #f4f8f5 100%);
  padding: 24px 26px 22px;
}

.coverage-preview::after {
  content: "PY";
  position: absolute;
  right: -12px;
  top: 38px;
  color: rgba(18, 102, 79, .035);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 124px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.coverage-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.coverage-preview-head .eyebrow { margin: 0; font-size: 11px; }
.coverage-preview-head > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.coverage-preview-head i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2b9a6c;
}

.coverage-preview-number {
  margin-top: 21px;
  position: relative;
  z-index: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 52px;
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .95;
}

.coverage-preview-number sup {
  color: var(--accent);
  font-family: inherit;
  font-size: .42em;
  vertical-align: top;
}

.coverage-preview-label {
  margin: 6px 0 17px;
  position: relative;
  z-index: 1;
  color: #45524b;
  font-size: 13px;
  font-weight: 690;
}

.coverage-preview-proof {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  z-index: 1;
}

.coverage-preview-proof > div { padding: 10px 9px 10px 0; }
.coverage-preview-proof > div + div { padding-left: 13px; border-left: 1px solid var(--line); }
.coverage-preview-proof dt { color: var(--ink); font-size: 12px; font-weight: 800; }
.coverage-preview-proof dd { margin: 1px 0 0; color: var(--muted); font-size: 10px; }

.coverage-preview-link {
  margin-top: auto;
  padding-top: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
}

.coverage-preview-link span { transition: transform .18s ease; }
.coverage-preview-link:hover span { transform: translateX(3px); }

.results-section {
  scroll-margin-top: 88px;
  padding: 28px 0 56px;
  border-top: 1px solid var(--line);
}

.results-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.results-toolbar h2 { margin: 0; font-size: 28px; }

.results-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.share-trigger {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(18, 102, 79, .24);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
}

.share-trigger:hover { border-color: var(--accent); background: var(--soft); }
.share-trigger:focus-visible { outline: 3px solid rgba(18, 102, 79, .2); outline-offset: 2px; }

.share-trigger.link-copied,
.document-viewer-head .document-share-button.link-copied,
button[data-share-source].link-copied {
  border-color: rgba(18, 102, 79, .34);
  background: var(--soft);
  color: var(--accent);
}

.share-trigger:disabled,
.document-viewer-head .document-share-button:disabled,
button[data-share-source]:disabled { cursor: wait; opacity: .72; }

.filter-trigger {
  display: none;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 720;
}

.filter-trigger span {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
}

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 0 14px;
}

.ghost:hover { color: var(--ink); border-color: #aeb7b1; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.filter-chip {
  min-height: 32px;
  max-width: 100%;
  border: 1px solid rgba(18, 102, 79, .24);
  border-radius: 6px;
  background: var(--soft);
  color: #24483d;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}

.filter-chip span {
  color: var(--muted);
}

.filter-chip:hover {
  border-color: rgba(18, 102, 79, .42);
}

.workbench {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.workbench > * { min-width: 0; }

.facets {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.facets-mobile-head,
.facets-backdrop { display: none; }

.facet-multi-hint {
  margin: 0 0 13px;
  border-left: 2px solid rgba(18, 102, 79, .32);
  color: var(--muted);
  padding: 2px 0 2px 8px;
  font-size: 11px;
  line-height: 1.45;
}

.facet-group + .facet-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.facet-group h3 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
}

.facet-group button {
  width: 100%;
  min-height: 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

.facet-group button > span {
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.facet-group button.active > span::before {
  content: "✓";
  margin-right: 5px;
  color: var(--accent);
  font-weight: 850;
}

.facet-group button:hover, .facet-group button.active { background: var(--soft); }
.facet-group button.active {
  color: var(--accent);
  font-weight: 760;
  box-shadow: inset 3px 0 0 var(--accent);
}
.facet-group button:focus-visible,
.filter-chip:focus-visible,
.ghost:focus-visible,
.query-chips button:focus-visible,
.search-row button:focus-visible {
  outline: 3px solid rgba(18, 102, 79, .2);
  outline-offset: 2px;
}
.facet-group small { flex: 0 0 auto; margin-top: 1px; color: var(--muted); }
.facet-group button.active small { color: var(--accent); }

.facet-more { margin-top: 4px; }
.facet-more > summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  padding: 0 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  list-style: none;
}
.facet-more > summary::-webkit-details-marker { display: none; }
.facet-more > summary::before { content: "+"; font-size: 15px; font-weight: 500; }
.facet-more[open] > summary::before { content: "−"; }
.facet-more > div { display: grid; }

.results-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

body[data-loading="true"] .workbench { grid-template-columns: minmax(0, 1fr); }
body[data-loading="true"] .facets { display: none; }
body[data-loading="true"] .workbench > section { grid-column: 1 / -1; }

.search-loading {
  min-height: 118px;
  border: 1px solid rgba(18, 102, 79, .19);
  border-radius: 8px;
  background: linear-gradient(110deg, #f8faf8 0%, #f1f7f3 100%);
  padding: 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 15px;
  align-content: center;
  position: relative;
  overflow: hidden;
}

.search-loading-mark {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(18, 102, 79, .18);
  border-top-color: var(--accent);
  border-radius: 50%;
  grid-row: 1;
  align-self: center;
  animation: search-loading-spin .85s linear infinite;
}

.search-loading-copy { display: grid; gap: 2px; }
.search-loading-copy strong { color: var(--ink); font-size: 15px; }
.search-loading-copy small { color: var(--muted); font-size: 12px; }

.search-loading-track {
  height: 2px;
  margin-top: 15px;
  border-radius: 2px;
  background: rgba(18, 102, 79, .1);
  grid-column: 1 / -1;
  overflow: hidden;
}

.search-loading-track i {
  width: 34%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--accent);
  animation: search-loading-progress 1.35s ease-in-out infinite;
}

@keyframes search-loading-spin { to { transform: rotate(360deg); } }
@keyframes search-loading-progress {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(300%); }
}

.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.result-head > * { min-width: 0; }

.result-title, .result h3 {
  font-size: 18px;
  line-height: 1.3;
  margin: 0 0 6px;
  font-weight: 600;
}

/* The title is the primary click target -> full text (with modifications for laws) */
.result-title-link {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.result-title-link:hover,
.result-title-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}
.result-title-link[data-load-reader]::after {
  content: " →";
  color: var(--accent);
  font-weight: 600;
  opacity: .5;
}
.result-title-link[data-load-reader]:hover::after { opacity: 1; }
.result.reader-open .result-title-link[data-load-reader]::after { content: " ↓"; opacity: 1; }

.result-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

/* Modificaciones / vigencia / relaciones: hidden until the user asks for them */
.result-more { margin: 10px 0 0; }
.result-more > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
  padding: 4px 0;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.result-more > summary::-webkit-details-marker { display: none; }
.result-more > summary::before {
  content: "›";
  display: inline-block;
  transition: transform .15s ease;
  font-size: 15px;
}
.result-more[open] > summary::before { transform: rotate(90deg); }
.result-more > summary:hover { color: var(--accent); }
.result-more-body { margin-top: 8px; }

/* Sentencia (ruling) inline reader */
.ruling-cites {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ruling-cites ul { margin: 6px 0 0; padding-left: 18px; }
.ruling-cites li { font-size: 13px; margin: 3px 0; line-height: 1.4; }
.cite-soft { color: var(--muted); font-size: 12px; }

.document-relations {
  border-top: 1px solid rgba(18, 102, 79, .14);
  border-bottom: 1px solid rgba(18, 102, 79, .14);
  padding: 12px 0;
}

.document-relations-slot { margin-top: 18px; }

.document-relations-loading {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid rgba(18, 102, 79, .14);
  color: var(--muted);
}

.document-relations-loading > span {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid rgba(18, 102, 79, .18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: relation-loading-spin .8s linear infinite;
}

.document-relations-loading > div { display: grid; gap: 2px; }
.document-relations-loading strong { color: var(--ink); font-size: 12px; }
.document-relations-loading small { font-size: 11px; line-height: 1.4; }
.document-relations-unavailable { margin: 0; padding: 11px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

@keyframes relation-loading-spin { to { transform: rotate(360deg); } }

.document-relations-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.document-relations-head .relation-group-title { margin: 0; }
.document-relations-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.relation-origin {
  flex: 0 0 auto;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 9px;
  font-size: 12px;
  font-weight: 720;
}

.document-relation-groups { display: grid; gap: 16px; }
.document-relation-group h5 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}
.document-relation-group h5 span { color: var(--muted); font-weight: 650; }

.graph-relation-list { display: grid; }
.graph-relation-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(104px, 132px) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0 10px 18px;
  border-top: 1px solid rgba(28, 35, 31, .08);
}

.graph-relation-item::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(18, 102, 79, .2);
}

.graph-relation-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 20px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fcfdfa;
}

.graph-relation-copy { min-width: 0; display: grid; gap: 3px; }
.graph-relation-copy > a,
.graph-relation-copy > strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 720;
  overflow-wrap: anywhere;
}
.graph-relation-copy > a:hover { color: var(--accent); }
.graph-relation-description {
  margin: 1px 0 2px;
  max-width: 82ch;
  color: #39443e;
  font-size: 12px;
  line-height: 1.45;
}
.graph-relation-copy > small { color: var(--muted); font-size: 11px; }
.graph-relation-copy details { margin-top: 2px; }
.graph-relation-copy summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-size: 11px;
}
.graph-relation-copy details p {
  margin: 6px 0 0;
  color: #3f4843;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.graph-relation-copy details small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
}

.graph-locators {
  display: grid;
  gap: 5px;
  margin-top: 4px;
  padding: 7px 8px;
  border-left: 2px solid rgba(18, 102, 79, .38);
  background: rgba(18, 102, 79, .045);
}
.graph-locator-row {
  display: grid;
  grid-template-columns: minmax(120px, 178px) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.graph-locator-row > span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}
.graph-locator-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.graph-locator-row strong {
  border: 1px solid rgba(18, 102, 79, .18);
  border-radius: 999px;
  background: #fff;
  color: #184f40;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 730;
  line-height: 1.35;
}

.graph-load-more {
  min-height: 36px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 720;
}
.graph-load-more:hover { border-color: rgba(18, 102, 79, .38); background: var(--soft); }
.graph-load-more:disabled { cursor: wait; opacity: .65; }
.relation-explorer {
  border: 1px solid rgba(18, 102, 79, .16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 102, 79, .035), rgba(255, 255, 255, .82));
  padding: 14px;
}
.relation-explorer [hidden] { display: none !important; }
.relation-explorer-intro {
  max-width: 78ch;
  margin: 2px 0 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.relation-explorer-open {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
}
.relation-explorer-open:hover { filter: brightness(.96); }
.relation-explorer-body { display: grid; gap: 11px; margin-top: 7px; }
.relation-explorer-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, auto) minmax(158px, auto) auto;
  gap: 8px;
  align-items: end;
  padding: 11px;
  border: 1px solid rgba(28, 35, 31, .1);
  border-radius: 7px;
  background: #fff;
}
.relation-explorer-form label,
.relation-explorer-fixed-scope { display: grid; gap: 5px; min-width: 0; }
.relation-explorer-form label > span,
.relation-explorer-fixed-scope > span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 720;
}
.relation-explorer-form input,
.relation-explorer-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
  font-size: 12px;
}
.relation-explorer-form input:focus,
.relation-explorer-form select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(18, 102, 79, .12);
  outline-offset: 0;
}
.relation-explorer-form > button {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  padding: 0 13px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}
.relation-explorer-form > button:disabled { cursor: wait; opacity: .62; }
.relation-explorer-fixed-scope strong {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(18, 102, 79, .15);
  border-radius: 5px;
  background: rgba(18, 102, 79, .055);
  color: var(--accent);
  padding: 7px 10px;
  font-size: 12px;
}
.relation-explorer-active { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.relation-explorer-active > span { margin-right: 2px; color: var(--muted); font-size: 10.5px; font-weight: 730; }
.relation-explorer-active button,
.relation-explorer-facets button {
  border: 1px solid rgba(18, 102, 79, .16);
  border-radius: 999px;
  background: #fff;
  color: #31544a;
  padding: 4px 8px;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.relation-explorer-active button { max-width: 100%; text-align: left; }
.relation-explorer-active button:hover,
.relation-explorer-facets button:hover,
.relation-explorer-facets button.active {
  border-color: rgba(18, 102, 79, .48);
  background: rgba(18, 102, 79, .075);
  color: var(--accent);
}
.relation-explorer-active .relation-clear-filters { border-color: transparent; background: transparent; color: var(--muted); }
.relation-explorer-multi-hint {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.relation-explorer-facets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 9px;
  padding: 10px 0;
  border-top: 1px solid rgba(28, 35, 31, .08);
  border-bottom: 1px solid rgba(28, 35, 31, .08);
}
.relation-explorer-facets section { min-width: 0; }
.relation-explorer-facets h6 { margin: 0 0 6px; color: var(--muted); font-size: 10.5px; }
.relation-explorer-facets h6 span { display: block; margin-top: 2px; color: #849089; font-size: 9px; font-weight: 560; }
.relation-facet-search { display: block; margin-bottom: 5px; }
.relation-facet-search input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 5px 7px;
  font: inherit;
  font-size: 10.5px;
}
.relation-facet-search input:focus { border-color: var(--accent); outline: 2px solid rgba(18, 102, 79, .1); }
.relation-facet-options {
  display: grid;
  gap: 4px;
  max-height: 230px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.relation-explorer-facets button {
  width: 100%;
  min-height: 32px;
  display: flex;
  gap: 7px;
  align-items: flex-start;
  justify-content: space-between;
  border-radius: 6px;
  text-align: left;
}
.relation-explorer-facets button span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.relation-explorer-facets button.active span::before { content: "✓"; margin-right: 4px; font-weight: 850; }
.relation-explorer-facets button small { flex: 0 0 auto; color: var(--muted); font-size: 9.5px; }
.relation-facet-empty { margin: 6px 0 0; color: var(--muted); font-size: 10.5px; }
.relation-explorer-status { min-height: 18px; color: var(--muted); font-size: 11px; }
.relation-explorer-results:empty { display: none; }
.relation-explorer-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.relation-simple-list {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 3px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.relation-specificity {
  width: fit-content;
  border: 1px solid rgba(91, 103, 97, .16);
  border-radius: 999px;
  background: #f5f7f5;
  color: #65706a;
  padding: 2px 7px;
  font-size: 9.5px;
  font-weight: 740;
}
.relation-specificity.exact { border-color: rgba(18, 102, 79, .2); background: rgba(18, 102, 79, .06); color: var(--accent); }
.graph-context-snippet {
  margin: 3px 0;
  max-width: 88ch;
  border-left: 2px solid rgba(18, 102, 79, .28);
  background: rgba(18, 102, 79, .035);
  color: #35433d;
  padding: 6px 8px;
  font-size: 11.5px;
  line-height: 1.48;
}
.graph-context-snippet.citation { border-left-color: rgba(128, 99, 29, .32); background: rgba(128, 99, 29, .04); }
@media (max-width: 820px) {
  .relation-explorer-form { grid-template-columns: 1fr 1fr; }
  .relation-explorer-query { grid-column: 1 / -1; }
  .relation-explorer-form > button { align-self: stretch; }
}
@media (max-width: 540px) {
  .relation-explorer { padding: 11px; }
  .relation-explorer-form { grid-template-columns: 1fr; padding: 9px; }
  .relation-explorer-query { grid-column: auto; }
  .relation-explorer-facets { grid-template-columns: 1fr; }
}
.ruling-text {
  margin-top: 12px;
  max-width: 78ch;
  font-size: 15.5px;
  line-height: 1.72;
  color: #26302b;
}
.ruling-text p { margin: 0 0 12px; }
.legal-document {
  display: grid;
  gap: 13px;
}
.legal-reading-note {
  width: fit-content;
  border: 1px solid rgba(18, 102, 79, .14);
  border-radius: 999px;
  background: rgba(18, 102, 79, .055);
  color: #49625a;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.legal-block {
  margin: 0;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.ruling-text .legal-paragraph,
.ruling-text .legal-recital,
.ruling-text .legal-signature,
.ruling-text .legal-phase p,
.ruling-text .legal-article p,
.ruling-text .legal-list-item p {
  margin: 0;
}
.legal-document-title {
  padding: 2px 0 7px;
  border-bottom: 1px solid rgba(18, 102, 79, .14);
  color: #173f34;
  font-size: 15px;
  line-height: 1.48;
  letter-spacing: .015em;
}
.legal-phase {
  border-left: 3px solid rgba(18, 102, 79, .55);
  border-radius: 0 7px 7px 0;
  background: rgba(18, 102, 79, .045);
  padding: 11px 13px;
}
.legal-block-label {
  margin-bottom: 6px;
  color: #0b5b46;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .065em;
  line-height: 1.35;
  text-transform: uppercase;
}
.legal-article {
  border: 1px solid rgba(28, 35, 31, .11);
  border-radius: 7px;
  background: #fff;
  padding: 12px 14px;
  box-shadow: 0 1px 0 rgba(28, 35, 31, .025);
}
.legal-article .legal-block-label {
  color: #173f34;
  font-size: 13px;
  letter-spacing: .025em;
  text-transform: none;
}
.legal-recital {
  position: relative;
  padding-left: 16px;
}
.legal-recital::before {
  position: absolute;
  top: .38em;
  bottom: .38em;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: rgba(18, 102, 79, .2);
  content: '';
}
.legal-structural-heading,
.legal-subheading {
  color: #173f34;
  line-height: 1.45;
}
.legal-structural-heading {
  margin-top: 8px;
  padding: 9px 0 6px;
  border-bottom: 1px solid rgba(18, 102, 79, .19);
  font-size: 15px;
  letter-spacing: .035em;
}
.legal-subheading {
  margin-top: 5px;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.legal-page-marker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #7a8781;
  font-size: 11px;
  line-height: 1;
}
.legal-page-marker::before,
.legal-page-marker::after {
  height: 1px;
  background: rgba(28, 35, 31, .1);
  content: '';
  flex: 1;
}
.legal-page-break {
  height: 1px;
  margin: 4px 0;
  background: linear-gradient(90deg, transparent, rgba(28, 35, 31, .12) 16%, rgba(28, 35, 31, .12) 84%, transparent);
}
.legal-running-header {
  color: #78837e;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: .025em;
  text-align: center;
}
.legal-digitization-artifact {
  justify-self: center;
  margin: -9px 0;
  color: #a4aca8;
  font-size: 9px;
  line-height: 1;
}
.legal-data-row {
  overflow-x: auto;
  border-radius: 5px;
  background: rgba(28, 35, 31, .04);
  color: #34433d;
  padding: 7px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.legal-list-item {
  display: grid;
  grid-template-columns: minmax(24px, auto) 1fr;
  gap: 8px;
  align-items: start;
}
.legal-list-marker {
  color: #0b5b46;
  font-weight: 760;
}
.legal-signature {
  margin-top: 5px;
  border-top: 1px solid rgba(28, 35, 31, .1);
  color: #44534d;
  padding-top: 11px;
  font-style: italic;
}
.legal-source-note {
  border-radius: 6px;
  background: #f4f6f4;
  color: #6a756f;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}
.ruling-pending {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fff7ed;
  border: 1px solid rgba(154, 52, 18, .2);
  border-radius: 8px;
  color: #7c3a12;
  font-size: 14px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

.badge.source { color: var(--accent); border-color: rgba(18, 102, 79, .28); }
.badge.tag {
  max-width: 100%;
  height: auto;
  color: #324640;
  border-color: rgba(50, 70, 64, .18);
  background: #f8faf8;
  padding: 4px 8px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.badge.status { color: #365f52; border-color: rgba(18, 102, 79, .32); background: var(--soft); }
.badge.warn { color: var(--danger); border-color: rgba(154, 52, 18, .25); background: #fff7ed; }
.badge.danger { color: #8b1d1d; border-color: rgba(139, 29, 29, .26); background: #fff1f1; }
.badge.temporal {
  max-width: 100%;
  height: auto;
  padding: 4px 9px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.badge.temporal.reached {
  color: #205f4d;
  border-color: rgba(18, 102, 79, .28);
  background: #f1f8f5;
}
.badge.temporal.future {
  color: #755415;
  border-color: rgba(167, 112, 17, .28);
  background: #fff9ec;
}
.badge.temporal.undetermined {
  color: #59655f;
  border-color: rgba(89, 101, 95, .22);
  background: #f6f7f6;
}

.snippet {
  color: #303632;
  margin: 0;
  font-size: 15px;
}

.relation-panel,
.article-impact-panel,
.official-panel,
.consolidated-panel {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.graph-summary-panel {
  border: 1px solid rgba(18, 102, 79, .18);
  border-radius: 7px;
  background: #f7fbf8;
  padding: 10px 11px;
}
.graph-summary-panel p { margin: 0; color: #32403a; font-size: 13px; line-height: 1.5; }
.graph-summary-panel button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-weight: 720;
}
.graph-summary-panel button:hover { text-decoration: underline; }

.relation-group,
.article-impact-panel,
.official-panel,
.consolidated-panel {
  border: 1px solid rgba(28, 35, 31, .1);
  background: #fbfaf7;
  border-radius: 7px;
  padding: 10px 11px;
}

.article-impact-panel {
  border-color: rgba(154, 52, 18, .18);
  background: #fffaf4;
}

.official-panel {
  border-color: rgba(18, 102, 79, .16);
  background: #f7fbf8;
}

.consolidated-panel {
  border-color: rgba(18, 102, 79, .22);
  background: #f7fbf8;
}

.consolidated-panel p {
  margin: 0;
  color: #1f2823;
  font-size: 14px;
  line-height: 1.48;
  white-space: pre-wrap;
}

.consolidated-panel small {
  color: var(--muted);
  font-size: 12px;
}

.consolidated-panel a {
  color: var(--accent);
  font-weight: 720;
}

.relation-group-title {
  color: #303632;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  margin-bottom: 7px;
}

.relation-group ul,
.article-impact-panel ul,
.official-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.relation-group li,
.article-impact-panel li,
.official-panel li {
  display: grid;
  grid-template-columns: minmax(104px, max-content) minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.relation-action {
  border-radius: 5px;
  border: 1px solid rgba(18, 102, 79, .24);
  color: #365f52;
  background: #eef7f1;
  min-height: 24px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.35;
  text-align: center;
}

.relation-action.warn {
  color: var(--danger);
  border-color: rgba(154, 52, 18, .24);
  background: #fff7ed;
}

.relation-action.danger {
  color: #8b1d1d;
  border-color: rgba(139, 29, 29, .25);
  background: #fff1f1;
}

.relation-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: #303632;
  font-size: 13px;
  line-height: 1.35;
}

.relation-copy a,
.relation-copy strong {
  color: #1f2823;
  font-weight: 740;
}

.relation-copy a:hover { color: var(--accent); }

.relation-number {
  color: var(--muted);
  font-size: 12px;
}

.relation-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.replacement-text {
  margin-top: 5px;
  color: #303632;
}

.replacement-text summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 720;
}

.replacement-text p {
  margin: 6px 0 0;
  padding: 8px;
  border-left: 3px solid rgba(18, 102, 79, .35);
  background: #fff;
  color: #303632;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.relation-more {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

mark {
  background: #f5d483;
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 14px 0 0;
}

.result-actions a, .result-actions button {
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.result-actions a:hover, .result-actions button:hover { color: var(--ink); border-color: #aeb7b1; }

.result-actions .primary-action {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.result-actions .primary-action:hover {
  color: #fff;
  background: #0b4f3d;
  border-color: #0b4f3d;
}

.reader-slot { scroll-margin-top: 82px; }
.reader-slot[hidden] { display: none; }

.law-reader {
  margin-top: 14px;
  border: 1px solid rgba(18, 102, 79, .2);
  border-radius: 8px;
  background: #fcfdfa;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.law-reader-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  border-bottom: 1px solid rgba(18, 102, 79, .12);
  padding-bottom: 10px;
}

.law-reader-head h4 {
  margin: 1px 0 4px;
  font-size: 16px;
  line-height: 1.25;
}

.law-reader-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.law-reader-head a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.temporal-status {
  padding: 12px 13px;
  border: 1px solid rgba(18, 102, 79, .18);
  border-radius: 8px;
  background: #f7fbf9;
  color: #31453f;
}
.temporal-status.future {
  border-color: rgba(167, 112, 17, .22);
  background: #fffbf2;
  color: #66501d;
}
.temporal-status.undetermined {
  border-color: rgba(89, 101, 95, .18);
  background: #f8f9f8;
  color: #52615a;
}
.temporal-status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.temporal-status-head > span {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #16815f;
  box-shadow: 0 0 0 3px rgba(22, 129, 95, .1);
}
.temporal-status.future .temporal-status-head > span {
  background: #b37b18;
  box-shadow: 0 0 0 3px rgba(179, 123, 24, .1);
}
.temporal-status.undetermined .temporal-status-head > span {
  background: #7b8881;
  box-shadow: 0 0 0 3px rgba(123, 136, 129, .1);
}
.temporal-status-head strong {
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.temporal-status > p {
  margin: 8px 0 0;
  color: inherit;
  font-size: 12px;
  line-height: 1.5;
}
.temporal-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0 0;
}
.temporal-facts > div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(28, 35, 31, .08);
  border-radius: 6px;
  background: rgba(255, 255, 255, .78);
}
.temporal-facts dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 740;
  line-height: 1.35;
}
.temporal-facts dd {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.temporal-evidence {
  margin-top: 9px;
  border-top: 1px solid rgba(28, 35, 31, .09);
  padding-top: 8px;
}
.temporal-evidence > summary,
.temporal-audit > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 720;
}
.temporal-evidence ul {
  display: grid;
  gap: 6px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}
.temporal-evidence li {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .78);
}
.temporal-evidence li strong,
.temporal-evidence li span,
.temporal-evidence li small {
  display: block;
  overflow-wrap: anywhere;
}
.temporal-evidence li strong { color: var(--ink); font-size: 11px; }
.temporal-evidence li span { margin-top: 2px; font-size: 12px; }
.temporal-evidence li small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.temporal-evidence li a {
  flex: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.temporal-audit { margin-top: 9px; }
.temporal-audit dl { display: grid; gap: 5px; margin: 8px 0 0; }
.temporal-audit dl > div {
  display: grid;
  grid-template-columns: minmax(110px, .4fr) minmax(0, 1fr);
  gap: 8px;
}
.temporal-audit dt { color: var(--muted); font-size: 10px; }
.temporal-audit dd { min-width: 0; margin: 0; }
.temporal-audit code {
  display: block;
  color: #3d4943;
  font-size: 10px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.article-comparison {
  border: 1px solid rgba(28, 35, 31, .1);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
}

.reader-article-list { display: grid; gap: 12px; }
.reader-more-row { display: flex; justify-content: center; padding-top: 2px; }
.reader-more-row button {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 720;
}
.reader-more-row button:hover { border-color: rgba(18, 102, 79, .38); background: var(--soft); }

.article-comparison.has-impact {
  border-color: rgba(154, 52, 18, .2);
}

.article-comparison-title {
  min-height: 38px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(28, 35, 31, .08);
  background: #fbfbf8;
}

.article-comparison-title strong { color: var(--ink); }

.article-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.article-relations-trigger {
  min-height: 28px;
  border: 1px solid rgba(18, 102, 79, .24);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  padding: 0 9px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 740;
}
.article-relation-action { display: contents; }
.article-relations-trigger:hover { background: var(--soft); }
.article-relations-trigger:disabled { cursor: wait; opacity: .65; }
.article-relations-slot {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(28, 35, 31, .08);
  background: #fcfdfa;
}
.article-relations-slot .document-relations {
  padding-bottom: 0;
  border-bottom: 0;
}

.article-comparison-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.comparison-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.comparison-grid.single { grid-template-columns: minmax(0, 1fr); }

.comparison-cell {
  min-width: 0;
  padding: 12px;
}

.comparison-cell + .comparison-cell {
  border-left: 1px solid rgba(28, 35, 31, .1);
}

.comparison-cell.original { background: #fff; }
.comparison-cell.current { background: #f7fbf8; }

.comparison-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.comparison-cell p,
.article-plain p {
  margin: 0;
  color: #252d28;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.comparison-cell p.muted { color: var(--muted); }
.comparison-unchanged { color: var(--muted); font-style: italic; font-size: 13px; }

.comparison-cell small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.comparison-cell small a {
  color: var(--accent);
  font-weight: 720;
}

.comparison-warning {
  margin-top: 9px;
  border: 1px solid rgba(154, 52, 18, .22);
  border-radius: 6px;
  background: #fff7ed;
  color: var(--danger);
  padding: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.comparison-history {
  border-top: 1px solid rgba(28, 35, 31, .1);
  background: #fffdfa;
  padding: 10px 12px 12px;
}

.comparison-history-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.comparison-history ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.comparison-history li {
  display: grid;
  grid-template-columns: 134px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.article-plain { padding: 12px; }

.loading.compact {
  padding: 12px;
  font-size: 13px;
}

.feedback-panel {
  margin-top: 18px;
  border: 1px solid rgba(18, 102, 79, .22);
  border-radius: 8px;
  background: #f2f7f4;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
  box-shadow: 0 8px 24px rgba(22, 28, 24, .04);
}

.feedback-panel[hidden] { display: none; }

.feedback-copy p {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 790;
  color: var(--ink);
}

.feedback-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.feedback-form {
  display: grid;
  gap: 10px;
}

.rating-control {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.rating-control button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #9aa29d;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.rating-control button.active {
  color: #9f6d1e;
  border-color: rgba(192, 138, 45, .45);
  background: #fff8e8;
}

/* Preview the complete score, then restore the selected value on mouseout. */
.rating-control:has(button:hover) button {
  color: #9aa29d;
  border-color: var(--line);
  background: #fff;
}

.rating-control:has(button:hover) button:hover,
.rating-control:has(button:hover) button:has(~ button:hover) {
  color: #9f6d1e;
  border-color: rgba(192, 138, 45, .45);
  background: #fff8e8;
}

.feedback-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 720;
}

.feedback-form label small,
.research-feedback form > label small {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(18, 102, 79, .08);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.feedback-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

.feedback-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 102, 79, .12);
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.feedback-actions button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 760;
}

.feedback-actions button:hover { background: #0e5743; }
.feedback-actions button:disabled { opacity: .65; cursor: default; }

.rating-control button:focus-visible,
.feedback-actions button:focus-visible {
  outline: 3px solid rgba(18, 102, 79, .2);
  outline-offset: 2px;
}

.feedback-message {
  min-height: 20px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 720;
}

.empty-state {
  border-top: 1px solid var(--line);
  padding: 40px 0;
}

.empty-state h2 { font-size: 26px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 680px; }

.info-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding: 44px 0;
}

.info-band h2, .method h2 { font-size: 24px; margin-bottom: 8px; }
.info-band p, .method p { color: var(--muted); margin-bottom: 0; }

.method {
  border-top: 1px solid var(--line);
  padding: 36px 0 64px;
  max-width: 780px;
}

.loading {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .topnav { display: none; }
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 34px;
  }
  .workbench {
    grid-template-columns: 1fr;
  }
  .filter-trigger { display: inline-flex; }
  .facets-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(18, 24, 21, .34);
    backdrop-filter: blur(2px);
  }
  .facets-backdrop:not([hidden]) { display: block; }
  .facets {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    width: 100%;
    max-width: none;
    max-height: min(78dvh, 720px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    padding: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -18px 60px rgba(18, 26, 22, .18);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.facets-open { overflow: hidden; }
  body.facets-open .facets {
    transform: translateY(0);
    visibility: visible;
    transition: transform .22s ease;
  }
  .facets-mobile-head {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: #f9faf8;
  }
  .facets-mobile-head strong,
  .facets-mobile-head span { display: block; }
  .facets-mobile-head strong { font-size: 16px; }
  .facets-mobile-head span { margin-top: 2px; color: var(--muted); font-size: 11px; }
  .facets-mobile-actions { display: flex; align-items: center; gap: 4px; }
  .facets-mobile-actions button {
    min-height: 38px;
    border: 0;
    background: transparent;
    color: var(--accent);
    padding: 0 8px;
    cursor: pointer;
    font-weight: 720;
  }
  .facets-mobile-actions #facetsClose {
    width: 38px;
    padding: 0;
    color: var(--muted);
    font-size: 27px;
    font-weight: 400;
  }
  .facets-content {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
  }
  .facet-group {
    min-width: 0;
  }
  .facet-group + .facet-group {
    margin-top: 16px;
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .facet-group h3 {
    margin: 0 0 7px;
    font-size: 11px;
  }
  .facet-group button {
    width: 100%;
    min-height: 40px;
    gap: 8px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .facet-group button.active {
    border-color: rgba(18, 102, 79, .45);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  .info-band {
    grid-template-columns: 1fr;
  }
  .feedback-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  main { width: min(100% - 24px, 1180px); }
  .topbar { padding: 12px; min-height: 64px; }
  .brand small { display: none; }
  h1 { font-size: 38px; }
  .search-row { grid-template-columns: 1fr; }
  .search-row button { min-width: 0; width: 100%; }
  .results-toolbar { align-items: start; flex-direction: column; }
  .results-toolbar h2 { font-size: 26px; }
  .result-head { display: block; }
  .result { padding: 14px; }
  .relation-group li,
  .article-impact-panel li,
  .official-panel li {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .relation-action {
    width: fit-content;
    text-align: left;
  }
  .law-reader-head {
    display: grid;
  }
  .law-reader-head a {
    white-space: normal;
  }
  .temporal-facts {
    grid-template-columns: 1fr;
  }
  .temporal-evidence li {
    display: grid;
    gap: 6px;
  }
  .temporal-evidence li a {
    white-space: normal;
  }
  .temporal-audit dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .document-relations-head { align-items: flex-start; }
  .relation-origin { max-width: 116px; white-space: normal; }
  .graph-relation-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding-left: 17px;
  }
  .graph-locator-row { grid-template-columns: 1fr; gap: 3px; }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  .comparison-cell + .comparison-cell {
    border-left: 0;
    border-top: 1px solid rgba(28, 35, 31, .1);
  }
  .comparison-history li {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .article-comparison-title {
    display: grid;
    justify-content: stretch;
  }
  .article-title-actions { justify-content: space-between; }
}

.ruling-provenance {
  margin: 10px 0 2px;
  padding: 8px 12px;
  background: #fbf8ef;
  border: 1px solid rgba(160, 130, 40, .25);
  border-radius: 8px;
  color: #6d5c22;
  font-size: 12.5px;
  line-height: 1.45;
}

.ruling-report {
  appearance: none;
  border: 0;
  background: transparent;
  color: #8a6d1d;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin-left: 8px;
}

[hidden] { display: none !important; }
body[data-workspace="research"] [data-workspace-view="search"] { display: none !important; }
body[data-workspace="search"] [data-workspace-view="research"] { display: none !important; }
body[data-workspace="research"] [data-workspace-view="expedientes"] { display: none !important; }
body[data-workspace="search"] [data-workspace-view="expedientes"] { display: none !important; }
body[data-workspace="expedientes"] [data-workspace-view="search"],
body[data-workspace="expedientes"] [data-workspace-view="research"] { display: none !important; }

.workspace-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef0ed;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.coverage-nav-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  padding: 0 4px;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.coverage-nav-link::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 102, 79, .09);
}

.coverage-nav-link span { color: var(--accent); transition: transform .18s ease; }
.coverage-nav-link:hover { color: var(--ink); }
.coverage-nav-link:hover span { transform: translate(1px, -1px); }

.history-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 0 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.history-trigger:hover { background: #fff; }
.history-trigger #historyCount {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
}

.history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(18, 24, 21, .28);
  backdrop-filter: blur(2px);
}

.history-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 40;
  width: min(410px, 100vw);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #f9faf8;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(18, 26, 22, .14);
}

.history-drawer > header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.history-drawer .eyebrow { margin-bottom: 2px; font-size: 11px; }
.history-drawer h2 { margin: 0; font-size: 22px; }
.history-close {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.history-close:hover { color: var(--ink); }
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.history-toolbar button {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 740;
}

.history-list { overflow: auto; }
.history-entry {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
}

.history-entry:hover { background: #fff; }
.history-entry-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 11px;
}

.history-entry-top time { color: var(--muted); font-weight: 500; }
.history-entry-query {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 690;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.history-entry-detail { color: var(--muted); font-size: 11px; }
.history-empty { margin: 0; padding: 22px 18px; color: var(--muted); }
body.history-open { overflow: hidden; }

.document-viewer {
  width: min(1040px, calc(100vw - 32px));
  max-width: none;
  height: min(900px, calc(100dvh - 32px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9faf8;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(18, 26, 22, .22);
}

.document-viewer::backdrop {
  background: rgba(18, 24, 21, .4);
  backdrop-filter: blur(3px);
}

.document-viewer-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.document-viewer-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.document-viewer-head .eyebrow { margin-bottom: 2px; font-size: 11px; }
.document-viewer-head h2 { margin: 0; font-size: 19px; line-height: 1.3; }
.document-viewer-head-actions { display: flex; align-items: center; gap: 5px; }
.document-viewer-head button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 29px;
  line-height: 1;
}

.document-viewer-head .document-share-button {
  width: auto;
  min-width: 84px;
  height: 38px;
  flex-basis: auto;
  padding: 0 11px;
  border: 1px solid rgba(18, 102, 79, .22);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
}

.document-viewer-head .document-share-button:hover { background: var(--soft); }

.document-viewer-head button:focus-visible {
  outline: 3px solid rgba(18, 102, 79, .22);
  outline-offset: 0;
  border-radius: 6px;
}

.document-viewer-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.document-viewer-content > .law-reader { margin-top: 0; }
body.document-viewer-open { overflow: hidden; }

.workspace-tab {
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 680;
}

.workspace-tab:hover { color: var(--ink); }

.workspace-tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(22, 28, 24, .12);
}

.workspace-tab:focus-visible,
.coverage-nav-link:focus-visible,
.coverage-preview-link:focus-visible,
.coverage-ribbon:focus-visible,
.research-compose button:focus-visible,
.research-examples button:focus-visible,
.citation-link:focus-visible,
.source-card a:focus-visible {
  outline: 3px solid rgba(18, 102, 79, .2);
  outline-offset: 2px;
}

.research-workspace {
  padding: 34px 0 72px;
}

.research-heading,
.research-run-head,
.answer-head,
.research-sources > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.research-heading {
  align-items: end;
  margin-bottom: 18px;
}

.research-heading h1 { margin: 0; }

.engine-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.engine-status.ready {
  color: var(--accent);
  border-color: rgba(18, 102, 79, .28);
  background: #f5faf7;
}

.research-compose {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(22, 28, 24, .05);
}

.research-compose > label {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.research-compose > label span { color: var(--ink); }

.research-compose > label small {
  font-size: 11px;
  font-weight: 520;
  line-height: 1.45;
}

.research-compose textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 14px 15px;
  line-height: 1.5;
  outline: none;
}

.research-compose textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 102, 79, .12);
}

.research-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.research-mode-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.research-mode-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.research-mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.research-mode-option > span {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.research-mode-option strong {
  color: var(--ink);
  font-size: 13px;
}

.research-mode-option small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.42;
}

.research-mode-option input:checked + span {
  border-color: rgba(18, 102, 79, .55);
  background: #f3f9f6;
  box-shadow: 0 0 0 2px rgba(18, 102, 79, .08);
}

.research-mode-option input:focus-visible + span {
  outline: 3px solid rgba(18, 102, 79, .2);
  outline-offset: 2px;
}

.research-mode-option input:disabled + span {
  cursor: default;
  opacity: .64;
}

.research-expectation {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}

.research-expectation svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--accent);
}

.research-expectation > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.research-expectation strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.research-expectation small {
  font-size: 12px;
  line-height: 1.45;
}

.research-compose-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 12px;
}

.research-compose-footer > button {
  min-width: 132px;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 760;
}

.research-compose-footer > button:hover { background: #0e5743; }
.research-compose-footer > button:disabled { opacity: .58; cursor: default; }

.research-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.research-examples button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
}

.research-examples button:hover { color: var(--ink); border-color: #aeb7b1; }

.coverage-ribbon {
  min-height: 76px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(100deg, #fbfcfa 0%, #f3f8f5 100%);
  padding: 13px 16px;
  display: grid;
  grid-template-columns: auto minmax(245px, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.coverage-ribbon:hover {
  border-color: rgba(18, 102, 79, .32);
  box-shadow: 0 8px 24px rgba(22, 28, 24, .05);
  transform: translateY(-1px);
}

.coverage-ribbon-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 850;
}

.coverage-ribbon-copy { min-width: 0; display: grid; gap: 2px; }
.coverage-ribbon-copy strong { color: var(--ink); font-size: 13px; }
.coverage-ribbon-copy small {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coverage-ribbon-metrics {
  padding-left: 16px;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.coverage-ribbon-metrics span { display: grid; gap: 1px; }
.coverage-ribbon-metrics b { color: var(--ink); font-size: 13px; }

.coverage-ribbon-action {
  color: var(--accent);
  font-size: 11px;
  font-weight: 780;
  white-space: nowrap;
}

.coverage-ribbon-action b { margin-left: 5px; }

.research-run {
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 82px;
}

.research-run-head { align-items: end; }
.research-run-head h2 { margin: 0; font-size: 25px; line-height: 1.25; }

.research-progress {
  width: 100%;
  height: 6px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 3px;
  background: #e3e6e2;
}

.research-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .3s ease;
}

.research-eta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.research-eta strong {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.research-timeline {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  padding: 0;
}

.research-timeline li {
  position: relative;
  padding-left: 14px;
  color: var(--muted);
  font-size: 12px;
}

.research-timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .48em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aeb7b1;
}

.research-timeline li.current { color: var(--ink); font-weight: 700; }
.research-timeline li.current::before { background: var(--accent); }

.research-wait-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.research-wait-note.expanded {
  max-width: 780px;
  padding: 10px 12px;
  border: 1px solid rgba(154, 107, 53, .38);
  border-radius: 6px;
  background: #fff8e8;
  color: #68491f;
  font-weight: 700;
}

.research-output {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 30px;
  align-items: start;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 92px;
}

.research-answer { min-width: 0; }
.answer-head { align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.answer-head h2 { margin: 0; font-size: 27px; }
.answer-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

.verification-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.verification-badge.verified {
  color: var(--accent);
  background: #f1f8f4;
  border-color: rgba(18, 102, 79, .3);
}

.verification-badge.partial {
  color: #8a611b;
  background: #fff8e8;
  border-color: rgba(192, 138, 45, .4);
}

.answer-content {
  max-width: 78ch;
  padding-top: 20px;
  color: #202722;
  font-size: 16px;
  line-height: 1.72;
}

.answer-content h1,
.answer-content h2,
.answer-content h3,
.answer-content h4 {
  margin: 26px 0 9px;
  line-height: 1.3;
  letter-spacing: 0;
}

.answer-content h1 { font-size: 23px; }
.answer-content h2 { font-size: 21px; }
.answer-content h3 { font-size: 17px; }
.answer-content h4 { font-size: 15px; }
.answer-content p { margin: 0 0 14px; }
.answer-content ul, .answer-content ol { margin: 0 0 14px; padding-left: 22px; }
.answer-content ul ul, .answer-content ol ol, .answer-content ul ol, .answer-content ol ul { margin: 5px 0; }
.answer-content li { margin: 7px 0; }
.answer-content a { color: var(--accent); text-underline-offset: 2px; }
.answer-content blockquote { margin: 18px 0; padding: 2px 0 2px 14px; border-left: 3px solid #9a6b35; color: #4d5550; }
.answer-content hr { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }
.answer-content code { border-radius: 3px; background: #f0f2ef; padding: 2px 4px; font-size: .9em; }
.answer-content pre { max-width: 100%; overflow: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 6px; background: #202722; padding: 14px; color: #f7f8f6; line-height: 1.5; }
.answer-content pre code { background: transparent; padding: 0; color: inherit; }

.markdown-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.answer-content table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.answer-content th, .answer-content td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.answer-content th:last-child, .answer-content td:last-child { border-right: 0; }
.answer-content tr:last-child td { border-bottom: 0; }
.answer-content th { background: #f2f4f1; color: #313a34; font-size: 12px; font-weight: 800; }
.answer-content tbody tr:nth-child(even) { background: #fafbfa; }

.citation-link {
  display: inline;
  min-height: 0;
  border: 0;
  border-radius: 3px;
  background: var(--soft);
  color: var(--accent);
  padding: 1px 4px;
  cursor: pointer;
  font: inherit;
  font-size: .82em;
  font-weight: 800;
  vertical-align: .08em;
}

.citation-link:hover { background: #d8eade; }

.answer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.conversation-transcript {
  max-width: 86ch;
  display: grid;
  gap: 28px;
}

.conversation-turn {
  min-width: 0;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 110px;
}

.conversation-turn:last-child { padding-bottom: 0; border-bottom: 0; }

.conversation-user {
  width: min(88%, 64ch);
  margin-left: auto;
  padding: 12px 14px;
  border: 1px solid #d8ddd9;
  border-radius: 8px;
  background: #f2f4f1;
  color: #28312b;
}

.conversation-user strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.conversation-user p { margin: 0; line-height: 1.55; }

.conversation-response { margin-top: 18px; min-width: 0; }
.conversation-response > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.conversation-response > header > strong { font-size: 13px; }
.conversation-response-body { min-width: 0; }
.conversation-response > footer {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.conversation-verification {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.conversation-verification.verified { color: var(--accent); }
.conversation-verification.partial,
.conversation-verification.unverified { color: #8a611b; }

.conversation-pending,
.conversation-failed {
  margin-top: 18px;
  padding: 12px 0 12px 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.conversation-failed { border-left-color: #9a3412; color: #7c3a12; }

.research-followup {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.research-followup label {
  display: block;
  margin-bottom: 7px;
  color: #303a33;
  font-size: 13px;
  font-weight: 780;
}

.research-followup textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid #bfc7c1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  line-height: 1.5;
}

.research-followup textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 102, 79, .12);
}

.research-followup-actions {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 9px;
}

.research-followup-actions span {
  flex: 1;
  color: #8a611b;
  font-size: 12px;
}

.research-followup-actions button {
  min-width: 112px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 17px;
  cursor: pointer;
  font-weight: 800;
}

.research-followup-actions button:hover { background: #0e5743; }
.research-followup-actions button:disabled { opacity: .58; cursor: default; }

.research-feedback {
  display: grid;
  grid-template-columns: minmax(180px, .65fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(18, 102, 79, .2);
  border-radius: 8px;
  background: #f2f7f4;
}

.research-feedback > div strong,
.research-feedback > div span { display: block; }
.research-feedback > div strong { font-size: 16px; }
.research-feedback > div span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.research-feedback form { min-width: 0; }
.research-feedback form > label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.research-feedback textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.research-feedback textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 102, 79, .12);
}

.research-sources {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  scrollbar-gutter: stable;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.research-sources > header {
  align-items: baseline;
  padding: 0 2px 10px;
}

.research-sources > header h2 { margin: 0; font-size: 18px; }
.research-sources > header span { color: var(--muted); font-size: 13px; }
.research-sources > div { display: grid; gap: 9px; }

.source-card {
  scroll-margin-top: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.source-card.targeted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 102, 79, .12);
}

.source-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.source-card-id {
  color: var(--accent);
  font-size: 12px;
  font-weight: 820;
}

.source-card-authority {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.source-card h3 {
  margin: 7px 0 5px;
  font-size: 14px;
  line-height: 1.35;
}

.source-card-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.source-card details { margin-top: 9px; }
.source-card summary { cursor: pointer; color: var(--accent); font-size: 12px; font-weight: 700; }
.source-card blockquote {
  margin: 8px 0 0;
  padding: 8px 0 0 10px;
  border-left: 2px solid var(--line);
  color: #3d4641;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

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

.source-card-actions a,
.source-card-actions button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.research-error {
  margin-top: 20px;
  border: 1px solid rgba(154, 52, 18, .24);
  border-radius: 8px;
  background: #fff7ed;
  color: #7c3a12;
  padding: 14px;
}

@media (max-width: 980px) {
  .research-output { grid-template-columns: 1fr; }
  .research-sources {
    position: static;
    max-height: none;
    padding: 24px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .coverage-ribbon {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .coverage-ribbon-mark { grid-column: 1; grid-row: 1 / 3; }
  .coverage-ribbon-copy { grid-column: 2; grid-row: 1; }
  .coverage-ribbon-metrics {
    grid-column: 2;
    grid-row: 2;
    padding-left: 0;
    border-left: 0;
  }
  .coverage-ribbon-action { grid-column: 3; grid-row: 1 / 3; }
}

@media (max-width: 900px) {
  .hero { padding-top: 26px; }
}

@media (max-width: 620px) {
  main { width: min(100% - 24px, 1320px); }
  .pilot-banner-inner {
    width: calc(100% - 24px);
    min-height: 86px;
    grid-template-columns: 1fr;
    align-content: center;
    align-items: start;
    gap: 7px;
  }
  .pilot-promise { display: none; }
  .pilot-banner p { font-size: 11px; }
  .topbar { align-items: center; gap: 10px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 15px; }
  .brand small { display: none; }
  .topbar-tools { gap: 6px; }
  .coverage-nav-link { display: none; }
  .workspace-tab { min-height: 34px; padding: 0 9px; font-size: 12px; }
  .history-trigger { min-height: 40px; padding: 0 8px; font-size: 11px; }
  .history-trigger #historyCount { min-width: 18px; height: 18px; }
  h1 { font-size: 30px; }
  .corpus-panel { min-height: 220px; padding: 22px; }
  .corpus-panel.coverage-preview { min-height: 270px; padding: 21px; }
  .coverage-preview-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .coverage-preview-number { margin-top: 15px; }
  .corpus-promise { font-size: 30px; }
  .corpus-support { margin-top: 18px; font-size: 16px; }
  .results-toolbar-actions { width: 100%; justify-content: flex-start; }
  .results-toolbar-actions .share-trigger { flex: 1; }
  .results-toolbar h2 { font-size: 22px; line-height: 1.22; }
  .filter-trigger { flex: 1; }
  .research-heading { display: grid; grid-template-columns: 1fr; align-items: start; gap: 8px; }
  .engine-status { width: fit-content; white-space: normal; text-align: left; }
  .research-compose { padding: 12px; }
  .research-compose textarea { min-height: 188px; }
  .research-mode-picker { grid-template-columns: 1fr; }
  .research-compose-footer { align-items: stretch; flex-direction: column; }
  .research-compose-footer > button { width: 100%; }
  .coverage-ribbon {
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
  }
  .coverage-ribbon-mark { grid-column: 1; grid-row: 1 / 3; }
  .coverage-ribbon-copy { grid-column: 2; grid-row: 1; }
  .coverage-ribbon-copy small { white-space: normal; }
  .coverage-ribbon-metrics { display: none; }
  .coverage-ribbon-action { grid-column: 2; grid-row: 2; }
  .search-loading { min-height: 108px; padding: 19px; }
  .research-run-head, .answer-head { align-items: flex-start; }
  .research-run-head { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .research-run-head .ghost { width: fit-content; }
  .research-output { gap: 22px; }
  .answer-content { font-size: 15px; }
  .conversation-user { width: 100%; }
  .conversation-response > header { align-items: flex-start; flex-direction: column; gap: 3px; }
  .research-followup-actions { align-items: stretch; flex-direction: column; }
  .research-followup-actions button { width: 100%; }
  .research-feedback { grid-template-columns: 1fr; gap: 12px; }
  .research-eta { align-items: flex-start; flex-direction: column; gap: 3px; }
  .answer-head { display: grid; grid-template-columns: 1fr; gap: 9px; }
  .answer-head-actions { justify-content: flex-start; flex-wrap: wrap; }
  .verification-badge { width: fit-content; }
  .document-viewer {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .document-viewer-head { min-height: 68px; padding: 10px 12px; }
  .document-viewer-head h2 {
    max-width: 180px;
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .document-viewer-content { padding: 12px; }
}

@media (max-width: 480px) {
  .brand > span:last-child { display: none; }
  .topbar { gap: 6px; }
  .topbar-tools { flex: 1; justify-content: flex-end; }
  .workspace-tab { padding: 0 7px; }
}

@media (max-width: 350px) {
  .history-label { display: none; }
  .history-trigger { width: 38px; justify-content: center; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .facets { transition: none; }
  .search-loading-mark,
  .search-loading-track i,
  .document-relations-loading > span { animation: none; }
}

/* Search workspace: quiet hierarchy, semantic identity and contextual reading. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.pilot-banner-inner { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.pilot-dismiss {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #617069;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.pilot-dismiss:hover { background: rgba(18, 102, 79, .09); color: var(--ink); }
.pilot-dismiss:focus-visible { outline: 3px solid rgba(18, 102, 79, .2); }
.pilot-banner[hidden] { display: none; }

.results-commandbar {
  position: sticky;
  top: 72px;
  z-index: 9;
  margin: -1px 0 24px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid rgba(205, 212, 207, .9);
  border-radius: 12px;
  background: rgba(250, 251, 249, .93);
  box-shadow: 0 9px 28px rgba(22, 28, 24, .08);
  backdrop-filter: blur(16px);
}

.results-search-form {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd6d1;
  border-radius: 8px;
  background: #fff;
  padding: 3px 4px 3px 12px;
}
.results-search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 102, 79, .12);
}
.results-search-symbol { color: var(--accent); font-size: 20px; line-height: 1; }
.results-search-form input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}
.results-search-shortcut {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f8f6;
  color: var(--muted);
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.results-search-form button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
}
.results-search-form button:hover { background: #0e5743; }
.results-commandbar .filter-trigger { min-height: 46px; border-radius: 8px; }

.results-toolbar { align-items: flex-start; margin-bottom: 14px; }
.results-toolbar .eyebrow { margin-bottom: 5px; font-size: 11px; letter-spacing: .075em; }
.results-toolbar h2 { max-width: 850px; font-size: 27px; line-height: 1.23; text-wrap: balance; }
.results-summary { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.facets { top: 150px; max-height: calc(100vh - 170px); border-radius: 12px; padding: 15px; }
.facet-group h3 { letter-spacing: .055em; }
.facet-group button { gap: 9px; }
.facet-group button span { min-width: 0; overflow-wrap: anywhere; }
.facet-group small { flex: 0 0 auto; font-size: 11px; font-variant-numeric: tabular-nums; }
.facet-search { display: block; margin: 0 0 7px; }
.facet-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: #fbfcfa;
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
}
.facet-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(18, 102, 79, .1); }
.facet-empty { margin: 8px; color: var(--muted); font-size: 12px; }
.facet-advanced {
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.facet-advanced > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
}
.facet-advanced > summary::-webkit-details-marker { display: none; }
.facet-advanced > summary::after { content: "+"; font-size: 18px; font-weight: 450; }
.facet-advanced[open] > summary::after { content: "−"; }
.facet-advanced > summary span {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--soft);
  font-size: 10px;
}
.facet-advanced-body > .facet-group:first-child { margin-top: 5px; padding-top: 0; border-top: 0; }

.results-list { gap: 12px; }
.result {
  border-color: #dce1dc;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 0 rgba(22, 28, 24, .025);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.result:hover { border-color: #c7d0c9; box-shadow: 0 10px 30px rgba(22, 28, 24, .055); transform: translateY(-1px); }
.result.is-selected { border-color: rgba(18, 102, 79, .55); box-shadow: inset 4px 0 0 var(--accent), 0 10px 30px rgba(22, 28, 24, .07); }
.result-meta-line {
  min-height: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}
.result-meta-line .result-type { color: var(--accent); font-weight: 770; }
.result-meta-line i { color: #a5aea8; font-style: normal; }
.result-identity-label {
  margin: 11px 0 4px;
  color: #65716a;
  font-size: 10px;
  font-weight: 810;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.result-title, .result h3 { margin-bottom: 7px; font-size: 20px; line-height: 1.32; font-weight: 680; text-wrap: pretty; }
.result-title-link { font-weight: inherit; }
.result-title-link[data-open-document]::after { content: " →"; color: var(--accent); opacity: .58; }
.result-title-link[data-open-document]:hover::after { opacity: 1; }
.result-formal-title {
  margin: 0 0 7px;
  color: #6b746f;
  font-size: 12px;
  line-height: 1.45;
}
.result-formal-title span { margin-right: 7px; color: #8b938e; font-size: 10px; font-weight: 760; letter-spacing: .045em; text-transform: uppercase; }
.result-subtitle { max-width: 90ch; margin-bottom: 10px; line-height: 1.5; }
.snippet { max-width: 92ch; font-size: 14.5px; line-height: 1.62; }
.snippet.prominent {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid rgba(18, 102, 79, .62);
  border-radius: 0 7px 7px 0;
  background: #f6faf7;
  color: #26322c;
  font-size: 15px;
}
.snippet-label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.result-signals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.result-signals .badge { min-height: 23px; background: #fafbf9; font-size: 11px; }
.result-more { margin-top: 12px; }
.result-actions { align-items: center; margin-top: 15px; }
.result-actions a, .result-actions button, .result-action-menu > summary { min-height: 40px; border-radius: 7px; padding: 0 12px; font-size: 12px; }
.result-action-menu { position: relative; }
.result-action-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.result-action-menu > summary::-webkit-details-marker { display: none; }
.result-action-menu[open] > summary { border-color: #aeb7b1; color: var(--ink); }
.result-action-menu > div {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 6;
  width: max-content;
  min-width: 150px;
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(22, 28, 24, .14);
}
.result-action-menu > div button { justify-content: flex-start; border: 0; }

.document-viewer {
  inset: 0 0 0 auto;
  width: min(880px, 72vw);
  height: 100dvh;
  margin: 0 0 0 auto;
  border-width: 0 0 0 1px;
  border-radius: 14px 0 0 14px;
  box-shadow: -22px 0 70px rgba(18, 26, 22, .2);
  animation: document-drawer-in .2s ease-out;
}
@keyframes document-drawer-in { from { transform: translateX(24px); opacity: .7; } }
.document-viewer::backdrop { background: rgba(18, 24, 21, .24); backdrop-filter: blur(1px); }
.document-viewer-shell { grid-template-rows: auto auto minmax(0, 1fr); }
.document-viewer-head { min-height: 74px; padding: 12px 16px; }
.document-viewer-head > div:first-child { min-width: 0; }
.document-viewer-head h2 { max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-viewer-head-actions { flex: 0 0 auto; }
.document-result-navigation { display: flex; align-items: center; gap: 2px; }
.document-result-navigation[hidden] { display: none; }
.document-result-navigation span { min-width: 46px; color: var(--muted); text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.document-viewer-head .document-result-navigation button { width: 34px; height: 34px; flex-basis: 34px; border-radius: 6px; font-size: 17px; }
.document-viewer-head button:disabled { opacity: .35; cursor: default; }
.document-query-navigation {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(18, 102, 79, .15);
  background: #f2f7f4;
  color: #3d5148;
  font-size: 12px;
}
.document-query-navigation[hidden] { display: none; }
.document-query-navigation > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-query-navigation > div { display: flex; gap: 4px; }
.document-query-navigation button {
  width: 34px;
  height: 30px;
  border: 1px solid rgba(18, 102, 79, .2);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}
.document-viewer-content { padding: 20px clamp(16px, 3vw, 30px) 40px; }
.document-viewer-content > .law-reader { border: 0; background: transparent; padding: 0; }
.document-viewer-content .comparison-cell p,
.document-viewer-content .article-plain p { font-size: 14px; line-height: 1.64; }
.reader-query-hit { background: #f5d483; box-shadow: 0 0 0 1px rgba(167, 112, 17, .08); }
.reader-query-hit.is-current { background: #ffbf3f; box-shadow: 0 0 0 3px rgba(192, 138, 45, .3); }

@media (max-width: 1050px) {
  .document-viewer { width: min(900px, 91vw); }
}

@media (max-width: 900px) {
  .results-commandbar { grid-template-columns: minmax(0, 1fr) auto; }
  .results-commandbar .filter-trigger { display: inline-flex; }
  .facets { top: auto; max-height: min(78dvh, 720px); border-radius: 14px 14px 0 0; }
}

@media (max-width: 620px) {
  .pilot-banner-inner {
    width: calc(100% - 24px);
    min-height: 0;
    padding: 9px 0 10px;
    grid-template-columns: auto 1fr auto;
    gap: 6px 10px;
  }
  .pilot-status { grid-column: 1; grid-row: 1; min-height: 25px; }
  .pilot-banner p { grid-column: 1 / -1; grid-row: 2; padding-right: 28px; font-size: 11px; }
  .pilot-dismiss { grid-column: 3; grid-row: 1; width: 30px; height: 30px; }
  .results-section { padding-top: 20px; }
  .results-commandbar { top: 64px; margin-bottom: 18px; padding: 7px; gap: 7px; border-radius: 10px; }
  .results-search-form { min-height: 44px; grid-template-columns: auto minmax(64px, 1fr) auto; padding-left: 9px; }
  .results-search-shortcut { display: none; }
  .results-search-form button { min-height: 36px; padding: 0 11px; }
  .results-commandbar .filter-trigger { min-height: 44px; padding: 0 10px; }
  .results-toolbar { gap: 10px; }
  .results-toolbar h2 { font-size: 21px; }
  .results-summary { font-size: 12px; }
  .result { padding: 16px; }
  .result:hover { transform: none; }
  .result-title, .result h3 { font-size: 18px; }
  .snippet { font-size: 14px; }
  .snippet.prominent { margin-top: 10px; padding: 11px 12px; font-size: 14px; }
  .result-formal-title span { display: block; margin: 0 0 2px; }
  .result-actions { gap: 7px; }
  .result-actions .primary-action { flex: 1; justify-content: center; }
  .result-action-menu > div { left: auto; right: 0; }
  .document-viewer {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .document-viewer-head { min-height: 64px; padding: 8px 10px; gap: 8px; }
  .document-viewer-head .eyebrow { font-size: 9px; }
  .document-viewer-head h2 { max-width: min(44vw, 210px); font-size: 15px; }
  .document-viewer-head .document-share-button { display: none; }
  .document-result-navigation span { display: none; }
  .document-viewer-head .document-result-navigation button { width: 32px; height: 34px; flex-basis: 32px; }
  .document-query-navigation { padding: 6px 10px; font-size: 11px; }
  .document-viewer-content { padding: 14px 12px 32px; }
}

@media (max-width: 420px) {
  .results-commandbar { grid-template-columns: 1fr auto; }
  .results-search-form { grid-column: 1 / -1; }
  .results-commandbar .filter-trigger { grid-column: 1 / -1; width: 100%; }
  .results-toolbar-actions { width: auto; }
  .results-toolbar-actions .share-trigger { flex: 0 0 auto; }
  .result-actions > a { padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .result { transition: none; }
  .document-viewer { animation: none; }
}

/* Research follow-ups read as one continuous, verifiable conversation. */
.conversation-transcript { gap: 32px; }
.conversation-turn { padding-bottom: 32px; }
.conversation-user {
  border-radius: 14px 14px 4px 14px;
  background: #f1f4f1;
  box-shadow: 0 1px 0 rgba(22, 28, 24, .025);
}
.conversation-user strong { letter-spacing: .055em; }
.conversation-response {
  margin-top: 14px;
  padding: 17px 18px;
  border: 1px solid #dde2dd;
  border-radius: 4px 14px 14px 14px;
  background: #fff;
}
.conversation-response > header {
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(28, 35, 31, .08);
}
.conversation-response-body { line-height: 1.66; }
.conversation-pending {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(18, 102, 79, .18);
  border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  background: #f5faf7;
  font-weight: 400;
}
.conversation-pending > i {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 2px solid rgba(18, 102, 79, .18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: conversation-pending-spin .85s linear infinite;
}
.conversation-pending span { display: grid; gap: 2px; }
.conversation-pending strong { color: #28443a; font-size: 13px; }
.conversation-pending small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
@keyframes conversation-pending-spin { to { transform: rotate(360deg); } }

.research-followup {
  margin-top: 30px;
  padding: 18px;
  border: 1px solid rgba(18, 102, 79, .2);
  border-radius: 12px;
  background: linear-gradient(145deg, #f6faf7 0%, #fbfcfa 100%);
}
.research-followup-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
}
.research-followup-head > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}
.research-followup-head strong { display: block; color: var(--ink); font-size: 16px; }
.research-followup-head p { max-width: 70ch; margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.research-followup label { margin-bottom: 6px; font-size: 12px; }
.research-followup textarea {
  min-height: 96px;
  border-radius: 9px;
  padding: 12px 13px;
  box-shadow: inset 0 1px 2px rgba(22, 28, 24, .025);
}
.research-followup-actions { gap: 10px; }
.research-followup-actions > span { min-width: 0; }
.research-followup-actions > small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.research-followup-actions button { min-width: 154px; min-height: 42px; border-radius: 7px; }
.research-followup-form.is-submitting textarea,
.research-followup form.is-submitting textarea { background: #f7f8f6; }

@media (max-width: 620px) {
  .conversation-transcript { gap: 24px; }
  .conversation-turn { padding-bottom: 24px; }
  .conversation-user { width: 96%; padding: 11px 12px; }
  .conversation-response { padding: 14px 13px; }
  .conversation-response > header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .conversation-pending { align-items: flex-start; }
  .research-followup { margin-top: 24px; padding: 14px; }
  .research-followup-head { margin-bottom: 13px; }
  .research-followup-actions { align-items: stretch; flex-direction: column; }
  .research-followup-actions > small { white-space: normal; }
  .research-followup-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .conversation-pending > i { animation: none; }
}

/* Legal notices and versioned clickwrap consent. */
.legal-inline-notice {
  margin: 11px 0 0;
  color: #65706a;
  font-size: 10px;
  line-height: 1.5;
}
.search-shell .legal-inline-notice { margin-bottom: -2px; }
.legal-inline-notice a {
  color: #315b4e;
  font-weight: 720;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-inline-notice strong { color: #3b4741; }
.research-legal-notice {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(18, 102, 79, .16);
  border-radius: 6px;
  background: #f4f8f5;
}

.app-legal-footer {
  width: min(1320px, calc(100% - 32px));
  min-height: 76px;
  margin: 28px auto 0;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #7a827e;
  font-size: 10px;
}
.app-legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}
.app-legal-footer a { color: #69736e; }
.app-legal-footer a:hover { color: var(--accent); text-decoration: underline; }

.legal-consent-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(820px, calc(100dvh - 28px));
  position: fixed;
  inset: 0;
  z-index: 1001;
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(10, 19, 15, .28);
}
.legal-consent-dialog[open] { display: block; }
body.legal-consent-pending { overflow: hidden; }
body.legal-consent-pending::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(13, 23, 18, .66);
  backdrop-filter: blur(4px);
}
.legal-consent-dialog::backdrop {
  background: rgba(13, 23, 18, .66);
  backdrop-filter: blur(4px);
}
.legal-consent-card { padding: 30px 32px 24px; }
.legal-consent-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 820;
}
.legal-consent-card .eyebrow { margin-bottom: 6px; font-size: 10px; }
.legal-consent-card h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.legal-consent-card > p:not(.eyebrow):not(.legal-consent-error) {
  margin: 0 0 14px;
  color: #56615b;
  font-size: 13px;
  line-height: 1.55;
}
.legal-consent-card ul {
  margin: 0 0 19px;
  padding: 14px 18px 14px 32px;
  border-radius: 7px;
  background: #f3f6f3;
  color: #3c4842;
  font-size: 12px;
  line-height: 1.55;
}
.legal-consent-card li + li { margin-top: 5px; }
.legal-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0;
  padding: 14px;
  border: 1px solid #cbd5cf;
  border-radius: 7px;
  color: #303a35;
  font-size: 12px;
  font-weight: 620;
  line-height: 1.5;
  cursor: pointer;
}
.legal-consent-check:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 102, 79, .12);
}
.legal-consent-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}
.legal-consent-check a {
  color: var(--accent);
  font-weight: 760;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-consent-error {
  margin: 10px 0 0;
  color: #9a3412;
  font-size: 12px;
  font-weight: 680;
}
.legal-consent-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}
.legal-consent-actions button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 750;
}
.legal-consent-actions .ghost {
  border-color: var(--line);
  background: #fff;
  color: #58625d;
}
.legal-consent-actions button[type="submit"] { background: var(--accent); color: #fff; }
.legal-consent-actions button[type="submit"]:disabled { opacity: .48; cursor: not-allowed; }
.legal-consent-card > small {
  display: block;
  margin-top: 13px;
  color: #818985;
  font-size: 9px;
  line-height: 1.45;
  text-align: right;
}

@media (max-width: 620px) {
  .app-legal-footer { align-items: flex-start; flex-direction: column; }
  .app-legal-footer nav { justify-content: flex-start; }
  .legal-consent-card { padding: 23px 19px 19px; }
  .legal-consent-card h2 { font-size: 23px; }
  .legal-consent-actions { align-items: stretch; flex-direction: column-reverse; }
  .legal-consent-actions button { width: 100%; }
  .legal-consent-card > small { text-align: left; }
}

/* Private professional workspace: persistent dossiers scoped to this browser. */
.dossier-workspace {
  padding: 44px 0 70px;
}

.dossier-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.dossier-heading h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -.035em;
}

.dossier-heading > div > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.dossier-heading > button,
.dossier-create-form button[type="submit"],
.dossier-meta-actions button,
.dossier-item-note-actions button,
.dossier-save-actions button[type="submit"] {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 760;
}

.dossier-heading button:focus-visible,
.dossier-list-item:focus-visible,
.dossier-item button:focus-visible,
.dossier-alerts button:focus-visible,
.dossier-save-dialog button:focus-visible,
.dossier-save-dialog select:focus-visible,
.dossier-save-dialog input:focus-visible,
.dossier-save-dialog textarea:focus-visible {
  outline: 3px solid rgba(18, 102, 79, .2);
  outline-offset: 2px;
}

.dossier-identity-note {
  margin: 0 0 22px;
  padding: 11px 13px;
  border: 1px solid rgba(18, 102, 79, .16);
  border-radius: 7px;
  background: rgba(232, 241, 236, .64);
  color: #3b5149;
  font-size: 12px;
}

.citation-validator {
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(22, 28, 24, .04);
}

.citation-validator > summary {
  min-height: 64px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
  list-style: none;
}

.citation-validator > summary::-webkit-details-marker { display: none; }

.citation-validator > summary > span:first-child {
  display: grid;
  gap: 2px;
}

.citation-validator > summary strong { font-size: 14px; }
.citation-validator > summary small { color: var(--muted); font-size: 11px; }

.citation-validator > summary > span:last-child {
  color: var(--accent);
  font-size: 21px;
  transition: transform .18s ease;
}

.citation-validator[open] > summary > span:last-child { transform: rotate(45deg); }

.citation-validator form {
  padding: 17px 16px;
  display: grid;
  grid-template-columns: minmax(150px, .42fr) minmax(280px, 1fr);
  align-items: start;
  gap: 7px 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.citation-validator label {
  color: #4d5953;
  font-size: 11px;
  font-weight: 720;
}

.citation-validator label small { color: var(--muted); font-weight: 500; }

.citation-validator input,
.citation-validator select,
.citation-validator textarea {
  width: 100%;
  min-height: 41px;
  border: 1px solid #cbd1cc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  resize: vertical;
}

.citation-validator input:focus,
.citation-validator select:focus,
.citation-validator textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(18, 102, 79, .1);
}

.citation-validator input:disabled {
  background: #f1f3f1;
  color: #8a928e;
}

.citation-locator-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(150px, .42fr) minmax(160px, .42fr) minmax(220px, .58fr);
  align-items: center;
  gap: 7px 14px;
}

.citation-validator-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.citation-validator-actions span {
  flex: 1;
  color: var(--muted);
  font-size: 11px;
}

.citation-validator-actions button,
.citation-result-pointer button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 760;
}

.citation-validator-actions button:disabled { cursor: wait; opacity: .58; }

.citation-validator-result {
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid #d6ded9;
  border-left: 4px solid #7d8982;
  border-radius: 7px;
  background: #f8faf9;
}

.citation-validator-result.match { border-left-color: #16815f; background: #f2f8f5; }
.citation-validator-result.ambiguity { border-left-color: #c58b12; background: #fffaf0; }
.citation-validator-result.not_verified { border-left-color: #a34a3f; background: #fff7f5; }

.citation-validator-result > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.citation-validator-result > header span {
  color: #33413a;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.citation-validator-result > header small,
.citation-validator-result > p {
  color: var(--muted);
  font-size: 11px;
}

.citation-validator-result > p { margin: 7px 0 0; font-size: 12px; }

.citation-result-pointer {
  margin-top: 11px;
  padding-top: 11px;
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(92, 108, 99, .16);
}

.citation-result-pointer strong { font-size: 12px; overflow-wrap: anywhere; }

.citation-result-pointer > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 13px;
}

.citation-result-pointer button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 11px;
}

.citation-result-pointer a {
  color: var(--accent);
  font-size: 11px;
  font-weight: 730;
  text-decoration: none;
}

.citation-result-pointer a:hover { text-decoration: underline; }
.citation-result-candidates { margin-top: 13px; }
.citation-result-candidates > strong { font-size: 11px; }

.dossier-create-form {
  margin: 0 0 22px;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(280px, 1.5fr) auto;
  align-items: end;
  gap: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dossier-create-form label {
  color: #4f5a54;
  font-size: 12px;
  font-weight: 720;
}

.dossier-create-form label:nth-of-type(1) { grid-column: 1; }
.dossier-create-form label:nth-of-type(2) { grid-column: 2; }

.dossier-create-form input,
.dossier-create-form textarea,
.dossier-meta-form input,
.dossier-meta-form textarea,
.dossier-item textarea,
.dossier-save-dialog input,
.dossier-save-dialog select,
.dossier-save-dialog textarea {
  width: 100%;
  border: 1px solid #cbd1cc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  resize: vertical;
}

.dossier-create-form input:focus,
.dossier-create-form textarea:focus,
.dossier-meta-form input:focus,
.dossier-meta-form textarea:focus,
.dossier-item textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(18, 102, 79, .1);
}

.dossier-create-form > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dossier-create-form > p {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.dossier-layout {
  display: grid;
  grid-template-columns: minmax(245px, 310px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.dossier-index,
.dossier-detail {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 35px rgba(22, 28, 24, .055);
}

.dossier-index {
  position: sticky;
  top: 92px;
  overflow: hidden;
}

.dossier-index > header {
  min-height: 57px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.dossier-index > header > strong { font-size: 14px; }

.dossier-index > header label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.dossier-index > header input { accent-color: var(--accent); }

#dossierList {
  max-height: min(68vh, 720px);
  overflow: auto;
  padding: 7px;
}

.dossier-list-item {
  width: 100%;
  padding: 12px 11px;
  display: grid;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.dossier-list-item:hover { background: #f5f7f4; }

.dossier-list-item.active {
  border-color: rgba(18, 102, 79, .24);
  background: var(--soft);
}

.dossier-list-item > span {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.dossier-list-item strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.dossier-list-item em {
  padding: 2px 5px;
  border-radius: 4px;
  background: #ede9df;
  color: #756441;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.dossier-list-item small,
.dossier-empty-copy {
  color: var(--muted);
  font-size: 10px;
}

.dossier-empty-copy {
  margin: 0;
  padding: 18px 13px;
  line-height: 1.55;
}

.dossier-detail {
  min-height: 430px;
  overflow: hidden;
}

.dossier-detail-empty {
  min-height: 430px;
  padding: 40px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.dossier-detail-empty > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  font-size: 24px;
}

.dossier-detail-empty h2 { margin: 16px 0 5px; font-size: 22px; }
.dossier-detail-empty p { max-width: 520px; margin: 0; color: var(--muted); font-size: 13px; }

.dossier-meta-form {
  padding: 22px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.dossier-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.dossier-detail-head > div { flex: 1; min-width: 0; }
.dossier-detail-head .eyebrow { margin-bottom: 5px; }

.dossier-detail-head #dossierTitle {
  min-height: 68px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 1px 0 5px;
  font-size: 25px;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: -.025em;
  resize: none;
}

.dossier-detail-head #dossierTitle:focus {
  border-bottom-color: var(--accent);
  outline: 0;
}

.dossier-detail-head .ghost {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.dossier-detail-controls {
  flex: none !important;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dossier-detail-controls .ghost {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 720;
  text-decoration: none;
}

.dossier-detail-controls .ghost:hover {
  border-color: rgba(18, 102, 79, .42);
  color: var(--accent);
}

.dossier-meta-form > label,
.dossier-item > label,
.dossier-save-dialog label {
  color: #4d5953;
  font-size: 11px;
  font-weight: 720;
}

.dossier-meta-actions,
.dossier-item-note-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.dossier-meta-actions span,
.dossier-item-note-actions span,
#dossierSaveMessage {
  flex: 1;
  color: var(--muted);
  font-size: 11px;
}

.dossier-alerts-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.dossier-alerts-section > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.dossier-alerts-section h2 {
  margin: 0;
  font-size: 19px;
}

#dossierAlertUnreadCount {
  min-width: 27px;
  height: 27px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e8ece9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

#dossierAlertUnreadCount.has-unread {
  background: var(--accent);
  color: #fff;
}

.dossier-alerts-help {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.dossier-alerts {
  display: grid;
  gap: 11px;
}

.dossier-alert-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(18, 102, 79, .22);
  border-radius: 8px;
  background: #fbfdfb;
}

.dossier-alert-card.inactive {
  border-color: var(--line);
  background: #f8f8f6;
}

.dossier-alert-card > header {
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.dossier-alert-card > header > div {
  min-width: 0;
}

.dossier-alert-card > header span,
.dossier-alert-active-label {
  color: var(--accent);
  font-size: 9px;
  font-weight: 820;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dossier-alert-card.inactive > header span { color: var(--muted); }

.dossier-alert-card h3 {
  margin: 4px 0 2px;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.dossier-alert-card > header small {
  color: var(--muted);
  font-size: 9px;
}

.dossier-alert-card button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-size: 10px;
  font-weight: 740;
}

.dossier-alert-card > header .ghost {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
}

.dossier-alert-inbox-head {
  min-height: 42px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f3f7f4;
}

.dossier-alert-inbox-head strong {
  font-size: 10px;
}

.dossier-alert-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dossier-alert-event {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-top: 1px solid #e5e8e5;
  background: #fff;
}

.dossier-alert-event.unread {
  box-shadow: inset 3px 0 var(--accent);
  background: #f8fcf9;
}

.dossier-alert-event > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dossier-alert-event strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.dossier-alert-event p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.dossier-alert-event small,
.dossier-alert-event time {
  color: var(--muted);
  font-size: 9px;
}

.dossier-alert-event > div:last-child {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.dossier-alert-empty,
.dossier-alerts-empty {
  margin: 0;
  padding: 18px 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.dossier-alerts-empty {
  display: grid;
  gap: 3px;
  border: 1px dashed #cbd2cc;
  border-radius: 8px;
}

.dossier-alerts-empty strong { color: var(--ink); font-size: 13px; }
.dossier-alert-retention-note { display: block; padding: 8px 14px; color: var(--muted); font-size: 9px; }

.dossier-items-section { padding: 22px; }

.dossier-items-section > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dossier-items-section h2 { margin: 0; font-size: 19px; }

#dossierItemCount {
  min-width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 780;
}

.dossier-items { display: grid; gap: 11px; }

.dossier-item {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dossier-item > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dossier-item > header > span {
  color: var(--accent);
  font-size: 9px;
  font-weight: 820;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dossier-item > header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dossier-item > header button,
.dossier-references button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 720;
}

.dossier-item > header .dossier-remove-item { color: #8a4b39; }

.dossier-item h3 {
  margin: 9px 0 4px;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
}

.dossier-item > p {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 12px;
}

.dossier-item > label { display: block; margin: 12px 0 5px; }
.dossier-item textarea { font-size: 12px; }
.dossier-item-note-actions { margin-top: 7px; }
.dossier-item-note-actions button { min-height: 34px; padding: 0 11px; font-size: 11px; }

.dossier-references {
  margin-top: 11px;
  padding: 10px 11px;
  border-radius: 6px;
  background: #f5f7f4;
}

.dossier-references summary {
  color: #3f5048;
  cursor: pointer;
  font-size: 11px;
  font-weight: 720;
}

.dossier-references ul {
  max-height: 330px;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 1px;
  overflow: auto;
  list-style: none;
}

.dossier-references li {
  padding: 8px 4px;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid #e1e5e1;
}

.dossier-references li:last-child { border-bottom: 0; }
.dossier-references li strong,
.dossier-references li button { text-align: left; font-size: 11px; }
.dossier-references li small { color: var(--muted); font-size: 9px; }
.dossier-references > small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; }

.dossier-items-empty {
  padding: 28px;
  display: grid;
  gap: 4px;
  border: 1px dashed #cbd2cc;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.dossier-items-empty strong { color: var(--ink); font-size: 14px; }
.dossier-items-empty span { font-size: 12px; }

.dossier-save-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(10, 19, 15, .28);
}

.dossier-save-dialog::backdrop {
  background: rgba(13, 23, 18, .62);
  backdrop-filter: blur(4px);
}

.dossier-save-dialog form { padding: 24px; display: grid; gap: 8px; }

.dossier-save-dialog header {
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dossier-save-dialog h2 { margin: 2px 0 0; font-size: 23px; }

#dossierSaveClose {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 21px;
}

.dossier-save-new-toggle {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 2px 0 7px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 740;
}

.dossier-save-new { display: grid; gap: 7px; }
#dossierSaveMessage { min-height: 18px; margin: 2px 0 0; }

.dossier-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.dossier-save-actions .ghost {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.dossier-save-actions button:disabled,
.dossier-heading button:disabled,
.dossier-meta-actions button:disabled,
.dossier-item button:disabled,
.dossier-alerts button:disabled { cursor: wait; opacity: .58; }

@media (max-width: 820px) {
  .dossier-layout { grid-template-columns: 1fr; }
  .dossier-index { position: static; }
  #dossierList {
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dossier-create-form { grid-template-columns: 1fr; }
  .dossier-create-form label:nth-of-type(1),
  .dossier-create-form label:nth-of-type(2),
  .dossier-create-form > p { grid-column: 1; }
}

@media (max-width: 620px) {
  .dossier-workspace { padding: 27px 0 50px; }
  .dossier-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .dossier-heading > button { width: 100%; }
  .dossier-heading h1 { font-size: 32px; }
  .dossier-identity-note { font-size: 11px; }
  .citation-validator > summary { align-items: flex-start; }
  .citation-validator form,
  .citation-locator-fields { grid-template-columns: 1fr; }
  .citation-validator form > label,
  .citation-locator-fields,
  .citation-validator-actions { grid-column: 1; }
  .citation-validator-actions { align-items: stretch; flex-direction: column; }
  .citation-validator-actions button { width: 100%; }
  .citation-validator-result > header { align-items: flex-start; flex-direction: column; }
  .citation-result-pointer > div { align-items: stretch; flex-direction: column; }
  .citation-result-pointer button { width: 100%; }
  #dossierList { grid-template-columns: 1fr; }
  .dossier-detail-empty { min-height: 320px; padding: 28px 19px; }
  .dossier-meta-form,
  .dossier-alerts-section,
  .dossier-items-section { padding: 15px; }
  .dossier-detail-head { align-items: stretch; flex-direction: column; }
  .dossier-detail-head #dossierTitle { min-height: 78px; font-size: 21px; }
  .dossier-detail-controls { width: 100%; }
  .dossier-detail-controls .ghost { flex: 1; }
  .dossier-item { padding: 13px; }
  .dossier-item > header { align-items: flex-start; }
  .dossier-item > header > div { align-items: flex-end; flex-direction: column; gap: 5px; }
  .dossier-alert-card > header,
  .dossier-alert-inbox-head { align-items: stretch; flex-direction: column; }
  .dossier-alert-card > header .ghost { width: 100%; }
  .dossier-alert-event { grid-template-columns: 1fr; gap: 9px; }
  .dossier-alert-event > div:last-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 12px;
  }
  .dossier-alert-event time { flex-basis: 100%; }
  .dossier-alert-event button { min-height: 32px; }
  .dossier-meta-actions,
  .dossier-item-note-actions { align-items: stretch; flex-direction: column; }
  .dossier-meta-actions button,
  .dossier-item-note-actions button { width: 100%; }
  .dossier-save-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .dossier-save-dialog form { min-height: 100%; padding: 22px 17px; align-content: start; }
  .dossier-save-actions { margin-top: auto; align-items: stretch; flex-direction: column-reverse; }
  .dossier-save-actions button { width: 100%; }
}

@media (max-width: 450px) {
  .topbar { padding-inline: 10px; }
  .brand > span:last-child { display: none; }
  .topbar-tools { flex: 1; justify-content: flex-end; min-width: 0; }
  .workspace-tabs { max-width: calc(100vw - 104px); overflow-x: auto; scrollbar-width: none; }
  .workspace-tabs::-webkit-scrollbar { display: none; }
  .workspace-tab { flex: 0 0 auto; padding-inline: 8px; font-size: 10.5px; }
  .history-trigger { flex: 0 0 auto; }
  .history-label { display: none; }
}
