:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d8dee6;
  --accent: #1267b1;
  --accent-soft: #e8f2ff;
  --good: #0f7a3b;
  --bad: #b42318;
  --shadow: 0 10px 24px rgba(16, 32, 51, .07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Microsoft YaHei UI", "Segoe UI", Arial, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 16px 24px;
  background: #102033;
  box-shadow: 0 10px 24px rgba(16, 32, 51, .16);
  color: #fff;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.main-nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-width: 280px;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  padding: 0 10px;
  color: #dbe7f3;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  border-color: #7ab8ec;
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  margin-bottom: 12px;
  font-size: 16px;
}

.topbar p {
  color: #c7d1de;
}

.layout {
  display: grid;
  gap: 18px;
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px;
}

.strategy-shortcuts {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  background:
    linear-gradient(135deg, #f7fbff 0%, #eef6ff 48%, #f9fcff 100%);
  box-shadow: var(--shadow);
}

.strategy-shortcuts-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.strategy-shortcuts-heading span {
  display: inline-block;
  margin-bottom: 6px;
  color: #1267b1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.strategy-shortcuts-heading h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.strategy-shortcuts-heading p {
  max-width: 580px;
  color: var(--muted);
  text-align: right;
}

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

.strategy-shortcut-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid #d7e1ec;
  border-radius: 12px;
  background: rgba(255, 255, 255, .88);
  color: var(--text);
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.strategy-shortcut-card strong {
  font-size: 18px;
}

.strategy-shortcut-card span {
  color: var(--muted);
}

.strategy-shortcut-card:hover {
  transform: translateY(-2px);
  border-color: #8dbbe3;
  box-shadow: 0 14px 26px rgba(18, 103, 177, .12);
}

.strategy-shortcut-card-focus {
  border-color: #9fc0f7;
  background: linear-gradient(180deg, #f4f8ff 0%, #eaf2ff 100%);
}

.strategy-shortcut-card-invest {
  border-color: #a7d9b8;
  background: linear-gradient(180deg, #f5fcf7 0%, #edf8f0 100%);
}

.work-section {
  --section-accent: var(--accent);
  --section-soft: #f8fafc;
  --section-border: #d6dde6;
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
  border: 2px solid var(--section-border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, var(--section-soft) 0, #f8fafc 180px, #f8fafc 100%);
  overflow: hidden;
}

.primary-workflow {
  --section-accent: #1267b1;
  --section-soft: #edf6ff;
  --section-border: #b9d4ee;
}

.account-work {
  --section-accent: #0f7a3b;
  --section-soft: #eef8f1;
  --section-border: #b9dec6;
}

.strategy-work {
  --section-accent: #8a4f05;
  --section-soft: #fff7e8;
  --section-border: #ead2a5;
}

.analysis-work {
  --section-accent: #6b4bb7;
  --section-soft: #f3f0ff;
  --section-border: #d4c8f0;
}

.page-dashboard .account-work .panel:not(.task-panel),
.page-dashboard .strategy-work,
.page-dashboard .analysis-work,
.page-paper .primary-workflow,
.page-paper .account-work .data-panel,
.page-paper .account-work .simulation-panel,
.page-paper .account-work .task-panel,
.page-paper .account-work .review-panel,
.page-paper .strategy-work,
.page-paper .analysis-work,
.page-data .primary-workflow,
.page-data .account-work .paper-panel,
.page-data .account-work .simulation-panel,
.page-data .account-work .review-panel,
.page-data .strategy-work,
.page-data .analysis-work,
.page-review .primary-workflow,
.page-review .account-work .paper-panel,
.page-review .account-work .data-panel,
.page-review .account-work .simulation-panel,
.page-review .strategy-work,
.page-review .analysis-work,
.page-strategy .primary-workflow,
.page-strategy .account-work .paper-panel,
.page-strategy .account-work .data-panel,
.page-strategy .account-work .task-panel,
.page-strategy .account-work .review-panel {
  display: none;
}

.page-paper .account-work,
.page-data .account-work,
.page-review .account-work {
  --section-accent: #0f7a3b;
  --section-soft: #eef8f1;
  --section-border: #b9dec6;
}

.page-strategy .analysis-work {
  display: grid;
}

.page-strategy .strategy-work {
  --section-accent: #8a4f05;
  --section-soft: #fff7e8;
  --section-border: #ead2a5;
}

.page-strategy .account-work {
  order: 3;
}

.page-strategy .strategy-work {
  order: 1;
}

.page-strategy .analysis-work {
  order: 2;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -16px;
  padding: 14px 16px 12px;
  border-bottom: 2px solid var(--section-border);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--section-accent) 14%, #ffffff) 0, var(--section-soft) 46%, #ffffff 100%);
  box-shadow: inset 6px 0 0 var(--section-accent);
}

.section-heading span {
  display: block;
  color: var(--section-accent);
  font-size: 12px;
  font-weight: 700;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.section-heading p {
  max-width: 520px;
  margin-bottom: 2px;
  color: var(--muted);
  text-align: right;
}

.panel, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.work-section > .panel,
.work-section .panel-grid > .panel {
  border-top: 3px solid var(--section-accent);
}

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

.account-grid {
  align-items: start;
}

.span-2 {
  grid-column: span 2;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.analysis-selector-panel {
  display: grid;
  gap: 12px;
}

.analysis-controls {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) 150px 150px 170px;
  gap: 10px;
  align-items: end;
}

.dragon-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.dragon-filters[hidden] {
  display: none;
}

.command-panel {
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input, select, button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.table-sort {
  width: 100%;
  height: auto;
  min-height: 28px;
  border: 0;
  padding: 2px 0;
  background: transparent !important;
  color: inherit;
  font-weight: 700;
  text-align: left;
}

.table-sort:hover,
.table-sort:focus {
  background: transparent !important;
  color: var(--accent);
}

.table-sort.active {
  color: var(--accent);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 154px;
}

.mini-btn {
  height: 28px;
  min-width: 44px;
  padding: 0 8px;
  font-size: 12px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.topbar .button-link {
  border-color: #2b7fc5;
  background: #2b7fc5;
}

.button-link.ghost.dark {
  border-color: rgba(255, 255, 255, .32);
  background: transparent;
  color: #fff;
}

button:disabled {
  cursor: wait;
  opacity: .6;
}

button.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

button.ghost.dark {
  border-color: rgba(255, 255, 255, .32);
  background: transparent;
  color: #fff;
}

.work-section button:not(.ghost):not(.tab) {
  border-color: var(--section-accent);
  background: var(--section-accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.command-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--section-soft) 72%, #ffffff);
}

.action-cluster span {
  flex: 0 0 auto;
  min-width: 46px;
  color: var(--section-accent);
  font-size: 12px;
  font-weight: 700;
}

.inline-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-control input {
  width: 90px;
}

.help-panel {
  border-left: 4px solid var(--accent);
}

.help-panel.collapsed {
  display: none;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title > div {
  min-width: 0;
}

.guide-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.note {
  margin-top: 10px;
  color: var(--muted);
}

.data-coverage-alert {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.data-coverage-alert strong {
  color: inherit;
}

.data-coverage-alert-critical {
  border-color: #f3b3ad;
  background: #fff1f0;
  color: #b42318;
}

.data-coverage-alert-warning {
  border-color: #f0cd85;
  background: #fff8e8;
  color: #8a4f05;
}

.data-coverage-alert-ok {
  border-color: #93d6aa;
  background: #eaf8ef;
  color: #0f7a3b;
}

.data-repair-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.data-repair-panel h3 {
  margin: 0 0 4px;
}

.data-repair-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.data-repair-controls input {
  width: 100%;
}

.command-snippet {
  display: block;
  width: 100%;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

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

.dashboard {
  display: grid;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(18, 103, 177, .10);
}

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

.summary-item {
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.35;
  white-space: normal;
}

.period-ranking {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.period-rank-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 3px 0 0 #98a2b3;
}

.period-rank-card.recommended {
  background: #f7fbf8;
  box-shadow: inset 3px 0 0 var(--good);
}

.period-rank-card span,
.period-rank-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.period-rank-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.period-rank-card p {
  margin: 4px 0;
  font-size: 13px;
}

.score-part {
  white-space: nowrap;
  font-weight: 600;
}

.score-part.positive {
  color: var(--good);
}

.score-part.negative {
  color: var(--bad);
}

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

.global-market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.global-market-card {
  display: grid;
  gap: 6px;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #f7fbff 100%);
}

.global-market-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.global-market-card strong {
  font-size: 15px;
}

.global-market-card.global-market-card-planned {
  border-color: #d0d5dd;
  background: linear-gradient(180deg, #fcfcfd 0%, #f8fafc 100%);
}

.global-market-card.global-market-card-partial {
  border-color: #f7b955;
  background: linear-gradient(180deg, #fffdf7 0%, #fffaeb 100%);
}

.global-market-card .muted {
  font-size: 12px;
}

.global-market-card code {
  font-size: 11px;
  color: var(--muted);
  white-space: normal;
}

.global-market-note {
  display: block;
  font-size: 12px;
  line-height: 1.5;
}

.global-market-note.planned {
  color: #475467;
}

.global-market-note.partial {
  color: #b54708;
}

.note b {
  color: var(--text);
}

.review-issue-panel {
  display: grid;
  gap: 10px;
}

.selection-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.morning-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.check-item {
  display: grid;
  gap: 3px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--section-accent);
  border-radius: 6px;
  background: #fff;
}

.check-item strong {
  font-size: 13px;
}

.check-item span {
  color: var(--muted);
  font-size: 12px;
}

.candidate-toolbar {
  display: flex;
  justify-content: flex-end;
}

.pool-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}

.pool-toolbar input,
.pool-toolbar select {
  min-width: 130px;
}

.trade-plan-panel {
  display: grid;
  gap: 8px;
}

.trade-plan-panel h3 {
  margin: 0;
  font-size: 15px;
}

.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.risk-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--good);
  border-radius: 6px;
  background: #fff;
}

.risk-config-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.panel-title.compact h3 {
  margin: 0;
}

.risk-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.risk-config-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.risk-config-grid input {
  width: 100%;
  min-width: 0;
}

.risk-card.warn {
  border-left-color: #d97706;
}

.risk-card.bad {
  border-left-color: var(--bad);
}

.risk-card span {
  color: var(--muted);
  font-size: 12px;
}

.priority-risk-panel {
  display: grid;
  gap: 8px;
}

.compact-risk-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.priority-risk-summary {
  margin-top: 2px;
}

.priority-risk-panel h3 {
  margin: 0;
  font-size: 15px;
}

.tablewrap table tbody tr.priority-row {
  box-shadow: inset 3px 0 0 #9db4c8;
}

.tablewrap table tbody tr.priority-row td:first-child {
  position: relative;
}

.tablewrap table tbody tr.priority-row td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--line);
  border-radius: 999px;
}

.tablewrap table tbody tr.priority-row.priority-rank-1 td:first-child::before {
  background: var(--bad);
}

.tablewrap table tbody tr.priority-row.priority-rank-2 td:first-child::before {
  background: #d97706;
}

.tablewrap table tbody tr.priority-row.priority-rank-3 td:first-child::before {
  background: #0f7a3b;
}

.tablewrap table tbody tr.priority-row.priority-rank-4 td:first-child::before {
  background: #98a2b3;
}

.tablewrap table tbody tr.priority-rank-1 td:first-child,
.tablewrap table tbody tr.priority-rank-2 td:first-child,
.tablewrap table tbody tr.priority-rank-3 td:first-child,
.tablewrap table tbody tr.priority-rank-4 td:first-child {
  font-weight: 700;
}

.tablewrap table tbody tr.priority-rank-1 {
  background: #fff1f0;
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.08);
}

.tablewrap table tbody tr.priority-rank-2 {
  background: #fff8eb;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.08);
}

.tablewrap table tbody tr.priority-rank-3 {
  background: #f7fbf8;
  box-shadow: inset 0 0 0 1px rgba(15, 122, 59, 0.08);
}

.tablewrap table tbody tr.priority-rank-4 {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(152, 162, 179, 0.08);
}

.tablewrap table tbody tr.recommended-row {
  background: #f7fbf8;
  box-shadow: inset 3px 0 0 var(--good);
}

.tablewrap table tbody tr.recommended-row td:first-child {
  font-weight: 700;
}

.tablewrap table tbody tr.quality-row-full td:first-child,
.tablewrap table tbody tr.quality-row-partial td:first-child,
.tablewrap table tbody tr.quality-row-alert-fallback td:first-child,
.tablewrap table tbody tr.quality-row-legacy-gap td:first-child,
.tablewrap table tbody tr.quality-row-no-score td:first-child {
  font-weight: 700;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f7fa;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.quality-badge.quality-full {
  border-color: #93d6aa;
  background: #eaf8ef;
  color: #0f7a3b;
}

.quality-badge.quality-partial {
  border-color: #f0cd85;
  background: #fff6df;
  color: #8a4f05;
}

.quality-badge.quality-fallback {
  border-color: #e8b38d;
  background: #fff0e6;
  color: #b35817;
}

.quality-badge.quality-legacy {
  border-color: #d0c1f0;
  background: #f3efff;
  color: #6b4bb7;
}

.quality-badge.quality-empty {
  border-color: #d8dee6;
  background: #f4f6f8;
  color: #667085;
}

.sample-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f7fa;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sample-badge.sample-full {
  border-color: #93d6aa;
  background: #eaf8ef;
  color: #0f7a3b;
}

.sample-badge.sample-legacy {
  border-color: #d0c1f0;
  background: #f3efff;
  color: #6b4bb7;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f7fa;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.priority-badge.priority-urgent {
  border-color: #e6a4a1;
  background: #fff1f0;
  color: #b42318;
}

.priority-badge.priority-high {
  border-color: #f0cd85;
  background: #fff6df;
  color: #8a4f05;
}

.priority-badge.priority-normal {
  border-color: #b8d9c1;
  background: #eef8f1;
  color: #0f7a3b;
}

.priority-badge.priority-watch {
  border-color: #d8dee6;
  background: #f4f6f8;
  color: #667085;
}

.risk-card.priority-rank-1 {
  border-left-color: var(--bad);
}

.risk-card.priority-rank-2 {
  border-left-color: #d97706;
}

.risk-card.priority-rank-3 {
  border-left-color: #0f7a3b;
}

.risk-card.priority-rank-4 {
  border-left-color: #98a2b3;
}

.priority-risk-panel .risk-card {
  gap: 6px;
}

.selection-grid article,
.grid.two > article {
  min-width: 0;
}

.selection-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.candidate-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}

.candidate-list.compact {
  max-height: 330px;
}

.candidate {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(16, 32, 51, .04);
}

.candidate-head,
.candidate-meta,
.candidate-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.candidate-head strong {
  font-size: 15px;
}

.candidate-head span,
.candidate-meta,
.candidate-foot {
  color: var(--muted);
  font-size: 12px;
}

.candidate-detail {
  display: grid;
  gap: 5px;
  margin: 0;
}

.candidate-detail div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
}

.candidate-detail dt {
  color: var(--muted);
  font-size: 12px;
}

.candidate-detail dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.candidate-head b {
  flex: 0 0 auto;
  min-width: 40px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--section-soft) 70%, #ffffff);
  color: var(--section-accent);
  text-align: center;
  font-size: 12px;
}

.candidate p {
  color: var(--text);
}

.empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.decision {
  display: grid;
  grid-template-columns: 180px 1fr 2fr;
  gap: 12px;
  align-items: center;
}

.decision h2 {
  margin: 0;
  font-size: 24px;
}

.decision p {
  color: var(--muted);
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.analysis-market-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, .85fr);
  gap: 14px;
  align-items: start;
}

canvas {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.kline-panel canvas {
  height: 430px;
}

.order-book-panel {
  min-height: 430px;
}

.relative-strength-panel {
  min-height: 320px;
}

.minute-chart-panel canvas {
  height: 240px;
}

.relative-strength-panel canvas {
  height: 220px;
}

.order-book-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.order-flow-meter {
  grid-column: 1 / -1;
}

.score-card,
.flow-alert-card {
  min-height: 108px;
}

.score-value.positive,
.flow-alert-card strong.positive,
.score-caption .positive {
  color: var(--good);
}

.score-value.negative,
.flow-alert-card strong.negative,
.score-caption .negative {
  color: var(--bad);
}

.score-value.neutral,
.flow-alert-card strong.neutral {
  color: var(--accent);
}

.score-bar {
  overflow: hidden;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: #e7edf4;
}

.score-bar-fill {
  height: 100%;
}

.score-bar-fill.positive {
  background: linear-gradient(90deg, #0f7a3b 0, #38a169 100%);
}

.score-bar-fill.neutral {
  background: linear-gradient(90deg, #1267b1 0, #49a0f2 100%);
}

.score-bar-fill.negative {
  background: linear-gradient(90deg, #f08c82 0, #b42318 100%);
}

.score-caption {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.flow-meter-block {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.flow-meter-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.flow-meter-labels small {
  font-size: 12px;
}

.flow-meter-track {
  display: flex;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e7edf4;
}

.flow-meter-track-neutral {
  background: linear-gradient(90deg, rgba(15, 122, 59, .08) 0, rgba(15, 122, 59, .08) 50%, rgba(180, 35, 24, .08) 50%, rgba(180, 35, 24, .08) 100%);
}

.flow-meter-fill {
  height: 100%;
}

.flow-meter-fill-buy,
.flow-meter-fill-order-buy {
  background: linear-gradient(90deg, #0f7a3b 0, #38a169 100%);
}

.flow-meter-fill-sell,
.flow-meter-fill-order-sell {
  background: linear-gradient(90deg, #f08c82 0, #b42318 100%);
}

.order-book-depth {
  display: grid;
  gap: 10px;
}

.order-book-depth h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

.order-book-depth table {
  width: 100%;
  border-collapse: collapse;
}

.chart-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.segmented button {
  height: 30px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--text);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--section-accent);
  color: #fff;
}

.segmented.compact {
  margin: 8px 0;
}

.strategy-fit {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.tabs nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab {
  background: #edf2f7;
  border-color: #d7e0ea;
  color: var(--text);
}

.tab.active {
  border-color: var(--section-accent);
  background: var(--section-accent);
  color: #fff;
}

.tabpage {
  display: none;
  padding-top: 12px;
}

.tabpage.active {
  display: grid;
  gap: 12px;
}

.statrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.statrow span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #f8fafc;
}

.tablewrap {
  overflow: auto;
  max-height: 430px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.tablewrap.small {
  max-height: 260px;
}

.tabpage h3,
.paper-panel h3,
.simulation-panel h3,
.strategy-version-panel h3 {
  margin: 4px 0 -2px;
  color: #263442;
  font-size: 14px;
}

.paper-equity {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.simulation-equity {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.paper-equity canvas {
  height: 220px;
}

.simulation-equity canvas {
  height: 220px;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  background: #fff;
}

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

th {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--section-soft) 68%, #ffffff);
  z-index: 1;
  color: #344054;
  font-size: 12px;
}

#analysisListTable {
  table-layout: fixed;
  min-width: 1480px;
}

#analysisListTable th,
#analysisListTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#analysisListTable .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analysis-col-code {
  width: 78px;
}

.analysis-col-name {
  width: 96px;
}

.analysis-col-latestPrice,
.analysis-col-changePercent,
.analysis-col-turnoverRate,
.analysis-col-amplitude {
  width: 86px;
}

.analysis-col-volume,
.analysis-col-amount {
  width: 104px;
}

.analysis-col-source {
  width: 92px;
}

.analysis-col-updatedAt {
  width: 142px;
}

.analysis-col-institutionCount {
  width: 64px;
}

.analysis-col-actions {
  width: 170px;
}

.analysis-col-reason {
  width: 360px;
  max-width: 360px;
}

.selectable-row {
  cursor: pointer;
}

.selectable-row:hover {
  background: #eef6ff;
}

.selectable-row.selected {
  background: color-mix(in srgb, var(--section-accent) 13%, #ffffff);
  box-shadow: inset 4px 0 0 var(--section-accent);
}

.selectable-row.selected td:first-child {
  font-weight: 700;
  color: var(--section-accent);
}

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

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

.log-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto auto 1fr;
  width: min(560px, 96vw);
  height: 100vh;
  padding: 16px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -12px 0 28px rgba(16, 32, 51, .18);
  transform: translateX(105%);
  transition: transform .18s ease;
}

.log-drawer.open {
  transform: translateX(0);
}

.log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.log-header p {
  color: var(--muted);
}

.log-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#logOutput {
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1722;
  color: #dce7f3;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

.terms-page {
  background:
    linear-gradient(180deg, #eaf1f8 0, #f4f6f8 280px, #f4f6f8 100%);
}

.terms-topbar {
  padding-bottom: 22px;
  background: #13283f;
}

.terms-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.terms-sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 4px;
  padding: 10px;
  border-color: #cfd9e5;
  box-shadow: 0 10px 24px rgba(16, 32, 51, .08);
}

.terms-sidebar a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.terms-sidebar a:hover {
  background: #edf2f7;
  color: var(--accent);
}

.terms-content {
  display: grid;
  gap: 14px;
}

.terms-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 22px;
  border: 1px solid #cfd9e5;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(16, 32, 51, .08);
}

.terms-hero .eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.terms-hero h2 {
  max-width: 760px;
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
}

.terms-hero p {
  max-width: 820px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.terms-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 8px;
}

.terms-hero-stats article {
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.terms-hero-stats strong {
  display: block;
  color: #b42318;
  font-size: 24px;
  line-height: 1;
}

.terms-hero-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.guide-flow {
  display: grid;
  gap: 10px;
  counter-reset: guide-step;
}

.guide-step {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 14px 14px 14px 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.guide-step::before {
  counter-increment: guide-step;
  content: counter(guide-step);
  position: absolute;
  left: 14px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8f2ff;
  color: var(--accent);
  font-weight: 700;
}

.guide-step h3 {
  margin: 0;
  color: #13283f;
  font-size: 16px;
}

.guide-step p {
  color: var(--muted);
}

.guide-note {
  padding: 12px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.guide-note strong {
  color: var(--text);
}

.guide-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.guide-checklist article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.guide-checklist h3 {
  margin: 0 0 8px;
  color: #13283f;
  font-size: 15px;
}

.guide-checklist ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.terms-section {
  display: grid;
  gap: 12px;
  border-color: #cfd9e5;
  box-shadow: 0 10px 24px rgba(16, 32, 51, .06);
}

.terms-section h2 {
  position: relative;
  margin: 0;
  padding-left: 12px;
  font-size: 18px;
}

.terms-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent);
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.term-card {
  display: grid;
  gap: 7px;
  min-height: 128px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: inset 0 3px 0 #e8f2ff;
}

.term-card h3 {
  margin: 0;
  color: #13283f;
  font-size: 16px;
}

.term-card p {
  color: var(--muted);
}

.term-card strong {
  color: var(--text);
}

.visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px;
}

.source-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.source-card h3 {
  margin: 0;
  color: #13283f;
  font-size: 15px;
}

.source-card p {
  color: var(--muted);
}

.source-card a {
  justify-self: start;
  padding: 4px 0;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.source-card a:hover {
  text-decoration: underline;
}

.visual-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.visual-card h3 {
  margin: 0;
  font-size: 15px;
}

.term-svg {
  width: 100%;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 980px) {
  .controls, .analysis-controls, .metrics, .grid.two, .analysis-market-grid, .decision, .summary-grid, .selection-grid, .panel-grid, .command-actions, .risk-config-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .terms-shell, .term-grid, .source-grid, .visual-grid, .guide-checklist {
    grid-template-columns: 1fr;
  }

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

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

  .terms-sidebar {
    position: static;
  }

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

  .main-nav {
    justify-content: flex-start;
    min-width: 0;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
  }

  .section-heading p {
    max-width: none;
    text-align: left;
  }

  .strategy-shortcuts-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .strategy-shortcuts-heading p {
    text-align: left;
  }

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

  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-title > button,
  .panel-title > .actions {
    align-self: flex-start;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  .topbar,
  .layout,
  .terms-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .layout {
    gap: 12px;
  }

  .work-section {
    gap: 12px;
    padding: 0 10px 10px;
    border-radius: 8px;
  }

  .section-heading {
    margin: 0 -10px;
    padding: 12px 10px;
  }

  .panel,
  .metric {
    padding: 12px;
  }

  .actions,
  .main-nav,
  .top-actions {
    width: 100%;
  }

  .actions > *,
  .main-nav > *,
  .top-actions > *,
  .action-cluster > button {
    flex: 1 1 150px;
  }

  .action-cluster {
    align-items: stretch;
  }

  .strategy-shortcuts {
    padding: 14px;
  }

  .strategy-shortcut-grid {
    grid-template-columns: 1fr;
  }

  .strategy-shortcut-card {
    min-height: 0;
    padding: 14px;
  }

  .action-cluster span {
    flex-basis: 100%;
  }

  input,
  select,
  button,
  .button-link {
    max-width: 100%;
    min-height: 34px;
    height: auto;
    white-space: normal;
  }

  .terms-hero {
    padding: 16px;
  }

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

  .terms-hero-stats article {
    padding: 10px 6px;
  }

  .terms-hero-stats strong {
    font-size: 20px;
  }
}
