:root {
  color-scheme: dark;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; }
button, input, select, summary { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.control-shell {
  position: relative;
  z-index: 20;
  background: linear-gradient(180deg, var(--panel), var(--panel));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--panel) 20%, transparent);
}

.app-header,
.controls,
.workspace {
  width: calc(100% - 28px);
  margin-inline: auto;
}

.app-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 7px 4px 6px;
}

.heading-group,
.header-actions,
.stock-picker,
.control-group,
.pane-controls {
  display: flex;
  align-items: center;
}

.heading-group { gap: 14px; }
.app-header .heading-group > div { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 10px; }
.app-header .heading-group .eyebrow { grid-column: 1 / -1; }
.home-link { color: var(--green); font-size: 13px; font-weight: 900; letter-spacing: .18em; text-decoration: none; }
.heading-divider { width: 1px; height: 31px; background: var(--line); }
.eyebrow { margin: 0 0 2px; color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(20px, 1.45vw, 27px); line-height: 1.05; }
.page-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 11px; font-weight: 650; }
.header-actions { gap: 9px; }
.language-link { min-width: 40px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; text-align: center; text-decoration: none; color: var(--muted); font-weight: 800; }

.controls {
  display: flex;
  align-items: end;
  gap: 11px;
  padding: 5px 4px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.025);
}

.stock-picker { position: relative; flex: 1 1 760px; display: grid; grid-template-columns: auto minmax(230px, 1fr) auto minmax(180px, .9fr); align-items: end; gap: 8px; }
.market-field { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.market-field label,
.control-label,
.compact-control label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.search-wrap { position: relative; flex: 1 1 300px; min-width: 190px; }
input, select {
  min-height: 34px;
  border: 1px solid #27425b;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
input { width: 100%; padding: 7px 12px; }
select { padding: 6px 32px 6px 10px; }
input:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 100;
  max-height: 330px;
  overflow: auto;
  padding: 5px;
  border: 1px solid #31506d;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--panel) 58%, transparent);
}
.search-result { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; }
.search-result:hover, .search-result:focus-visible, .search-result.active { background: var(--panel); }
.search-result.active { box-shadow: inset 3px 0 0 var(--blue); }
.search-result strong, .search-result span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result span { color: var(--muted); font-size: 12px; }
.search-message { margin: 8px; color: var(--muted); font-size: 13px; }

.cluster-picker { position: relative; align-self: end; }
.cluster-trigger {
  min-height: 34px;
  max-width: min(220px, 28vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid #2a4a67;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}
.cluster-trigger-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cluster-trigger-icon { flex: 0 0 auto; color: var(--muted); font-size: 10px; transition: transform .14s ease; }
.cluster-trigger[aria-expanded="true"] { border-color: var(--muted); background: var(--panel); }
.cluster-trigger[aria-expanded="true"] .cluster-trigger-icon { transform: rotate(180deg); }
.cluster-picker.customized .cluster-trigger { border-color: rgba(216, 180, 254, .48); color: var(--text); }
.cluster-picker.incomplete .cluster-trigger { border-color: rgba(251, 191, 36, .52); color: var(--orange); }
.cluster-dialog {
  inset: 0;
  width: min(760px, calc(100vw - 28px));
  max-width: none;
  height: min(760px, calc(100dvh - 36px));
  max-height: none;
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 1px solid #315674;
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 32px 100px color-mix(in srgb, var(--panel) 76%, transparent), 0 0 0 1px rgba(96, 165, 250, .08);
}
html.cluster-dialog-open,
html.cluster-dialog-open body { overflow: hidden; }
.cluster-dialog::backdrop { background: color-mix(in srgb, var(--panel) 76%, transparent); backdrop-filter: blur(5px); }
.cluster-dialog-surface { height: 100%; display: grid; grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr); gap: 11px; padding: 17px; }
.cluster-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cluster-dialog-header h2 { margin: 2px 0 0; font-size: 22px; }
.cluster-dialog-close { width: 40px; height: 40px; display: grid; place-items: center; padding: 0 0 3px; border: 1px solid #29465f; border-radius: 10px; background: var(--panel); color: var(--text); font-size: 24px; line-height: 1; }
.cluster-dialog-help { margin: -5px 0 0; color: var(--muted); font-size: 12px; }
.custom-cluster-toolbar { min-width: 0; display: flex; align-items: center; gap: 10px; }
.custom-cluster-toolbar .button { flex: 0 0 auto; }
.custom-cluster-status { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.custom-cluster-status.error { color: var(--danger); }
.custom-cluster-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(130px, auto) minmax(130px, auto) auto; align-items: end; gap: 9px; padding: 10px; border: 1px solid rgba(96, 165, 250, .34); border-radius: 10px; background: color-mix(in srgb, var(--panel) 76%, transparent); }
.custom-cluster-field { min-width: 0; display: grid; gap: 4px; }
.custom-cluster-field label { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.custom-cluster-field input,
.custom-cluster-field select { width: 100%; min-width: 0; }
.custom-cluster-form-error { grid-column: 1 / -1; margin: 0; color: var(--danger); font-size: 11px; }
.custom-cluster-form-actions { display: flex; gap: 6px; }
.cluster-category-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.cluster-category { min-height: 34px; padding: 6px 12px; border: 1px solid #28465f; border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 800; }
.cluster-category[aria-pressed="true"] { border-color: rgba(96, 165, 250, .72); background: #173958; color: var(--text); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .2); }
.cluster-search { min-height: 40px; background: var(--panel); }
.cluster-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 4px 2px;
  scrollbar-color: var(--muted) transparent;
}
.cluster-option { width: 100%; min-height: 142px; display: grid; align-content: start; gap: 7px; padding: 12px; border: 1px solid rgba(61, 96, 125, .62); border-radius: 11px; background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 86%, transparent), color-mix(in srgb, var(--panel) 92%, transparent)); color: var(--text); text-align: left; }
.cluster-option:hover, .cluster-option:focus-visible { border-color: rgba(96, 165, 250, .72); background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 96%, transparent), color-mix(in srgb, var(--panel) 98%, transparent)); }
.cluster-option.selected { border-color: rgba(83, 224, 160, .62); box-shadow: inset 3px 0 0 var(--green), 0 0 22px rgba(83, 224, 160, .08); }
.cluster-option-custom { position: relative; padding: 0; overflow: hidden; }
.cluster-option-custom-select { width: 100%; min-height: 104px; display: grid; align-content: start; gap: 7px; padding: 12px 12px 8px; border: 0; background: transparent; color: var(--text); text-align: left; }
.cluster-option-custom-select:hover { background: rgba(96, 165, 250, .06); }
.cluster-option-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 7px 9px 9px; border-top: 1px solid var(--line-soft); }
.cluster-option-action { min-height: 30px; padding: 4px 8px; border: 1px solid #294a64; border-radius: 7px; background: var(--panel); color: var(--text); font-size: 10px; font-weight: 800; }
.cluster-option-action.danger { border-color: rgba(251, 113, 133, .5); color: var(--danger); }
.cluster-option-heading { display: flex; justify-content: space-between; gap: 12px; }
.cluster-option-heading strong { min-width: 0; font-size: 14px; line-height: 1.25; }
.cluster-option-heading span { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.cluster-option-preview { color: var(--text); font-size: 11px; }
.cluster-option-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cluster-option-description { color: var(--muted); font-size: 11px; line-height: 1.38; }
.cluster-option-meta { margin-top: auto; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.cluster-empty { margin: 12px 2px; color: var(--muted); font-size: 13px; }
.control-group { gap: 7px; }
.control-group:not(.compact-control) { flex-direction: column; align-items: flex-start; }
.compact-control { align-self: stretch; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 3px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid #28445e; border-radius: 9px; background: var(--panel); }
.segmented button { min-height: 30px; padding: 5px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: #183859; color: var(--text); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .35); }
.segmented button:disabled { cursor: not-allowed; opacity: .38; }
.period-notice { margin: 0; padding: 8px 18px; color: var(--text); font-size: 13px; line-height: 1.5; }
.history-freshness { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.history-freshness.verification-failed { color: var(--orange); }
.button { min-height: 36px; padding: 7px 13px; border-radius: 8px; font-size: 12px; font-weight: 850; }
.button.primary { border: 1px solid #2f8f70; background: #0f5b47; color: var(--text); }
.button.secondary { border: 1px solid #2a4a67; background: var(--panel); color: var(--text); }
.button:hover { filter: brightness(1.14); }

.selected-stocks-shell { position: relative; min-width: 0; min-height: 34px; align-self: end; }
.selected-stocks-shell::before,
.selected-stocks-shell::after { position: absolute; top: 1px; bottom: 1px; z-index: 1; width: 42px; opacity: 0; pointer-events: none; transition: opacity .16s ease; content: ''; }
.selected-stocks-shell::before { left: 1px; border-radius: 8px 0 0 8px; background: linear-gradient(90deg, var(--panel) 24%, transparent); }
.selected-stocks-shell::after { right: 1px; border-radius: 0 8px 8px 0; background: linear-gradient(270deg, var(--panel) 24%, transparent); }
.selected-stocks-shell.can-scroll-left::before,
.selected-stocks-shell.can-scroll-right::after { opacity: 1; }
.selected-stocks { width: 100%; display: flex; min-width: 0; min-height: 34px; align-items: center; gap: 6px; padding: 2px 3px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scroll-behavior: smooth; scroll-padding-inline: 34px; border: 1px solid rgba(39, 66, 91, .72); border-radius: 8px; background: color-mix(in srgb, var(--panel) 55%, transparent); scrollbar-width: none; }
.selected-stocks::-webkit-scrollbar { display: none; }
.selected-stocks-nav { position: absolute; top: 50%; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center; padding: 0 0 2px; transform: translateY(-50%); border: 1px solid rgba(96, 165, 250, .42); border-radius: 50%; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: 0 6px 18px color-mix(in srgb, var(--panel) 42%, transparent); color: var(--text); font-size: 20px; line-height: 1; backdrop-filter: blur(8px); }
.selected-stocks-previous { left: 4px; }
.selected-stocks-next { right: 4px; }
.selected-stocks-nav:hover:not(:disabled) { border-color: rgba(125, 211, 252, .84); background: #173a5b; }
.selected-stocks-nav:disabled { opacity: 0; pointer-events: none; }
.stock-chip { display: inline-flex; align-items: center; flex: 0 0 auto; min-height: 34px; padding: 2px 3px; border: 1px solid color-mix(in srgb, var(--chip-color) 55%, var(--panel)); border-radius: 999px; background: color-mix(in srgb, var(--chip-color) 12%, var(--panel)); transition: border-color .14s ease, box-shadow .14s ease, opacity .14s ease; }
.stock-chip-focus { min-width: 0; min-height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; border: 0; border-radius: 999px 5px 5px 999px; background: transparent; color: inherit; }
.stock-chip-focus:hover:not(:disabled) { background: color-mix(in srgb, var(--chip-color) 14%, transparent); }
.stock-chip-focus:disabled { cursor: default; }
.stock-chip.focused-series { border-color: var(--chip-color); box-shadow: 0 0 0 1px color-mix(in srgb, var(--chip-color) 38%, transparent), 0 0 18px color-mix(in srgb, var(--chip-color) 22%, transparent); }
.stock-chip.dimmed-series { opacity: .48; }
.stock-chip .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color); box-shadow: 0 0 10px var(--chip-color); }
.stock-chip strong { font-size: 12px; }
.stock-chip span { color: var(--muted); font-size: 10px; }
.stock-chip-remove { width: 28px; height: 28px; flex: 0 0 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.07); color: var(--text); }
.stock-chip-remove:hover { background: rgba(251, 113, 133, .16); color: var(--danger); }
.selection-help { color: var(--muted); font-size: 12px; }

.view-controls { display: flex; flex: 0 0 auto; align-items: end; gap: 8px; }
.view-options { position: relative; align-self: end; }
.view-options > summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #2a4a67;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.view-options > summary::-webkit-details-marker { display: none; }
.view-options > summary::after { content: '▾'; color: var(--muted); font-size: 10px; }
.view-options[open] > summary { border-color: var(--muted); background: var(--panel); }
.view-options[open] > summary::after { transform: rotate(180deg); }
.view-options-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 90;
  width: 220px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #31506d;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--panel) 58%, transparent);
}
.view-options-panel .button, .view-options-panel select { width: 100%; }

.workspace { min-height: calc(100vh - 125px); padding: 8px 0 16px; }
.broadcast-heading { display: none; }
.comparison-insight {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(260px, 1fr) minmax(250px, auto);
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 7px;
  padding: 6px 13px;
  border: 1px solid rgba(70, 112, 148, .38);
  border-radius: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--panel) 94%, transparent), color-mix(in srgb, var(--panel) 78%, transparent));
}
.insight-main { font-size: 14px; line-height: 1.25; }
.insight-main.positive { color: var(--green); }
.insight-main.negative { color: var(--danger); }
.insight-detail { color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.insight-risk { justify-self: end; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 98%, transparent), color-mix(in srgb, var(--panel) 98%, transparent)); box-shadow: 0 18px 55px color-mix(in srgb, var(--panel) 22%, transparent); }
.chart-toolbar { min-height: 59px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); }
.chart-heading { min-width: 0; display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 12px; }
.chart-heading h2 { grid-column: 1 / -1; }
.chart-toolbar h2 { margin: 0 0 3px; font-size: 17px; }
.chart-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.chart-status { margin-top: 3px !important; color: var(--muted) !important; font-size: 11px !important; line-height: 1.25; }
.chart-status.error, .chart-status.limited { display: inline-block; padding: 3px 7px; border-radius: 5px; }
.chart-status.error { color: var(--danger) !important; background: rgba(190, 24, 93, .13); }
.chart-status.limited { color: var(--orange) !important; background: rgba(154, 52, 18, .13); }
.chart-controls { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.pane-controls { gap: 9px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.reference-control { display: flex; align-items: center; gap: 7px; }
.reference-control label { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.reference-control select { min-height: 32px; max-width: 230px; font-size: 11px; }

.chart-stage { position: relative; min-height: 480px; height: clamp(480px, 57vh, 700px); }
.chart-host { position: absolute; inset: 0; }
.chart-host:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .24); }
.chart-empty { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.chart-empty-content { width: min(430px, 100%); display: grid; justify-items: center; gap: 9px; padding: 24px; border: 1px solid rgba(76, 127, 166, .32); border-radius: 13px; background: radial-gradient(circle at 50% 0, rgba(56, 189, 248, .09), transparent 58%), color-mix(in srgb, var(--panel) 90%, transparent); box-shadow: 0 18px 48px color-mix(in srgb, var(--panel) 28%, transparent); }
.chart-empty-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(96, 165, 250, .46); border-radius: 50%; background: rgba(96, 165, 250, .1); color: var(--muted); font-size: 20px; font-weight: 900; }
.chart-empty-content strong { color: var(--text); font-size: 16px; }
.chart-empty-content p { max-width: 360px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.chart-empty-retry { margin-top: 4px; min-width: 112px; }
.chart-card.has-error-state .chart-empty-content { border-color: rgba(251, 113, 133, .34); background: radial-gradient(circle at 50% 0, rgba(251, 113, 133, .1), transparent 58%), color-mix(in srgb, var(--panel) 92%, transparent); }
.chart-card.has-error-state .chart-empty-icon { border-color: rgba(251, 113, 133, .55); background: rgba(251, 113, 133, .1); color: var(--danger); }
.chart-card.has-empty-state .chart-stage { min-height: 310px; height: clamp(310px, 42vh, 430px); }
.chart-card.has-empty-state .chart-controls, .chart-card.has-empty-state .lower-pane-label, .chart-card.has-empty-state .legend { display: none; }
.chart-card.has-empty-state.has-stale-analysis .chart-stage { height: auto; min-height: 0; }
.chart-card.has-stale-analysis .chart-empty { position: relative; }
.has-stale-analysis .chart-empty-content { width: min(620px, 100%); border-color: var(--orange); }
.has-stale-analysis .chart-empty-icon { color: var(--orange); border-color: currentColor; }
.has-stale-analysis .chart-empty-retry { min-height: 44px; }
.stale-analysis-members { display: grid; gap: 8px; width: 100%; margin: 5px 0; padding: 0; list-style: none; text-align: left; }
.stale-analysis-members li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.stale-analysis-members strong, .stale-analysis-members span { overflow-wrap: anywhere; }
.stale-analysis-members strong { font-size: 13px; }
.stale-analysis-members span { color: var(--muted); font-size: 12px; }
@media (max-width: 680px) {
  .stale-analysis-members li { grid-template-columns: minmax(0, 1fr); }
}
.lower-pane-label { position: absolute; left: 16px; bottom: 27%; z-index: 4; padding: 3px 7px; border-radius: 4px; background: color-mix(in srgb, var(--panel) 72%, transparent); color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .09em; pointer-events: none; }
.chart-tooltip { position: absolute; z-index: 8; width: min(310px, calc(100% - 20px)); overflow: hidden; border: 1px solid rgba(102, 164, 211, .55); border-radius: 11px; background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 98%, transparent), color-mix(in srgb, var(--panel) 98%, transparent)); box-shadow: 0 20px 55px color-mix(in srgb, var(--panel) 48%, transparent), 0 0 0 1px rgba(125, 211, 252, .06) inset; color: var(--text); pointer-events: none; backdrop-filter: blur(12px); }
.chart-tooltip[hidden] { display: none; }
.chart-tooltip::before { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: linear-gradient(180deg, #38bdf8, #8b5cf6 55%, #2dd4bf); content: ''; }
.chart-tooltip-header { display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 11px 13px 10px 16px; border-bottom: 1px solid rgba(102, 143, 177, .22); background: radial-gradient(circle at 12% 0, rgba(56, 189, 248, .15), transparent 55%); }
.chart-tooltip-header > div { min-width: 0; display: grid; gap: 2px; }
.chart-tooltip-header strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chart-tooltip-eyebrow { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.chart-tooltip-metric { flex: none; color: var(--muted); font-size: 9px; font-weight: 800; text-align: right; }
.chart-tooltip-list { display: grid; padding: 5px 7px 7px 10px; }
.chart-tooltip-row { min-width: 0; display: grid; grid-template-columns: 22px 8px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 36px; padding: 4px 6px; border-radius: 7px; }
.chart-tooltip-row + .chart-tooltip-row { border-top: 1px solid rgba(83, 121, 151, .13); }
.chart-tooltip-row.is-leader { background: linear-gradient(90deg, color-mix(in srgb, var(--tooltip-series-color) 14%, transparent), transparent); }
.chart-tooltip-rank { color: var(--muted); font-size: 9px; font-weight: 900; font-variant-numeric: tabular-nums; }
.chart-tooltip-row.is-leader .chart-tooltip-rank { color: var(--tooltip-series-color); }
.chart-tooltip-swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--tooltip-series-color); box-shadow: 0 0 10px color-mix(in srgb, var(--tooltip-series-color) 72%, transparent); }
.chart-tooltip-identity { min-width: 0; display: grid; line-height: 1.15; }
.chart-tooltip-identity strong { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chart-tooltip-identity span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.chart-tooltip-value { color: var(--text); font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums; }
.chart-tooltip-value.positive { color: var(--muted); }
.chart-tooltip-value.negative { color: var(--danger); }
.anomaly-banner { margin: 0 14px 8px; padding: 8px 10px; border: 1px solid rgba(251, 146, 60, .34); border-radius: 7px; background: rgba(154, 52, 18, .12); color: var(--orange); font-size: 12px; }

.edge-view {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 0, rgba(30, 73, 105, .22), transparent 38%), linear-gradient(180deg, var(--panel), var(--panel) 72%);
  box-shadow: 0 18px 55px color-mix(in srgb, var(--panel) 24%, transparent);
}
.edge-header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); }
.edge-eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.edge-title { margin: 0; font-size: 18px; line-height: 1.1; }
.edge-context { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.edge-data-status { color: var(--muted); }
.edge-latest { min-height: 34px; padding: 6px 11px; border: 1px solid #315575; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 11px; font-weight: 850; }
.edge-latest:hover { border-color: var(--muted); background: var(--panel); }
.edge-latest.is-at-latest,
.cluster-latest.is-at-latest { display: none; }

.edge-hero { min-height: 78px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .75fr) minmax(0, 1fr); align-items: center; gap: 16px; padding: 8px 18px; border-bottom: 1px solid rgba(70, 112, 148, .22); background: color-mix(in srgb, var(--panel) 68%, transparent); }
.edge-participant { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 2px 9px; padding-left: 12px; border-left: 3px solid var(--participant-color); }
.edge-participant:last-child { grid-template-columns: minmax(0, 1fr) auto; padding: 0 12px 0 0; border-right: 3px solid var(--participant-color); border-left: 0; text-align: right; }
.edge-participant:last-child .edge-participant-symbol { grid-column: 2; }
.edge-participant:last-child .edge-participant-name { grid-column: 1; grid-row: 1; }
.edge-participant:last-child .edge-participant-value { grid-column: 1 / -1; }
.edge-participant-symbol { color: var(--participant-color); font-size: 17px; }
.edge-participant-name { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.edge-participant-value { grid-column: 1 / -1; color: var(--text); font-size: clamp(22px, 2vw, 30px); font-weight: 900; font-variant-numeric: tabular-nums; }
.edge-hero-center { display: grid; justify-items: center; gap: 1px; text-align: center; }
.edge-hero-label { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.edge-hero-value { color: var(--text); font-size: clamp(19px, 1.75vw, 27px); font-weight: 900; font-variant-numeric: tabular-nums; }
.edge-hero-date { color: var(--muted); font-size: 10px; }
.edge-a-text { color: var(--edge-a); }
.edge-b-text { color: var(--edge-b); }

.edge-chart-shell { position: relative; width: 100%; height: auto; min-height: 300px; max-height: 560px; aspect-ratio: 10 / 3; border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--panel) 52%, transparent); }
.edge-chart { width: 100%; height: 100%; display: block; outline: none; }
.edge-chart:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.edge-grid-line { stroke: rgba(92, 126, 154, .18); stroke-width: 1; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.edge-grid-line.vertical { stroke: rgba(92, 126, 154, .12); }
.edge-zero-line { stroke: #8aa6bb; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.edge-axis-label, .edge-time-label { fill: #7891a5; font-size: 11px; font-weight: 650; }
.edge-zone-label { font-size: 11px; font-weight: 900; letter-spacing: .12em; opacity: .8; }
.edge-zone-a { fill: var(--edge-a); }
.edge-zone-b { fill: var(--edge-b); }
.edge-lead-area { fill: url(#edge-lead-gradient); opacity: .16; }
.edge-lead-line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.edge-selection-line { stroke: rgba(220, 233, 243, .72); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.edge-selection-dot { fill: var(--selection-color); stroke: #f8fbfd; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.edge-interaction-layer { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.edge-tooltip { position: absolute; top: 15px; z-index: 5; box-sizing: border-box; width: max-content; min-width: min(227px, calc(100% - 16px)); max-width: calc(100% - 16px); display: grid; gap: 5px; padding: 9px 10px; border: 1px solid #355572; border-radius: 8px; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: 0 12px 30px color-mix(in srgb, var(--panel) 38%, transparent); font-size: 11px; pointer-events: none; overflow-wrap: anywhere; }
.edge-tooltip > strong { color: var(--text); }
.edge-tooltip-row { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); }
.edge-tooltip-row > * { min-width: 0; }
.edge-tooltip-row strong { color: var(--text); font-variant-numeric: tabular-nums; }

.edge-statistics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); }
.edge-stat-card { min-height: 70px; display: grid; align-content: center; gap: 5px; padding: 10px 14px; border-right: 1px solid var(--line-soft); }
.edge-stat-card:last-child { border-right: 0; }
.edge-stat-card span { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.edge-stat-card strong { min-width: 0; color: var(--text); font-size: 15px; overflow-wrap: anywhere; }

.edge-supporting { display: grid; grid-template-columns: minmax(310px, .85fr) minmax(480px, 1.15fr); }
.edge-panel { min-width: 0; padding: 12px 14px 14px; }
.edge-panel + .edge-panel { border-left: 1px solid var(--line-soft); }
.edge-panel h3 { margin: 0 0 9px; color: var(--text); font-size: 13px; }
.edge-event-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.edge-event { min-width: 0; min-height: 44px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid rgba(70, 112, 148, .3); border-radius: 7px; background: color-mix(in srgb, var(--panel) 62%, transparent); color: var(--text); text-align: left; }
.edge-event:hover { border-color: rgba(96, 165, 250, .62); background: color-mix(in srgb, var(--panel) 72%, transparent); }
.edge-event-date { color: var(--muted); font-size: 10px; white-space: nowrap; }
.edge-event strong { font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.edge-event-value { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.edge-panel-empty { color: var(--muted); font-size: 12px; }
.edge-h2h-header, .edge-h2h-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(130px, .85fr) minmax(90px, 1fr); align-items: center; gap: 8px; text-align: center; }
.edge-h2h-header { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.edge-series-heading { color: var(--series-heading-color); }
.edge-h2h-row { min-height: 29px; border-top: 1px solid rgba(70, 112, 148, .17); color: var(--muted); font-size: 11px; }
.edge-h2h-row strong { color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.edge-h2h-row .is-advantage { color: var(--green); }
.edge-empty { min-height: 420px; display: grid; place-items: center; margin: 0; padding: 30px; color: var(--muted); text-align: center; }

.cluster-lens { position: relative; min-width: 0; display: grid; }
.cluster-header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 15px; border-bottom: 1px solid var(--line-soft); }
.cluster-eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.cluster-title { margin: 0; font-size: 19px; line-height: 1.12; }
.cluster-context, .cluster-panel-heading p, .cluster-panel-date, .cluster-cohesion-panel p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.cluster-header-actions { display: flex; align-items: center; gap: 8px; }
.cluster-status-pill { padding: 4px 7px; border: 1px solid #395a75; border-radius: 999px; color: var(--text); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.cluster-status-pill.incomplete { border-color: rgba(251, 191, 36, .45); background: rgba(146, 64, 14, .16); color: var(--orange); }
.cluster-latest, .cluster-filter-button { min-height: 32px; padding: 5px 10px; border: 1px solid #315575; border-radius: 7px; background: var(--panel); color: var(--text); font-size: 11px; font-weight: 850; }
.cluster-latest:hover, .cluster-filter-button:hover, .cluster-filter-button[aria-pressed="true"] { border-color: var(--muted); background: var(--panel); }
.cluster-data-quality { margin: 9px 14px; border: 1px solid var(--line); border-radius: 7px; background: color-mix(in srgb, var(--panel) 72%, transparent); color: var(--muted); font-size: 11px; }
.cluster-data-quality.has-issues { border-color: rgba(251, 191, 36, .32); }
.cluster-data-quality[open] { border-color: rgba(251, 191, 36, .42); }
.cluster-data-quality > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; color: var(--text); font-weight: 800; cursor: pointer; }
.cluster-quality-badge { margin-left: auto; padding: 2px 6px; border: 1px solid rgba(251, 191, 36, .34); border-radius: 999px; background: rgba(146, 64, 14, .16); color: var(--orange); font-size: 9px; font-weight: 900; letter-spacing: .03em; }
.cluster-quality-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; padding: 0 10px 10px; }
.cluster-quality-section { min-width: 0; }
.cluster-quality-section strong { color: var(--text); }
.cluster-quality-section ul { margin: 6px 0 0; padding-left: 18px; }
.cluster-quality-section li { overflow-wrap: anywhere; }
.cluster-anomaly-warnings { color: var(--orange); }
.cluster-anomaly-warnings strong { color: var(--orange); }
.cluster-anomaly-warnings p { margin: 6px 0 0; }

.cluster-hero { display: grid; grid-template-columns: minmax(290px, 1.75fr) repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--panel) 68%, transparent); }
.cluster-hero-card { min-width: 0; min-height: 94px; display: grid; align-content: center; gap: 5px; padding: 12px 14px; border-right: 1px solid var(--line-soft); }
.cluster-hero-card:last-child { border-right: 0; }
.cluster-hero-cluster { background: radial-gradient(circle at 0 0, rgba(96, 165, 250, .13), transparent 58%); }
.cluster-hero-label { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.cluster-hero-value { overflow: hidden; color: var(--text); font-size: clamp(18px, 1.65vw, 25px); font-weight: 900; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.cluster-hero-cluster .cluster-hero-value { font-size: clamp(26px, 2.4vw, 38px); }
.cluster-hero-meta { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; text-overflow: ellipsis; }
.cluster-lens .positive { color: var(--green); }
.cluster-lens .negative { color: var(--danger); }
.cluster-lens .neutral { color: var(--text); }
.cluster-insight { margin: 2px 0 0; color: var(--text); font-size: 12px; font-weight: 700; }

.cluster-chart-panel { min-width: 0; border-bottom: 1px solid var(--line-soft); }
.cluster-panel-heading { min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px; }
.cluster-panel-heading h3, .cluster-panel h3 { margin: 0; color: var(--text); font-size: 13px; }
.cluster-focus-controls { display: flex; gap: 5px; }
.cluster-chart-shell { position: relative; min-width: 0; overflow: hidden; background: color-mix(in srgb, var(--panel) 52%, transparent); }
.cluster-chart { width: 100%; display: block; outline: none; touch-action: pan-y; }
.cluster-chart:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.cluster-grid line { stroke: rgba(92, 126, 154, .2); stroke-width: 1; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.cluster-grid .cluster-zero-line { stroke: rgba(203, 222, 237, .52); stroke-dasharray: 2 3; }
.cluster-time-grid line { stroke: rgba(92, 126, 154, .12); stroke-width: 1; stroke-dasharray: 2 6; vector-effect: non-scaling-stroke; }
.cluster-grid text, .cluster-date-label { fill: #7891a5; font-size: 11px; font-weight: 650; }
.cluster-band { fill: rgba(96, 165, 250, .13); stroke: none; }
.cluster-median-line { fill: none; stroke: #8ca3b7; stroke-width: var(--cluster-median-line-width, 1.5); stroke-dasharray: 5 4; opacity: .8; vector-effect: non-scaling-stroke; }
.cluster-member-line { fill: none; stroke-width: var(--cluster-member-line-width, 1.5); stroke-linecap: round; stroke-linejoin: round; opacity: .42; vector-effect: non-scaling-stroke; transition: opacity 120ms ease, stroke-width 120ms ease; }
.cluster-member-line.focused { stroke-width: var(--cluster-focused-line-width, 3.5); opacity: 1; }
.cluster-member-line.dimmed { opacity: .08; }
.cluster-index-line { fill: none; stroke: #f8fafc; stroke-width: var(--cluster-index-line-width, 3); stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(248, 250, 252, .18)); vector-effect: non-scaling-stroke; }
.cluster-date-cursor { stroke: rgba(248, 250, 252, .7); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.cluster-label-rail { position: absolute; top: 0; right: 7px; bottom: 0; z-index: 2; width: 140px; pointer-events: none; }
.cluster-end-label { position: absolute; right: 0; width: 134px; min-height: 20px; display: block; padding: 2px 6px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--label-color) 45%, var(--panel)); border-radius: 4px; background: color-mix(in srgb, var(--label-color) 16%, color-mix(in srgb, var(--panel) 94%, transparent)); color: color-mix(in srgb, var(--label-color) 78%, white); font-size: 10px; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 15px; text-align: left; text-overflow: ellipsis; white-space: nowrap; pointer-events: auto; }
.cluster-end-label-index { border-color: rgba(248, 250, 252, .62); background: rgba(248, 250, 252, .12); color: var(--text); }
.cluster-tooltip { position: absolute; top: 10px; z-index: 4; width: min(390px, calc(100% - 24px)); max-height: calc(100% - 20px); overflow: auto; padding: 10px; border: 1px solid #3b6382; border-radius: 10px; background: color-mix(in srgb, var(--panel) 96%, transparent); box-shadow: 0 18px 48px color-mix(in srgb, var(--panel) 48%, transparent); color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none; transform: translateX(-10%); backdrop-filter: blur(10px); }
.cluster-tooltip-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 7px; border-bottom: 1px solid rgba(94, 139, 174, .25); }
.cluster-tooltip-ranking { display: grid; gap: 3px; margin-top: 6px; }
.cluster-tooltip-row { display: grid; grid-template-columns: 20px 8px minmax(120px, 1fr) auto auto; align-items: center; gap: 7px; min-height: 27px; }
.cluster-tooltip-rank { color: var(--muted); font-size: 10px; font-weight: 900; }
.cluster-tooltip-swatch, .cluster-rank-swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--series-color); box-shadow: 0 0 8px color-mix(in srgb, var(--series-color) 64%, transparent); }
.cluster-tooltip-identity { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; align-items: baseline; }
.cluster-tooltip-identity span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

.cluster-panels { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(260px, 360px); align-items: start; border-bottom: 1px solid var(--line-soft); }
.cluster-panel { min-width: 0; padding: 12px 14px 14px; }
.cluster-panel + .cluster-panel { border-left: 1px solid var(--line-soft); }
.cluster-ranking-list { display: grid; gap: 4px; margin-top: 9px; }
.cluster-ranking-row { width: 100%; min-width: 0; min-height: 39px; display: grid; grid-template-columns: 24px 8px minmax(150px, 1fr) auto minmax(118px, auto); align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; background: rgba(255, 255, 255, .018); color: var(--text); text-align: left; }
.cluster-ranking-row:hover, .cluster-ranking-row.focused { border-color: rgba(96, 165, 250, .48); background: rgba(28, 64, 96, .42); }
.cluster-ranking-row.dimmed { opacity: .38; }
.cluster-rank-number { color: var(--muted); font-size: 11px; font-weight: 900; }
.cluster-rank-identity { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 7px; }
.cluster-rank-ticker { font-size: 11px; }
.cluster-rank-name { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.cluster-ranking-row > strong, .cluster-ranking-row > span:last-child { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cluster-breadth-panel { display: grid; align-content: start; gap: 9px; }
.cluster-breadth-summary { margin-top: 7px; font-size: 22px; font-variant-numeric: tabular-nums; }
.cluster-breadth-track { height: 12px; display: flex; overflow: hidden; border-radius: 999px; background: rgba(111, 139, 161, .2); }
.cluster-breadth-segment { display: block; height: 100%; min-width: 0; transition: width .16s ease; }
.cluster-breadth-positive { background: linear-gradient(90deg, #22d3ee, #53e0a0); }
.cluster-breadth-neutral { background: #71879a; }
.cluster-breadth-negative { background: linear-gradient(90deg, #fb923c, #fb7185); }
.cluster-breadth-details { margin: 0; color: var(--muted); font-size: 11px; }

.cluster-dna-panel { border-bottom: 1px solid var(--line-soft); }
.cluster-dna-scroll { overflow-x: auto; padding: 0 14px 14px; }
.cluster-dna-table { width: 100%; min-width: 670px; border-collapse: separate; border-spacing: 3px; }
.cluster-dna-table th { color: var(--muted); font-size: 10px; font-weight: 850; text-align: center; }
.cluster-dna-table th:first-child { position: sticky; left: 0; z-index: 2; min-width: 150px; background: var(--panel); text-align: left; }
.cluster-dna-table tbody tr.dimmed { opacity: .34; }
.cluster-dna-table tbody tr.focused th:first-child { box-shadow: inset 3px 0 0 var(--series-color, var(--blue)); }
.cluster-dna-member { width: 100%; min-height: 34px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 6px; padding: 4px 7px; border: 0; border-left: 3px solid var(--series-color); border-radius: 5px; background: var(--panel); color: var(--text); font-size: 11px; font-weight: 900; text-align: left; }
.cluster-dna-member span { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.cluster-dna-cell { width: 100%; min-width: 54px; min-height: 34px; padding: 3px 5px; border: 1px solid transparent; border-radius: 5px; color: var(--text); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cluster-dna-cell:hover, .cluster-dna-cell.selected { border-color: rgba(248, 250, 252, .82); box-shadow: 0 0 0 1px color-mix(in srgb, var(--panel) 58%, transparent); }
.cluster-cohesion-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line-soft); }
.cluster-cohesion-copy { color: var(--muted) !important; font-size: 12px !important; }
.cluster-cohesion-value { color: var(--text); font-size: 21px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cluster-method { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 10px 14px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.cluster-method strong { color: var(--text); }
.cluster-method p { margin: 0; }
.cluster-method-copy { display: grid; gap: 3px; }
.cluster-incomplete { min-height: 420px; display: grid; place-content: center; justify-items: center; gap: 9px; padding: 30px; text-align: center; }
.cluster-incomplete h2, .cluster-incomplete p { margin: 0; }
.cluster-incomplete > p:not(.cluster-eyebrow) { max-width: 610px; color: var(--muted); font-size: 12px; }
.cluster-incomplete-meta { color: var(--orange) !important; }
.cluster-incomplete .cluster-data-quality { width: min(620px, 100%); text-align: left; }

.legend { border-top: 1px solid var(--line-soft); }
.legend-header, .legend-row { display: grid; grid-template-columns: minmax(190px, 1.5fr) repeat(7, minmax(82px, 1fr)); align-items: center; gap: 9px; padding: 7px 13px; }
.legend.spread-mode .legend-header, .legend.spread-mode .legend-row { grid-template-columns: minmax(190px, 1.5fr) repeat(8, minmax(82px, 1fr)); }
.legend:not(.spread-mode) .legend-header > :last-child, .legend:not(.spread-mode) .metric-difference { display: none; }
.legend-header { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.legend-row { min-height: 46px; border-top: 1px solid rgba(79, 112, 139, .16); background: rgba(255,255,255,.012); font-size: 12px; }
.legend-row:hover { background: rgba(96, 165, 250, .035); }
.legend-identity { min-width: 0; display: flex; align-items: center; gap: 9px; }
.legend-toggle { min-width: 24px; min-height: 24px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid color-mix(in srgb, var(--series-color) 52%, #284158); border-radius: 6px; background: color-mix(in srgb, var(--series-color) 10%, var(--panel)); }
.legend-toggle-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--series-color); box-shadow: 0 0 8px color-mix(in srgb, var(--series-color) 65%, transparent); }
.legend-toggle-label { display: none; }
.legend-row.hidden-series { opacity: .46; }
.legend-name { min-width: 0; }
.legend-name strong, .legend-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-name span { color: var(--muted); font-size: 11px; }
.legend-focus { position: relative; flex: 1; min-width: 0; padding: 3px 54px 3px 5px; border: 0; border-radius: 6px; background: transparent; color: inherit; text-align: left; }
.legend-name .legend-focus-cue { position: absolute; top: 50%; right: 5px; display: inline-flex; align-items: center; min-height: 20px; padding: 2px 6px; overflow: visible; border: 1px solid rgba(126, 161, 189, .28); border-radius: 999px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .05em; line-height: 1; text-transform: uppercase; transform: translateY(-50%); }
.legend-focus[aria-pressed="true"] .legend-focus-cue { border-color: color-mix(in srgb, var(--series-color) 62%, #29445b); background: color-mix(in srgb, var(--series-color) 13%, transparent); color: color-mix(in srgb, var(--series-color) 82%, white); }
.legend-focus:hover, .legend-focus:focus-visible, .legend-focus[aria-pressed="true"] { background: color-mix(in srgb, var(--series-color) 13%, transparent); }
.legend-row.focused-series { box-shadow: inset 3px 0 0 var(--series-color); }
.legend-row.dimmed-series { opacity: .58; }
.metric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-period, .metric-drawdown { font-size: 13px; font-weight: 800; }
.metric.positive { color: var(--green); }
.metric.negative { color: var(--danger); }
.metric.muted { color: var(--muted); }

.methodology { margin-top: 9px; border-left: 2px solid #2d5b7c; background: color-mix(in srgb, var(--panel) 76%, transparent); color: var(--muted); font-size: 11px; line-height: 1.45; }
.methodology > summary { padding: 8px 12px; color: var(--text); font-size: 12px; font-weight: 800; cursor: pointer; }
.methodology-content { padding: 0 13px 9px; }
.methodology p { margin: 0; }
.methodology p + p { margin-top: 3px; }
.credit { padding: 8px 4px 0; color: var(--muted); font-size: 10px; text-align: center; }
.credit a { color: var(--muted); }
.broadcast-sensor { display: none; }

html.broadcast-mode,
html.broadcast-mode body { height: 100%; overflow: hidden; }
html.broadcast-mode .control-shell {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  max-height: min(70vh, 540px);
  overflow: visible;
  transform: translateY(calc(-100% - 3px));
  visibility: hidden;
  pointer-events: none;
  transition: transform 170ms ease, visibility 0s linear 170ms;
}
html.broadcast-mode .control-shell.is-open,
html.broadcast-mode .control-shell:focus-within { transform: translateY(0); visibility: visible; pointer-events: auto; transition: transform 170ms ease; }
html.broadcast-mode .broadcast-sensor { display: block; position: fixed; top: 0; right: 0; left: 0; z-index: 999; width: 100%; height: 13px; padding: 0; border: 0; background: linear-gradient(90deg, transparent 10%, rgba(96,165,250,.8), transparent 90%) top / 100% 2px no-repeat; }
html.broadcast-mode .workspace { width: 100%; height: 100vh; min-height: 0; display: flex; flex-direction: column; padding: 0 8px 6px; }
html.broadcast-mode .broadcast-heading { flex: 0 0 48px; display: flex; align-items: center; justify-content: space-between; padding: 5px 12px 4px; border-bottom: 1px solid var(--line); }
html.broadcast-mode .broadcast-heading .eyebrow { display: none; }
html.broadcast-mode .broadcast-heading h1 { font-size: clamp(20px, 1.35vw, 24px); line-height: 1; }
html.broadcast-mode .broadcast-heading p:last-child { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1; }
.broadcast-chip { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 34px; height: 34px; padding: 0; border: 1px solid rgba(96,165,250,.48); border-radius: 50%; background: rgba(96,165,250,.06); color: var(--muted); }
.broadcast-chip:hover { border-color: rgba(96,165,250,.82); background: rgba(96,165,250,.14); color: var(--text); }
.broadcast-chip:focus-visible { outline: 2px solid var(--accent, #93c5fd); outline-offset: 3px; }
html.broadcast-mode .chart-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-radius: 5px; }
html.broadcast-mode .chart-toolbar { flex: 0 0 40px; min-height: 40px; padding: 4px 11px; }
html.broadcast-mode .chart-heading { display: flex; align-items: center; gap: 8px; }
html.broadcast-mode .chart-heading h2 { flex: 0 0 auto; margin: 0; }
html.broadcast-mode .chart-heading p { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.broadcast-mode .chart-toolbar .chart-heading p { margin-top: 1px; }
html.broadcast-mode .chart-controls { flex: 0 0 auto; }
html.broadcast-mode .chart-toolbar .segmented { padding: 2px; }
html.broadcast-mode .chart-toolbar .segmented button { min-height: 26px; padding: 3px 8px; font-size: 10px; white-space: nowrap; }
html.broadcast-mode .comparison-insight { flex: 0 0 38px; min-height: 38px; gap: 10px; margin-bottom: 4px; padding: 5px 10px; border-radius: 5px; }
html.broadcast-mode .insight-main { font-size: 12px; }
html.broadcast-mode .insight-detail, html.broadcast-mode .insight-risk { font-size: 10px; }
html.broadcast-mode .edge-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-radius: 5px; }
html.broadcast-mode .edge-view.cluster-edge-active { overflow: hidden; }
html.broadcast-mode .edge-header { flex: 0 0 52px; min-height: 52px; padding-block: 6px; }
html.broadcast-mode .edge-hero { flex: 0 0 72px; min-height: 72px; }
html.broadcast-mode .edge-chart-shell { flex: 1 1 auto; height: auto; min-height: 280px; max-height: none; aspect-ratio: auto; }
html.broadcast-mode .edge-axis-label,
html.broadcast-mode .edge-time-label,
html.broadcast-mode .edge-zone-label { font-size: calc(12px * var(--edge-label-scale, 1)); }
html.broadcast-mode .edge-stat-card { min-height: 58px; padding-block: 7px; }
html.broadcast-mode .edge-supporting { flex: 0 0 auto; }
html.broadcast-mode .edge-panel { padding-block: 8px 9px; }
html.broadcast-mode .edge-event { min-height: 36px; }
html.broadcast-mode .chart-stage { flex: 1 1 auto; min-height: 320px; height: auto; }
html.broadcast-mode .methodology { display: none; }
html.broadcast-mode .credit { flex: 0 0 15px; padding-top: 2px; font-size: 9px; }

@media (min-width: 681px) {
  html.broadcast-mode .legend {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    overflow: hidden;
    background: color-mix(in srgb, var(--panel) 72%, transparent);
  }
  html.broadcast-mode .legend-header { display: none; }
  html.broadcast-mode .legend-row,
  html.broadcast-mode .legend.spread-mode .legend-row {
    min-width: 0;
    min-height: 29px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    padding: 3px 7px;
    border: 1px solid rgba(70, 112, 148, .2);
    border-radius: 6px;
    background: rgba(255, 255, 255, .018);
  }
  html.broadcast-mode .legend-identity { gap: 5px; }
  html.broadcast-mode .legend-toggle { min-width: 18px; min-height: 18px; border-radius: 5px; }
  html.broadcast-mode .legend-toggle-swatch { width: 8px; height: 8px; }
  html.broadcast-mode .legend-focus { padding: 2px 3px; }
  html.broadcast-mode .legend-name strong { font-size: 11px; line-height: 1.25; white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip; }
  html.broadcast-mode .legend-name > span,
  html.broadcast-mode .legend-focus-cue,
  html.broadcast-mode .metric:not(.metric-period) { display: none; }
  html.broadcast-mode .metric-period { font-size: 12px; }

  html.broadcast-mode .cluster-lens {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) clamp(286px, 18vw, 350px);
    grid-template-rows: 46px minmax(58px, auto) minmax(0, 1fr);
    grid-template-areas:
      "cluster-header cluster-header"
      "cluster-hero cluster-hero"
      "cluster-chart cluster-rail";
    overflow: hidden;
  }
  html.broadcast-mode .cluster-header {
    grid-area: cluster-header;
    min-height: 0;
    gap: 10px;
    padding: 5px 12px;
  }
  html.broadcast-mode .cluster-header > div:first-child {
    display: none;
  }
  html.broadcast-mode .cluster-header { justify-content: flex-end; }
  html.broadcast-mode .cluster-eyebrow { display: none; }
  html.broadcast-mode .cluster-title { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
  html.broadcast-mode .cluster-context { overflow: hidden; margin: 0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  html.broadcast-mode .cluster-latest { min-height: 28px; padding: 4px 8px; }
  html.broadcast-mode .cluster-data-quality {
    position: absolute;
    top: 7px;
    right: 82px;
    z-index: 7;
    width: auto;
    margin: 0;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
  }
  html.broadcast-mode .cluster-data-quality > summary {
    min-height: 28px;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 10px;
    list-style: none;
  }
  html.broadcast-mode .cluster-data-quality > summary::-webkit-details-marker { display: none; }
  html.broadcast-mode .cluster-data-quality > summary::before { content: "ⓘ"; margin-right: 5px; color: var(--muted); }
  html.broadcast-mode .cluster-data-quality[open] { width: min(620px, calc(100% - 110px)); }
  html.broadcast-mode .cluster-data-quality[open] .cluster-quality-content {
    max-height: min(56vh, 430px);
    overflow: auto;
    padding: 9px 10px 10px;
    border-top: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--panel) 98%, transparent);
    box-shadow: 0 18px 48px color-mix(in srgb, var(--panel) 48%, transparent);
  }
  html.broadcast-mode .cluster-hero {
    grid-area: cluster-hero;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  html.broadcast-mode .cluster-hero-card {
    min-height: 0;
    align-content: center;
    gap: 1px;
    padding: 5px 11px;
  }
  html.broadcast-mode .cluster-hero-label { font-size: 9px; }
  html.broadcast-mode .cluster-hero-value,
  html.broadcast-mode .cluster-hero-cluster .cluster-hero-value { font-size: clamp(16px, 1.25vw, 21px); }
  html.broadcast-mode .cluster-hero-meta { font-size: 9px; line-height: 1.2; }
  html.broadcast-mode .cluster-insight { display: none; }
  html.broadcast-mode .cluster-chart-panel {
    grid-area: cluster-chart;
    min-height: 0;
    display: grid;
    grid-template-rows: 36px minmax(0, 1fr);
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
  }
  html.broadcast-mode .cluster-panel-heading { min-height: 0; padding: 4px 10px; }
  html.broadcast-mode .cluster-panel-heading p { margin-top: 1px; font-size: 9px; }
  html.broadcast-mode .cluster-filter-button { min-height: 27px; padding: 3px 8px; font-size: 10px; }
  html.broadcast-mode .cluster-chart-shell { height: 100%; min-height: 260px; }
  html.broadcast-mode .cluster-chart { height: 100%; min-height: 260px; }
  html.broadcast-mode .cluster-panels {
    grid-area: cluster-rail;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
    overflow: hidden;
    border-bottom: 0;
  }
  html.broadcast-mode .cluster-panel { padding: 7px 9px; }
  html.broadcast-mode .cluster-panel + .cluster-panel { border-top: 1px solid var(--line-soft); border-left: 0; }
  html.broadcast-mode .cluster-ranking-panel { min-height: 0; display: flex; flex-direction: column; }
  html.broadcast-mode .cluster-ranking-list { min-height: 0; gap: 2px; margin-top: 5px; overflow: hidden; }
  html.broadcast-mode .cluster-ranking-row {
    min-height: 29px;
    grid-template-columns: 16px 7px minmax(0, 1fr) auto minmax(72px, auto);
    gap: 5px;
    padding: 3px 5px;
  }
  html.broadcast-mode .cluster-rank-number,
  html.broadcast-mode .cluster-ranking-row > strong,
  html.broadcast-mode .cluster-ranking-row > span:last-child { font-size: 10px; }
  html.broadcast-mode .cluster-rank-identity { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 1px; }
  html.broadcast-mode .cluster-rank-ticker,
  html.broadcast-mode .cluster-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.broadcast-mode .cluster-rank-name { display: block; color: var(--muted); font-size: 9px; }
  html.broadcast-mode .cluster-breadth-panel { gap: 4px; }
  html.broadcast-mode .cluster-breadth-summary { margin-top: 1px; font-size: 17px; }
  html.broadcast-mode .cluster-breadth-track { height: 8px; }
  html.broadcast-mode .cluster-dna-panel,
  html.broadcast-mode .cluster-cohesion-panel,
  html.broadcast-mode .cluster-method { display: none; }
}

@media (max-width: 1120px) {
  .controls { flex-wrap: wrap; }
  .stock-picker { flex-basis: 100%; }
  .comparison-insight { grid-template-columns: minmax(180px, auto) 1fr; }
  .insight-risk { grid-column: 1 / -1; justify-self: start; }
  .chart-toolbar { align-items: flex-start; }
  .chart-heading { display: block; }
  .chart-controls { flex-wrap: wrap; }
  .legend { overflow-x: auto; }
  .legend-header, .legend-row { min-width: 1040px; }
  .edge-supporting { grid-template-columns: 1fr; }
  .edge-panel + .edge-panel { border-top: 1px solid var(--line-soft); border-left: 0; }
  .cluster-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cluster-hero-cluster { grid-column: 1 / -1; border-right: 0; }
  .cluster-hero-card:nth-child(n+2) { border-top: 1px solid var(--line-soft); }
  .cluster-hero-card:nth-child(3) { border-right: 0; }
  .cluster-hero-card:last-child { grid-column: 1 / -1; }
  .cluster-panels { grid-template-columns: 1fr; }
  .cluster-panel + .cluster-panel { border-top: 1px solid var(--line-soft); border-left: 0; }
}

@media (min-width: 681px) and (max-width: 1120px) {
  html.broadcast-mode .comparison-insight {
    grid-template-columns: minmax(140px, auto) minmax(0, 1fr) auto;
  }
  html.broadcast-mode .comparison-insight > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.broadcast-mode .insight-risk { grid-column: auto; justify-self: end; }
  html.broadcast-mode .chart-toolbar { align-items: center; }
  html.broadcast-mode .chart-heading { display: flex; align-items: center; gap: 8px; }
  html.broadcast-mode .chart-heading h2 { flex: 0 0 auto; margin: 0; }
  html.broadcast-mode .chart-heading p { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.broadcast-mode .cluster-hero { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html.broadcast-mode .cluster-hero-cluster { grid-column: auto; border-right: 1px solid var(--line-soft); }
  html.broadcast-mode .cluster-hero-card:nth-child(n+2) { border-top: 0; }
  html.broadcast-mode .cluster-hero-card:nth-child(3) { border-right: 1px solid var(--line-soft); }
  html.broadcast-mode .cluster-hero-card:last-child { grid-column: auto; }
}

@media (min-width: 681px) {
  .chart-tooltip { max-height: calc(100dvh - 20px); overflow-y: auto; }
  .controls.many-stocks { flex-wrap: wrap; }
  .controls.many-stocks .stock-picker { flex: 1 1 100%; }
  .controls.many-stocks .selected-stocks-shell { grid-column: 1 / -1; }
  .controls.many-stocks .stock-chip-focus > span:not(.swatch) { display: none; }
  .controls.many-stocks > .stock-picker + .control-group { margin-left: auto; }
}

@media (min-width: 1121px) {
  .app-header { min-height: 48px; padding-block: 4px 3px; }
  .heading-divider { height: 26px; }
  .eyebrow { margin-bottom: 0; font-size: 9px; }
  h1 { font-size: clamp(19px, 1.3vw, 24px); }
  .page-subtitle { margin-top: 0; font-size: 10px; }
  .controls { gap: 9px; padding-block: 3px 4px; }
  .stock-picker { grid-template-columns: auto minmax(220px, 1fr) auto minmax(180px, .9fr); gap: 6px; }
  .market-field label, .control-label { font-size: 10px; }
  .control-group { gap: 4px; }
  .controls.many-stocks { flex-wrap: nowrap; }
  .controls.many-stocks .stock-picker { flex: 1 1 620px; grid-template-columns: auto minmax(190px, 1fr) auto minmax(220px, 1fr); }
  .controls.many-stocks .selected-stocks-shell { grid-column: auto; }
  .controls.many-stocks > .stock-picker + .control-group { margin-left: 0; }
}

@media (min-width: 681px) and (max-width: 820px) {
  .stock-picker { grid-template-columns: auto minmax(190px, 1fr) auto; }
  .selected-stocks-shell { grid-column: 1 / -1; }
  .stock-chip-focus > span:not(.swatch) { display: none; }
  .cluster-label-rail { display: none; }
  .legend { overflow: visible; padding: 7px; background: color-mix(in srgb, var(--panel) 42%, transparent); }
  .legend-header { display: none; }
  .legend-row {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-bottom: 7px;
    padding: 11px;
    border: 1px solid rgba(70, 112, 148, .32);
    border-radius: 9px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 95%, transparent), color-mix(in srgb, var(--panel) 94%, transparent));
  }
  .legend-row:last-child { margin-bottom: 0; }
  .legend-identity { grid-column: 1 / -1; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
  .legend-toggle { min-width: 54px; padding: 0 7px; display: inline-flex; justify-content: center; gap: 5px; }
  .legend-toggle-label { display: inline; color: var(--text); font-size: 10px; font-weight: 800; }
  .legend-name { flex: 1; }
  .legend-name strong, .legend-name span { white-space: normal; overflow-wrap: anywhere; }
  .metric { min-width: 0; display: grid; gap: 2px; white-space: normal; font-size: 12px; }
  .metric::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .metric-period, .metric-drawdown { padding: 7px 8px; border-radius: 7px; background: rgba(255, 255, 255, .035); font-size: 15px; }
  .metric-difference { grid-column: 1 / -1; }
  html.broadcast-mode .chart-heading #chart-context { display: none; }
  html.broadcast-mode .pane-controls > span:first-child { display: none; }
  html.broadcast-mode .pane-controls .segmented { padding: 2px; }
  html.broadcast-mode .pane-controls .segmented button { min-height: 26px; padding: 3px 7px; font-size: 10px; white-space: nowrap; }
  html.broadcast-mode .legend { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; overflow: hidden; }
  html.broadcast-mode .legend-row,
  html.broadcast-mode .legend.spread-mode .legend-row {
    min-height: 29px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    margin-bottom: 0;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .018);
  }
  html.broadcast-mode .legend-identity { grid-column: auto; gap: 5px; padding-bottom: 0; border-bottom: 0; }
  html.broadcast-mode .legend-toggle { min-width: 18px; padding: 0; display: inline-grid; }
  html.broadcast-mode .legend-toggle-label { display: none; }
  html.broadcast-mode .legend-name span { white-space: nowrap; }
  html.broadcast-mode .metric { display: block; white-space: nowrap; }
  html.broadcast-mode .metric::before { content: none; }
  html.broadcast-mode .metric-period { padding: 0; background: transparent; font-size: 12px; }
}

@media (min-width: 821px) and (max-width: 1120px) {
  .controls.many-stocks .selected-stocks-shell { grid-column: auto; }
  .cluster-hero { grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(0, 1fr)); }
  .cluster-hero-cluster { grid-column: auto; border-right: 1px solid var(--line-soft); }
  .cluster-hero-card:nth-child(n+2) { border-top: 0; }
  .cluster-hero-card:nth-child(3) { border-right: 1px solid var(--line-soft); }
  .cluster-hero-card:last-child { grid-column: auto; }
}

@media (max-width: 680px) {
  html, body { overflow-x: clip; }
  .app-header, .controls, .workspace { width: min(100% - 16px, 1880px); }
  .app-header { min-height: 54px; align-items: flex-start; gap: 8px; }
  .app-header .heading-group > div { display: block; }
  .heading-divider { display: none; }
  .home-link { display: none; }
  .header-actions { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 5px; }
  h1 { font-size: 21px; }
  .page-subtitle { display: none; }
  .controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 6px; }
  .stock-picker { grid-column: 1 / -1; display: grid; grid-template-columns: 112px minmax(0, 1fr); width: 100%; }
  .market-field select { width: 100%; min-width: 0; }
  .search-wrap { min-width: 0; }
  .cluster-picker { grid-column: 1 / -1; justify-self: stretch; }
  .cluster-trigger { width: 100%; max-width: none; min-height: 40px; }
  .cluster-dialog { width: calc(100vw - 12px); height: calc(100dvh - 12px); border-radius: 13px; }
  .cluster-dialog-surface { gap: 9px; padding: 13px; }
  .cluster-dialog-header h2 { font-size: 20px; }
  .cluster-category-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .cluster-category-filters::-webkit-scrollbar { display: none; }
  .cluster-category { flex: 0 0 auto; min-height: 40px; }
  .cluster-search { min-height: 44px; }
  .custom-cluster-toolbar { align-items: stretch; flex-direction: column; gap: 5px; }
  .custom-cluster-toolbar .button { width: 100%; min-height: 40px; }
  .custom-cluster-status { min-height: 16px; white-space: normal; }
  .custom-cluster-form { grid-template-columns: 1fr 1fr; }
  .custom-cluster-name-field,
  .custom-cluster-form-actions { grid-column: 1 / -1; }
  .custom-cluster-form-actions .button { flex: 1; min-height: 40px; }
  .cluster-options { grid-template-columns: 1fr; }
  .cluster-option { min-height: 132px; }
  .selected-stocks-shell { grid-column: 1 / -1; min-height: 40px; }
  .selected-stocks { min-height: 40px; padding: 3px; scroll-snap-type: x proximity; }
  .stock-chip { min-width: 0; max-width: 100%; }
  .stock-chip { scroll-snap-align: start; }
  .stock-chip-focus > span:not(.swatch) { display: none; }
  .stock-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .control-group { min-width: 0; }
  .controls > .period-control { grid-column: 1 / -1; width: 100%; }
  #period-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  #period-buttons button { min-width: 44px; min-height: 44px; }
  .controls > .control-group .segmented button { padding-inline: 9px; }
  .view-options { grid-column: auto; justify-self: end; }
  .view-mode-control { align-self: end; }
  .view-options-panel { width: min(270px, calc(100vw - 20px)); }
  .workspace { padding-top: 7px; }
  .comparison-insight { min-height: 0; grid-template-columns: 1fr; gap: 3px; padding: 9px 11px; }
  .insight-main { font-size: 13px; }
  .insight-detail, .insight-risk { justify-self: start; font-size: 11px; }
  .chart-toolbar { min-height: 0; align-items: stretch; flex-direction: column; gap: 8px; padding: 9px 10px; }
  .chart-controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 152px); align-items: end; gap: 8px; }
  .pane-controls { min-width: 0; align-items: flex-start; flex-direction: column; gap: 4px; }
  .pane-controls .segmented button { padding-inline: 8px; font-size: 11px; }
  .reference-control { min-width: 0; align-items: flex-start; flex-direction: column; gap: 4px; }
  .reference-control select { width: 100%; max-width: none; }
  .chart-stage { min-height: 430px; height: 54svh; }
  .chart-card.has-empty-state .chart-stage { min-height: 290px; height: 38svh; }
  .chart-empty { padding: 16px; }
  .chart-empty-content { padding: 20px 16px; }
  .chart-tooltip-mobile { position: fixed; top: auto; right: auto; bottom: 12px; left: 50%; z-index: 120; width: min(320px, calc(100vw - 24px)); max-height: min(34svh, 260px); overflow-y: auto; transform: translateX(-50%); overscroll-behavior: contain; }
  .chart-tooltip-mobile .chart-tooltip-header { position: sticky; top: 0; z-index: 1; padding-block: 9px 8px; background: radial-gradient(circle at 12% 0, rgba(56, 189, 248, .18), transparent 55%), color-mix(in srgb, var(--panel) 98%, transparent); }
  .chart-tooltip-mobile .chart-tooltip-list { padding-block: 4px 5px; }
  .chart-tooltip-mobile .chart-tooltip-row { min-height: 25px; padding-block: 2px; }
  .chart-tooltip-mobile .chart-tooltip-identity > span { display: none; }
  .edge-header { min-height: 54px; }
  .edge-context { max-width: 245px; }
  .edge-hero { min-height: 146px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 11px; }
  .edge-hero-center { grid-column: 1 / -1; grid-row: 1; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
  .edge-participant { grid-row: 2; }
  .edge-participant-symbol { font-size: 14px; }
  .edge-participant-name { display: none; }
  .edge-participant-value { font-size: 21px; }
  .edge-chart-shell { height: auto; min-height: 0; max-height: none; aspect-ratio: 48 / 43; }
  .edge-axis-label { font-size: 13px; }
  .edge-time-label { font-size: 12px; }
  .edge-zone-label { font-size: 11px; }
  .edge-tooltip { top: 10px; min-width: min(215px, calc(100% - 24px)); }
  .edge-statistics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edge-stat-card { min-height: 66px; border-bottom: 1px solid var(--line-soft); }
  .edge-stat-card:nth-child(2) { border-right: 0; }
  .edge-event-list { grid-template-columns: 1fr; }
  .edge-h2h-header, .edge-h2h-row { grid-template-columns: minmax(75px, 1fr) minmax(100px, 1.15fr) minmax(75px, 1fr); }
  .cluster-header { align-items: flex-start; padding: 10px 11px; }
  .cluster-context { line-height: 1.45; }
  .cluster-header-actions { flex-direction: column; align-items: flex-end; }
  .cluster-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cluster-hero-card { min-height: 64px; padding: 8px; border-top: 1px solid var(--line-soft); }
  .cluster-hero-card:nth-child(1) { grid-column: 1 / -1; border-top: 0; border-right: 0; }
  .cluster-hero-card:nth-child(3) { border-right: 1px solid var(--line-soft); }
  .cluster-hero-card:last-child { grid-column: auto; }
  .cluster-hero-label { font-size: 9px; }
  .cluster-hero-value { font-size: 16px; }
  .cluster-hero-meta { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .cluster-panel-heading { align-items: flex-start; flex-direction: column; }
  .cluster-focus-controls { width: 100%; }
  .cluster-filter-button { flex: 1; }
  .cluster-chart-shell { overflow: hidden; }
  .cluster-label-rail { display: none; }
  .cluster-tooltip { left: auto !important; right: 8px; max-width: calc(100% - 16px); transform: none; }
  .cluster-latest, .cluster-filter-button, .cluster-dna-cell, .cluster-dna-member { min-height: 40px; }
  .cluster-ranking-row { grid-template-columns: 20px 8px minmax(90px, 1fr) auto; }
  .cluster-ranking-row > span:last-child { grid-column: 3 / -1; }
  .cluster-cohesion-panel { align-items: flex-start; flex-direction: column; gap: 9px; }
  .cluster-method { grid-template-columns: 1fr; gap: 5px; }
  .legend { overflow: visible; padding: 7px; background: color-mix(in srgb, var(--panel) 42%, transparent); }
  .legend-header { display: none; }
  .legend-row {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-bottom: 7px;
    padding: 11px;
    border: 1px solid rgba(70, 112, 148, .32);
    border-radius: 9px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 95%, transparent), color-mix(in srgb, var(--panel) 94%, transparent));
  }
  .legend-row:last-child { margin-bottom: 0; }
  .legend-identity { grid-column: 1 / -1; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
  .legend-toggle { min-width: 54px; padding: 0 7px; display: inline-flex; justify-content: center; gap: 5px; }
  .legend-toggle-label { display: inline; color: var(--text); font-size: 10px; font-weight: 800; }
  .legend-name { flex: 1; }
  .legend-name strong, .legend-name span { white-space: normal; overflow-wrap: anywhere; }
  .metric { min-width: 0; display: grid; gap: 2px; white-space: normal; font-size: 12px; }
  .metric::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .metric-period, .metric-drawdown { padding: 7px 8px; border-radius: 7px; background: rgba(255, 255, 255, .035); font-size: 15px; }
  .metric-difference { grid-column: 1 / -1; }
  .methodology > summary { min-height: 40px; }
  .credit { font-size: 9px; }
  html.broadcast-mode, html.broadcast-mode body { height: auto; overflow-y: auto; }
  html.broadcast-mode .workspace { height: auto; min-height: 100svh; }
  html.broadcast-mode .broadcast-heading { flex-basis: 62px; }
  html.broadcast-mode .broadcast-heading h1 { font-size: 24px; }
  html.broadcast-mode .comparison-insight { flex-basis: auto; }
  html.broadcast-mode .edge-view { display: block; }
  html.broadcast-mode .edge-hero { min-height: 138px; }
  html.broadcast-mode .edge-chart-shell { height: 52svh; min-height: 330px; }
  html.broadcast-mode .chart-stage { height: 58svh; min-height: 430px; }
  html.broadcast-mode .chart-card.has-empty-state .chart-stage { height: 52svh; min-height: 330px; }
  html.broadcast-mode .legend-header, html.broadcast-mode .legend-row { min-width: 0; }
}

@media (max-width: 359px) {
  body { min-width: 0; }
  .app-header { gap: 5px; }
  .app-header h1 { font-size: 19px; }
  .header-actions .button { min-height: 32px; padding: 5px 8px; font-size: 11px; }
  .language-link { min-width: 32px; padding: 6px; font-size: 11px; }
  .controls { grid-template-columns: minmax(0, 1fr) auto; }
  .view-options { grid-column: 2; }
  .cluster-header { align-items: center; gap: 6px; }
  .cluster-header .cluster-eyebrow,
  .cluster-context { display: none; }
  .cluster-header-actions { flex-direction: row; }
  .cluster-data-quality { margin: 6px 8px; }
  .cluster-hero-meta { display: none; }
  .cluster-insight { margin: 0; font-size: 10px; }
  .cluster-panel-heading { gap: 6px; padding: 6px 8px; }
  .cluster-panel-heading p { display: none; }
}

@media (min-width: 681px) and (max-height: 820px) {
  html.broadcast-mode .broadcast-heading { flex-basis: 40px; padding-block: 4px 3px; }
  html.broadcast-mode .broadcast-heading h1 { font-size: 21px; }
  html.broadcast-mode .edge-header { flex-basis: 45px; min-height: 45px; padding-block: 4px; }
  html.broadcast-mode .edge-eyebrow { display: none; }
  html.broadcast-mode .edge-hero { flex-basis: 62px; min-height: 62px; padding-block: 5px; }
  html.broadcast-mode .edge-chart-shell { min-height: 235px; }
  html.broadcast-mode .edge-stat-card { min-height: 50px; padding-block: 5px; }
  html.broadcast-mode .edge-panel { padding-block: 7px; }
  html.broadcast-mode .edge-panel h3 { margin-bottom: 6px; }
  html.broadcast-mode .edge-event { min-height: 32px; padding-block: 5px; }
  html.broadcast-mode .edge-h2h-row { min-height: 25px; }
  html.broadcast-mode .cluster-lens { grid-template-rows: 42px 52px minmax(0, 1fr); }
  html.broadcast-mode .cluster-chart-panel { grid-template-rows: 32px minmax(0, 1fr); }
  html.broadcast-mode .cluster-data-quality { top: 5px; }
  html.broadcast-mode .cluster-hero-meta { display: none; }
  html.broadcast-mode .cluster-ranking-row { min-height: 25px; }
  html.broadcast-mode .cluster-ranking-row > span:last-child { display: none; }
  html.broadcast-mode .cluster-ranking-row { grid-template-columns: 15px 7px minmax(0, 1fr) auto; }
  html.broadcast-mode .cluster-breadth-details { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html.broadcast-mode .control-shell { transition: none; }
  .cluster-member-line { transition: none; }
  .cluster-trigger-icon { transition: none; }
}

/* Routine provenance stays below the analysis; exceptional warnings stay above. */
.analysis-notices { display: grid; gap: 4px; margin: 0 0 8px; min-width: 0; }
.analysis-notices p { margin: 0; }
.history-verification-notice { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--orange); background: var(--panel-strong); font-size: 12px; line-height: 1.5; }
.price-return-disclosure { color: var(--muted); font-size: 12px; line-height: 1.45; }
.data-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; margin-top: 9px; padding: 8px 3px 0; border-top: 1px solid var(--line-soft); }
.data-footer-meta { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 12px; }
.data-footer-meta p { margin: 0; font-size: 11px; }
.data-footer .series-quality[open] { grid-column: 1 / -1; }
.currency-notice { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-strong); font-size: 12px; line-height: 1.5; }
.analysis-notices .anomaly-banner { margin: 0; line-height: 1.5; }
.series-quality { color: var(--muted); font-size: 11px; }
.series-quality > summary { min-height: 26px; cursor: pointer; width: fit-content; }
.series-quality-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 8px; padding: 7px 0; }
.series-quality-item { min-width: 0; display: grid; gap: 3px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); overflow-wrap: anywhere; }
.series-quality-item strong { color: var(--text); }
.series-quality-warning { color: var(--orange); }
.comparison-insight.duel-insight { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 16px; padding: 10px 14px; border-inline-start: 3px solid var(--accent); }
.duel-insight .insight-main { font-size: 18px; color: var(--text); }
.duel-insight .insight-detail { grid-column: 1; font-size: 13px; }
.duel-insight .insight-risk { grid-column: 2; grid-row: 1 / 3; max-width: 350px; font-size: 12px; line-height: 1.45; }
.edge-zero-guide { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.edge-header { align-items: flex-start; }
.edge-lead-days { display: grid; gap: 4px; }
.edge-lead-day-row { min-width: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1px 6px; }
.edge-stat-card .edge-lead-day-name { font-size: 12px; }
.edge-stat-card .edge-lead-day-value { color: var(--text); font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.edge-stat-card .edge-lead-day-tie strong, .edge-stat-card .edge-lead-day-tie span { color: var(--muted); font-size: 10px; }
.edge-stat-detail { font-size: 10px; line-height: 1.35; color: var(--muted); }
.edge-event-copy { min-width: 0; display: grid; gap: 3px; }
.edge-event-detail { font-size: 11px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.edge-stat-scope { margin: 0; padding: 8px 14px 0; color: var(--muted); font-size: 12px; }
.edge-period-scope { margin: 0 0 9px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.edge-panel-heading { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 9px; }
.edge-panel-heading h3 { margin: 0; }
.volatility-help { margin: 8px 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.volatility-help summary { cursor: pointer; padding-block: 6px; }
.volatility-help p { margin: 5px 0; }
.edge-panel-heading .volatility-help { margin: 0; }
.edge-panel-heading .volatility-help[open] { flex-basis: 100%; }
@media (max-width: 680px) {
  .volatility-help summary { min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; }
  .volatility-help summary::before { content: '▸'; }
  .volatility-help[open] summary::before { content: '▾'; }
  .volatility-help summary::-webkit-details-marker { display: none; }
  .edge-event-date, .edge-event-value, .edge-stat-detail { font-size: 11px; }
}
.edge-h2h-value { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.edge-advantage-mark { font-size: 11px; }

/* One legend DOM keeps focus, visibility and point-in-time metrics intact. */
html:not(.broadcast-mode) .duel-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; overflow: visible; }
html:not(.broadcast-mode) .duel-legend .legend-header { display: none; }
html:not(.broadcast-mode) .duel-legend .legend-row,
html:not(.broadcast-mode) .duel-legend.spread-mode .legend-row { min-width: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 12px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; border-top: 2px solid var(--series-color); }
html:not(.broadcast-mode) .duel-legend .legend-identity { grid-column: 1 / -1; order: 0; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
html:not(.broadcast-mode) .duel-legend .legend-name { flex: 1; }
html:not(.broadcast-mode) .duel-legend .legend-name strong { font-size: 14px; }
html:not(.broadcast-mode) .duel-legend .metric { min-width: 0; display: grid; gap: 3px; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
html:not(.broadcast-mode) .duel-legend .metric::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 650; }
html:not(.broadcast-mode) .duel-legend .metric-period { order: 1; }
html:not(.broadcast-mode) .duel-legend .metric-drawdown { order: 2; }
html:not(.broadcast-mode) .duel-legend .metric-momentum { order: 3; }
html:not(.broadcast-mode) .duel-legend .metric-volatility { order: 4; }
html:not(.broadcast-mode) .duel-legend :is(.metric-period, .metric-drawdown) { padding: 5px 7px; border-radius: 6px; font-size: 17px; background: var(--panel-strong); }
html:not(.broadcast-mode) .duel-legend .metric-date { order: 5; }
html:not(.broadcast-mode) .duel-legend .metric-price { order: 6; }
html:not(.broadcast-mode) .duel-legend .metric-day { order: 7; }
html:not(.broadcast-mode) .duel-legend .metric-difference { order: 8; grid-column: auto; }
html:not(.broadcast-mode) .duel-legend:not(.spread-mode) .metric-difference { display: none; }
@media (min-width: 821px) {
  html:not(.broadcast-mode) .chart-card.two-stock-layout { display: flex; flex-direction: column; }
}
@media (max-width: 820px) {
  html:not(.broadcast-mode) .duel-legend { grid-template-columns: 1fr; }
  html:not(.broadcast-mode) .duel-legend .legend-row,
  html:not(.broadcast-mode) .duel-legend.spread-mode .legend-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-insight.duel-insight { grid-template-columns: 1fr; }
  .duel-insight .insight-risk { grid-column: 1; grid-row: auto; justify-self: start; max-width: none; }
}
@media (max-width: 680px) {
  .series-quality > summary { min-height: 44px; display: flex; align-items: center; }
  .series-quality > summary::before { content: '▸'; margin-inline-end: 6px; }
  .series-quality[open] > summary::before { content: '▾'; }
  .series-quality > summary { list-style: none; }
  .series-quality > summary::-webkit-details-marker { display: none; }
  .edge-h2h-header, .edge-h2h-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 5px; }
  .edge-h2h-row > span { overflow-wrap: anywhere; }
  .edge-stat-card { padding-inline: 10px; }
  .edge-stat-card strong { font-size: 13px; }
}
html.broadcast-mode .analysis-notices { flex: 0 0 auto; gap: 2px; margin-bottom: 4px; }
html.broadcast-mode .series-quality { position: relative; }
html.broadcast-mode .data-footer { flex: 0 0 auto; margin-top: 4px; padding-top: 3px; }
html.broadcast-mode .data-footer-meta p { font-size: 10px; }
html.broadcast-mode .data-footer .series-quality[open] { grid-column: auto; }
html.broadcast-mode .series-quality[open] .series-quality-items { position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 20; width: min(780px, calc(100vw - 28px)); max-height: min(240px, 40vh); overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 10px 28px #0005; }
html.broadcast-mode .price-return-disclosure { font-size: 10px; }
html.broadcast-mode .series-quality > summary { min-height: 20px; }
html.broadcast-mode .comparison-insight.duel-insight { flex-basis: auto; padding: 6px 10px; }
html.broadcast-mode .duel-insight .insight-main { font-size: 14px; }
html.broadcast-mode .edge-header { flex-basis: auto; }
html.broadcast-mode .edge-view:not(.cluster-edge-active) { overflow-y: auto; }
html.broadcast-mode .edge-statistics { flex: 0 0 auto; }
html.broadcast-mode .edge-stat-scope { padding-top: 4px; }
/* Help expands over the chart rather than hiding the fixed-height analysis. */
html.broadcast-mode .volatility-help { position: relative; flex: 0 0 auto; }
html.broadcast-mode .edge-panel-heading .volatility-help { position: static; }
html.broadcast-mode .edge-panel-heading .volatility-help[open] { flex-basis: auto; }
html.broadcast-mode .volatility-help[open] p { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 10; width: min(440px, 100%); max-height: min(220px, 40vh); overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 10px 28px #0005; color: var(--text); }
@media (min-width: 681px) and (max-height: 850px) {
  html.broadcast-mode .edge-chart-shell { min-height: 160px; }
}
/* A blocked analysis must fit long company names and every selected member. */
html.broadcast-mode .chart-card.has-stale-analysis { overflow-y: auto; }
html.broadcast-mode .chart-card.has-empty-state.has-stale-analysis .chart-stage { height: auto; min-height: 0; flex: 0 0 auto; }

/* Presentation is viewed at a distance. Keep the chart and its financial
   context readable together, while allowing exceptional/long content to scroll. */
@media (min-width: 681px) {
  html.broadcast-mode .workspace { overflow-y: auto; }
  html.broadcast-mode .broadcast-heading { flex-basis: auto; min-height: 64px; gap: 16px; padding: 8px 12px; }
  html.broadcast-mode .broadcast-heading h1 { font-size: clamp(26px, 2vw, 38px); line-height: 1.1; }
  html.broadcast-mode .broadcast-heading p:last-child { margin-top: 4px; font-size: clamp(13px, .85vw, 17px); line-height: 1.25; }
  html.broadcast-mode .broadcast-chip { width: 40px; height: 40px; }
  html.broadcast-mode .comparison-insight { flex-basis: auto; min-height: 48px; padding: 7px 12px; }
  html.broadcast-mode .insight-main,
  html.broadcast-mode .duel-insight .insight-main { font-size: clamp(16px, 1.05vw, 21px); }
  html.broadcast-mode .insight-detail,
  html.broadcast-mode .insight-risk { font-size: clamp(13px, .85vw, 17px); line-height: 1.35; }
  html.broadcast-mode .comparison-insight > * { white-space: normal; overflow: visible; }
  html.broadcast-mode .chart-card { flex-shrink: 0; }
  html.broadcast-mode .chart-toolbar { flex-basis: auto; min-height: 54px; flex-wrap: wrap; gap: 6px 16px; padding: 7px 12px; }
  html.broadcast-mode .chart-heading { display: grid; gap: 3px; }
  html.broadcast-mode .chart-heading h2 { font-size: clamp(17px, 1vw, 20px); }
  html.broadcast-mode .chart-heading #chart-context { display: block; overflow: visible; white-space: normal; font-size: clamp(13px, .8vw, 16px); line-height: 1.3; }
  html.broadcast-mode .chart-toolbar .segmented button { min-height: 32px; font-size: 13px; }
  html.broadcast-mode .pane-controls > span:first-child,
  html.broadcast-mode .lower-pane-label { font-size: clamp(12px, .8vw, 16px); }
  html.broadcast-mode .legend { gap: 6px; padding: 6px; }
  html.broadcast-mode .legend.duel-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.broadcast-mode .legend-row,
  html.broadcast-mode .legend.spread-mode .legend-row { min-height: 44px; padding: 5px 9px; }
  html.broadcast-mode .legend-toggle { min-width: 28px; min-height: 28px; }
  html.broadcast-mode .legend-toggle-swatch { width: 11px; height: 11px; }
  html.broadcast-mode .legend-focus { min-height: 28px; }
  html.broadcast-mode .legend-name strong { font-size: clamp(15px, .95vw, 19px); }
  html.broadcast-mode .metric-period { font-size: clamp(19px, 1.3vw, 25px); font-weight: 800; }
  html.broadcast-mode .volatility-help { font-size: 13px; }
  html.broadcast-mode .data-footer-meta p,
  html.broadcast-mode .price-return-disclosure,
  html.broadcast-mode .series-quality > summary,
  html.broadcast-mode .credit { font-size: clamp(11px, .7vw, 14px); }
  html.broadcast-mode .series-quality > summary { min-height: 28px; }
  html.broadcast-mode .currency-notice,
  html.broadcast-mode .history-verification-notice { font-size: clamp(13px, .85vw, 17px); }
  html.broadcast-mode .edge-axis-label,
  html.broadcast-mode .edge-time-label,
  html.broadcast-mode .edge-zone-label { font-size: calc(14px * var(--edge-label-scale, 1)); }
  html.broadcast-mode .edge-hero-label,
  html.broadcast-mode .edge-hero-date { font-size: 13px; }
  html.broadcast-mode .edge-hero { flex: 0 0 auto; min-height: min-content; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr) minmax(0, 1fr); }
  html.broadcast-mode .edge-participant,
  html.broadcast-mode .edge-participant:last-child { grid-template-columns: minmax(0, 1fr); align-content: start; }
  html.broadcast-mode .edge-participant:last-child .edge-participant-symbol { grid-column: 1; }
  html.broadcast-mode .edge-participant-symbol { font-size: clamp(17px, 1.2vw, 23px); white-space: normal; overflow-wrap: anywhere; }
  html.broadcast-mode .edge-hero-label,
  html.broadcast-mode .edge-series-heading,
  html.broadcast-mode .edge-stat-card strong { overflow-wrap: anywhere; }
  html.broadcast-mode .edge-tooltip { max-height: calc(100% - 20px); overflow-y: auto; font-size: 13px; }
  html.broadcast-mode .cluster-lens { grid-template-rows: 46px auto minmax(0, 1fr); }
  html.broadcast-mode .cluster-hero-value,
  html.broadcast-mode .cluster-hero-meta,
  html.broadcast-mode .cluster-rank-ticker { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
  html.broadcast-mode .cluster-chart-panel,
  html.broadcast-mode .cluster-panels,
  html.broadcast-mode .cluster-ranking-list { overflow: auto; }
  html.broadcast-mode .cluster-end-label { width: 100%; white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip; font-size: 12px; line-height: 16px; }
  html.broadcast-mode .cluster-tooltip-identity,
  html.broadcast-mode .cluster-dna-member { grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; }
  html.broadcast-mode .cluster-hero-label,
  html.broadcast-mode .cluster-hero-meta { font-size: 12px; }
  html.broadcast-mode .cluster-hero-value,
  html.broadcast-mode .cluster-hero-cluster .cluster-hero-value { font-size: clamp(21px, 1.5vw, 28px); }
  html.broadcast-mode .cluster-rank-number,
  html.broadcast-mode .cluster-ranking-row > strong,
  html.broadcast-mode .cluster-ranking-row > span:last-child { font-size: 12px; }
  html.broadcast-mode .cluster-rank-name { font-size: 11px; }
}

/* Distance-readable Edge and Cluster presentation; normal and touch layouts
   retain their existing density. SVG label sizes are compensated in the renderer. */
@media (min-width: 681px) {
  html.broadcast-mode { --tv-copy: clamp(16px, 1.05vw, 24px); --tv-axis: clamp(16px, 1vw, 23px); }
  html.broadcast-mode .edge-header { flex: 0 0 auto; min-height: 66px; }
  html.broadcast-mode .edge-title { font-size: clamp(22px, 1.4vw, 32px); }
  html.broadcast-mode .edge-context,
  html.broadcast-mode .edge-zero-guide,
  html.broadcast-mode .edge-latest { font-size: var(--tv-copy); }
  html.broadcast-mode .edge-hero { padding: 12px 18px; }
  html.broadcast-mode .edge-participant-symbol { font-size: clamp(22px, 1.4vw, 32px); overflow-wrap: break-word; }
  html.broadcast-mode .edge-participant-value { font-size: clamp(34px, 2.2vw, 52px); }
  html.broadcast-mode .edge-hero-value { font-size: clamp(30px, 2vw, 48px); }
  html.broadcast-mode .edge-hero-label,
  html.broadcast-mode .edge-hero-date { font-size: var(--tv-copy); line-height: 1.35; }
  html.broadcast-mode .edge-chart-shell { flex: 1 0 320px; min-height: 320px; }
  html.broadcast-mode .edge-axis-label,
  html.broadcast-mode .edge-time-label,
  html.broadcast-mode .edge-zone-label { font-size: calc(var(--tv-axis) * var(--edge-label-scale, 1)); }
  html.broadcast-mode .edge-broadcast-details { flex: 0 0 auto; border-top: 1px solid var(--line-soft); }
  html.broadcast-mode .edge-broadcast-details > summary { min-height: 48px; padding: 12px 18px; cursor: pointer; font-size: var(--tv-copy); }
  html.broadcast-mode .edge-broadcast-details > summary span { margin-left: 18px; color: var(--muted); }
  html.broadcast-mode .edge-broadcast-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
  html.broadcast-mode .edge-stat-scope,
  html.broadcast-mode .edge-stat-card span,
  html.broadcast-mode .edge-supporting h3,
  html.broadcast-mode .edge-event-date,
  html.broadcast-mode .edge-event strong,
  html.broadcast-mode .edge-event-value,
  html.broadcast-mode .edge-head-to-head th,
  html.broadcast-mode .edge-head-to-head td,
  html.broadcast-mode .edge-series-heading,
  html.broadcast-mode .edge-head-to-head .volatility-help { font-size: var(--tv-copy); line-height: 1.35; }
  html.broadcast-mode .edge-stat-card strong { font-size: clamp(20px, 1.3vw, 30px); }
  html.broadcast-mode .edge-event { padding: 12px; min-height: 56px; }
  html.broadcast-mode .edge-tooltip { width: min(680px, calc(100% - 24px)); font-size: var(--tv-copy); }
  html.broadcast-mode .edge-tooltip strong,
  html.broadcast-mode .edge-tooltip span { font-size: inherit; }
  html.broadcast-mode .cluster-lens { grid-template-columns: minmax(0, 1fr) clamp(330px, 25vw, 560px); grid-template-rows: auto auto minmax(360px, 1fr); }
  html.broadcast-mode .cluster-header { min-height: 70px; padding: 10px 14px; }
  html.broadcast-mode .cluster-title { font-size: clamp(23px, 1.5vw, 36px); }
  html.broadcast-mode .cluster-context,
  html.broadcast-mode .cluster-date-state,
  html.broadcast-mode .cluster-latest,
  html.broadcast-mode .cluster-hero-label,
  html.broadcast-mode .cluster-hero-meta { font-size: var(--tv-copy); line-height: 1.35; }
  html.broadcast-mode .cluster-hero-value,
  html.broadcast-mode .cluster-hero-cluster .cluster-hero-value { font-size: clamp(26px, 1.8vw, 42px); line-height: 1.15; overflow-wrap: break-word; }
  html.broadcast-mode .cluster-hero-card { padding: 12px 14px; }
  html.broadcast-mode .cluster-chart-panel { grid-template-rows: auto minmax(320px, 1fr); }
  html.broadcast-mode .cluster-panel-heading { min-height: 52px; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  html.broadcast-mode .cluster-panel-heading strong,
  html.broadcast-mode .cluster-panel-heading p,
  html.broadcast-mode .cluster-filter-button,
  html.broadcast-mode .cluster-ranking-date,
  html.broadcast-mode .cluster-panel h3,
  html.broadcast-mode .cluster-breadth-date,
  html.broadcast-mode .cluster-breadth-detail { font-size: var(--tv-copy); }
  html.broadcast-mode .cluster-filter-button { min-height: 38px; padding: 6px 10px; }
  html.broadcast-mode .cluster-grid text,
  html.broadcast-mode .cluster-date-label { font-size: var(--tv-axis); }
  html.broadcast-mode .cluster-member-line { opacity: .86; }
  html.broadcast-mode .cluster-member-line.focused { opacity: 1; }
  html.broadcast-mode .cluster-member-line.dimmed { opacity: .18; }
  html.broadcast-mode .cluster-end-label { padding: 5px 9px; font-size: var(--tv-axis); line-height: 1.25; overflow-wrap: break-word; }
  html.broadcast-mode .cluster-ranking-list { gap: 8px; margin-top: 12px; }
  html.broadcast-mode .cluster-ranking-row { grid-template-columns: 24px 10px minmax(0, 1fr) auto; gap: 6px 9px; min-height: 76px; padding: 10px 8px; }
  html.broadcast-mode .cluster-rank-ticker { font-size: var(--tv-copy); overflow-wrap: break-word; }
  html.broadcast-mode .cluster-rank-number,
  html.broadcast-mode .cluster-ranking-row > span:last-child { display: block; font-size: var(--tv-copy); }
  html.broadcast-mode .cluster-ranking-row > span:last-child { grid-column: 3 / -1; white-space: normal; }
  html.broadcast-mode .cluster-ranking-row > strong { font-size: clamp(22px, 1.4vw, 32px); }
  html.broadcast-mode .cluster-rank-name { display: none; }
  html.broadcast-mode .cluster-breadth-summary { font-size: clamp(24px, 1.6vw, 36px); }
  html.broadcast-mode .cluster-tooltip { font-size: var(--tv-copy); max-width: min(680px, calc(100% - 24px)); }
  html.broadcast-mode .cluster-tooltip strong,
  html.broadcast-mode .cluster-tooltip span { font-size: inherit; }
}
@media (min-width: 681px) {
  html.broadcast-mode #edge-view .cluster-date-state,
  html.broadcast-mode #edge-view .cluster-line-key,
  html.broadcast-mode #edge-view .cluster-end-date,
  html.broadcast-mode #edge-view .cluster-panel-date,
  html.broadcast-mode #edge-view .cluster-breadth-details,
  html.broadcast-mode #edge-view .cluster-panel-heading h3 { font-size: var(--tv-copy); line-height: 1.35; }
  html.broadcast-mode #edge-view .cluster-header-meta .cluster-context { display: block; white-space: normal; overflow: visible; }
  html.broadcast-mode .cluster-header-copy { min-width: 0; }
}
@media (min-width: 681px) {
  html.broadcast-mode #edge-view .cluster-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  html.broadcast-mode .cluster-hero-meta { display: block; }
  html.broadcast-mode .cluster-tooltip-identity span { white-space: normal; overflow: visible; text-overflow: clip; }
  html.broadcast-mode .cluster-tooltip-row { grid-template-columns: 24px 10px minmax(180px, 1fr) auto; }
  html.broadcast-mode .cluster-tooltip-row > :last-child { grid-column: 3 / -1; }
}
@media (min-width: 681px) {
  html.broadcast-mode .edge-h2h-header,
  html.broadcast-mode .edge-h2h-row,
  html.broadcast-mode .edge-h2h-row strong,
  html.broadcast-mode .edge-period-scope,
  html.broadcast-mode .edge-panel-empty { font-size: var(--tv-copy); line-height: 1.4; }
  html.broadcast-mode .edge-h2h-row { min-height: 48px; padding-block: 8px; }
  html.broadcast-mode .edge-supporting { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
}
/* On laptop-height presentations the endpoint rail is the complete passive
   overview; ranking retains a visible scroll track for its secondary deltas. */
@media (min-width: 681px) and (max-height: 850px) {
  html.broadcast-mode .cluster-end-label { padding: 2px 6px; line-height: 20px; }
  html.broadcast-mode .cluster-hero-card { padding-block: 8px; }
  html.broadcast-mode .cluster-header { min-height: 60px; padding-block: 6px; }
  html.broadcast-mode .cluster-panel-heading { padding-block: 6px; }
  html.broadcast-mode .cluster-ranking-list { overflow-y: scroll; scrollbar-gutter: stable; scrollbar-width: auto; }
  html.broadcast-mode .cluster-ranking-row { padding-block: 6px; min-height: 62px; }
}
.cluster-ranking-scroll-hint { display: none; }
@media (min-width: 681px) and (max-height: 850px) {
  html.broadcast-mode .cluster-ranking-scroll-hint { display: block; flex: 0 0 auto; margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.3; }
}
/* Every broadcast height can overflow; contain scrolling inside the ranking
   and chart panels instead of clipping content at the fixed TV viewport. */
@media (min-width: 681px) {
  html.broadcast-mode .cluster-panels { grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
  html.broadcast-mode .cluster-ranking-list { flex: 1 1 auto; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: auto; }
  html.broadcast-mode .cluster-ranking-scroll-hint { display: block; flex: 0 0 auto; margin: 8px 0 0; color: var(--muted); font-size: var(--tv-copy); line-height: 1.3; }
  html.broadcast-mode .cluster-ranking-scroll-hint[hidden] { display: none; }
  html.broadcast-mode .cluster-chart-panel { overflow-y: auto; overflow-x: hidden; grid-template-rows: auto minmax(0, 1fr); scrollbar-gutter: stable; }
}
@media (min-width: 681px) {
  html.broadcast-mode .cluster-panels { align-items: stretch; }
  html.broadcast-mode .cluster-ranking-panel { overflow: hidden; }
  html.broadcast-mode .cluster-ranking-list { flex-basis: 0; }
}
@media (min-width: 681px) {
  html.broadcast-mode .cluster-ranking-list { display: flex; flex-direction: column; align-items: stretch; }
  html.broadcast-mode .cluster-ranking-row { flex: 0 0 auto; height: auto; grid-template-rows: auto auto; align-content: start; }
  html.broadcast-mode .cluster-rank-identity { align-self: start; }
}
/* The LP palette matches In Hindsight, Fear & Greed and the 13F explorer. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url('/assets/ibm-plex-sans-var-roman-DKYrB2Yq.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #04101d;
  --chart-bg: #04101d;
  --panel: #0a1828;
  --panel-strong: #10263a;
  --hover: #1a3651;
  --line: rgba(112, 164, 224, .26);
  --line-soft: rgba(112, 164, 224, .16);
  --text: #eef6ff;
  --muted: #c8dcf2;
  --blue: #8fd1ff;
  --accent: #e2c891;
  --green: #53e0a0;
  --orange: #fbbf24;
  --danger: #fb7185;
  --focus: #8fd1ff;
  --selected-bg: #202c35;
  --header: radial-gradient(circle at 0% 0%, rgba(92, 169, 255, .16), transparent 32%), linear-gradient(135deg, rgba(13, 35, 58, .92), rgba(7, 18, 31, .98));
}
:root[data-stock-compare-theme="dark"] {
  --bg: #000;
  --chart-bg: #000;
  --panel: #0b1220;
  --panel-strong: #102038;
  --hover: #1e3a5f;
  --line: #475569;
  --line-soft: rgba(148, 163, 184, .18);
  --text: #e2e8f0;
  --muted: #a8b8cc;
  --blue: #93c5fd;
  --accent: #93c5fd;
  --focus: #93c5fd;
  --selected-bg: #1e314c;
  --header: #020914;
}
:root[data-stock-compare-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fa;
  --chart-bg: #fff;
  --panel: #fff;
  --panel-strong: #eaf0f7;
  --hover: #dce7f3;
  --line: #a9bace;
  --line-soft: rgba(77, 99, 125, .2);
  --text: #172c43;
  --muted: #4b6077;
  --blue: #1260a2;
  --accent: #835b00;
  --green: #087548;
  --orange: #8a5400;
  --danger: #b92347;
  --focus: #1260a2;
  --selected-bg: #fff2c7;
  --header: linear-gradient(110deg, #fff, #e7eef8);
}
body { font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; min-width: 0; }
.control-shell { background: var(--bg); box-shadow: none; }
.app-header {
  min-height: 52px;
  margin-block: 8px 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--header);
}
.home-link { min-width: 0; min-height: 40px; display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: 0; }
.home-link img { width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; }
.home-link span { color: inherit; white-space: nowrap; }
.header-menu { position: relative; }
.header-menu > summary { display: none; }
.header-actions { gap: 6px; }
.header-actions :is(button, a, select) { min-height: 44px; }
.header-actions .button, .header-actions .language-link { background: var(--panel-strong); border-color: var(--line); color: var(--text); }
.language-link { width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.language-link img { width: 24px; height: 18px; display: block; object-fit: contain; }
.theme-control { position: relative; display: inline-flex; align-items: center; }
.theme-control::before { position: absolute; left: 10px; width: 23px; height: 16px; content: ''; pointer-events: none; border: 1px solid var(--line); border-radius: 3px; background: linear-gradient(135deg, #04101d 0 58%, #c6a75e 58% 76%, #a8a8a8 76%); }
[data-stock-compare-theme="dark"] .theme-control::before { background: linear-gradient(135deg, #080d13 0 58%, #f7f9fb 58% 76%, #55a7ff 76%); }
[data-stock-compare-theme="light"] .theme-control::before { background: linear-gradient(135deg, #f4f7fa 0 58%, #18232d 58% 76%, #2879bd 76%); }
.theme-control select { min-width: 192px; padding-left: 42px; font-size: 12px; font-weight: 650; }
.page-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; width: calc(100% - 36px); margin: 8px auto 6px; }
.page-heading h1 { color: var(--accent); font-size: 24px; line-height: 1.2; }
.page-heading .page-subtitle { margin: 0; font-size: 12px; }
.page-heading { justify-content: space-between; align-items: center; }
.page-heading-copy { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.overview-status { max-width: 52%; margin: 0; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 11px; line-height: 1.4; }
.overview-status::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); }
.overview-status.error { color: var(--danger); }
.overview-status.error::before { background: var(--danger); }
.overview-status.pending::before { background: var(--muted); }
.overview-status.limited { color: var(--orange); }
.overview-status.limited::before { background: var(--orange); }
html:not(.broadcast-mode) .chart-status { display: none; }

.cluster-header-copy { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 3px 12px; }
.cluster-header-copy .cluster-eyebrow { margin: 0; }
.cluster-header-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 14px; }
.cluster-date-state { font-size: 11px; color: var(--text); }
.cluster-date-state.is-historical { color: var(--accent); }
.cluster-header-meta .cluster-context { margin: 0; }
.cluster-hero-card { min-height: 76px; gap: 3px; padding: 8px 14px; }
.cluster-hero-cluster .cluster-hero-value { font-size: clamp(25px, 2vw, 30px); }
.cluster-insight { display: none; }
.cluster-panel-heading { min-height: 40px; padding-block: 6px; }
.cluster-panel-heading > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.cluster-line-key { color: var(--muted); font-size: 11px; }
.cluster-line-key::before { content: ''; display: inline-block; width: 18px; height: 2px; margin-right: 5px; vertical-align: middle; background: var(--text); }
.cluster-end-date { margin-left: auto; font-size: 11px; color: var(--muted); }
.cluster-label-rail { width: 168px; }
.cluster-end-label { width: 162px; }
.cluster-ranking-date { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.cluster-breadth-panel { gap: 6px; }
.cluster-breadth-summary { margin-top: 0; font-size: 19px; }
html.broadcast-mode .cluster-header-copy { display: block; }
html.broadcast-mode .cluster-header-meta { display: block; }
html.broadcast-mode .cluster-header > div.cluster-header-copy:first-child { display: block; }
html.broadcast-mode .cluster-header { justify-content: space-between; }
html.broadcast-mode .cluster-date-state { font-size: 10px; }
html.broadcast-mode .cluster-header-meta .cluster-context { display: none; }
html.broadcast-mode .cluster-line-key, html.broadcast-mode .cluster-end-date { font-size: 9px; }
.controls { padding-block: 6px 8px; }
input, select { background: var(--panel-strong); border-color: var(--line); }
.cluster-trigger, .view-options > summary, .button.secondary, .edge-latest, .cluster-latest, .cluster-filter-button, .cluster-dialog-close, .cluster-category, .custom-cluster-edit, .custom-cluster-delete { background: var(--panel-strong); border-color: var(--line); color: var(--text); }
.cluster-trigger:hover, .button:hover, .view-options[open] > summary, .cluster-filter-button:hover, .cluster-filter-button[aria-pressed="true"], .search-result:hover, .search-result.active { background: var(--hover); }
.search-results, .view-options-panel, .cluster-dialog { background: var(--panel); border-color: var(--line); }
.cluster-dialog { color: var(--text); }
.cluster-option { background: var(--panel-strong); border-color: var(--line); }
.cluster-option:hover, .cluster-option[aria-pressed="true"] { background: var(--hover); }
.cluster-option.active, .cluster-category.active, .segmented button.active { background: var(--selected-bg); color: var(--accent); border-color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.segmented, .selected-stocks { background: var(--panel); border-color: var(--line); }
.segmented button { color: var(--muted); }
.segmented button:hover { background: var(--hover); }
.selected-stocks-nav { background: var(--panel-strong); color: var(--text); border-color: var(--line); }
.stock-chip { background: color-mix(in srgb, var(--chip-color) 12%, var(--panel)); }
.stock-chip-remove { color: var(--text); }
.stock-chip-focus { min-width: 0; }
.stock-chip strong { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow, .edge-eyebrow, .cluster-eyebrow { color: var(--accent); }
.comparison-insight, .chart-card, .edge-view, .cluster-lens { background: var(--panel); border-color: var(--line); }
.chart-toolbar, .edge-header, .cluster-header { background: var(--header); }
.chart-stage, .edge-chart-shell, .cluster-chart-shell { background: var(--chart-bg); }
.edge-hero, .cluster-hero, .edge-stat-card, .edge-panel, .cluster-panel, .cluster-data-quality, .cluster-method, .methodology, .legend { background: var(--panel); }
.edge-tooltip, .cluster-tooltip, .chart-tooltip, .chart-empty-content { background: var(--panel); color: var(--text); border-color: var(--line); }
.chart-tooltip-mobile .chart-tooltip-header { background: var(--panel); }
.chart-tooltip-header, .cluster-panel-heading { background: var(--panel-strong); }
.lower-pane-label { background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--muted); }
.chart-status { color: var(--muted) !important; }
.chart-status.error { color: var(--danger) !important; }
.chart-status.limited { color: var(--orange) !important; }
.chart-empty-icon { background: var(--panel-strong); color: var(--blue); }
.chart-card.has-error-state .chart-empty-content { background: var(--panel); }
.edge-grid-line, .cluster-grid line { stroke: var(--line-soft); }
.edge-zero-line, .cluster-zero-line { stroke: var(--muted); }
.edge-axis-label, .edge-time-label, .cluster-grid text, .cluster-date-label { fill: var(--muted); }
[data-stock-compare-theme="light"] .edge-zone-label { opacity: 1; }
.cluster-index-line { stroke: var(--text); }
.cluster-index-marker, .cluster-selection-dot { fill: var(--text); }
.cluster-end-label { background: var(--panel-strong); color: var(--label-color); border-color: var(--label-color); }
.cluster-end-label-index { background: var(--panel-strong); color: var(--text); border-color: var(--muted); }
.cluster-dna-table th:first-child, .cluster-dna-member { background: var(--panel); }
.cluster-dna-cell { color: #fff; }
[data-stock-compare-theme="light"] .cluster-dna-cell { color: var(--text); }
.cluster-breadth-positive { background: var(--green); }
.cluster-breadth-negative { background: var(--danger); }
.legend-row { background: var(--panel); }
.legend-row:hover { background: var(--panel-strong); }
.legend-toggle { background: var(--panel-strong); border-color: var(--series-color); }
.legend-focus-cue { color: var(--muted); }
.legend-focus[aria-pressed="true"] .legend-focus-cue { color: var(--series-color); }
.methodology { color: var(--muted); border-color: var(--line); }
.methodology > summary, .methodology strong, .credit a { color: var(--text); }
.credit { color: var(--muted); }
.broadcast-chip { color: var(--accent); border-color: var(--line); }
.mobile-stock-picker { grid-column: 1 / -1; }
.mobile-stock-picker > summary { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); font-weight: 650; cursor: pointer; }
#mobile-stock-picker-body { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: end; gap: 8px; padding-top: 8px; }

@media (max-width: 680px) {
  .app-header { min-height: 54px; align-items: center; gap: 6px; padding: 5px 8px; }
  .home-link { display: flex; min-height: 44px; gap: 6px; font-size: 16px; }
  .home-link img { width: 32px; height: 32px; }
  .header-menu { flex: 0 0 auto; }
  .header-menu > summary { min-height: 44px; display: grid; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); color: var(--text); list-style: none; cursor: pointer; font-weight: 650; }
  .header-menu > summary::-webkit-details-marker { display: none; }
  .header-menu:not([open]) .header-actions { display: none; }
  .header-actions { position: absolute; top: calc(100% + 6px); right: 0; z-index: 110; display: grid; grid-template-columns: minmax(0, 1fr) 44px; width: min(270px, calc(100vw - 28px)); padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, .3); }
  .theme-control { min-width: 0; }
  .theme-control select { min-width: 0; width: 100%; font-size: 14px; }
  .page-heading { width: calc(100% - 20px); gap: 3px; margin-block: 8px; }
  .page-heading h1 { font-size: 24px; }
  .page-heading .page-subtitle { display: none; }
  .overview-status { max-width: none; width: 100%; border: 0; padding: 3px 0; background: transparent; }
  .data-footer { grid-template-columns: minmax(0, 1fr); }
  .data-footer-meta { display: grid; }
  .cluster-header-copy { grid-template-columns: minmax(0, 1fr); }
  .cluster-header-meta { gap: 3px; }
  .cluster-hero-card { padding: 8px; }
  .cluster-panel-heading { flex-direction: row; flex-wrap: wrap; }
  .cluster-panel-heading > div:first-child { flex-basis: 100%; }
  .cluster-end-date { margin-left: 0; }
  .controls { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .period-control { grid-row: 1; }
  .control-group .control-label { display: none; }
  .view-controls { grid-column: 1 / -1; grid-row: 4; justify-content: space-between; }
  .controls .control-group .segmented button { min-height: 44px; min-width: 44px; padding-inline: 10px; font-size: 14px; }
  .mobile-stock-picker { grid-row: 2; }
  .stock-picker { grid-column: 1 / -1; grid-row: 3; grid-template-columns: minmax(0, 1fr); }
  .stock-picker .selected-stocks-shell { width: 100%; }
  .selected-stocks { min-height: 44px; }
  .stock-chip { min-height: 40px; }
  .stock-chip-remove { width: 40px; height: 40px; flex-basis: 40px; }
  .stock-chip-focus { min-height: 40px; }
  .selected-stocks-nav { width: 40px; height: 40px; }
  .market-field select, .search-wrap input, .cluster-trigger { min-height: 44px; }
  .stock-chip strong { max-width: 96px; font-size: 13px; }
  .view-options { justify-self: end; }
  .view-options > summary { min-height: 44px; justify-content: space-between; }
  .view-options-panel { width: min(270px, calc(100vw - 28px)); }
  .chart-heading { display: block; }
  .chart-toolbar h2 { font-size: 17px; }
  .chart-controls { grid-template-columns: 1fr; }
  .pane-controls { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .pane-controls > span:first-child { display: none; }
  .pane-controls .segmented button { min-height: 44px; font-size: 13px; }
  .chart-controls select { min-height: 44px; }
  .chart-stage { height: 58svh; min-height: 370px; }
  .legend-toggle { min-width: 44px; min-height: 44px; }
  .legend-focus { min-height: 44px; }
  .legend-row { background: var(--panel); }
  .cluster-latest, .cluster-filter-button, .edge-latest, .cluster-dialog-close, .custom-cluster-form select, .custom-cluster-form input, .custom-cluster-form .button { min-height: 44px; }
  .edge-event { min-height: 44px; }
  .credit { font-size: 11px; line-height: 1.5; }
}
@media (max-width: 359px) {
  .home-link { font-size: 14px; gap: 4px; }
  .home-link img { width: 28px; height: 28px; }
  .header-menu > summary { padding-inline: 8px; font-size: 14px; }
  .controls > .control-group .segmented button { padding-inline: 7px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
