:root {
  color-scheme: light;
  --ink: #171a20;
  --muted: #69717d;
  --muted-strong: #4f5865;
  --line: #e1e4e8;
  --line-strong: #c7ccd3;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --canvas: #f4f6f8;
  --blue: #175cd3;
  --blue-hover: #1849a9;
  --blue-soft: #edf4ff;
  --green: #067647;
  --green-soft: #ecfdf3;
  --amber: #9a5700;
  --amber-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 5px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
}

button,
input,
textarea,
select {
  min-width: 0;
  font: inherit;
}

button,
summary,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid rgba(23, 92, 211, 0.25);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--blue);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.product-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

.brand strong {
  font-size: 19px;
  line-height: 1;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-menu {
  position: relative;
}

.header-menu > summary {
  list-style: none;
}

.header-menu > summary::-webkit-details-marker {
  display: none;
}

.header-menu > summary::after {
  margin-left: 7px;
  content: "▾";
  font-size: 10px;
}

.header-menu[open] > summary {
  background: var(--surface-soft);
  color: var(--ink);
}

.header-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  min-width: 164px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(23, 26, 32, 0.16);
}

.header-menu-panel .header-button {
  justify-content: flex-start;
  width: 100%;
}

.header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.header-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.header-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--amber);
}

.header-state.ready .state-dot {
  background: var(--green);
}

.header-state.error .state-dot {
  background: var(--danger);
}

main,
footer {
  width: min(1380px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

main {
  margin-top: 16px;
  margin-bottom: 32px;
}

.query-workspace,
.result-workspace {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.query-workspace {
  padding: 18px 20px 14px;
}

.workspace-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.workspace-heading h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.index-readout {
  display: grid;
  justify-items: end;
  gap: 1px;
  text-align: right;
}

.index-readout span,
.control > label,
.period-control legend,
.basis-control legend,
.period-inputs label span,
.summary-strip span,
.result-freshness span,
.inline-filter > span,
.inspector-header span,
.product-dialog header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.index-readout strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.index-readout small {
  color: var(--muted);
  font-size: 10px;
}

.query-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(260px, 1.7fr) minmax(240px, 1.25fr) auto;
  align-items: start;
  gap: 10px;
}

.metric-panel {
  grid-column: 1;
}

.scope-panel {
  grid-column: 2;
}

.option-panel {
  grid-column: 3;
}

.query-actions {
  grid-column: 4;
}

.query-panel {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.query-panel > summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  padding: 0 12px;
  list-style: none;
}

.query-panel > summary::-webkit-details-marker {
  display: none;
}

.query-panel > summary span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.query-panel > summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: right;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.query-panel > summary::after {
  grid-column: 2;
  width: 18px;
  color: var(--muted);
  content: "▾";
  font-size: 11px;
  text-align: right;
}

.query-panel > summary strong {
  grid-column: 2;
  grid-row: 1;
  margin-right: 18px;
}

.query-panel[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.query-panel[open] > summary::after {
  content: "▴";
}

.panel-body {
  padding: 10px 12px 12px;
}

.option-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(136px, 0.85fr);
  align-items: end;
  gap: 10px;
}

.option-grid .toggle-control {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.normalized-mode-control {
  grid-column: 1 / -1;
  align-items: center;
  min-height: 28px;
  padding-top: 2px;
}

.normalized-mode-control input:disabled + span {
  color: var(--muted);
}

.normalized-status {
  grid-column: 1 / -1;
  padding: 7px 8px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
}

.normalized-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.taxonomy-control {
  position: relative;
}

.taxonomy-control input,
.select-control select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
}

.taxonomy-control input:hover,
.select-control select:hover {
  border-color: #929ba8;
}

.select-control,
.taxonomy-control > label {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.select-control > span,
.taxonomy-control > label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.normalized-results {
  top: 53px;
  max-height: 220px;
}

.control {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 6px;
}

.control input,
.period-inputs input,
.inline-filter input,
.save-current-section input,
.command-dialog textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.control input,
.period-inputs input {
  height: 40px;
  padding: 0 10px;
}

.control input:hover,
.period-inputs input:hover,
.inline-filter input:hover,
.save-current-section input:hover,
.command-dialog textarea:hover {
  border-color: #929ba8;
}

.control > small,
.scope-summary {
  min-height: 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.metric-definition {
  margin: 0;
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.scope-summary strong {
  color: var(--ink);
}

.combobox-results {
  position: absolute;
  top: 62px;
  right: 0;
  left: 0;
  z-index: 60;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(23, 26, 32, 0.14);
}

.scope-results {
  top: 62px;
}

.combobox-group-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.combobox-option {
  display: grid;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.combobox-option:last-child {
  border-bottom: 0;
}

.combobox-option:hover,
.combobox-option[aria-selected="true"] {
  background: var(--blue-soft);
}

.combobox-option:disabled {
  cursor: default;
  background: #fafafa;
  color: var(--muted);
}

.combobox-option strong,
.combobox-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option strong {
  font-size: 12px;
}

.combobox-option span {
  color: var(--muted);
  font-size: 10px;
}

.company-chips {
  display: flex;
  min-height: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.scope-mode {
  height: 34px;
  margin-bottom: 9px;
}

.scope-mode span {
  font-size: 9px;
}

.company-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 23px;
  padding: 0 4px 0 7px;
  border: 1px solid #b7c9e9;
  border-radius: 4px;
  background: var(--blue-soft);
  color: #1849a9;
  font-size: 10px;
  font-weight: 800;
}

.company-chip.entity-chip {
  border-color: #b9d7c5;
  background: var(--green-soft);
  color: var(--green);
}

.company-chip button {
  display: grid;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font-size: 13px;
  place-items: center;
}

.company-chip button:hover {
  background: rgba(23, 92, 211, 0.12);
}

.period-control,
.basis-control {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.period-control legend,
.basis-control legend {
  margin-bottom: 6px;
}

.period-inputs {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr);
  align-items: end;
  gap: 6px;
}

.period-inputs label {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.period-inputs label span {
  font-size: 9px;
}

.period-separator {
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.segmented-control label {
  position: relative;
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  height: 100%;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  place-items: center;
}

.segmented-control label + label span {
  border-left: 1px solid var(--line-strong);
}

.segmented-control input:checked + span {
  background: var(--blue-soft);
  color: var(--blue-hover);
}

.segmented-control input:focus-visible + span {
  outline: 3px solid rgba(23, 92, 211, 0.25);
  outline-offset: -3px;
}

.query-actions {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding-top: 16px;
}

.primary-button,
.secondary-button,
.query-actions button,
.result-actions > button,
.export-menu summary,
.export-menu button,
.saved-view-actions button,
.dialog-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button,
.query-actions .primary-button {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.primary-button:hover,
.query-actions .primary-button:hover {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary-button:hover,
.result-actions > button:hover,
.export-menu summary:hover,
.export-menu button:hover,
.saved-view-actions button:hover,
.dialog-actions button:hover {
  background: var(--surface-soft);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.toggle-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.result-workspace {
  min-height: 440px;
  margin-top: 8px;
  overflow: hidden;
}

.empty-workspace {
  display: flex;
  min-height: 430px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: 36px 20px;
  text-align: center;
}

.empty-workspace h2 {
  margin: 0;
  font-size: 18px;
}

.empty-workspace p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-workspace p:empty {
  display: none;
}

.preset-row {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.preset-row button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 750;
}

.preset-row button:hover {
  border-color: #929ba8;
  background: var(--surface-soft);
  color: var(--ink);
}

.result-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.result-identity {
  min-width: 0;
}

.result-kicker-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

#resultKicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.query-state-badge {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 9px;
  font-weight: 800;
}

.result-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.result-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.result-freshness {
  display: grid;
  justify-items: end;
  gap: 2px;
  flex: 0 0 auto;
  text-align: right;
}

.result-freshness strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.result-freshness small {
  color: var(--muted);
  font-size: 10px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.summary-strip > div,
.summary-strip > button {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 10px 16px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.summary-strip > :last-child {
  border-right: 0;
}

.summary-strip strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.summary-action:hover {
  background: var(--surface-soft);
}

.summary-action strong {
  color: var(--amber);
}

.coverage-summary strong {
  color: var(--blue);
}

.result-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.tab-list {
  display: flex;
  align-items: stretch;
  gap: 18px;
}

.tab-list button {
  min-height: 44px;
  padding: 0 1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.tab-list button[aria-selected="true"] {
  border-bottom-color: var(--blue);
  color: var(--ink);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-actions > button,
.export-menu summary {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.export-menu {
  position: relative;
}

.export-menu summary {
  display: grid;
  list-style: none;
  place-items: center;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu > div {
  position: absolute;
  top: 35px;
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 130px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(23, 26, 32, 0.12);
}

.export-menu button {
  min-height: 34px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

.export-menu button:last-child {
  border-bottom: 0;
}

.result-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.result-body.inspector-open {
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
}

.view-shell {
  min-width: 0;
}

.view-panel,
.chart-section,
.table-section {
  min-width: 0;
}

.chart-section,
.table-section {
  padding: 16px;
}

.subheading,
.table-subheading,
.section-heading-small,
.dialog-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subheading {
  min-height: 30px;
  margin-bottom: 10px;
}

.subheading h3,
.section-heading-small h3,
.dialog-section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.subheading > span,
.table-subheading > div > span,
.section-heading-small span,
.dialog-section-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.series-legend {
  display: flex;
  min-height: 24px;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-bottom: 6px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.legend-swatch {
  width: 14px;
  height: 3px;
  flex: 0 0 14px;
  border-radius: 1px;
}

.line-chart-wrap {
  position: relative;
  width: 100%;
  min-height: 380px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.line-chart {
  display: block;
  width: 100%;
  min-width: 760px;
  height: 380px;
}

.line-chart .grid-line {
  stroke: #e5e8ec;
  stroke-width: 1;
}

.line-chart .axis-line {
  stroke: #aeb5bf;
  stroke-width: 1;
}

.line-chart .axis-label {
  fill: #69717d;
  font-size: 11px;
}

.line-chart .series-line {
  fill: none;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.line-chart .series-point {
  cursor: pointer;
  stroke: #ffffff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.line-chart .series-point:hover,
.line-chart .series-point:focus {
  r: 6px;
  stroke: var(--ink);
  stroke-width: 2;
  outline: none;
}

.empty-chart {
  position: absolute;
  inset: 0;
  display: grid;
  color: var(--muted);
  font-size: 12px;
  place-items: center;
}

.line-chart-wrap.has-data .empty-chart {
  display: none;
}

.table-subheading {
  align-items: end;
}

.inline-filter {
  display: grid;
  width: min(300px, 100%);
  gap: 4px;
}

.inline-filter input {
  height: 34px;
  padding: 0 9px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 11px;
}

.normalized-native-label,
.provenance-meta {
  display: block;
  margin-top: 3px;
  max-width: 220px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.normalized-coordinate {
  display: block;
  max-width: 260px;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.normalization-badge {
  display: inline-flex;
  max-width: 160px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.normalization-badge.is-adjusted {
  border-color: #e7c98d;
  background: var(--amber-soft);
  color: var(--amber);
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

th button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-transform: inherit;
}

tbody tr:hover,
tbody tr[aria-selected="true"] {
  background: var(--blue-soft);
}

tbody tr[data-point-key] {
  cursor: pointer;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.row-inspect {
  display: grid;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.row-inspect strong {
  font-size: 11px;
}

.row-inspect span,
.cell-meta {
  color: var(--muted);
  font-size: 9px;
}

.number-cell,
.date-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.number-cell {
  font-weight: 750;
}

.definition-cell {
  max-width: 280px;
  overflow-wrap: anywhere;
  color: var(--muted-strong);
}

.empty-cell {
  padding: 40px 12px;
  color: var(--muted);
  text-align: center;
}

.inspector {
  min-width: 0;
  max-height: 690px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.inspector-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.inspector-header h2 {
  margin: 2px 0 0;
  font-size: 16px;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 20px;
  line-height: 1;
  place-items: center;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.inspector-value {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.inspector-value strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.inspector-value span {
  color: var(--muted);
  font-size: 11px;
}

.fact-list {
  margin: 0;
  padding: 4px 16px;
  border-bottom: 1px solid var(--line);
}

.fact-list > div {
  display: grid;
  grid-template-columns: minmax(105px, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.fact-list > div:last-child {
  border-bottom: 0;
}

.fact-list dt,
.fact-list dd {
  min-width: 0;
  margin: 0;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.fact-list dt {
  color: var(--muted);
  font-weight: 750;
}

.fact-list dd {
  color: var(--ink);
  text-align: right;
}

.inspector-notice {
  margin: 12px 16px;
  padding: 8px 9px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #684000;
  font-size: 10px;
  line-height: 1.5;
}

.inspector-notice:empty {
  display: none;
}

.inspector-section {
  border-bottom: 1px solid var(--line);
}

.inspector-section > summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  list-style: none;
}

.inspector-section > summary::-webkit-details-marker {
  display: none;
}

.inspector-section > summary span {
  color: var(--muted);
  font-size: 10px;
}

.inspector-section[open] > summary {
  border-bottom: 1px solid var(--line);
}

.section-note {
  margin: 10px 16px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.evidence-list,
.relationship-list,
.quality-list,
.lineage-list {
  display: grid;
  min-width: 0;
}

.evidence-item,
.relationship-item,
.quality-item,
.lineage-item {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.evidence-item:last-child,
.relationship-item:last-child,
.quality-item:last-child,
.lineage-item:last-child {
  border-bottom: 0;
}

.evidence-item h3,
.relationship-item strong,
.quality-item strong,
.lineage-item strong {
  min-width: 0;
  margin: 0;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.evidence-item p,
.relationship-item span,
.quality-item span,
.lineage-item span {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.evidence-item a {
  width: fit-content;
  max-width: 100%;
  font-size: 10px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.evidence-meta,
.quality-reasons {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.evidence-meta span,
.quality-reason {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 750;
}

.definition-group {
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
}

.definition-group:last-child {
  border-bottom: 0;
}

.section-heading-small {
  padding: 0 16px 5px;
}

.quality-reasons {
  padding: 10px 16px 0;
}

.quality-reason {
  display: inline-flex;
  gap: 4px;
  background: var(--amber-soft);
  color: var(--amber);
}

.quality-item {
  border-left: 3px solid var(--amber);
}

.lineage-item {
  border-left: 3px solid var(--blue);
}

.empty-detail {
  padding: 18px 16px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.result-workspace[aria-busy="true"] .result-header {
  border-top: 2px solid var(--blue);
}

.result-workspace[data-state="dirty"] .result-header,
.result-workspace[data-state="partial"] .result-header,
.result-workspace[data-state="degraded"] .result-header,
.result-workspace[data-state="no-result"] .result-header {
  border-top: 2px solid var(--amber);
}

.result-workspace[data-state="error"] .result-header {
  border-top: 2px solid var(--danger);
}

footer {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 10px;
}

.product-dialog {
  width: min(620px, calc(100% - 24px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 22px 60px rgba(23, 26, 32, 0.2);
}

.product-dialog::backdrop {
  background: rgba(23, 26, 32, 0.36);
}

.dialog-shell {
  max-height: min(760px, calc(100vh - 32px));
  overflow-y: auto;
}

.product-dialog header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.product-dialog header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.product-dialog section,
.command-dialog .dialog-shell > label,
.command-dialog textarea,
.command-feedback,
.dialog-actions {
  margin-right: 16px;
  margin-left: 16px;
}

.product-dialog section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.product-dialog section:last-child {
  border-bottom: 0;
}

.save-current-section > label,
.command-dialog .dialog-shell > label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.save-current-section > div {
  display: flex;
  gap: 7px;
}

.save-current-section input {
  height: 40px;
  flex: 1;
  padding: 0 10px;
}

.save-current-section p {
  min-height: 15px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.saved-view-list {
  display: grid;
  margin-top: 7px;
}

.saved-view-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.saved-view-item:last-child {
  border-bottom: 0;
}

.saved-view-item > div:first-child {
  min-width: 0;
}

.saved-view-item strong,
.saved-view-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-view-item strong {
  font-size: 11px;
}

.saved-view-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.saved-view-actions {
  display: flex;
  gap: 5px;
}

.saved-view-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 10px;
}

.coverage-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.coverage-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 92px 82px 96px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.coverage-row:last-child {
  border-bottom: 0;
}

.coverage-row strong,
.coverage-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coverage-row strong {
  font-size: 12px;
}

.coverage-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.coverage-row .coverage-pct {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-align: right;
}

.coverage-row .coverage-kind {
  width: fit-content;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  text-transform: uppercase;
}

.command-dialog .dialog-shell {
  padding-bottom: 16px;
}

.command-dialog .dialog-shell > label {
  margin-top: 14px;
}

.command-dialog textarea {
  display: block;
  width: calc(100% - 32px);
  min-height: 110px;
  padding: 10px;
  resize: vertical;
}

.command-feedback {
  font-size: 10px;
  line-height: 1.5;
}

.command-feedback {
  min-height: 38px;
  padding: 8px 9px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: var(--muted-strong);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 14px;
}

@media (max-width: 1180px) {
  .query-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-panel {
    grid-column: 1;
  }

  .scope-panel {
    grid-column: 2;
  }

  .option-panel {
    grid-column: 3;
  }

  .query-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
    padding-top: 0;
  }
}

@media (max-width: 900px) {
  .result-body.inspector-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .inspector {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    width: 100%;
    max-height: 84vh;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
    box-shadow: 0 -16px 42px rgba(23, 26, 32, 0.2);
  }
}

@media (max-width: 820px) {
  main,
  footer {
    width: min(100% - 20px, 760px);
  }

  .product-header {
    padding: 0 12px;
  }

  .query-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-panel {
    grid-column: 1;
  }

  .scope-panel {
    grid-column: 2;
  }

  .option-panel {
    grid-column: 3;
  }

  .query-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
    padding-top: 0;
  }

  .query-actions button {
    flex: 1;
  }

  .result-header {
    align-items: flex-start;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-strip > :nth-child(3) {
    border-right: 0;
  }

  .summary-strip > :nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .summary-strip > :nth-child(4) {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  .product-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-rows: 32px;
    min-height: 48px;
    gap: 3px 5px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .header-state {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
  }

  .header-menu {
    grid-column: 3;
    grid-row: 1;
  }

  .header-button {
    min-height: 32px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 11px;
  }
}

@media (max-width: 540px) {
  main {
    width: 100%;
    margin-top: 0;
    margin-bottom: 22px;
  }

  footer {
    width: calc(100% - 28px);
  }

  .query-workspace,
  .result-workspace {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .query-workspace {
    padding: 15px 14px 12px;
  }

  .workspace-heading {
    margin-bottom: 14px;
  }

  .workspace-heading h1 {
    font-size: 20px;
  }

  .index-readout strong {
    font-size: 16px;
  }

  .query-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .query-panel {
    grid-column: auto;
  }

  .query-panel > summary {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    justify-items: center;
    min-height: 48px;
    padding: 0 8px;
    text-align: center;
  }

  .query-panel > summary::after {
    display: none;
  }

  .query-panel > summary strong {
    grid-column: 1;
    grid-row: 2;
    max-width: 100%;
    margin-right: 0;
    font-size: 8px;
    text-align: center;
  }

  .query-panel[open] {
    grid-column: 1 / -1;
  }

  .query-panel[open] > summary {
    justify-items: start;
    min-height: 38px;
    text-align: left;
  }

  .control input,
  .period-inputs input,
  .segmented-control {
    height: 44px;
  }

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

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

  .query-actions button {
    min-height: 44px;
  }

  .empty-workspace {
    min-height: 360px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .preset-row {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .preset-row button {
    flex: 0 0 auto;
  }

  .result-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .result-freshness {
    justify-items: start;
    text-align: left;
  }

  .summary-strip > div,
  .summary-strip > button {
    padding: 10px 12px;
  }

  .summary-strip strong {
    font-size: 15px;
  }

  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
    padding: 0 14px 8px;
  }

  .coverage-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
  }

  .coverage-row > :first-child {
    grid-column: 1 / -1;
  }

  .coverage-row .coverage-pct {
    text-align: left;
  }

  .tab-list,
  .result-actions {
    width: 100%;
  }

  .tab-list {
    gap: 20px;
  }

  .result-actions {
    justify-content: flex-end;
  }

  .chart-section,
  .table-section {
    padding: 14px;
  }

  .line-chart-wrap {
    min-height: 330px;
  }

  .line-chart {
    min-width: 720px;
    height: 330px;
  }

  .table-subheading {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-filter {
    width: 100%;
  }

  .product-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .save-current-section > div {
    align-items: stretch;
    flex-direction: column;
  }

  .save-current-section .primary-button {
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
