:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #18212f;
  --muted: #647067;
  --soft: #e8ece5;
  --line: #d8ded4;
  --primary: #2457c5;
  --primary-weak: #dce7ff;
  --secondary: #0f766e;
  --secondary-weak: #d9f0ec;
  --accent: #b45f06;
  --accent-weak: #f8e6c9;
  --danger: #b42318;
  --danger-weak: #f7d8d4;
  --positive: #087443;
  --shadow: 0 16px 40px rgba(24, 33, 47, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="file"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(36, 87, 197, 0.34);
  outline-offset: 2px;
}

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

.topbar {
  min-height: 68px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #18212f;
  color: #f8faf7;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: #f8faf7;
  color: #18212f;
  font-weight: 800;
  font-size: 14px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #b7c0b7;
  font-size: 12px;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.tab-button,
.range-button,
.ghost-button,
.primary-button,
.icon-text-button {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 14px;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.tab-button {
  color: #d7ded6;
  background: transparent;
}

.tab-button.is-active {
  color: #18212f;
  background: #f8faf7;
}

.tab-button:disabled {
  color: #838d85;
}

.workspace {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 18px 0 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

.market-status,
.panel-head p,
.disclaimer,
.dialog-note {
  color: var(--muted);
  font-size: 13px;
}

.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.toolbar-controls > * {
  min-width: 0;
}

.field-label,
.form-grid label,
.file-field,
.textarea-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-label small {
  max-width: 300px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

#symbolSelect {
  min-width: 230px;
}

select,
input,
textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

textarea {
  min-height: 220px;
  padding: 12px;
  resize: vertical;
  font-family: "Fira Code", Consolas, "Courier New", monospace;
  font-size: 13px;
}

.segmented {
  min-height: 44px;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.range-button {
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.range-button.is-active {
  color: var(--primary);
  background: var(--primary-weak);
}

.ghost-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button:hover,
.icon-text-button:hover {
  background: var(--surface-2);
}

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

.primary-button:hover {
  background: #1d49a8;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric-card,
.panel,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 112px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.metric-card span,
.portfolio-stats span,
.scenario-table span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  font-size: 26px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.metric-card small {
  color: var(--muted);
}

.accent-card {
  border-color: #ecc883;
  background: #fffaf0;
}

.valuation-card {
  border-color: #b9c9ee;
  background: #f5f8ff;
}

.decision-grid,
.research-feed-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.decision-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.research-feed-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.65fr);
}

.event-panel {
  grid-column: 1 / -1;
}

.position-score {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.position-score > strong {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #18356d;
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.position-score span,
.news-pressure span,
.factor-grid span,
.radar-card span,
.collection-item span,
.event-row span,
.event-row small {
  color: var(--muted);
  font-size: 12px;
}

.position-meter,
.position-meter span {
  height: 12px;
  border-radius: 999px;
}

.position-meter {
  margin-top: 10px;
  overflow: hidden;
  background: linear-gradient(90deg, #d9f0ec, #f8e6c9, #f7d8d4);
}

.position-meter span {
  display: block;
  width: 0;
  background: #18212f;
  transition: width 220ms ease;
}

.position-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: #eefbf8;
  color: #0b4b45;
  font-size: 13px;
}

.factor-grid,
.radar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.factor-grid div,
.radar-card,
.collection-item,
.event-row {
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.factor-grid div,
.radar-card {
  min-height: 78px;
  display: grid;
  gap: 2px;
  align-content: center;
  padding: 10px;
}

.factor-grid strong,
.radar-card strong,
.news-pressure strong {
  font-variant-numeric: tabular-nums;
}

.factor-grid strong,
.radar-card strong {
  font-size: 24px;
}

.news-pressure {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.news-pressure strong {
  font-size: 34px;
  line-height: 1;
}

.collection-list,
.event-list {
  display: grid;
  gap: 8px;
}

.collection-item {
  min-height: 58px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.collection-item time {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.collection-item strong,
.collection-item span,
.event-row strong,
.event-row small {
  display: block;
}

.event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.event-row b {
  min-width: 82px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
}

.event-row b.positive {
  background: var(--secondary-weak);
  color: var(--secondary);
}

.event-row b.negative {
  background: var(--danger-weak);
  color: var(--danger);
}

.event-row b.mixed {
  background: var(--accent-weak);
  color: var(--accent);
}

.calibration-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}

.calibration-grid,
.model-metrics {
  display: grid;
  gap: 10px;
}

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

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

.calibration-card,
.model-metric {
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: grid;
  align-content: space-between;
  gap: 6px;
}

.calibration-card span,
.model-metric span,
.calibration-card small,
.model-metric small {
  color: var(--muted);
  font-size: 12px;
}

.calibration-card span,
.model-metric span {
  font-weight: 800;
}

.calibration-card strong,
.model-metric strong {
  color: var(--ink);
  line-height: 1.15;
}

.calibration-card strong {
  font-size: 22px;
}

.model-metric strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.view-pane[hidden] {
  display: none;
}

.model-view {
  display: grid;
  gap: 12px;
}

.model-hero {
  min-height: 126px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 0;
}

.model-hero h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

.model-hero p:last-child {
  max-width: 820px;
  color: var(--muted);
}

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

.model-kpi,
.feature-group-card,
.boundary-item,
.next-step-item,
.pipeline-step {
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.model-kpi {
  min-height: 112px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.model-kpi span,
.model-kpi small,
.model-bar-row span,
.pipeline-step small,
.feature-group-card li,
.boundary-item span {
  color: var(--muted);
  font-size: 12px;
}

.model-kpi span {
  font-weight: 800;
}

.model-kpi strong {
  font-size: 22px;
  line-height: 1.18;
}

.model-layout,
.model-section-grid {
  display: grid;
  gap: 12px;
}

.model-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.model-section-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr) minmax(280px, 0.8fr);
}

.model-chart-panel,
.model-logic-panel,
.model-table-panel {
  padding: 0;
}

.model-bars,
.model-pipeline,
.model-feature-groups,
.model-boundary-list,
.model-next-list {
  display: grid;
  gap: 10px;
}

.model-bars,
.model-pipeline,
.model-feature-groups,
.model-boundary-list,
.model-next-list {
  padding: 14px;
}

.model-bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(0, 0.58fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.model-bar-row strong,
.model-bar-row span,
.model-bar-stack label {
  display: block;
}

.model-bar-stack {
  display: grid;
  gap: 5px;
}

.model-bar-stack label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.model-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.model-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.model-bar-track.lift i {
  background: var(--secondary);
}

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

.pipeline-step {
  min-height: 118px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.pipeline-step span,
.next-step-item span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary-weak);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.feature-group-card {
  padding: 12px;
}

.feature-group-card strong {
  display: block;
  margin-bottom: 8px;
}

.feature-group-card ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  margin: 0;
}

.boundary-item {
  padding: 12px;
  display: grid;
  gap: 5px;
  border-color: #ecc883;
  background: #fffaf0;
}

.boundary-item strong,
.next-step-item strong {
  font-size: 13px;
  line-height: 1.45;
}

.next-step-item {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
}

td small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.research-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.mindmap-canvas {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(36, 87, 197, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(36, 87, 197, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(36, 87, 197, 0.10), transparent 32%),
    var(--surface-2);
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.mindmap-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mindmap-lines path {
  fill: none;
  stroke: rgba(36, 87, 197, 0.28);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 8 8;
}

.mind-node {
  position: absolute;
  width: min(210px, 24%);
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid rgba(36, 87, 197, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 32px rgba(24, 33, 47, 0.12);
}

.mind-node span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.mind-node strong {
  font-size: 16px;
  line-height: 1.25;
}

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

.node-core {
  left: 50%;
  top: 50%;
  width: 230px;
  min-height: 118px;
  transform: translate(-50%, -50%);
  border-color: rgba(36, 87, 197, 0.45);
  background: #18356d;
  color: #ffffff;
  box-shadow: 0 22px 50px rgba(24, 53, 109, 0.28);
}

.node-core span,
.node-core small {
  color: #d7e3ff;
}

.node-top {
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
}

.node-left {
  left: 10%;
  top: 115px;
}

.node-right {
  right: 10%;
  top: 115px;
}

.node-left-low {
  left: 3%;
  top: 310px;
}

.node-left-mid {
  left: 22%;
  top: 410px;
}

.node-right-low {
  right: 22%;
  top: 310px;
}

.node-right-mid {
  right: 3%;
  top: 410px;
}

.node-bottom-left {
  left: 18%;
  bottom: 28px;
}

.node-bottom-right {
  right: 18%;
  bottom: 28px;
}

.node-result {
  border-color: rgba(8, 116, 67, 0.30);
  background: #f1fbf4;
}

.node-primary {
  border-color: rgba(15, 118, 110, 0.34);
  background: #eefbf8;
}

.node-process {
  border-color: rgba(180, 95, 6, 0.32);
  background: #fff7ea;
}

.valuation-panel {
  display: grid;
  align-content: start;
}

.valuation-overview {
  grid-column: 1 / -1;
}

.valuation-hero {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--soft);
}

.valuation-hero > div:first-child {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.valuation-hero strong {
  font-size: 38px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.valuation-hero span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.valuation-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, #d9f0ec, #f8e6c9, #f7d8d4);
}

.valuation-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: #18212f;
  transition: width 220ms ease;
}

.valuation-list {
  display: grid;
  gap: 8px;
}

.valuation-overview .valuation-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.valuation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft);
}

.valuation-overview .valuation-row {
  padding: 10px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.valuation-row span,
.valuation-row small {
  color: var(--muted);
}

.valuation-row span {
  font-size: 12px;
  font-weight: 800;
}

.valuation-row strong {
  font-variant-numeric: tabular-nums;
}

.valuation-row small {
  grid-column: 1 / -1;
  font-size: 12px;
}

.valuation-summary {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: #fff7ea;
  color: #6f3b05;
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 12px;
}

.panel,
.table-panel {
  padding: 16px;
}

.panel-large {
  grid-row: span 2;
}

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

.panel-head.compact {
  align-items: center;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.legend-line {
  width: 18px;
  height: 3px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 99px;
}

.legend-line.primary {
  background: var(--primary);
}

.legend-line.secondary {
  background: var(--secondary);
}

.legend-line.accent {
  background: var(--accent);
}

.chart-frame {
  width: 100%;
  height: 360px;
  overflow: hidden;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chart-frame.small {
  height: 220px;
}

svg {
  width: 100%;
  height: 100%;
  display: block;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--secondary-weak);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 800;
}

.signal-list {
  display: grid;
  gap: 8px;
}

.signal-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft);
}

.signal-row span {
  color: var(--muted);
}

.signal-row strong,
.portfolio-stats strong,
.scenario-table strong {
  font-variant-numeric: tabular-nums;
}

.score-track {
  height: 12px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.score-track span {
  width: 0;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--danger), var(--accent), var(--positive));
  transition: width 220ms ease;
}

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

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.portfolio-stats div,
.scenario-item {
  min-height: 64px;
  display: grid;
  gap: 2px;
  align-content: center;
  padding: 10px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.scenario-table {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.table-panel {
  margin-top: 12px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--soft);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

tbody tr:hover {
  background: #fbfcf8;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--danger);
}

.neutral {
  color: var(--muted);
}

.disclaimer {
  margin-top: 14px;
}

dialog {
  width: min(780px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(24, 33, 47, 0.28);
}

dialog::backdrop {
  background: rgba(24, 33, 47, 0.56);
}

.dialog-shell {
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 14px;
  background: var(--surface);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-text-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.dialog-note {
  min-height: 20px;
  color: var(--danger);
}

.mindmap-dialog {
  width: min(1240px, calc(100% - 32px));
}

.mindmap-dialog .dialog-shell {
  padding: 20px;
}

.mindmap-dialog .dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 6px;
  background: var(--surface);
}

.mindmap-dialog .mindmap-canvas {
  min-height: 680px;
}

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

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #10151a;
    --surface: #171d23;
    --surface-2: #1d252c;
    --ink: #eef4ed;
    --muted: #9ba99e;
    --soft: #2a3530;
    --line: #33413a;
    --primary: #7aa2ff;
    --primary-weak: #1f3156;
    --secondary: #68d1c5;
    --secondary-weak: #173a38;
    --accent: #f1b45f;
    --accent-weak: #4a3218;
    --danger: #ff8a80;
    --danger-weak: #4a2622;
    --positive: #76d39b;
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  }

  .accent-card {
    background: #251f15;
    border-color: #594326;
  }

  .valuation-card {
    background: #172033;
    border-color: #32456d;
  }

  .mindmap-canvas {
    background:
      linear-gradient(90deg, rgba(122, 162, 255, 0.05) 1px, transparent 1px),
      linear-gradient(0deg, rgba(122, 162, 255, 0.05) 1px, transparent 1px),
      radial-gradient(circle at 50% 50%, rgba(122, 162, 255, 0.13), transparent 32%),
      var(--surface-2);
    background-size: 36px 36px, 36px 36px, auto, auto;
  }

  .mind-node {
    background: rgba(23, 29, 35, 0.94);
  }

  .node-core {
    background: #263f78;
  }

  .node-result {
    background: #132e24;
  }

  .node-primary {
    background: #123331;
  }

  .node-process,
  .valuation-summary {
    background: #352413;
    color: #f1d4a7;
  }

  .position-score > strong {
    background: #263f78;
  }

  .position-meter span {
    background: #d7e3ff;
  }

  .position-summary {
    background: #123331;
    color: #b9f0e8;
  }

  .boundary-item {
    background: #352413;
    border-color: #594326;
  }

  .pipeline-step span,
  .next-step-item span {
    background: #1f3156;
    color: #cbd9ff;
  }

  tbody tr:hover {
    background: #1f272e;
  }
}

@media (max-width: 1180px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-controls {
    justify-content: flex-start;
  }

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

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

  .decision-grid,
  .research-feed-grid {
    grid-template-columns: 1fr;
  }

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

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

  .model-layout,
  .model-section-grid {
    grid-template-columns: 1fr;
  }

  .panel-large {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 16px;
  }

  .view-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-button {
    min-width: 0;
    padding: 0 6px;
  }

  .workspace {
    width: calc(100% - 20px);
    max-width: 680px;
    padding-top: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .toolbar-controls,
  .segmented {
    width: 100%;
  }

  .toolbar-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .field-label,
  .field-label select,
  .ghost-button,
  .primary-button {
    width: 100%;
  }

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

  .range-button {
    min-width: 0;
    padding: 0 4px;
  }

  .metrics-grid,
  .decision-grid,
  .research-feed-grid,
  .research-grid,
  .model-kpi-grid,
  .model-pipeline,
  .form-grid,
  .portfolio-stats,
  .scenario-table {
    grid-template-columns: 1fr;
  }

  .valuation-overview .valuation-list {
    grid-template-columns: 1fr;
  }

  .calibration-grid,
  .model-metrics {
    grid-template-columns: 1fr;
  }

  .model-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .model-bar-row,
  .position-score,
  .factor-grid,
  .radar-grid,
  .event-row {
    grid-template-columns: 1fr;
  }

  .position-score > strong {
    width: 100%;
    height: 64px;
  }

  .event-row b {
    width: max-content;
  }

  .mindmap-canvas {
    min-height: auto;
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .mindmap-lines {
    display: none;
  }

  .mind-node,
  .node-core,
  .node-top,
  .node-left,
  .node-right,
  .node-left-low,
  .node-left-mid,
  .node-right-low,
  .node-right-mid,
  .node-bottom-left,
  .node-bottom-right {
    position: static;
    width: 100%;
    transform: none;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-frame {
    height: 300px;
  }

  .chart-frame.small {
    height: 210px;
  }

  dialog {
    width: calc(100% - 20px);
  }
}
