/* Hallmark · macrostructure: Workbench · tone: technical/utilitarian/austere · anchor hue: cobalt 255 · theme: Cobalt · H4: tabular/below/four · F3: 4-cols/groups/tabular · nav: N13 · footer: Ft2 · contrast: pass (40–41) · slop: pass (42–45) · honest: pass (46) · chrome: pass (47) · tokens: pass (48) · responsive: pass (49) · icons: pass (30) · mobile: pass (34, 49, 50–57) */
/* Hallmark · pre-emit critique: P5 H5 E4 S5 R4 V5 */
:root {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  overflow-x: clip;
}

body {
  min-width: 320px;
  letter-spacing: 0;
  color: var(--color-ink);
  font-size: var(--text-base);
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: var(--color-ink);
  color: var(--color-paper);
  border-bottom: 1px solid var(--color-ink-2);
}

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

.brand-mark {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #60717a;
  border-radius: 4px;
  color: #f29a70;
  font-size: 12px;
  font-weight: 800;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 720;
}

.brand-block p {
  margin: 3px 0 0;
  color: #9eabb1;
  font-size: 11px;
}

.topbar-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.topbar-nav-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #45545c;
  border-radius: 999px;
  color: #d6dee2;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.topbar-nav-link:hover,
.topbar-nav-link:focus-visible,
.topbar-nav-link.is-active {
  border-color: #f29a70;
  color: #ffffff;
  background: rgba(242, 154, 112, 0.12);
  outline: none;
}

.topbar-nav-link svg {
  width: 15px;
  height: 15px;
  color: #f29a70;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #aeb9be;
  font-size: 12px;
  white-space: nowrap;
}

.topbar-meta strong {
  color: #edf3f5;
  font-variant-numeric: tabular-nums;
}

.topbar-refresh {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #45545c;
  border-radius: 4px;
  background: transparent;
  color: #c4cdd1;
  cursor: pointer;
}

.topbar-refresh:hover {
  border-color: #7d8b92;
  color: #ffffff;
}

.topbar-refresh:disabled {
  cursor: wait;
  opacity: 0.55;
}

.topbar-refresh svg {
  width: 14px;
  height: 14px;
}

.topbar-refresh.is-loading svg {
  animation: spin 900ms linear infinite;
}

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

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72b788;
  box-shadow: 0 0 0 3px rgba(114, 183, 136, 0.12);
}

.workbench {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.filter-panel {
  min-width: 0;
  padding: 20px 16px 24px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.search-row {
  height: 38px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.search-row > svg {
  width: 16px;
  height: 16px;
  color: #7d898f;
}

.search-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.icon-button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 15px;
  height: 15px;
}

.icon-button:hover {
  color: var(--accent);
}

.filter-group {
  margin-top: 24px;
}

.filter-group h2,
.filter-heading h2 {
  margin: 0 0 10px;
  color: #516067;
  font-size: 11px;
  line-height: 1;
  font-weight: 750;
  text-transform: uppercase;
}

.filter-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.filter-heading span {
  color: #8d989d;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef2f4;
}

.market-segmented {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button,
.status-filter button,
.relation-filter button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.segmented button {
  min-height: 28px;
  padding: 0 5px;
  border-radius: 4px;
  color: #67747b;
  font-size: 11px;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 33, 38, 0.09);
  font-weight: 700;
}

.sector-filters {
  display: grid;
  gap: 3px;
}

.sector-button {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #526067;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.sector-button:hover {
  background: #f3f6f7;
}

.sector-button.is-active {
  border-color: #d6dde1;
  background: #edf2f4;
  color: var(--ink);
  font-weight: 650;
}

.sector-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.sector-button em {
  color: #8d989d;
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.status-filter {
  display: grid;
  gap: 4px;
}

.status-filter button {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: 4px;
  color: #617078;
  text-align: left;
  font-size: 12px;
}

.status-filter button em {
  margin-left: auto;
  color: #8d989d;
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.status-filter button:hover,
.status-filter button.is-active {
  background: #edf2f4;
  color: var(--ink);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.analyzed {
  background: var(--teal);
}

.status-dot.core {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(208, 90, 42, 0.12);
}

.status-dot.caution {
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(165, 120, 25, 0.12);
}

.status-dot.pending {
  border: 1px solid #a6b0b5;
  background: transparent;
}

.source-block {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.source-block span {
  color: #8a969b;
  font-size: 10px;
  text-transform: uppercase;
}

.source-block p {
  margin: 5px 0 0;
  color: #66737a;
  font-size: 11px;
  line-height: 1.55;
}

.main-panel {
  min-width: 0;
  padding: 22px 26px 18px;
}

.summary-strip {
  min-height: 68px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.summary-item {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

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

.summary-item span {
  color: #738087;
  font-size: 11px;
}

.summary-item strong {
  color: #26343a;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

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

.summary-item:nth-child(3) strong {
  color: var(--teal);
}

.decision-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(4, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px 0;
}

.decision-loading {
  grid-column: 1 / -1;
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: #7b878d;
  background: var(--surface);
  font-size: 12px;
}

.decision-hero-card,
.decision-card {
  min-width: 0;
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.decision-hero-card {
  background: linear-gradient(135deg, #192329 0%, #24323a 64%, #31434b 100%);
  color: #f7fafb;
}

.decision-hero-card span,
.decision-card > span {
  display: block;
  color: #87939a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.decision-hero-card span {
  color: #f29a70;
}

.decision-hero-card h2 {
  margin: 10px 0 0;
  font-size: 25px;
  line-height: 1.15;
}

.decision-hero-card p,
.decision-card p {
  margin: 10px 0 0;
  color: #6d7980;
  font-size: 11px;
  line-height: 1.55;
}

.decision-hero-card p {
  color: #c5d0d5;
}

.decision-card strong {
  display: block;
  margin-top: 10px;
  color: #26343a;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.decision-card.health strong {
  color: var(--accent);
}

.decision-card.trend strong {
  color: var(--teal);
}

.decision-card ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: #66737a;
  font-size: 11px;
  line-height: 1.55;
}

.view-bar {
  height: 58px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-strong);
}

.view-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

.view-tabs button {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6f7c82;
  font-size: 12px;
  cursor: pointer;
}

.view-tabs button svg {
  width: 16px;
  height: 16px;
}

.view-tabs button:hover,
.view-tabs button.is-active {
  color: var(--ink);
}

.view-tabs button.is-active {
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.visible-label {
  padding-bottom: 17px;
  color: #7c898f;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.visible-label strong {
  color: var(--ink);
}

.content-view {
  display: none;
}

.content-view.is-active {
  display: block;
}

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

.workbench.policy-mode .filter-panel,
.workbench.policy-mode .summary-strip,
.workbench.policy-mode .decision-panel,
.workbench.policy-mode .visible-label {
  display: none;
}

.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 620px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.graph-pane {
  min-width: 0;
  padding: 14px 16px 12px;
}

.graph-toolbar {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}

.relation-filter,
.graph-focus-filter,
.graph-mode-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.relation-filter button,
.graph-focus-filter button,
.graph-mode-filter button {
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #78858b;
  font-size: 10px;
}

.relation-filter button:hover,
.relation-filter button.is-active,
.graph-focus-filter button:hover,
.graph-focus-filter button.is-active,
.graph-mode-filter button:hover,
.graph-mode-filter button.is-active {
  border-color: var(--line);
  background: #f1f4f5;
  color: var(--ink);
}

.graph-focus-filter button.is-active {
  border-color: rgba(208, 90, 42, 0.24);
  background: var(--accent-soft);
  color: #9f441f;
}

.graph-mode-filter button.is-active {
  border-color: rgba(46, 109, 145, 0.24);
  background: #e8f1f6;
  color: #265e7f;
}

.network-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1120 / 650;
  min-height: 450px;
  border: 1px solid var(--line);
  background: #fbfcfc;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.network-stage:focus-visible {
  outline: 2px solid rgba(46, 109, 145, 0.35);
  outline-offset: 2px;
}

.network-stage.is-dragging {
  cursor: grabbing;
}

.network-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #f6f8f9;
}

.network-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #f6f8f9;
}

#networkGraph {
  display: block;
  width: 100%;
  height: 100%;
}

.graph-controls {
  position: absolute;
  z-index: 5;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(198, 208, 213, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(25, 35, 41, 0.12);
  backdrop-filter: blur(10px);
  cursor: default;
}

.graph-controls button {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4f5f66;
  cursor: pointer;
}

.graph-controls button:hover,
.graph-controls button:focus-visible {
  background: #edf3f5;
  color: var(--ink);
  outline: none;
}

.graph-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.graph-controls svg {
  width: 15px;
  height: 15px;
}

.graph-zoom-reset {
  min-width: 54px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.graph-hint {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(198, 208, 213, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #758288;
  font-size: 10px;
  box-shadow: 0 6px 18px rgba(25, 35, 41, 0.08);
  backdrop-filter: blur(8px);
}

.layer-band {
  fill: #fbfcfc;
  stroke: #e5eaec;
  stroke-width: 1;
}

.layer-band.middle {
  fill: #f7faf9;
}

.layer-title {
  fill: #647179;
  font-size: 13px;
  font-weight: 750;
}

.layer-count {
  fill: #9ba5aa;
  font-size: 10px;
  font-weight: 600;
}

.relation-line {
  fill: none;
  stroke-width: 1.5;
  opacity: 0.32;
  transition: opacity 120ms ease, stroke-width 120ms ease;
}

.relation-line.chain {
  stroke: #c56336;
}

.relation-line.capex {
  stroke: #3d7796;
  stroke-dasharray: 7 4;
}

.relation-line.power {
  stroke: #5f8357;
  stroke-dasharray: 2 4;
}

.relation-line.theme {
  stroke: #8a7c9e;
  stroke-dasharray: 5 5;
}

.relation-line.mapping {
  stroke: #9b7422;
  stroke-dasharray: 3 3;
}

.relation-line.is-connected {
  opacity: 0.92;
  stroke-width: 2.4;
}

.relation-line.is-dimmed {
  opacity: 0.06;
}

.stock-node {
  cursor: pointer;
  outline: none;
}

.stock-node rect {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1;
  transition: stroke 120ms ease, stroke-width 120ms ease, opacity 120ms ease;
}

.stock-node text {
  fill: #ffffff;
  font-weight: 750;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.stock-node .node-ticker {
  font-size: 10px;
}

.stock-node .node-change {
  fill: rgba(255, 255, 255, 0.86);
  font-size: 8px;
  font-weight: 650;
}

.stock-node:hover rect,
.stock-node:focus rect,
.stock-node.is-selected rect {
  stroke: #172126;
  stroke-width: 2.2;
}

.stock-node.is-related rect {
  stroke: #52656d;
  stroke-width: 1.8;
}

.stock-node.is-dimmed {
  opacity: 0.18;
}

.analyzed-ring {
  fill: #ffffff;
  stroke: #197f73;
  stroke-width: 2;
}

.core-ring {
  fill: #ffffff;
  stroke: #d05a2a;
  stroke-width: 2;
}

.caution-ring {
  fill: #ffffff;
  stroke: #9b7422;
  stroke-width: 2;
}

.graph-tooltip {
  position: absolute;
  z-index: 4;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid #26343a;
  border-radius: 4px;
  background: #192329;
  color: #f4f8f9;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(25, 35, 41, 0.16);
}

.graph-tooltip strong {
  display: block;
  margin-bottom: 2px;
  color: #ffffff;
}

.relationship-legend {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-top: 10px;
  color: #77848a;
  font-size: 10px;
}

.relationship-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.line-sample {
  width: 25px;
  height: 0;
  border-top: 2px solid;
}

.line-sample.chain {
  border-color: #c56336;
}

.line-sample.capex {
  border-color: #3d7796;
  border-top-style: dashed;
}

.line-sample.power {
  border-color: #5f8357;
  border-top-style: dotted;
}

.line-sample.theme {
  border-color: #8a7c9e;
  border-top-style: dashed;
}

.line-sample.mapping {
  border-color: #9b7422;
  border-top-style: dashed;
}

.detail-panel {
  min-width: 0;
  padding: 25px 22px;
  border-left: 1px solid var(--line);
  background: #f8fafb;
}

.detail-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #7a878d;
  font-size: 10px;
  text-transform: uppercase;
}

.detail-title {
  margin: 16px 0 0;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.detail-company {
  margin: 7px 0 0;
  color: #6f7c82;
  font-size: 12px;
}

.detail-role {
  margin: 20px 0 0;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 700;
}

.live-quote {
  margin-top: 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.live-quote strong {
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

.live-quote span {
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.quote-up {
  color: #16755f;
}

.quote-down {
  color: #bd4d31;
}

.quote-flat {
  color: #718087;
}

.quote-missing {
  color: #8e999e;
  font-size: 11px;
}

.research-card-banner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.research-card-banner div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.research-card-banner span {
  display: block;
  color: #8a959a;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.research-card-banner strong {
  display: block;
  margin-top: 4px;
  color: #26343a;
  font-size: 12px;
  line-height: 1.35;
}

.detail-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 9px;
  color: #758187;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-section p {
  margin: 0;
  color: #33434a;
  font-size: 12px;
  line-height: 1.65;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 12px;
}

.meta-grid div {
  min-width: 0;
}

.meta-grid span {
  display: block;
  color: #8a959a;
  font-size: 9px;
  text-transform: uppercase;
}

.meta-grid strong {
  display: block;
  margin-top: 3px;
  color: #304047;
  font-size: 11px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.detail-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 700;
}

.detail-status.analyzed {
  background: #e4f2ef;
  color: #176f65;
}

.detail-status.pending {
  background: #edf1f3;
  color: #6f7b81;
}

.detail-status.core {
  background: var(--accent-soft);
  color: #a44822;
}

.detail-status.caution {
  background: #f7f0db;
  color: #846417;
}

.mapping-tier-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.mapping-tier-card.confirmed {
  border-color: rgba(25, 127, 115, 0.24);
  background: #f2faf8;
}

.mapping-tier-card.theme {
  border-color: rgba(46, 109, 145, 0.22);
  background: #f3f8fb;
}

.mapping-tier-card.proxy {
  border-color: rgba(165, 120, 25, 0.26);
  background: #fdf9ec;
}

.mapping-tier-card.risk {
  border-color: rgba(208, 90, 42, 0.26);
  background: #fff6f1;
}

.mapping-tier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mapping-tier-head strong {
  color: #26343a;
  font-size: 14px;
}

.mapping-tier-head span {
  color: #7b878d;
  font-size: 10px;
  text-align: right;
  overflow-wrap: anywhere;
}

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

.evidence-grid {
  display: grid;
  gap: 9px;
}

.evidence-grid h4 {
  margin: 0 0 7px;
  color: #536269;
  font-size: 11px;
}

.evidence-item {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.evidence-item a,
.evidence-item strong {
  color: #26343a;
  font-size: 11px;
  line-height: 1.35;
  text-decoration: none;
}

.evidence-item a:hover {
  color: var(--accent);
}

.evidence-item span {
  color: #7d898f;
  font-size: 9px;
}

.related-list {
  display: grid;
  gap: 5px;
}

.related-item,
.peer-button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.related-item:hover,
.peer-button:hover {
  border-color: var(--line-strong);
  background: #f2f6f7;
}

.related-item strong,
.peer-button strong {
  font-size: 11px;
}

.related-item span,
.peer-button span {
  color: #7b878d;
  font-size: 9px;
  text-align: right;
}

.peer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.empty-state {
  display: grid;
  min-height: 480px;
  place-items: center;
  color: #7f8b91;
  font-size: 12px;
  text-align: center;
}

.table-wrap {
  max-height: 650px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0f4f5;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #e5eaec;
  text-align: left;
  vertical-align: top;
  font-size: 11px;
  line-height: 1.45;
}

th {
  color: #69767d;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

th:nth-child(1) { width: 72px; }
th:nth-child(2) { width: 142px; }
th:nth-child(3) { width: 58px; }
th:nth-child(4) { width: 66px; }
th:nth-child(5) { width: 128px; }
th:nth-child(6) { width: 82px; }
th:nth-child(7) { width: 76px; }
th:nth-child(8) { width: 166px; }
th:nth-child(9) { width: 215px; }
th:nth-child(10) { width: 90px; }
th:nth-child(11) { width: 54px; }

th button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-transform: inherit;
}

th button svg {
  width: 11px;
  height: 11px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fafb;
}

.ticker-cell {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.layer-tag,
.status-tag,
.market-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  font-size: 9px;
  white-space: nowrap;
}

.layer-tag.upstream {
  background: #fff0e7;
  color: #a84b23;
}

.layer-tag.midstream {
  background: #e7f2f1;
  color: #196f66;
}

.layer-tag.downstream {
  background: #e9eef5;
  color: #45617a;
}

.status-tag.analyzed {
  background: #e4f2ef;
  color: #176f65;
}

.status-tag.pending {
  background: #eef2f3;
  color: #6f7b81;
}

.status-tag.core {
  background: var(--accent-soft);
  color: #a44822;
}

.status-tag.caution {
  background: #f7f0db;
  color: #846417;
}

.market-tag.us-share {
  background: #e9eef5;
  color: #45617a;
}

.market-tag.a-share {
  background: #f9e8e2;
  color: #a44822;
}

.relation-count {
  color: var(--accent);
  font-weight: 800;
}

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

.price-cell {
  font-weight: 700;
}

.chain-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.chain-column {
  min-width: 0;
  background: var(--surface);
}

.chain-header {
  min-height: 62px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 2px solid;
}

.chain-header h2 {
  margin: 0;
  font-size: 18px;
}

.chain-header span {
  color: #7b878d;
  font-size: 10px;
}

.chain-header.upstream { border-color: #d76737; }
.chain-header.midstream { border-color: #278376; }
.chain-header.downstream { border-color: #51718d; }

.sector-section {
  padding: 15px 18px 17px;
  border-bottom: 1px solid var(--line);
}

.sector-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  color: #5e6c72;
  font-size: 10px;
  text-transform: uppercase;
}

.sector-section h3 span {
  color: #9aa4a9;
  font-size: 9px;
  font-weight: 500;
}

.stock-row {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border: 0;
  border-top: 1px solid #edf0f1;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.stock-row:first-of-type {
  border-top: 0;
}

.stock-row:hover strong {
  color: var(--accent);
}

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

.stock-row div {
  min-width: 0;
}

.stock-row p {
  margin: 0;
  overflow: hidden;
  color: #657279;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-mini {
  display: inline-flex;
  margin-right: 5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #edf1f3;
  color: #6a777d;
  font-size: 8px;
  font-weight: 700;
}

.stock-row .row-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c4cdd1;
}

.stock-row .row-quote {
  text-align: right;
  font-size: 9px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stock-row .row-status.analyzed {
  background: var(--teal);
}

.discovery-panel {
  min-height: 640px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.policy-panel {
  min-height: 640px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: #f5f2ea;
}

.policy-live-bar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 12px;
  color: #67716f;
  background: #ebe7dd;
  border: 1px solid #d5d1c7;
  border-bottom: 0;
  font-size: 10px;
}

.policy-live-bar > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.policy-live-bar strong {
  color: #34403f;
}

.policy-live-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  font-weight: 800;
}

.policy-live-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.policy-live-status.live {
  color: #236a55;
  background: #dcefe5;
}

.policy-live-status.partial {
  color: #93681b;
  background: #f4e9c9;
}

.policy-live-status.fallback {
  color: #a14531;
  background: #f6ddd7;
}

.policy-live-bar button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #c4beb1;
  border-radius: 4px;
  color: #33403e;
  background: #f7f4ed;
  font-size: 10px;
  font-weight: 750;
}

.policy-live-bar button:hover {
  border-color: #d75234;
  color: #b83e26;
}

.policy-live-bar button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.policy-live-bar button svg {
  width: 13px;
  height: 13px;
}

.policy-live-bar button:disabled svg {
  animation: spin 900ms linear infinite;
}

.policy-fallback-notice {
  padding: 10px 13px;
  color: #8a412e;
  background: #f7ded7;
  border: 1px solid #e5b5a9;
  border-bottom: 0;
  font-size: 10px;
}

.policy-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr);
  gap: 34px;
  align-items: end;
  padding: 38px;
  background: #f5f2ea;
  border: 1px solid #d5d1c7;
}

.policy-kicker,
.policy-section-head span {
  color: #d75234;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.policy-hero h2 {
  margin: 10px 0 0;
  color: #162022;
  font-size: clamp(38px, 4vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.policy-hero h2 em {
  font-family: Georgia, serif;
  font-weight: 400;
}

.policy-hero-copy > p {
  max-width: 640px;
  margin: 22px 0 0;
  color: #566160;
  font-size: 14px;
  line-height: 1.75;
}

.policy-takeaway {
  max-width: 680px;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  margin-top: 22px;
  padding: 14px 15px;
  border-left: 3px solid #d75234;
  background: rgba(255, 255, 255, 0.42);
}

.policy-takeaway span {
  color: #d75234;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.policy-takeaway strong {
  color: #34403f;
  font-size: 12px;
  line-height: 1.55;
}

.policy-empty-retry {
  margin-top: 12px;
  padding: 7px 11px;
  border: 1px solid #cf7660;
  border-radius: 4px;
  color: #a43e28;
  background: #fff8f4;
  font-size: 10px;
  font-weight: 750;
}

.policy-score-card {
  min-height: 245px;
  padding: 24px;
  color: #f7f4ec;
  background: #162022;
  box-shadow: 8px 8px 0 #d75234;
}

.policy-score-head,
.policy-gauge-labels {
  display: flex;
  justify-content: space-between;
  color: #aeb8b4;
  font-size: 10px;
}

.policy-score-head strong {
  padding: 4px 7px;
  border-radius: 999px;
  color: #162022;
  background: #c8ef72;
}

.policy-score-value {
  margin-top: 20px;
  font-size: 76px;
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
}

.policy-score-change {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
}

.policy-score-change.is-up {
  color: #c8ef72;
}

.policy-score-change.is-down {
  color: #f29a70;
}

.policy-gauge {
  height: 6px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #35403f;
}

.policy-gauge i {
  display: block;
  height: 100%;
  background: #c8ef72;
}

.policy-gauge-labels {
  padding-top: 7px;
  color: #7f8b87;
}

.policy-score-card > p {
  margin: 16px 0 0;
  color: #aeb8b4;
  font-size: 10px;
  line-height: 1.5;
}

.policy-explain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-right: 1px solid #d5d1c7;
  border-bottom: 1px solid #d5d1c7;
  border-left: 1px solid #d5d1c7;
}

.policy-explain-grid article {
  min-width: 0;
  padding: 17px 19px;
  border-right: 1px solid #d5d1c7;
}

.policy-explain-grid article:last-child {
  border-right: 0;
}

.policy-explain-grid span {
  display: block;
  color: #d75234;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.policy-explain-grid strong {
  display: block;
  margin-top: 7px;
  color: #34403f;
  font-size: 16px;
}

.policy-explain-grid strong.is-hot {
  color: #c44a31;
}

.policy-explain-grid strong.is-cool {
  color: #28705d;
}

.policy-explain-grid p {
  margin: 6px 0 0;
  color: #7a8481;
  font-size: 10px;
  line-height: 1.5;
}

.policy-section {
  padding: 34px 0 0;
}

.policy-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 16px;
}

.policy-section-head h3 {
  margin: 6px 0 0;
  color: #162022;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.policy-section-head p {
  max-width: 360px;
  margin: 0;
  color: #79827f;
  font-size: 11px;
  line-height: 1.55;
  text-align: right;
}

.policy-driver-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.policy-driver-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid #d5d1c7;
  background: rgba(255, 255, 255, 0.32);
}

.policy-driver-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.policy-driver-head > div {
  display: grid;
  gap: 4px;
}

.policy-driver-head > div > span {
  color: #263331;
  font-size: 12px;
  font-weight: 800;
}

.policy-driver-head small {
  color: #6d7775;
  font-size: 9px;
}

.policy-freshness {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 6px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 8px;
  font-weight: 800;
}

.policy-freshness.live,
.policy-freshness.current {
  color: #236a55;
  background: #dcefe5;
}

.policy-freshness.delayed {
  color: #86621e;
  background: #f1e8ca;
}

.policy-freshness.stale,
.policy-freshness.fallback,
.policy-freshness.unknown {
  color: #9c4935;
  background: #f4ddd7;
}

.policy-driver-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.policy-driver-value-row > strong {
  color: #162022;
  font-size: 27px;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.policy-driver-value-row > span {
  color: #6f7976;
  font-size: 9px;
  text-align: right;
}

.policy-driver-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 15px 0 6px;
  color: #7d8784;
  font-size: 9px;
}

.policy-driver-score strong {
  color: #d75234;
  font-size: 13px;
}

.policy-driver-card > p {
  min-height: 31px;
  margin: 13px 0 0;
  color: #87908d;
  font-size: 10px;
  line-height: 1.55;
}

.policy-driver-bar {
  height: 4px;
  background: #ddd8cd;
}

.policy-driver-bar i {
  display: block;
  height: 100%;
  background: #d75234;
}

.policy-driver-card > footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #ddd8cd;
  color: #89918f;
  font-size: 8px;
}

.policy-driver-card > footer span {
  max-width: 64%;
  line-height: 1.35;
}

.policy-driver-card > footer time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.policy-history-chart {
  height: 205px;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding: 22px 18px 10px;
  border: 1px solid #d5d1c7;
  background: repeating-linear-gradient(to bottom, rgba(22, 32, 34, 0.05) 0, rgba(22, 32, 34, 0.05) 1px, transparent 1px, transparent 44px);
}

.policy-history-column {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
}

.policy-history-column strong {
  color: #5f6967;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.policy-history-column i {
  display: block;
  min-height: 3px;
  background: #162022;
}

.policy-history-column:nth-last-child(-n + 3) i {
  background: #d75234;
}

.policy-history-column span {
  color: #7a8582;
  font-size: 8px;
  text-align: center;
}

.policy-mapping-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.policy-mapping-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid #d5d1c7;
  background: rgba(255, 255, 255, 0.34);
}

.policy-mapping-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.policy-mapping-title h4 {
  margin: 0;
  color: #162022;
  font-size: 14px;
}

.policy-mapping-title span {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.policy-mapping-title .positive {
  background: #c8ef72;
}

.policy-mapping-title .caution {
  background: #f3c0b4;
}

.policy-mapping-title .watch {
  background: #ddd3b8;
}

.policy-mapping-card > p {
  min-height: 58px;
  margin: 15px 0;
  color: #6f7a77;
  font-size: 10px;
  line-height: 1.6;
}

.policy-mapping-signal {
  width: fit-content;
  margin-top: 11px;
  padding: 4px 7px;
  color: #7c5c1c;
  background: #efe5c7;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 750;
}

.policy-mapping-count {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding-top: 13px;
  border-top: 1px solid #ddd8cd;
}

.policy-mapping-count strong {
  color: #d75234;
  font-size: 21px;
}

.policy-mapping-count span {
  color: #8a928f;
  font-size: 9px;
}

.policy-ticker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.policy-ticker-list button,
.policy-ticker-list > span {
  padding: 4px 6px;
  border: 1px solid #cfc9bd;
  border-radius: 3px;
  color: #465250;
  background: #f7f4ed;
  font-size: 9px;
  font-weight: 750;
}

.policy-ticker-list button:hover {
  border-color: #d75234;
  color: #b83e26;
}

.policy-method-note {
  display: grid;
  grid-template-columns: 240px 1fr;
  align-items: center;
  gap: 28px;
  margin-top: 34px;
  padding: 21px 22px;
  color: #dfe5e1;
  background: #162022;
}

.policy-method-note span {
  display: block;
  color: #c8ef72;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.policy-method-note strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
}

.policy-method-note p {
  margin: 0;
  color: #aeb8b4;
  font-size: 10px;
  line-height: 1.65;
}

.policy-source-ledger {
  margin-top: 34px;
  border: 1px solid #d5d1c7;
  background: rgba(255, 255, 255, 0.3);
}

.policy-source-ledger summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 15px;
  color: #34403f;
  cursor: pointer;
  font-size: 11px;
}

.policy-source-ledger summary strong {
  color: #6d7775;
  font-size: 9px;
}

.policy-source-ledger > div {
  border-top: 1px solid #d5d1c7;
}

.policy-source-ledger article {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 110px 52px;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 14px;
  border-bottom: 1px solid #e1ddd4;
}

.policy-source-ledger article:last-child {
  border-bottom: 0;
}

.policy-source-ledger article strong {
  color: #34403f;
  font-size: 10px;
}

.policy-source-ledger article p {
  margin: 3px 0 0;
  color: #87908d;
  font-size: 9px;
}

.policy-source-ledger article time {
  color: #737e7b;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.policy-source-ledger article a {
  color: #b83e26;
  font-size: 9px;
  font-weight: 750;
  text-decoration: none;
}

.policy-source-ledger article a:hover {
  text-decoration: underline;
}
.discovery-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 22px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid #26343a;
  border-radius: 8px;
  background: linear-gradient(135deg, #192329 0%, #24323a 58%, #31434b 100%);
  color: #f7fafb;
}

.discovery-kicker {
  color: #f29a70;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.discovery-hero h2 {
  margin: 10px 0 0;
  font-size: 28px;
  line-height: 1;
}

.discovery-hero p {
  max-width: 760px;
  margin: 12px 0 0;
  color: #c5d0d5;
  font-size: 13px;
  line-height: 1.7;
}

.discovery-run-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.discovery-run-card span {
  color: #aab8be;
  font-size: 10px;
  text-transform: uppercase;
}

.discovery-run-card strong {
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.report-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(242, 154, 112, 0.45);
  border-radius: 4px;
  color: #ffd0bb;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}

.report-link:hover {
  border-color: #f29a70;
  color: #ffffff;
}

.discovery-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #fbfcfc;
}

.discovery-metrics div {
  min-width: 0;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
}

.discovery-metrics div:last-child {
  border-right: 0;
}

.discovery-metrics span {
  display: block;
  color: #7b878d;
  font-size: 10px;
}

.discovery-metrics strong {
  display: block;
  margin-top: 7px;
  color: #26343a;
  font-size: 23px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.discovery-trend-section {
  margin-top: 14px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mini-trend {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.mini-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mini-trend-head span {
  color: #7b878d;
  font-size: 10px;
}

.mini-trend-head strong {
  color: #26343a;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.mini-bars {
  height: 62px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  margin-top: 9px;
}

.mini-bars span {
  flex: 1 1 0;
  min-width: 4px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #f29a70, #d05a2a);
}

.history-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.history-point {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.history-point.is-current {
  border-color: rgba(208, 90, 42, 0.28);
  background: #fff8f4;
}

.history-point div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-point strong {
  color: #26343a;
  font-size: 13px;
}

.history-point span {
  color: #7b878d;
  font-size: 10px;
}

.history-point p {
  margin: 8px 0 0;
  color: #4f5f66;
  font-size: 11px;
  line-height: 1.5;
}

.history-point a {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
}

.discovery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.discovery-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.discovery-section-wide {
  grid-column: 1 / -1;
}

.discovery-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.discovery-section-head h3 {
  margin: 0;
  color: #26343a;
  font-size: 16px;
}

.discovery-section-head p {
  margin: 5px 0 0;
  color: #738087;
  font-size: 11px;
  line-height: 1.5;
}

.discovery-section-head > span {
  flex: 0 0 auto;
  color: #8b969b;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 10px;
}

.compact-stack,
.discovery-list {
  display: grid;
  gap: 8px;
}

.discovery-card {
  min-width: 0;
  display: grid;
  gap: 11px;
  padding: 14px;
  border: 1px solid #d9e0e4;
  border-radius: 6px;
  background: var(--surface);
}

.discovery-card.compact {
  gap: 8px;
  padding: 12px;
}

.discovery-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.discovery-ticker {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
}

.discovery-ticker span {
  color: #7d898f;
  font-size: 10px;
  font-weight: 700;
}

.discovery-card h4 {
  margin: 6px 0 0;
  color: #26343a;
  font-size: 14px;
  line-height: 1.25;
}

.score-pill {
  flex: 0 0 auto;
  min-width: 38px;
  min-height: 28px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.score-pill.high {
  background: var(--accent-soft);
  color: #a34822;
}

.score-pill.medium {
  background: #e4f2ef;
  color: #176f65;
}

.score-pill.low {
  background: #eef2f4;
  color: #647179;
}

.discovery-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.discovery-meta-line span,
.discovery-tags span,
.discovery-mini-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: #eef2f4;
  color: #647179;
  font-size: 10px;
  font-weight: 650;
}

.discovery-tags,
.discovery-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.discovery-tags span {
  background: #f7f0db;
  color: #846417;
}

.discovery-card p,
.discovery-list-item p {
  margin: 0;
  color: #38484f;
  font-size: 12px;
  line-height: 1.6;
}

.discovery-card.compact p {
  font-size: 11px;
}

.discovery-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
  color: #7a878d;
  font-size: 10px;
}

.discovery-quote {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.discovery-action {
  margin-left: auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafb;
  color: #304047;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.discovery-action:hover {
  border-color: var(--line-strong);
  background: #edf2f4;
}

.discovery-action.is-muted {
  margin-left: 0;
  border-color: transparent;
  background: transparent;
  color: #9aa4a9;
  cursor: default;
}

.candidate-action-state.watch {
  background: #e8f1f6;
  color: #265e7f;
}

.candidate-action-state.promote {
  background: var(--accent-soft);
  color: #a44822;
}

.candidate-action-state.ignore {
  background: #edf1f3;
  color: #7b878d;
}

.candidate-action-state.research {
  background: #e4f2ef;
  color: #176f65;
}

.candidate-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.candidate-actions button {
  min-height: 28px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafb;
  color: #647179;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.candidate-actions button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.candidate-actions button.is-active {
  border-color: rgba(208, 90, 42, 0.24);
  background: var(--accent-soft);
  color: #a44822;
}

.mini-research-card {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(25, 127, 115, 0.2);
  border-radius: 6px;
  background: #f4fbf9;
}

.mini-research-card span {
  display: block;
  color: #558078;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mini-research-card p {
  margin: 4px 0 0;
  color: #263f3a;
  font-size: 11px;
  line-height: 1.55;
}

.discovery-list-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #d9e0e4;
  border-radius: 6px;
  background: var(--surface);
}

.discovery-list-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.discovery-list-title a,
.discovery-list-title strong {
  color: #26343a;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
  text-decoration: none;
}

.discovery-list-title a:hover {
  color: var(--accent);
}

.discovery-list-title span {
  flex: 0 0 auto;
  min-width: 30px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #edf2f4;
  color: #4f5f66;
  font-size: 11px;
  font-weight: 800;
}

.empty-card {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: #7f8b91;
  font-size: 12px;
}

.page-footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px 0;
  color: #7c898f;
  font-size: 10px;
}

.page-footer p {
  margin: 0;
}

.page-footer span {
  white-space: nowrap;
  font-weight: 700;
}

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

  .main-panel {
    padding: 18px 18px 14px;
  }

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

  .decision-hero-card {
    grid-column: 1 / -1;
  }

  .graph-layout {
    grid-template-columns: minmax(0, 1fr) 270px;
  }

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

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

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

  .discovery-section-wide {
    grid-column: 1;
  }

  .detail-panel {
    padding: 22px 16px;
  }

  .network-stage {
    min-height: 410px;
  }
}

@media (max-width: 860px) {
  .topbar {
    height: auto;
    min-height: 68px;
    padding: 13px 16px;
  }

  .topbar-nav {
    justify-content: flex-end;
  }

  .topbar-nav-link {
    min-height: 30px;
    padding: 0 10px;
  }

  .topbar-meta span:not(.live-dot) {
    display: none;
  }

  .workbench {
    display: block;
  }

  .filter-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 14px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .filter-group,
  .source-block {
    margin-top: 0;
  }

  .sector-group,
  .source-block {
    display: none;
  }

  .main-panel {
    padding: 14px 14px 10px;
  }

  .summary-strip {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
    overflow-x: auto;
  }

  .decision-panel {
    grid-template-columns: 1fr;
  }

  .summary-item {
    padding: 16px 14px;
  }

  .graph-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .discovery-hero {
    grid-template-columns: 1fr;
  }

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

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

  .policy-hero {
    grid-template-columns: 1fr;
  }

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

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

  .chain-column {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .brand-block h1 {
    font-size: 16px;
  }

  .brand-block p,
  .topbar-meta .live-dot {
    display: none;
  }

  .topbar {
    gap: 10px;
  }

  .topbar-nav {
    flex: 0 0 auto;
  }

  .topbar-nav-link {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .topbar-nav-link span {
    display: none;
  }

  .filter-panel {
    grid-template-columns: minmax(250px, 1fr);
  }

  .filter-panel > .filter-group {
    display: none;
  }

  .filter-panel > .market-group {
    display: block;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .summary-item:nth-child(2) {
    border-right: 0;
  }

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

  .view-bar {
    height: auto;
    min-height: 58px;
    align-items: center;
  }

  .view-tabs {
    gap: 0;
  }

  .view-tabs button {
    width: 42px;
    justify-content: center;
    padding: 0;
  }

  .view-tabs button span {
    display: none;
  }

  .visible-label {
    padding-bottom: 0;
  }

  .graph-pane {
    padding: 10px 0;
  }

  .graph-toolbar {
    padding: 0 8px 8px;
    justify-content: flex-start;
  }

  .relation-filter,
  .graph-focus-filter,
  .graph-mode-filter {
    justify-content: flex-start;
  }

  .network-stage {
    height: 441px;
    min-height: 441px;
    border-right: 0;
    border-left: 0;
    overflow: hidden;
  }

  #networkGraph {
    width: 100%;
    min-width: 0;
    height: 441px;
    max-width: none;
  }

  .graph-controls {
    top: 8px;
    right: 8px;
  }

  .graph-hint {
    left: 8px;
    bottom: 8px;
  }

  .relationship-legend {
    padding: 10px 8px 0;
  }

  .detail-panel {
    padding: 22px 16px;
  }

  .table-wrap {
    max-height: 620px;
  }

  .discovery-panel {
    padding: 14px 0;
  }

  .policy-panel {
    padding: 14px 0;
  }

  .policy-hero,
  .policy-signal,
  .policy-section,
  .policy-method-note {
    border-right: 0;
    border-left: 0;
  }

  .policy-hero {
    padding: 25px 17px;
  }

  .policy-section {
    padding: 28px 14px 0;
  }

  .policy-section-head {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .policy-section-head p {
    text-align: left;
  }

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

  .policy-mapping-grid {
    grid-template-columns: 1fr;
  }

  .policy-method-note {
    grid-template-columns: 1fr;
    gap: 13px;
    margin-top: 28px;
  }

  .discovery-hero,
  .discovery-section,
  .discovery-metrics {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .discovery-hero {
    padding: 20px 16px;
  }

  .discovery-section {
    padding: 16px;
  }

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

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

  .trend-grid,
  .history-timeline {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 1140px;
  }

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

/* TACO Research workbench extensions */
button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select,
textarea {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline-color: var(--color-focus);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

.brand-block h1,
.lab-heading h2,
.report-toolbar strong,
.research-report h2,
.research-report h3 {
  font-family: var(--font-display);
}

.brand-mark,
.lab-index,
kbd,
.result-stat strong,
.backtest-metric strong,
.report-meta,
.page-footer span {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.brand-mark {
  border-color: var(--color-rule-2);
  color: var(--color-focus);
}

.brand-block p {
  color: var(--color-rule-2);
}

.command-trigger {
  min-width: min(24rem, 34vw);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-inline: var(--space-md) var(--space-sm);
  border: 1px solid var(--color-neutral);
  border-radius: var(--radius-pill);
  background: var(--color-ink-2);
  color: var(--color-rule);
  cursor: pointer;
  transition:
    background-color var(--dur-short) var(--ease-out),
    transform var(--dur-micro) var(--ease-out);
}

.command-trigger svg {
  width: 1rem;
  height: 1rem;
}

.command-trigger span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-trigger kbd,
.command-field kbd,
.command-footer kbd {
  min-width: 1.55rem;
  min-height: 1.45rem;
  display: inline-grid;
  place-items: center;
  padding-inline: var(--space-2xs);
  border: 1px solid var(--color-neutral);
  border-radius: var(--radius-xs);
  background: var(--color-ink);
  color: var(--color-rule);
  font-size: var(--text-xs);
}

.topbar-nav-link {
  min-height: 2.75rem;
  border-color: var(--color-neutral);
  background: var(--color-ink-2);
  color: var(--color-rule);
  transition:
    background-color var(--dur-short) var(--ease-out),
    color var(--dur-short) var(--ease-out),
    transform var(--dur-micro) var(--ease-out);
}

.topbar-nav-link:hover,
.topbar-nav-link:focus-visible,
.topbar-nav-link.is-active {
  border-color: var(--color-focus);
  background: var(--color-ink-2);
  color: var(--color-paper);
}

.topbar-nav-link svg {
  color: var(--color-focus);
}

.topbar-refresh {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-color: var(--color-neutral);
  color: var(--color-rule);
}

.search-row {
  min-height: 2.75rem;
}

.search-row input,
.field input,
.field select,
.field textarea {
  font-size: var(--text-base);
}

.view-tabs {
  overflow-x: auto;
  scrollbar-width: thin;
}

.view-tabs button {
  min-height: 2.75rem;
  white-space: nowrap;
}

.lab-layout,
.research-shell {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.lab-controls,
.research-composer {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-paper-2);
  color: var(--color-ink);
}

.lab-heading {
  display: grid;
  gap: var(--space-xs);
}

.lab-heading-secondary {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-rule);
}

.lab-index {
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.lab-heading h2 {
  margin: 0;
  color: var(--color-ink);
  font-size: var(--text-lg);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lab-heading p {
  max-width: 52ch;
  margin: 0;
  color: var(--color-neutral);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.control-stack {
  display: grid;
  gap: var(--space-md);
}

.field,
.field-pair {
  min-width: 0;
}

.field {
  display: grid;
  gap: var(--space-xs);
  color: var(--color-ink-2);
  font-size: var(--text-sm);
  font-weight: 700;
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-weight: 400;
  transition: background-color var(--dur-short) var(--ease-out);
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--color-negative);
}

.field-helper {
  min-height: 1lh;
  margin: 0;
  color: var(--color-neutral);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.5;
}

.action-primary,
.action-secondary,
.report-actions button,
.history-heading button,
.prompt-samples button,
.command-footer button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding-inline: var(--space-md);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color var(--dur-short) var(--ease-out),
    color var(--dur-short) var(--ease-out),
    transform var(--dur-micro) var(--ease-out);
}

.action-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-ink);
}

.action-primary svg {
  width: 1rem;
  height: 1rem;
}

.action-primary[data-loading="true"] {
  cursor: wait;
}

.action-primary[data-loading="true"] svg {
  animation: spin 900ms linear infinite;
}

.lab-results,
.research-output {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--color-surface);
  color: var(--color-ink);
}

.result-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
}

.result-stat {
  min-width: 0;
  display: grid;
  gap: var(--space-2xs);
  padding: var(--space-md);
  border-right: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
}

.result-stat:nth-child(2n) {
  border-right: 0;
}

.result-stat:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.result-stat span {
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.result-stat strong {
  overflow: hidden;
  color: var(--color-ink);
  font-size: var(--text-lg);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-table-wrap {
  max-height: 34rem;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
}

.research-table {
  min-width: 54rem;
}

.research-table td,
.research-table th {
  font-size: var(--text-sm);
}

.research-table td:nth-child(1),
.research-table td:nth-child(5),
.research-table td:nth-child(6) {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.research-table .quote-positive {
  color: var(--color-positive);
}

.research-table .quote-negative {
  color: var(--color-negative);
}

.backtest-result {
  min-width: 0;
  border-top: 1px solid var(--color-rule);
  padding-top: var(--space-lg);
}

.backtest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
}

.backtest-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
}

.backtest-metric {
  display: grid;
  gap: var(--space-2xs);
  padding: var(--space-md);
  border-right: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
}

.backtest-metric:nth-child(2n) {
  border-right: 0;
}

.backtest-metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.backtest-metric span {
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.backtest-metric strong {
  font-size: var(--text-md);
}

.equity-chart {
  width: 100%;
  min-height: 14rem;
  display: block;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-paper);
}

.equity-chart .chart-grid {
  stroke: var(--color-rule);
  stroke-width: 1;
}

.equity-chart .chart-strategy {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2.25;
}

.equity-chart .chart-benchmark {
  fill: none;
  stroke: var(--color-neutral);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}

.mode-picker {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2xs);
  margin: 0;
  padding: var(--space-2xs);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-paper-3);
}

.mode-picker legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.mode-picker label {
  min-width: 0;
  min-height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.mode-picker input {
  position: absolute;
  opacity: 0;
}

.mode-picker span {
  max-width: 100%;
  padding-inline: var(--space-xs);
  overflow: hidden;
  color: var(--color-neutral);
  font-size: var(--text-xs);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-picker label:has(input:checked) {
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-rule);
}

.mode-picker label:has(input:checked) span {
  color: var(--color-accent);
}

.mode-picker label:has(input:focus-visible) {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.prompt-samples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.prompt-samples button {
  min-height: 2.25rem;
  border-radius: var(--radius-pill);
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.provider-settings {
  border-top: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
}

.provider-settings summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--color-ink-2);
  font-size: var(--text-sm);
  font-weight: 700;
}

.provider-settings summary::after {
  content: "+";
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.provider-settings[open] summary::after {
  content: "−";
}

.provider-grid {
  display: grid;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
}

.research-status[data-tone="error"],
.field-helper[data-tone="error"] {
  color: var(--color-negative);
}

.research-status[data-tone="success"],
.field-helper[data-tone="success"] {
  color: var(--color-positive);
}

.report-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-rule);
}

.report-toolbar > div:first-child {
  min-width: 0;
  display: grid;
  gap: var(--space-2xs);
}

.report-toolbar span {
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.report-toolbar strong {
  overflow-wrap: anywhere;
  font-size: var(--text-md);
  line-height: 1.2;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-xs);
}

.report-actions button {
  min-height: 2.25rem;
  padding-inline: var(--space-sm);
  font-size: var(--text-xs);
}

.research-report {
  min-width: 0;
  min-height: 30rem;
  max-width: 75ch;
  display: grid;
  align-content: start;
  gap: var(--space-md);
  margin-inline: auto;
  color: var(--color-ink-2);
}

.research-report h2,
.research-report h3 {
  margin: var(--space-lg) 0 0;
  color: var(--color-ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.research-report h2 {
  font-size: var(--text-lg);
}

.research-report h3 {
  font-size: var(--text-md);
}

.research-report p,
.research-report li {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.75;
}

.research-report ul,
.research-report ol {
  display: grid;
  gap: var(--space-xs);
  margin: 0;
  padding-inline-start: var(--space-lg);
}

.research-report code {
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius-xs);
  background: var(--color-paper-2);
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.research-report blockquote {
  margin: 0;
  padding: var(--space-md);
  border: 1px solid var(--color-rule);
  background: var(--color-paper-2);
  color: var(--color-neutral);
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-rule);
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.research-empty {
  min-height: 24rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  text-align: start;
}

.research-empty svg {
  width: 2rem;
  height: 2rem;
  color: var(--color-accent);
}

.research-empty strong {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.research-empty span {
  max-width: 48ch;
  color: var(--color-neutral);
}

.history-panel {
  display: grid;
  gap: var(--space-sm);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-rule);
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.history-heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-base);
}

.history-heading button {
  min-height: 2.25rem;
  font-size: var(--text-xs);
}

.history-list {
  display: grid;
  gap: var(--space-xs);
}

.history-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-xs);
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--color-rule);
}

.history-item button {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
}

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

.history-item strong {
  font-size: var(--text-sm);
}

.history-item span {
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.history-item time {
  color: var(--color-neutral);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.command-palette {
  position: fixed;
  inset: 0;
  width: min(42rem, calc(100% - 2rem));
  max-height: min(80dvh, 42rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 1rem 4rem var(--color-shadow);
}

.command-palette::backdrop {
  background: var(--color-scrim);
}

.command-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-rule);
}

.command-field > svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--color-accent);
}

.command-field label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.command-field input {
  min-width: 0;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  font-size: var(--text-base);
}

.command-results {
  max-height: calc(80dvh - 8rem);
  display: grid;
  align-content: start;
  gap: var(--space-2xs);
  padding: var(--space-xs);
  overflow-y: auto;
}

.command-group {
  padding: var(--space-sm) var(--space-sm) var(--space-2xs);
  color: var(--color-neutral);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
}

.command-item {
  min-width: 0;
  min-height: 2.75rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  padding-inline: var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
}

.command-item.is-active,
.command-item:focus-visible {
  border-color: var(--color-rule);
  background: var(--color-paper-2);
}

.command-item svg {
  width: 1rem;
  height: 1rem;
  color: var(--color-accent);
}

.command-item strong,
.command-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-item strong {
  font-size: var(--text-sm);
}

.command-item span {
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.command-footer {
  min-height: 3rem;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-inline: var(--space-md);
  border-top: 1px solid var(--color-rule);
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

.command-footer > span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
}

.command-footer button {
  min-height: 2rem;
  margin-inline-start: auto;
}

.page-footer {
  border-top: 1px solid var(--color-rule);
  color: var(--color-neutral);
  font-size: var(--text-xs);
}

@media (hover: hover) and (pointer: fine) {
  .command-trigger:hover,
  .topbar-nav-link:hover,
  .action-secondary:hover,
  .report-actions button:hover:not(:disabled),
  .history-heading button:hover,
  .prompt-samples button:hover,
  .command-footer button:hover {
    background: var(--color-paper-3);
    color: var(--color-ink);
  }

  .action-primary:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .field input:hover,
  .field select:hover,
  .field textarea:hover {
    background: var(--color-paper);
  }
}

@media (min-width: 40rem) {
  .field-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-stat-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .result-stat,
  .result-stat:nth-child(2n) {
    border-right: 1px solid var(--color-rule);
    border-bottom: 0;
  }

  .result-stat:last-child {
    border-right: 0;
  }

  .backtest-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .backtest-metric,
  .backtest-metric:nth-child(2n) {
    border-right: 1px solid var(--color-rule);
    border-bottom: 0;
  }

  .backtest-metric:last-child {
    border-right: 0;
  }
}

@media (min-width: 60rem) {
  .lab-layout {
    grid-template-columns: minmax(17rem, 0.72fr) minmax(0, 2fr);
  }

  .research-shell {
    grid-template-columns: minmax(20rem, 0.86fr) minmax(0, 1.65fr);
  }

  .lab-controls,
  .research-composer {
    border-right: 1px solid var(--color-rule);
    border-bottom: 0;
  }

  .lab-controls {
    align-self: start;
  }

  .research-composer {
    position: sticky;
    top: 0;
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
  }

  .backtest-grid {
    grid-template-columns: minmax(16rem, 0.7fr) minmax(0, 1.3fr);
  }
}

@media (min-width: 90rem) {
  .lab-layout {
    grid-template-columns: minmax(19rem, 0.64fr) minmax(0, 2.2fr);
  }

  .research-shell {
    grid-template-columns: minmax(22rem, 0.78fr) minmax(0, 1.8fr);
  }
}

@media (max-width: 72rem) {
  .command-trigger {
    min-width: 2.75rem;
    width: 2.75rem;
    justify-content: center;
    padding: 0;
  }

  .command-trigger span,
  .command-trigger kbd {
    display: none;
  }
}

@media (max-width: 40rem) {
  .topbar-nav {
    display: none;
  }

  .lab-controls,
  .research-composer,
  .lab-results,
  .research-output {
    padding: var(--space-md);
  }

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

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

  .report-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .research-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .research-table {
    min-width: 0;
    display: block;
  }

  .research-table thead {
    display: none;
  }

  .research-table tbody {
    display: grid;
    gap: var(--space-sm);
  }

  .research-table tr {
    display: grid;
    gap: var(--space-xs);
    padding: var(--space-md);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
  }

  .research-table td {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: var(--space-sm);
    padding: 0;
    border: 0;
  }

  .research-table td::before {
    content: attr(data-label);
    color: var(--color-neutral);
    font-family: var(--font-body);
    font-size: var(--text-xs);
  }

  .command-palette {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .command-results {
    max-height: calc(100dvh - 8rem);
  }

  .command-footer > span {
    display: none;
  }

  .page-footer span {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 150ms !important;
  }
}
