



.mark { display: inline-flex; align-items: center; gap: var(--s3); }
.mark svg { display: block; }
.mark-word { font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; }
.mark-word span { color: var(--ink-3); font-weight: 500; }
.mark-link { text-decoration: none; }



.measures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 860px) { .measures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.measure {
  background: var(--panel);
  padding: var(--s5) var(--s4) var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  position: relative;
  min-width: 0;
}
.measure-value {
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.measures-ex .measure { padding: var(--s4); }
.measures-ex .measure-value { font-size: var(--ex-stat-lg); }
.measure-name { font-size: var(--fs-xs); color: var(--ink-2); letter-spacing: 0.02em; }
.measure-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.measure::after {
  content: ""; position: absolute; left: var(--s4); right: var(--s4);
  top: calc(var(--s5) - 10px); height: 5px;
  background-image: linear-gradient(to right, var(--rule-strong) 0 1px, transparent 1px 100%);
  background-size: 12px 5px; opacity: 0.4;
  pointer-events: none;
}
.measures-ex .measure::after { top: calc(var(--s4) - 9px); }



.scale { display: block; }
.scale-track {
  display: flex; width: 100%; height: 34px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--ground-2); border: 1px solid var(--rule);
}
.scale-seg {
  position: relative; min-width: 3px; padding: 0; border: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.45);
  transition: width var(--dur-scale) var(--ease), opacity var(--dur-1) var(--ease),
              filter var(--dur-1) var(--ease);
}
.scale-seg:last-child { border-right: 0; }
.scale-seg[data-interactive="true"] { cursor: pointer; }

.scale-seg[data-pattern="2"]::after,
.scale-seg[data-pattern="3"]::after,
.scale-seg[data-pattern="4"]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
.scale-seg[data-pattern="2"]::after {
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.30) 0 3px, transparent 3px 7px);
}
.scale-seg[data-pattern="3"]::after {
  background-image: repeating-linear-gradient(-45deg, rgba(0,0,0,.30) 0 2px, transparent 2px 6px);
}
.scale-seg[data-pattern="4"]::after {
  background-image: repeating-linear-gradient(90deg, rgba(0,0,0,.32) 0 2px, transparent 2px 8px);
}
.scale-seg.is-dim { opacity: 0.26; }
.scale-seg.is-lit { filter: brightness(1.3); box-shadow: inset 0 0 0 2px var(--ink); }

.scale-seg-thin::before {
  content: ""; position: absolute; left: 50%; bottom: -9px;
  width: 1px; height: 9px; background: var(--rule-strong);
}

.scale-ticks {
  height: 7px; margin-top: 3px;
  background-image: linear-gradient(to right, var(--rule) 0 1px, transparent 1px 100%);
  background-size: 5% 4px; background-repeat: repeat-x;
  border-top: 1px solid var(--rule-faint);
}

.scale-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); margin-top: var(--s3); }
.scale-key {
  display: flex; align-items: baseline; gap: var(--s2);
  font-size: var(--fs-sm); color: var(--ink-2); text-align: left;
  padding: 4px var(--s2); border-radius: var(--radius-sm);
  border: 1px solid transparent; background: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              opacity var(--dur-1) var(--ease);
}
.scale-key i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; transform: translateY(-1px); }
.scale-key b { color: var(--ink); font-weight: 620; font-variant-numeric: tabular-nums; }
.scale-key em { font-style: normal; color: var(--ink-4); font-size: var(--fs-xs); }
.scale-key.is-dim { opacity: 0.4; }
.scale-key.is-lit, .scale-key:hover { background: var(--panel-2); border-color: var(--rule-strong); }
.scale-key[aria-pressed="true"] { border-color: var(--select-dim); background: var(--select-wash); }
.scale-caption { margin-top: var(--s2); font-size: var(--fs-xs); color: var(--ink-4); }



.funnel { display: grid; gap: var(--s3); }
.funnel-step { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s4); }
.funnel-bar {
  height: 26px; background: var(--panel-2); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); position: relative; overflow: hidden;
}
.funnel-fill {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--measured-dim), var(--measured));
  transition: width var(--dur-scale) var(--ease);
}
.funnel-fill[data-tone="excluded"] { background: linear-gradient(90deg, #3a3040, var(--st-unavailable)); }
.funnel-fill[data-tone="neutral"]  { background: linear-gradient(90deg, #26323a, #4a616d); }
.funnel-fill[data-tone="partial"]  { background: linear-gradient(90deg, #4a3a16, var(--st-partial)); }
.funnel-label {
  position: relative; z-index: 1; padding: 3px var(--s3);
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.funnel-n { font-variant-numeric: tabular-nums; font-weight: 660; min-width: 7ch; text-align: right; }



.plot { display: grid; gap: var(--s3); }
.plot-controls { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.plot-zoom-state {
  margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3);
  font-variant-numeric: tabular-nums; font-family: var(--mono);
}
.plot-shell { min-width: 0; max-width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--ground-2); overflow: hidden; }
.plot-svg {
  width: 100%; height: 460px; display: block; cursor: crosshair;
  
  touch-action: pan-y;
}
.field-svg { height: 420px; }

@media (max-width: 900px) {
  .plot-shell { overflow-x: auto; }
  .plot-svg { min-width: 680px; height: 340px; }
}
.plot-svg.is-panning { cursor: grabbing; }
.plot-tick { fill: var(--ink-3); font-size: 11px; font-family: var(--mono); }
.plot-axis-title { fill: var(--ink-2); font-size: 14px; letter-spacing: 0.02em; font-weight: 650; }
.plot-readout, .plot-scroll-note { color: var(--ink-3); font-size: var(--fs-xs); }
.plot-scroll-note {
  flex: 1 1 320px; line-height: 1.45;
  color: var(--ink-2); font-size: 13px; font-weight: 560;
}
.plot-svg:focus-visible { outline: 2px solid var(--select); outline-offset: -3px; }
.plot-mark { pointer-events: none; transition: fill-opacity var(--dur-1) var(--ease); }
.plot-mark.is-selected { stroke: var(--ink); stroke-width: 1.6; }
.plot-overlays { pointer-events: none; }
.plot-hover-halo, .plot-cursor-halo, .plot-ring, .plot-lead {
  vector-effect: non-scaling-stroke;
}
.plot-hover-halo { fill: none; stroke: var(--ink-2); stroke-width: 1.15; opacity: 0.9; }
.plot-cursor-halo { fill: none; stroke: var(--measured); stroke-width: 1.4; stroke-dasharray: 2.5 2.5; opacity: 0.95; }
.plot-ring { fill: none; stroke: var(--select); stroke-width: 2; opacity: 0.9; }
.plot-lead { stroke: var(--select); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.55; }
.plot-brush { fill: var(--select-wash); stroke: var(--select); stroke-width: 1; }

@media (forced-colors: active) {
  .plot-hover-halo, .plot-cursor-halo, .plot-ring, .plot-lead {
    stroke: Highlight;
    forced-color-adjust: auto;
  }
  .plot-svg:focus-visible { outline-color: Highlight; }
}

.field-boundary {
  font-size: var(--fs-sm); color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-left: 3px solid var(--st-partial);
  border-radius: var(--radius-sm); padding: var(--s2) var(--s3); background: var(--panel-2);
}
.field-boundary b { color: var(--ink); }

.plot-legend { display: flex; flex-wrap: wrap; gap: var(--s2); }
.plot-legend button {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); padding: 5px var(--s3);
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--ground-2); color: var(--ink-2);
  transition: border-color var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.plot-legend button[aria-pressed="false"] { opacity: 0.42; border-style: dashed; text-decoration: line-through; }
.plot-legend button[aria-pressed="true"] { border-color: var(--rule-strong); color: var(--ink); }
.plot-legend b { font-variant-numeric: tabular-nums; color: var(--ink); }
.legend-glyph { width: 11px; height: 11px; flex: none; }




.grid-root {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
}
.grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  justify-content: space-between;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  background: var(--ground-2);
  min-width: 0;
  max-width: 100%;
}
.grid-toolbar .grid-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 460px;
}
.grid-tools { display: flex; flex-wrap: wrap; gap: var(--s2); min-width: 0; max-width: 100%; }

.grid-sort-menu-trigger,
.grid-filter-index-trigger { display: none; }
.grid-toolbar .field-input,
.grid-popover .field-input {
  width: 100%;
  min-width: 0;
  padding: 7px 30px 7px 10px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
}
.grid-toolbar .field-input::placeholder { color: var(--ink-4); }
.grid-toolbar .field-input:hover,
.grid-popover .field-input:hover { border-color: var(--ink-3); }
.grid-toolbar .field-input:focus,
.grid-popover .field-input:focus {
  border-color: var(--select);
  outline: 2px solid var(--select);
  outline-offset: 1px;
}
.grid-toolbar .field-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 23px;
  height: 23px;
  transform: translateY(-50%);
  padding: 0;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.grid-toolbar .field-clear:hover { color: var(--ink); background: var(--raised); }
.grid-tools .caret { margin-left: 5px; color: var(--ink-4); font-size: 9px; }


.grid-tools .btn-export {
  color: var(--measured);
  border-color: var(--measured-dim);
  background: var(--measured-wash);
}
.grid-tools .btn-export:hover,
.grid-tools .btn-export[aria-expanded="true"] {
  color: var(--ink);
  border-color: var(--measured);
  background: var(--measured-wash);
}

.grid-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: 0 var(--s4);
  margin-top: var(--s2);
}
.grid-chips > .chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 4px 6px 4px 10px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
}
.grid-chips .chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  color: var(--ink-2);
  background: var(--raised);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  font-size: 10px;
}
.grid-chips .chip-x:hover { color: var(--ink); background: var(--select-dim); }
.grid-chips > .chip-clear { padding: 4px 12px; cursor: pointer; }
.grid-chips > .chip-clear:hover { color: var(--ink); border-color: var(--select); }

.grid-count {
  min-width: 0;
  max-width: 100%;
  padding: var(--s2) var(--s4) 0;
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.grid-count .count-note { color: var(--ink-semantic-muted); }

.grid-scroll {
  position: relative;
  min-width: 0;
  overflow: auto;
  max-height: 62vh;
  margin-top: var(--s2);
  border-block: 1px solid var(--rule);
  background: var(--panel);
}
.grid-scroll:focus-visible {
  outline: 2px solid var(--select);
  outline-offset: -2px;
}
.grid-table {
  display: grid;
  width: var(--grid-inline-size, 100%);
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--ex-body);
}
.grid-track-measure {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: var(--grid-track-measure-width);
  height: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.grid-table colgroup { display: none; }
.grid-table thead,
.grid-table tbody {
  display: grid;
  min-width: 100%;
}
.grid-table tr {
  display: grid;
  grid-template-columns: var(--grid-column-template);
  width: 100%;
  min-width: 0;
}

#documents-table { min-width: 0; }
.grid-table caption { text-align: left; }
.grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  text-align: left;
  white-space: normal;
  background: var(--panel-2);
  border-bottom: 1px solid var(--rule-strong);
}
.grid-table .th-inner {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  gap: 2px;
}
.grid-table .th-sort,
.grid-table .th-label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  padding: 8px var(--s2);
  font: inherit;
  font-size: var(--fs-xxs);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: transparent;
  border: 0;
}
.grid-table .th-sort { flex: 1 1 auto; overflow: hidden; cursor: pointer; }
.grid-table .th-sort > span:first-child,
.grid-table .th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}
.grid-table thead th[data-heading-line-limit="2"] .th-sort > span:first-child,
.grid-table thead th[data-heading-line-limit="2"] .th-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.grid-table thead th[data-heading-line-limit="2"] .th-sort > span:first-child,
.grid-table thead th[data-heading-line-limit="2"] .th-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
.grid-table .th-sort:hover { color: var(--ink); background: var(--raised); }
.grid-table .th-dir { flex: none; color: var(--ink-4); }
.grid-table th[aria-sort="ascending"] .th-dir,
.grid-table th[aria-sort="descending"] .th-dir { color: var(--measured); }
.grid-table .th-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  margin: 4px 4px 4px 0;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.grid-table .th-filter:hover { color: var(--ink); border-color: var(--rule-strong); }
.grid-table .th-filter[aria-expanded="true"] {
  color: var(--select);
  border-color: var(--select);
  background: var(--select-wash);
}
.grid-table .th-filter[data-active="true"] {
  color: var(--measured);
  border-color: var(--measured-dim);
}
.grid-table tbody th,
.grid-table tbody td {
  min-width: 0;
  padding: 7px var(--s2);
  vertical-align: top;
  text-align: left;
  font-weight: 400;
  border-bottom: 1px solid var(--rule-faint);
}
.grid-table tbody tr:hover { background: var(--panel-2); }
.grid-table tbody tr.is-selected { background: var(--select-wash); }
.grid-table tbody tr.is-selected > * { border-bottom-color: var(--select-dim); }
.grid-table tbody tr:focus-visible {
  outline: 2px solid var(--select);
  outline-offset: -2px;
  background: var(--select-wash);
}
.grid-table .col-number {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.grid-table .col-status,
.grid-table .col-actions { white-space: nowrap; }
.grid-table .col-actions { text-align: right; }
.grid-table .col-actions .th-label { justify-content: flex-end; }
.grid-cell-content {
  min-width: 0;
  max-width: 100%;
  line-height: 1.35;
}
.grid-cell-content[data-wrap="words"] {
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}
.grid-cell-content[data-wrap="break-word"] {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  white-space: normal;
}
.grid-cell-content[data-wrap="nowrap"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid-cell-content[data-line-limit="1"] {
  max-height: 1.35em;
  overflow: hidden;
}
.grid-cell-content[data-line-limit="2"] {
  max-height: 2.7em;
  overflow: hidden;
}
.grid-cell-content[data-role="identity"] > * { min-width: 0; max-width: 100%; }
.grid-cell-content[data-role="identity"] > div > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-id {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 1px;
}
.cell-name {
  min-width: 0;
  max-width: 100%;
  font-weight: 600;
}
.cell-path {
  min-width: 0;
  max-width: 100%;
  font-family: var(--mono);
  font-size: var(--fs-xxs);
  color: var(--ink-3);
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.row-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: var(--s1); }
.row-action {
  padding: 2px 7px;
  font-size: var(--fs-xxs);
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
}
.row-action:hover,
.row-action:focus-visible { color: var(--ink); border-color: var(--select); background: var(--raised); }
.grid-empty {
  grid-column: 1 / -1;
  padding: var(--s6);
  text-align: center;
  color: var(--ink-2);
}
.grid-empty p { margin-bottom: var(--s3); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 32px;
  padding: 6px 10px;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.filter-chip:hover,
.filter-chip:focus-visible { color: var(--ink); border-color: var(--select); }
.filter-chip[aria-pressed="true"] { color: var(--ink); border-color: var(--select); background: var(--select-wash); }
.filter-chip b { font-variant-numeric: tabular-nums; }

.grid-selected-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  margin: var(--s3) var(--s4) 0;
  padding: var(--s2) var(--s3);
  font-size: var(--fs-xs);
  background: var(--select-wash);
  border: 1px solid var(--select-dim);
  border-radius: var(--radius-sm);
}
.grid-selected-bar > * { min-width: 0; max-width: 100%; }
.grid-selected-bar b {
  font-weight: 650;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.grid-pager {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--rule);
}
.grid-pager .pager-pos { font-size: var(--fs-xs); color: var(--ink-2); }
.grid-pager .pager-note {
  flex: 1 1 100%;
  font-size: var(--fs-xxs);
  color: var(--ink-semantic-muted);
  max-width: 72ch;
}


.grid-cards { display: none; min-width: 0; max-width: 100%; }
.record-card {
  display: grid;
  min-width: 0;
  gap: var(--s2);
  padding: var(--s3);
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.record-card.is-selected {
  border-color: var(--select);
  background: var(--select-wash);
}
.card-identity {
  min-width: 0;
  max-width: 100%;
  font-weight: 620;
}
.card-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--s2);
}
.card-field { display: grid; gap: 1px; min-width: 0; }
.card-key {
  font-size: var(--fs-xxs);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.card-val {
  min-width: 0;
  max-width: 100%;
  font-size: var(--fs-xs);
}
.card-identity[data-wrap="words"],
.card-val[data-wrap="words"] {
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}
.card-identity[data-wrap="break-word"],
.card-val[data-wrap="break-word"] {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  white-space: normal;
}
.card-identity[data-wrap="nowrap"],
.card-val[data-wrap="nowrap"] {
  overflow-x: auto;
  white-space: nowrap;
}
.card-identity[data-line-limit="none"],
.card-val[data-line-limit="none"] {
  max-height: none;
  overflow-y: visible;
}
.card-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

@media (max-width: 860px) {
  .grid-scroll { display: none; }
  .grid-sort-menu-trigger,
  .grid-filter-index-trigger { display: inline-flex; }
  .grid-cards {
    display: grid;
    gap: var(--s2);
    padding: var(--s3) var(--s4);
  }
}


.grid-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 79;
  display: none;
  background: transparent;
  pointer-events: none;
}
.grid-popover-backdrop[hidden] { display: none; }
.grid-popover {
  position: fixed;
  z-index: 80;
  display: grid;
  gap: var(--s2);
  width: min(340px, calc(100vw - 24px));
  max-width: 340px;
  max-height: min(calc(100vh - 24px), var(--grid-popover-available-height, calc(100vh - 24px)));
  max-height: min(calc(100dvh - 24px), var(--grid-popover-available-height, calc(100dvh - 24px)));
  margin: 0;
  padding: var(--s4);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.grid-popover[hidden] { display: none; }
.grid-popover .popover-title {
  font-size: var(--fs-xs);
  font-weight: 660;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-2);
}
.grid-popover .popover-note {
  font-size: var(--fs-xxs);
  line-height: 1.5;
  color: var(--ink-4);
  max-width: 46ch;
}
.grid-popover .popover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: flex-end;
  margin-top: var(--s2);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule-faint);
}
.grid-popover .popover-scroll {
  display: grid;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
}
.grid-popover .check {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
}
.grid-popover .check:hover { background: var(--panel-2); }
.grid-popover .check-label { flex: 1 1 auto; }
.grid-popover .check-count {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.grid-popover .field { display: grid; gap: var(--s1); }
.grid-popover .field-label { font-size: var(--fs-xs); color: var(--ink-3); }
.grid-popover .range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
}
.grid-popover .range-dual {
  position: relative;
  height: 30px;
  margin-block: var(--s2);
}
.grid-popover .range-dual::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 14px;
  height: 2px;
  background: var(--measured-dim);
}
.grid-popover .range-slider {
  position: absolute;
  inset: 4px 0 auto;
  width: 100%;
  margin: 0;
  pointer-events: none;
  appearance: none;
  background: transparent;
  accent-color: var(--measured);
}
.grid-popover .range-slider::-webkit-slider-runnable-track { height: 2px; background: transparent; }
.grid-popover .range-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -7px;
  appearance: none;
  pointer-events: auto;
  background: var(--measured);
  border: 2px solid var(--ground);
  border-radius: 50%;
}
.grid-popover .range-slider::-moz-range-track { height: 2px; background: transparent; }
.grid-popover .range-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  pointer-events: auto;
  background: var(--measured);
  border: 2px solid var(--ground);
  border-radius: 50%;
}
.grid-popover .menu-item {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: var(--s2) var(--s3);
  text-align: left;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.grid-popover .menu-item:hover,
.grid-popover .menu-item:focus-visible {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--rule-strong);
}
.grid-popover .menu-note { font-size: var(--fs-xxs); color: var(--ink-3); }
.grid-popover .sort-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--s2);
  align-items: center;
}
.grid-popover .sort-row-label { font-size: var(--fs-sm); }
.grid-popover .chip-btn {
  padding: 4px 9px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  cursor: pointer;
  background: var(--ground-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.grid-popover .chip-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.grid-popover .chip-btn.is-on {
  color: var(--ink);
  background: var(--select-wash);
  border-color: var(--select);
}
.grid-popover :where(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--select);
  outline-offset: 2px;
}
.grid-popover :where(button, input, select, textarea):disabled,
.grid-popover [aria-disabled="true"] {
  opacity: 0.46;
  cursor: not-allowed;
}
.grid-popover .popover-validation {
  margin: 0;
  color: var(--st-violated);
  font-size: var(--fs-xxs);
  line-height: 1.45;
}


@media (max-width: 860px) {
  .grid-popover-backdrop.is-open:not([hidden]) {
    display: block;
    background: rgba(4, 8, 10, 0.62);
    pointer-events: auto;
  }
  .grid-popover.is-modal {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 86vh;
    max-height: 86dvh;
    padding: var(--s4);
    padding-bottom: max(var(--s4), env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.5);
  }
  .grid-popover.is-modal :where(button, .btn, input:not([type="checkbox"]):not([type="radio"]), select) {
    min-height: 40px;
  }
  .grid-popover.is-modal .popover-scroll { max-height: 42vh; max-height: 42dvh; }
}

@media (max-width: 620px) {
  .grid-toolbar { align-items: stretch; }
  .grid-toolbar .grid-search,
  .grid-tools { flex: 1 1 100%; max-width: none; }
  .grid-tools > .btn { flex: 1 1 auto; }
  .grid-popover .sort-row { grid-template-columns: 1fr; }
}



.trace-panel {
  position: fixed; inset: 0 0 0 auto; width: min(500px, 100vw);
  background: var(--panel); border-left: 1px solid var(--rule-strong);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
  z-index: 90; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--dur-3) var(--ease);
  padding: 0; margin: 0; max-height: 100vh; max-width: 100vw; color: var(--ink);
}
.trace-panel[open] { transform: translateX(0); }
.trace-panel::backdrop { background: rgba(4, 8, 10, 0.62); }
@media (max-width: 620px) {
  .trace-panel { width: 100vw; inset: auto 0 0 0; height: 90vh; transform: translateY(100%); }
  .trace-panel[open] { transform: translateY(0); }
}
.trace-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3);
  padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--rule);
}
.trace-body { overflow-y: auto; padding: var(--s5); display: grid; gap: var(--s5); }
.trace-sec { display: grid; gap: var(--s3); }
.trace-sec > h3 {
  font-size: var(--fs-xxs); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650;
  padding-bottom: var(--s2); border-bottom: 1px solid var(--rule-faint);
}
.digest {
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-2);
  background: var(--ground-2); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: var(--s2) var(--s3);
  overflow-wrap: anywhere; line-height: 1.5;
}


.chain { display: grid; gap: 0; counter-reset: chain; }
.chain-step {
  position: relative; padding: 0 0 var(--s4) var(--s5);
  border-left: 1px solid var(--rule-strong);
}
.chain-step:last-child { border-left-color: transparent; padding-bottom: 0; }
.chain-step::before {
  content: ""; position: absolute; left: -5px; top: 5px;
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--panel); border: 1px solid var(--rule-strong);
}
.chain-step:first-child::before { background: var(--ink-4); }
.chain-step:last-child::before { background: var(--select); border-color: var(--select); }
.chain-layer {
  font-size: var(--fs-xxs); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650;
}
.chain-what { font-size: var(--fs-sm); color: var(--ink); }
.chain-id { font-size: var(--fs-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.chain-guarantee { font-size: var(--fs-xs); color: var(--ink-semantic-muted); line-height: 1.5; }



.finding {
  min-width: 0;
  max-width: 100%;
  display: grid; grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 0 var(--s4); align-items: center;
  padding: var(--s3) var(--s4) var(--s3) 0; border-bottom: 1px solid var(--rule-faint);
}
.finding-bar { align-self: stretch; border-radius: 2px; background: var(--st-warning); }
.finding[data-severity="violation"] .finding-bar { background: var(--st-violated); }
.finding[data-severity="info"] .finding-bar { background: var(--st-waived); }
.finding-main { min-width: 0; display: grid; gap: 3px; }
.finding-rule { min-width: 0; font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; word-break: break-word; }
.finding-msg { min-width: 0; font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; word-break: break-word; }
.finding-meta { display: flex; gap: var(--s4); align-items: center; }
.finding-obs { font-variant-numeric: tabular-nums; font-weight: 660; }
.finding-obs em { font-style: normal; color: var(--ink-4); font-weight: 400; }



.hunks { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); min-width: 0; max-width: 100%; }
.hunk { display: grid; grid-template-columns: 3ch minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); align-items: center; min-width: 0; max-width: 100%; font-size: var(--fs-xs); }
.hunk > * { min-width: 0; }
.hunk-side { position: relative; height: 20px; background: var(--ground-2); border: 1px solid var(--rule); border-radius: 3px; }
.hunk-span { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.hunk-span[data-side="base"] { background: var(--st-refused); opacity: 0.85; }
.hunk-span[data-side="head"] { background: var(--measured); opacity: 0.85; }
.hunk-nums { font-family: var(--mono); color: var(--ink-3); white-space: nowrap; }

.occ {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s3); align-items: center; padding: var(--s3);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--panel-2); width: 100%; text-align: left;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.occ:hover { border-color: var(--rule-strong); background: var(--raised); }
.occ[aria-current="true"] { border-color: var(--select); background: var(--select-wash); }
.occ-ord { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-3); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 6px; }
.occ-path { font-family: var(--mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.occ-lines { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }



.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--panel); padding: var(--s4); display: grid; gap: 4px; min-width: 0; align-content: start; }
.stat b { font-size: var(--ex-stat); font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--fs-xs); color: var(--ink-2); }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: 2px; }



.projection {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(243, 182, 74, 0.5);
  background: rgba(243, 182, 74, 0.06);
  border-radius: var(--radius); padding: var(--s3) var(--s4);
  display: grid; gap: var(--s2);
}
.projection h3, .projection h2 {
  font-size: var(--fs-sm); font-weight: 680; color: var(--st-partial);
  display: flex; align-items: center; gap: var(--s2);
}
.projection p { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.55; }
.projection code { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink); }
.projection-tags { display: flex; gap: var(--s2); flex-wrap: wrap; }

@media (max-width: 640px) {
  .grid-toolbar > .grid-search { flex-basis: 100%; max-width: 100%; }
  .grid-toolbar, .grid-tools, .grid-count, .grid-cards, .grid-pager { width: 100%; }
  .projection-tags { min-width: 0; }
  .projection-tags .chip { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .finding { min-width: 0; max-width: 100%; grid-template-columns: 4px minmax(0, 1fr); }
  .finding > *, .finding .mono { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
  .finding-meta { grid-column: 2; flex-wrap: wrap; }
  .metricgrid, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-toolbar .field-clear { width: 32px; height: 32px; right: 2px; }
  .grid-chips .chip-x { width: 30px; height: 30px; }
  .record-card .row-action, .grid-tools > .btn, .grid-pager > .btn,
  .trace-tab, .stage-button, .plot-legend button, .scale-key { min-height: 40px; }
}


.trace-wide {
  width: auto; height: auto;
  gap: 6px; padding: 6px var(--s3);
  font-family: var(--sans); font-size: var(--fs-xs); font-weight: 600;
  border-radius: var(--radius-sm); color: var(--ink-2);
  background: var(--panel-2); border-color: var(--rule-strong);
}
.trace-wide:hover, .trace-wide:focus-visible { color: var(--ink); background: var(--raised); }

.mark .brand-image{display:block;max-width:100%;height:auto;flex-shrink:0}
.mark .mark-word{color:var(--ink-3);font-weight:500;font-size:.85rem}
@media(max-width:420px){.mark{gap:8px}.mark .brand-image{width:120px}.mark .mark-word{font-size:.75rem}}


.result-actions{display:flex;align-items:center;gap:8px;flex-shrink:0;margin-left:auto}
.result-actions .btn{min-height:35px;padding:7px 11px;font-size:13px;line-height:1.2;white-space:nowrap}
.result-try{background:transparent;border:1px solid var(--rule);color:var(--ink-2);transition:color .15s,border-color .15s,background .15s}
.result-try:hover,.result-try:focus-visible{color:var(--measured);border-color:var(--measured);background:rgba(65,232,198,.05)}
.mark-link{display:inline-flex;align-items:center;min-height:44px}
.mark-link:focus-visible,.result-actions a:focus-visible{outline:2px solid var(--measured);outline-offset:4px}
@media(max-width:640px),(pointer:coarse){.result-actions .btn{min-height:44px}}
@media(max-width:640px){.sitebar .sitebar-inner{flex-wrap:wrap;column-gap:12px;row-gap:5px}.sitebar-inner .result-actions{width:100%;justify-content:flex-end}.subjectbar-inner .result-actions{margin-left:0}}
@media(prefers-reduced-motion:reduce){.result-try{transition:none}}
