body:not(.dashboard-app-shell) {
  --bg: #f6f1e8;
  --paper: #fffaf2;
  --ink: #1f2328;
  --muted: #5e655f;
  --line: rgba(31, 35, 40, 0.12);
  --accent: #bf4f24;
  --accent-soft: #f2d9c7;
  --strong: #274c3d;
  --shadow: 0 18px 45px rgba(35, 26, 16, 0.12);
}

/* Retrospective App Shell: live and sealed-history projections share this layout. */
.dashboard-app-shell:has(.retrospective-workbench),
.retrospective-workbench {
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.retrospective-workbench,
.retrospective-workbench > *,
.retrospective-block,
.retrospective-block > * {
  box-sizing: border-box;
  min-width: 0;
}

.retrospective-workbench {
  display: grid;
  gap: 16px;
}

.retrospective-block {
  margin: 0;
}

.retrospective-metrics {
  margin: 14px 0;
}

.retrospective-equity-chart {
  width: 100%;
  height: 278px;
  overflow: hidden;
  border: 1px solid var(--border, #d9d2c3);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf7 0%, #f3f7ef 100%);
}

.retrospective-equity-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.retrospective-equity-chart line {
  stroke: #d8ddcf;
  stroke-width: 1;
}

.retrospective-equity-chart text {
  fill: #687064;
  font-size: 20px;
}

.retrospective-equity-chart .equity-area {
  fill: rgba(44, 116, 79, 0.12);
}

.retrospective-equity-chart .equity-line {
  fill: none;
  stroke: #1f6d49;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.retrospective-equity-chart circle {
  fill: #fffdf7;
  stroke: #1f6d49;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.retrospective-position-grid,
.retrospective-learning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

.retrospective-position-card,
.retrospective-learning-grid > article,
.governance-readonly-summary {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border, #d9d2c3);
  border-radius: 14px;
  background: #fffdf8;
}

.retrospective-position-card header,
.retrospective-position-card dl > div,
.retrospective-learning-grid dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.retrospective-position-card dl,
.retrospective-learning-grid dl {
  display: grid;
  gap: 6px;
}

.retrospective-position-card dt,
.retrospective-learning-grid dt {
  color: var(--muted, #6c6a62);
}

.retrospective-long-text {
  max-width: 100%;
  margin-top: 10px;
}

.retrospective-long-text summary {
  cursor: pointer;
}

.retrospective-long-text:not([open]) .expandable-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.retrospective-long-text[open] .expandable-preview {
  display: none;
}

.retrospective-long-text p,
.retrospective-long-text div,
.retrospective-learning-grid li,
.governance-readonly-summary p {
  overflow-wrap: anywhere;
  white-space: normal;
}

.retrospective-ledger-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--border, #d9d2c3);
  border-radius: 12px;
}

.retrospective-ledger-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.retrospective-ledger-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0eee6;
  text-align: left;
}

.retrospective-ledger-table th,
.retrospective-ledger-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border, #d9d2c3);
  vertical-align: top;
}

.retrospective-ledger-table td.numeric {
  text-align: right;
}

.retrospective-ledger-table td small {
  display: block;
  margin-top: 2px;
}

.ledger-row-hash,
.retrospective-ledger-table code {
  display: block;
  max-width: 220px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.trade-direction {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ece8dc;
}

.trade-direction-buy {
  color: #9a3328;
  background: #f9e4df;
}

.trade-direction-sell {
  color: #176345;
  background: #dff1e7;
}

.retrospective-history-tabs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.history-tab {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border, #d9d2c3);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.history-tab.active,
.history-tab[aria-selected="true"] {
  color: #fff;
  border-color: #1f6d49;
  background: #1f6d49;
}

.history-tab.disabled {
  color: var(--muted, #6c6a62);
}

.retrospective-history-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border, #d9d2c3);
  border-radius: 12px;
  background: #faf8f1;
}

.unknown-plan {
  color: #815326;
  background: #fff3d8;
  border-radius: 10px;
  padding: 9px;
}

@media (max-width: 700px) {
  .retrospective-workbench {
    gap: 10px;
  }

  .retrospective-block,
  .retrospective-position-card,
  .retrospective-learning-grid > article,
  .governance-readonly-summary {
    padding: 10px;
  }

  .retrospective-position-grid,
  .retrospective-learning-grid {
    gap: 8px;
    margin: 10px 0 12px;
  }

  .retrospective-equity-chart {
    height: 180px;
  }

  .retrospective-ledger-table {
    min-width: 1040px;
    font-size: 12px;
  }

  .retrospective-ledger-table th,
  .retrospective-ledger-table td {
    padding: 7px 8px;
  }
}

/* Task 5 App Shell: additive rules keep the compatibility page unchanged. */
.dashboard-app-shell {
  background:
    radial-gradient(circle at 78% 8%, rgba(34, 104, 89, 0.12), transparent 32rem),
    linear-gradient(145deg, #f1eee5 0%, #f8f6ef 54%, #edf2ec 100%);
}

.dashboard-shell-header,
.dashboard-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-section-mount {
  min-width: 0;
  scroll-margin-top: 1rem;
}

.dashboard-section-mount[aria-busy="true"] {
  opacity: 0.58;
  transition: opacity 150ms ease;
}

.dashboard-section-mount:focus-visible {
  outline: 3px solid #176b57;
  outline-offset: 5px;
}

.dashboard-section-heading time {
  color: #52615c;
  font-variant-numeric: tabular-nums;
}

.dashboard-metric-panel details,
.market-breadth-card details {
  margin-top: 0.75rem;
  color: #43504c;
}

.dashboard-trust-strip .trust-state.verified {
  color: #12634f;
}

.dashboard-trust-strip .trust-state.degraded,
.dashboard-trust-strip .trust-state.blocked {
  color: #9b3c20;
}

.legacy-integrity-warning {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid #b6532f;
  border-left-width: 5px;
  border-radius: 12px;
  background: #fff4e8;
  color: #662815;
}

.legacy-integrity-warning p {
  margin: 0.35rem 0;
}

@media (max-width: 760px) {
  .dashboard-shell-header,
  .dashboard-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-app-shell .dashboard-sidebar {
    position: static;
    width: auto;
    max-height: none;
  }

  .dashboard-app-shell .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-section-mount[aria-busy="true"] {
    transition: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 79, 36, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(39, 76, 61, 0.12), transparent 24%),
    linear-gradient(180deg, #f7efe2 0%, var(--bg) 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px 22px 40px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.86);
  backdrop-filter: blur(12px);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.content {
  padding: 28px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand,
.panel,
.stock-card,
.model-card,
.run-card,
.hero,
.research-risk-banner,
.query-result {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.research-risk-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 20px 24px;
  border-color: rgba(191, 79, 36, 0.42);
  background: linear-gradient(120deg, #fff0df 0%, #fffaf2 62%, #f4dfcd 100%);
}

.research-risk-banner h2,
.research-risk-banner p {
  margin-bottom: 4px;
}

.research-risk-banner strong {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: #9c3d29;
}

.brand,
.panel,
.hero {
  padding: 22px;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 30px;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.summary,
.section-desc,
.model-summary,
.tagline,
.stock-card p,
.query-result p,
li,
span,
dd,
dt {
  line-height: 1.65;
}

.summary,
.section-desc,
.tagline,
.model-summary {
  color: var(--muted);
}

.sidebar ul,
.chains,
.pick-list {
  margin: 0;
  padding-left: 20px;
}

.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips li {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.actions-vertical {
  flex-direction: column;
}

.side-nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nav-link.active {
  color: #fff;
  background: var(--strong);
  border-color: var(--strong);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.button.primary {
  color: #fff;
  background: var(--accent);
}

.button.secondary {
  color: var(--strong);
  background: transparent;
  border-color: rgba(39, 76, 61, 0.28);
}

.run-grid,
.stock-grid,
.model-grid,
.metric-grid,
.hotspot-grid,
.list-grid {
  display: grid;
  gap: 16px;
}

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

.run-grid.compact {
  grid-template-columns: 1fr;
}

.run-panel .run-grid {
  align-items: stretch;
  min-height: 148px;
  max-height: min(42vh, 420px);
  overflow-y: auto;
  padding-right: 4px;
}

.run-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  min-height: 64px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
}

.run-card-title {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.run-card-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.run-archive {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.run-archive > summary {
  padding: 10px 4px;
  color: var(--strong);
  font-weight: 800;
  cursor: pointer;
}

.run-archive[open] > summary {
  margin-bottom: 10px;
}

.model-family-stack {
  display: grid;
  gap: 18px;
}

.model-family-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
}

.model-family-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.model-family-head h3 {
  margin: 0;
  color: var(--strong);
}

.model-family-head span {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.pick-list b {
  font-weight: 700;
}

.run-card.active {
  border-color: var(--accent);
  background: #fff2e8;
}

.run-card.active .run-card-title,
.run-card.active .run-card-meta {
  color: var(--accent);
}

.run-empty {
  padding: 14px 16px;
  border: 1px dashed rgba(39, 76, 61, 0.28);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.stock-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

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

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

.list-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.strategy-validation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.strategy-validation-card {
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 16px;
  background: linear-gradient(145deg, #fffdf8, #f5efe5);
  padding: 18px;
}

.strategy-validation-metrics {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.strategy-validation-metrics strong,
.strategy-score-effect strong {
  color: var(--ink);
}

.strategy-score-effect {
  margin: 16px 0 6px;
  color: var(--accent-deep);
}

/* Selection validation is a scorecard: rows make strategy evidence comparable. */
.strategy-validation-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at 96% 0%, rgba(225, 130, 68, 0.12), transparent 24rem),
    linear-gradient(145deg, #fffdf8, #f6f1e7);
}

.strategy-validation-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.strategy-validation-score-table,
.strategy-validation-leaders-table,
.strategy-validation-audit-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.strategy-validation-score-table th,
.strategy-validation-leaders-table th,
.strategy-validation-audit-table th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(28, 83, 68, 0.08);
  color: var(--strong);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

.strategy-validation-score-table td,
.strategy-validation-leaders-table td,
.strategy-validation-audit-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(45, 84, 71, 0.12);
  vertical-align: top;
}

.strategy-validation-score-table tbody tr:last-child td,
.strategy-validation-leaders-table tbody tr:last-child td,
.strategy-validation-audit-table tbody tr:last-child td {
  border-bottom: 0;
}

.strategy-validation-score-table tbody tr:hover,
.strategy-validation-leaders-table tbody tr:hover,
.strategy-validation-audit-table tbody tr:hover {
  background: rgba(255, 247, 235, 0.82);
}

.strategy-validation-score-table small,
.strategy-validation-leaders-table small,
.strategy-validation-audit-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.strategy-validation-score-table .numeric,
.strategy-validation-leaders-table .numeric,
.strategy-validation-audit-table .numeric {
  text-align: right;
}

.sample-maturity {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.maturity-ok { background: rgba(31, 103, 84, 0.14); color: #1a6756; }
.maturity-deferred { background: rgba(204, 110, 45, 0.14); color: #a84f25; }
.maturity-unknown { background: rgba(101, 111, 103, 0.14); color: #5a665e; }

.validation-horizon strong { display: block; color: var(--ink); }
.validation-horizon.ok strong { color: #166452; }
.validation-horizon.deferred strong { color: #a84f25; }

.score-effect-cell { font-weight: 800; white-space: nowrap; }
.score-effect-cell.positive { color: #166452; }
.score-effect-cell.negative { color: #b84e2b; }

.strategy-validation-table-hint {
  margin: 10px 2px 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.strategy-validation-stacked-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.strategy-validation-table-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.78);
}

.strategy-validation-table-panel .section-heading-row {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.strategy-validation-table-panel h3 { margin: 2px 0 0; font-size: 1.05rem; }
.strategy-validation-table-panel .muted { font-size: 0.78rem; text-align: right; }
.strategy-validation-empty { color: var(--muted); text-align: center; }


@media (max-width: 760px) {
  .strategy-validation-stacked-panels { grid-template-columns: 1fr; }
  .strategy-validation-table-panel { padding: 14px; }
  .strategy-validation-score-table { min-width: 840px; }
}

.stock-card,
.model-card,
.query-result,
.metric-card,
.hotspot-card,
.list-card {
  padding: 18px;
  overflow: visible;
}

.view-section {
  display: none;
}

.view-section.active {
  display: grid;
  gap: 18px;
}

.hover-expand {
  --fold-line-height: 1.72em;
  position: relative;
  overflow: hidden;
  transition: max-height 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.hover-expand.is-collapsible,
.hover-expand.expanded {
  background: rgba(255, 250, 242, 0.96);
  border-radius: 12px;
}

.hover-expand.is-collapsible {
  cursor: pointer;
}

.hover-expand:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(199, 93, 33, 0.25);
}

.clamp-3,
.clamp-4,
.clamp-5 {
  overflow: hidden;
  text-overflow: clip;
}

.clamp-3 {
  max-height: calc(var(--fold-line-height) * 3);
}

.clamp-4 {
  max-height: calc(var(--fold-line-height) * 4);
}

.clamp-5 {
  max-height: calc(var(--fold-line-height) * 5);
}

.hover-expand.is-collapsible {
  padding-bottom: 22px;
}

.hover-expand.is-collapsible::after {
  content: "点击展开";
  position: absolute;
  right: 10px;
  bottom: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(199, 93, 33, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.hover-expand.expanded::after {
  content: "点击收起";
}

.hover-expand.expanded {
  overflow: visible;
  z-index: 3;
  box-shadow: 0 10px 24px rgba(35, 26, 16, 0.12);
  max-height: var(--expanded-max-height, none);
}

.hover-expand.expanded.clamp-3,
.hover-expand.expanded.clamp-4,
.hover-expand.expanded.clamp-5 {
  max-height: var(--expanded-max-height, none);
}

.stock-head,
.model-head,
.hotspot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.metric-card,
.hotspot-card,
.list-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.metric-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card h3,
.hotspot-card h3,
.list-card h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.metric-detail,
.muted {
  color: var(--muted);
}

.score-badge {
  min-width: 56px;
  padding: 8px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.stock-rank {
  margin-bottom: 6px;
  color: var(--accent);
  font-weight: 800;
}

.score {
  min-width: 62px;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: center;
  color: #fff;
  background: var(--strong);
  font-weight: 700;
}

.stock-card h3 span {
  color: var(--muted);
  font-size: 14px;
}

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

.stock-card dl div {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(39, 76, 61, 0.06);
}

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

dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.model-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.serenity-section-head,
.serenity-model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.serenity-section-head h2,
.serenity-model-card-head h3,
.serenity-section-head .eyebrow,
.serenity-model-card-head .eyebrow {
  margin: 0;
}

.serenity-health {
  display: grid;
  gap: 3px;
  min-width: 245px;
  padding: 10px 12px;
  border: 1px solid rgba(32, 100, 84, 0.18);
  border-radius: 14px;
  background: rgba(223, 240, 232, 0.56);
  color: #194b41;
  font-size: 12px;
}

.serenity-health span {
  color: var(--muted);
}

.serenity-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.serenity-model-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(21, 33, 39, 0.1);
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #fbfcfa);
  box-shadow: 0 7px 18px rgba(17, 32, 37, 0.035);
}

.serenity-model-card.status-ok {
  border-top: 3px solid #1e6757;
}

.serenity-model-card.status-failed,
.serenity-model-card.status-unknown {
  border-top: 3px solid #9b422f;
}

.serenity-model-card.status-deferred,
.serenity-model-card.status-running {
  border-top: 3px solid #d79a4b;
}

.serenity-model-state {
  min-height: 42px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.serenity-model-detail {
  border-top: 1px solid rgba(21, 33, 39, 0.08);
  padding-top: 10px;
}

.serenity-model-detail summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.serenity-model-detail p {
  margin: 10px 0 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .serenity-section-head,
  .serenity-model-card-head {
    display: grid;
  }

  .serenity-health {
    min-width: 0;
  }

  .serenity-model-grid {
    grid-template-columns: 1fr;
  }
}

.status {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.ok {
  color: #fff;
  background: var(--strong);
}

.status.mixed {
  color: #fff;
  background: #c75d21;
}

.status.failed,
.status.unknown {
  color: #fff;
  background: #8a3e2f;
}

.status.pending {
  color: #fff;
  background: #6b7280;
}

.pick-list li + li {
  margin-top: 14px;
}

.pick-list strong,
.pick-list span {
  display: block;
}

.pick-list span {
  color: var(--muted);
}

.points-block {
  margin-top: 12px;
}

.points-block ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.query-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.query-form input {
  flex: 1 1 320px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 16px;
}

.lessons-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

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

.status.review_required {
  color: #fff;
  background: #8a3e2f;
}

.status.not_ready {
  color: #fff;
  background: #6b7280;
}

.section-head {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel-stack {
  display: grid;
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.panel-nested {
  margin: 0;
}

.kline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.kline-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(39, 76, 61, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kline-wrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 240, 232, 0.9));
}

.kline-chart {
  width: 100%;
  height: 280px;
  display: block;
}

.kline-grid {
  stroke: rgba(116, 106, 91, 0.18);
  stroke-width: 1;
  stroke-dasharray: 6 8;
}

.kline-axis-label,
.kline-date-label {
  fill: var(--muted);
  font-size: 12px;
}

.kline-summary-grid {
  margin-top: 16px;
}

.equity-area {
  fill: rgba(37, 99, 235, 0.12);
}

.equity-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.equity-point {
  fill: #2563eb;
  stroke: #fff;
  stroke-width: 2;
}

.equity-wick {
  stroke: #65706a;
  stroke-width: 1.4;
}

.equity-candle {
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.equity-candle.up {
  fill: rgba(32, 129, 113, 0.38);
  stroke: #187565;
}

.equity-candle.down {
  fill: rgba(195, 102, 62, 0.28);
  stroke: #a94b31;
}

.drawdown-baseline {
  stroke: rgba(91, 100, 93, 0.42);
  stroke-dasharray: 4 5;
}

.drawdown-area {
  fill: rgba(169, 75, 49, 0.15);
  stroke: #a94b31;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.drawdown-label {
  fill: var(--muted);
  font-size: 11px;
}

.trade-day-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-selector {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.history-date-btn {
  display: block;
  flex: 0 0 auto;
  min-width: 132px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.history-date-btn span,
.history-date-btn strong {
  display: block;
}

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

.history-date-btn strong {
  margin-top: 4px;
  font-size: 15px;
}

.history-date-btn:hover,
.history-date-btn:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(199, 93, 33, 0.4);
  box-shadow: 0 8px 18px rgba(35, 26, 16, 0.08);
}

.history-date-btn.active {
  border-color: rgba(199, 93, 33, 0.46);
  background: rgba(255, 245, 235, 0.96);
  color: var(--accent);
}

.history-panel {
  border-radius: 20px;
}

.history-panel[hidden],
.account-snapshot-panel[hidden] {
  display: none !important;
}

.trade-day-grid {
  align-items: start;
}

.trade-day-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.trade-day-section h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.trade-day-section ul {
  margin: 0;
  padding-left: 18px;
}

.trade-day-empty {
  margin: 0;
  color: var(--muted);
}

.section-heading-row,
.snapshot-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-row h2,
.section-heading-row .eyebrow {
  margin-bottom: 0;
}

.strategy-hypothesis-form {
  margin: 20px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.strategy-hypothesis-form label {
  display: block;
  margin-bottom: 9px;
  font-weight: 800;
}

.strategy-admin-token {
  width: min(420px, 100%);
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.strategy-hypothesis-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}

.strategy-hypothesis-controls textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.form-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--strong);
  font-size: 14px;
}

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

.strategy-hypothesis-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.strategy-hypothesis-card > p {
  color: var(--muted);
}

.strategy-hypothesis-card details {
  margin-top: 14px;
}

.strategy-hypothesis-card summary {
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

#research-evolution details {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.72);
}

#research-evolution details > summary {
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

#research-evolution details[open] > summary {
  margin-bottom: 8px;
}

#research-evolution details > p {
  margin-bottom: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.strategy-metrics div,
.snapshot-metrics div {
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--bg);
}

.strategy-metrics dt,
.snapshot-metrics dt {
  color: var(--muted);
  font-size: 12px;
}

.strategy-metrics dd,
.snapshot-metrics dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.snapshot-time-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.snapshot-time-btn {
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.snapshot-time-btn strong,
.snapshot-time-btn span {
  display: block;
}

.snapshot-time-btn span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.snapshot-time-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.account-snapshot-panel {
  padding: 16px;
  border: 1px solid rgba(191, 79, 36, 0.18);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.74);
}

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

.snapshot-detail-grid h4 {
  margin: 0 0 8px;
}

.snapshot-detail-grid ul {
  margin: 0;
  padding-left: 18px;
}

.snapshot-unavailable {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 13px;
  background: rgba(94, 101, 95, 0.08);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .strategy-hypothesis-grid {
    grid-template-columns: 1fr;
  }

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

  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    height: auto;
    overflow: visible;
  }

  .content {
    height: auto;
    overflow: visible;
  }

  .section-head {
    flex-direction: column;
  }

  .kline-meta {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .section-heading-row,
  .snapshot-source-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .strategy-hypothesis-controls,
  .snapshot-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .content,
  .sidebar {
    padding: 18px;
  }

  .run-panel .run-grid {
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .brand,
  .panel,
  .hero {
    padding: 16px;
    border-radius: 18px;
  }

  .sidebar {
    gap: 12px;
  }

  .nav-panel {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 250, 242, 0.96);
    backdrop-filter: blur(12px);
  }

  .nav-panel h2 {
    display: none;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-link {
    flex: 0 0 auto;
    width: auto;
    padding: 10px 13px;
    white-space: nowrap;
  }

  .model-family-group {
    padding: 12px;
  }

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

/* Trading-terminal visual system: preserves the existing page structure while
   making navigation, current report context, and risk states scannable first. */
body:not(.dashboard-app-shell) {
  --bg: #eef1ed;
  --paper: #ffffff;
  --ink: #152127;
  --muted: #627078;
  --line: rgba(21, 33, 39, 0.13);
  --accent: #c6532e;
  --accent-soft: #fae7de;
  --strong: #173e35;
  --shadow: 0 16px 38px rgba(18, 33, 37, 0.08);
}

body {
  background:
    radial-gradient(circle at 88% -12%, rgba(28, 111, 91, 0.17), transparent 31rem),
    radial-gradient(circle at 14% 6%, rgba(223, 142, 84, 0.16), transparent 28rem),
    linear-gradient(135deg, #f5f4ee 0%, var(--bg) 48%, #e7eeea 100%);
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.sidebar {
  gap: 14px;
  padding: 22px 16px 34px;
  background:
    linear-gradient(180deg, rgba(17, 42, 37, 0.98), rgba(19, 49, 43, 0.97)),
    var(--strong);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  scrollbar-color: rgba(255, 255, 255, 0.36) transparent;
}

.content {
  padding: 28px 30px 52px;
}

.sidebar .brand,
.sidebar .panel {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

.sidebar .brand {
  position: relative;
  overflow: hidden;
  padding: 21px 18px;
}

.sidebar .brand::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #ffc15a, #e06b44);
}

.sidebar .brand::after {
  content: "";
  position: absolute;
  width: 132px;
  height: 132px;
  right: -70px;
  bottom: -76px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.sidebar h1,
.sidebar h2,
.sidebar h3,
.sidebar p,
.sidebar li,
.sidebar .run-card-title,
.sidebar .run-card-meta {
  color: #f8faf6;
}

.sidebar h1 {
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.sidebar h2 {
  margin-bottom: 10px;
  color: #d6e3dc;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.sidebar .eyebrow {
  color: #ffbc63;
}

.sidebar .summary,
.sidebar .run-card-meta {
  color: rgba(239, 246, 241, 0.72);
}

.nav-panel {
  padding: 13px;
}

.nav-panel h2,
.quick-panel h2 {
  padding: 0 4px;
}

.side-nav {
  gap: 4px;
}

.nav-group-label {
  display: block;
  margin: 9px 10px 2px;
  color: rgba(214, 227, 220, 0.58);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.nav-group-label:first-child {
  margin-top: 2px;
}

.nav-link {
  position: relative;
  padding: 11px 12px 11px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: rgba(248, 250, 246, 0.82);
  font-size: 14px;
  font-weight: 650;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 0 6px 6px 0;
  background: #ffc15a;
  transform: translateY(-50%);
  transition: height 0.18s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  color: #173e35;
  background: #f6f4eb;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.nav-link.active::before {
  height: 58%;
}

.quick-panel {
  padding: 15px;
}

.sidebar .button.primary {
  background: linear-gradient(135deg, #e87147, #bd472b);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

.sidebar .button.secondary {
  border-color: rgba(255, 255, 255, 0.2);
  color: #f8faf6;
}

.run-panel .run-grid {
  min-height: 0;
  max-height: 33vh;
}

.sidebar .run-card {
  min-height: 58px;
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.055);
}

.sidebar .run-card:hover {
  background: rgba(255, 255, 255, 0.11);
}

.sidebar .run-card.active {
  border-color: rgba(255, 193, 90, 0.78);
  background: rgba(255, 193, 90, 0.13);
}

.sidebar .run-card.active .run-card-title,
.sidebar .run-card.active .run-card-meta,
.sidebar .run-archive > summary {
  color: #ffca79;
}

.sidebar .run-empty,
.sidebar .model-family-group {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(248, 250, 246, 0.75);
}

.sidebar .hover-expand.is-collapsible,
.sidebar .hover-expand.expanded {
  background: rgba(255, 255, 255, 0.07);
  color: #f8faf6;
  box-shadow: none;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 206px;
  padding: 30px 34px;
  border: 0;
  color: #f8fbf9;
  background:
    radial-gradient(circle at 91% 30%, rgba(255, 194, 104, 0.29), transparent 15rem),
    linear-gradient(118deg, #102c2a 0%, #1f5144 56%, #206454 100%);
  box-shadow: 0 20px 48px rgba(16, 44, 42, 0.2);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
}

.hero::before {
  width: 360px;
  height: 360px;
  right: -148px;
  top: -265px;
}

.hero::after {
  width: 224px;
  height: 224px;
  right: -22px;
  bottom: -164px;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero .eyebrow {
  color: #ffca79;
}

.hero h2 {
  max-width: 650px;
  margin-bottom: 11px;
  color: #fff;
  font-size: clamp(26px, 3.2vw, 42px);
  letter-spacing: -0.045em;
}

.hero p:not(.eyebrow) {
  max-width: 720px;
  margin-bottom: 0;
  color: rgba(246, 252, 248, 0.77);
}

.hero .hover-expand.is-collapsible,
.hero .hover-expand.expanded {
  background: transparent;
  box-shadow: none;
}

.hero .hover-expand.is-collapsible::after {
  color: #ffce82;
  background: rgba(7, 36, 31, 0.46);
}

.report-context {
  display: grid;
  min-width: 190px;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: rgba(7, 36, 31, 0.25);
  backdrop-filter: blur(8px);
}

.report-context-label {
  color: rgba(246, 252, 248, 0.6);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.report-context strong {
  color: #fff;
  font-size: 17px;
}

.report-context > span:not(.report-context-label) {
  color: #d9eee4;
  font-size: 13px;
}

.report-context .report-context-signal {
  width: fit-content;
  margin-top: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #193d34;
  background: #ffc66f;
  font-weight: 800;
}

.research-risk-banner {
  border-color: rgba(193, 74, 40, 0.32);
  background: linear-gradient(105deg, #fff1e8, #fffdfa 68%, #f7dfd2);
  box-shadow: 0 12px 26px rgba(118, 49, 26, 0.08);
}

.content > .hero,
.content > .research-risk-banner,
.content > .report-trust-strip,
.content > .global-research-notice,
.view-section {
  max-width: 1520px;
  margin-inline: auto;
}

.report-trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(21, 33, 39, 0.1);
  border-radius: 18px;
  background: rgba(21, 33, 39, 0.09);
  box-shadow: 0 10px 24px rgba(18, 33, 37, 0.05);
}

.report-trust-strip > div {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 86px;
  padding: 14px 17px;
  background: rgba(255, 255, 255, 0.94);
}

.report-trust-strip > .trust-strip-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: auto;
  padding-block: 10px;
  background: #fff8f1;
}

.trust-strip-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.report-trust-strip span,
.report-trust-strip small {
  color: var(--muted);
  font-size: 11px;
}

.report-trust-strip strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.trust-state.ok {
  color: #176246;
}

.trust-state.partial {
  color: #936119;
}

.trust-state.stale {
  color: #9b422f;
}

.global-research-notice {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  margin-top: 10px;
  padding: 11px 15px;
  border: 1px solid rgba(191, 79, 36, 0.2);
  border-radius: 14px;
  color: #6a4a3b;
  background: rgba(255, 248, 241, 0.88);
  font-size: 12px;
  line-height: 1.55;
}

.global-research-notice strong {
  flex: 0 0 auto;
  color: #9b422f;
}

.view-section {
  margin-top: 18px;
}

.progressive-panel > summary,
.stock-analysis-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 800;
}

.progressive-panel > summary::-webkit-details-marker,
.stock-analysis-details > summary::-webkit-details-marker {
  display: none;
}

.progressive-panel > summary span {
  font-size: clamp(20px, 2vw, 29px);
}

.progressive-panel > summary small {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.progressive-panel > summary::after,
.stock-analysis-details > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 20px;
}

.progressive-panel[open] > summary::after,
.stock-analysis-details[open] > summary::after {
  content: "−";
}

.progressive-panel > summary + *,
.stock-analysis-details > summary + * {
  margin-top: 18px;
}

.stock-analysis-details {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(191, 79, 36, 0.14);
  border-radius: 14px;
  background: rgba(255, 248, 241, 0.72);
}

.stock-analysis-details > summary {
  color: var(--accent);
  font-size: 13px;
}

.panel,
.stock-card,
.model-card,
.query-result {
  border-color: rgba(21, 33, 39, 0.1);
  box-shadow: var(--shadow);
}

.content .panel {
  border-radius: 20px;
}

.content .panel > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.content .panel > h2::before {
  content: "";
  width: 7px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(180deg, #d66239, #f0ad5b);
}

.metric-card,
.hotspot-card,
.list-card {
  border-color: rgba(21, 33, 39, 0.1);
  background: linear-gradient(160deg, #ffffff, #fbfcfa);
  box-shadow: 0 7px 18px rgba(17, 32, 37, 0.035);
}

.stock-card,
.model-card,
.hotspot-card,
.metric-card,
.list-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stock-card:hover,
.model-card:hover,
.hotspot-card:hover,
.metric-card:hover,
.list-card:hover {
  transform: translateY(-3px);
  border-color: rgba(32, 100, 84, 0.28);
  box-shadow: 0 15px 30px rgba(17, 54, 48, 0.11);
}

.score,
.status.ok {
  background: linear-gradient(135deg, #1e6757, #194b41);
}

.score-badge,
.button.primary {
  background: linear-gradient(135deg, #d7673c, #b7462b);
}

.status.failed,
.status.unknown,
.status.review_required {
  background: #9b422f;
}

.status.collecting_evidence {
  color: #173e35;
  background: #dcefe8;
}

.status.stable {
  color: #133e2a;
  background: #c9ead6;
}

.risk-account-note {
  color: #69473a;
  font-weight: 700;
}

.risk-audit-details {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.risk-audit-details summary {
  width: fit-content;
  cursor: pointer;
  color: #8e4935;
  font-weight: 700;
}

.risk-audit-details p {
  margin-top: 7px;
  overflow-wrap: anywhere;
}

.market-signal-board {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

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

.market-pulse-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(27, 55, 50, 0.11);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 247, 0.94));
  box-shadow: 0 9px 22px rgba(20, 50, 44, 0.05);
}

.market-pulse-card.positive {
  border-top: 3px solid #c94d3a;
}

.market-pulse-card.negative {
  border-top: 3px solid #178356;
}

.market-pulse-card.neutral {
  border-top: 3px solid #d79a4b;
}

.market-pulse-head,
.signal-card-heading,
.mainline-title-row,
.section-title-row,
.news-meta,
.catalyst-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-pulse-head span,
.signal-card-heading span,
.signal-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.market-pulse-head em {
  max-width: 48%;
  overflow: hidden;
  color: #9a4931;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-pulse-card > strong {
  display: block;
  margin: 13px 0 6px;
  overflow-wrap: anywhere;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(25px, 2.8vw, 39px);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.market-pulse-card small {
  color: var(--muted);
  line-height: 1.55;
}

.market-signal-detail-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.8fr 0.9fr;
  gap: 14px;
}

.market-breadth-card,
.market-strength-card,
.market-sentiment-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(27, 55, 50, 0.11);
  border-radius: 18px;
  background: #fff;
}

.signal-card-heading > div {
  display: grid;
  gap: 5px;
}

.signal-card-heading strong {
  font-size: 17px;
}

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

.breadth-track {
  display: flex;
  height: 13px;
  margin: 21px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceae4;
}

.breadth-track span {
  min-width: 0;
}

.breadth-up {
  background: #e65b4d;
}

.breadth-flat {
  background: #d6c9ae;
}

.breadth-down {
  background: #14a265;
}

.breadth-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.breadth-legend .up {
  color: #bd4035;
}

.breadth-legend .down {
  color: #138457;
}

.market-breadth-card > p {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.strength-pair > div {
  display: grid;
  gap: 3px;
  padding: 14px 9px;
  border-radius: 14px;
  text-align: center;
}

.strength-pair > div:first-child {
  color: #b83f35;
  background: #fff0ed;
}

.strength-pair > div:last-child {
  color: #12784f;
  background: #edf9f3;
}

.strength-pair strong {
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

.strength-pair span {
  font-size: 12px;
  font-weight: 800;
}

.market-sentiment-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.sentiment-gauge {
  --gauge-color: #d39933;
  --sentiment-fill: 0%;
  display: grid;
  place-content: center;
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #fff 72%, transparent 73%),
    conic-gradient(from -90deg, var(--gauge-color) 0 var(--sentiment-fill), #ebe7df 0);
}

.sentiment-fill-0 { --sentiment-fill: 0%; }
.sentiment-fill-5 { --sentiment-fill: 5%; }
.sentiment-fill-10 { --sentiment-fill: 10%; }
.sentiment-fill-15 { --sentiment-fill: 15%; }
.sentiment-fill-20 { --sentiment-fill: 20%; }
.sentiment-fill-25 { --sentiment-fill: 25%; }
.sentiment-fill-30 { --sentiment-fill: 30%; }
.sentiment-fill-35 { --sentiment-fill: 35%; }
.sentiment-fill-40 { --sentiment-fill: 40%; }
.sentiment-fill-45 { --sentiment-fill: 45%; }
.sentiment-fill-50 { --sentiment-fill: 50%; }
.sentiment-fill-55 { --sentiment-fill: 55%; }
.sentiment-fill-60 { --sentiment-fill: 60%; }
.sentiment-fill-65 { --sentiment-fill: 65%; }
.sentiment-fill-70 { --sentiment-fill: 70%; }
.sentiment-fill-75 { --sentiment-fill: 75%; }
.sentiment-fill-80 { --sentiment-fill: 80%; }
.sentiment-fill-85 { --sentiment-fill: 85%; }
.sentiment-fill-90 { --sentiment-fill: 90%; }
.sentiment-fill-95 { --sentiment-fill: 95%; }
.sentiment-fill-100 { --sentiment-fill: 100%; }

.market-sentiment-card.cold .sentiment-gauge,
.market-sentiment-card.weak .sentiment-gauge {
  --gauge-color: #16855a;
}

.market-sentiment-card.warm .sentiment-gauge,
.market-sentiment-card.hot .sentiment-gauge {
  --gauge-color: #d65343;
}

.sentiment-gauge strong {
  font-size: 25px;
  line-height: 1;
  text-align: center;
}

.sentiment-gauge span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.market-sentiment-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.section-title-row {
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-title-row h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  font-size: 20px;
}

.section-title-row h2::before {
  content: "";
  width: 7px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(180deg, #d66239, #f0ad5b);
}

.section-title-row > span,
.macro-status-badge {
  padding: 5px 9px;
  border-radius: 999px;
  color: #5d5d52;
  background: #f1eee6;
  font-size: 11px;
  font-weight: 800;
}

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

.mainline-overview-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 13px;
  padding: 15px;
  border: 1px solid rgba(27, 55, 50, 0.11);
  border-radius: 17px;
  background: linear-gradient(145deg, #fff, #fafbf8);
}

.mainline-rank {
  display: grid;
  place-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: #244d42;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 700;
}

.mainline-content,
.mainline-title-row {
  min-width: 0;
}

.mainline-title-row h3 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mainline-level {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.mainline-level.core {
  color: #9f352b;
  background: #fde5df;
}

.mainline-level.active {
  color: #90601d;
  background: #fff0ce;
}

.mainline-level.watch {
  color: #42675d;
  background: #e5f1ed;
}

.mainline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.mainline-stats strong {
  color: var(--ink);
}

.macro-summary-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border-left: 4px solid #d88a43;
  border-radius: 0 14px 14px 0;
  background: #fff6e9;
}

.macro-summary-strip span {
  color: var(--muted);
  font-size: 12px;
}

.catalyst-news-grid,
.catalyst-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.macro-news-card,
.catalyst-plan-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(27, 55, 50, 0.11);
  border-radius: 17px;
  background: #fff;
}

.news-meta {
  align-items: flex-start;
  color: #93602b;
  font-size: 11px;
  font-weight: 800;
}

.news-meta small {
  max-width: 50%;
  color: var(--muted);
  font-weight: 500;
  text-align: right;
}

.macro-news-card h3,
.catalyst-plan-card h3 {
  margin: 11px 0 8px;
  font-size: 16px;
  line-height: 1.45;
}

.macro-news-card > p {
  color: var(--muted);
  font-size: 13px;
}

.news-sector-line {
  display: grid;
  gap: 3px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed rgba(27, 55, 50, 0.13);
  font-size: 12px;
}

.news-sector-line span {
  color: var(--muted);
}

.catalyst-plan-grid {
  margin-top: 12px;
}

.catalyst-plan-card {
  background: linear-gradient(150deg, #fffdf8, #f8fbf8);
}

.catalyst-plan-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.catalyst-plan-head strong {
  padding: 3px 8px;
  border-radius: 999px;
  color: #8b4e22;
  background: #ffebce;
  font-size: 10px;
}

.catalyst-sectors {
  color: #385e53;
  font-size: 12px;
  font-weight: 700;
}

.catalyst-condition {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 9px;
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 11px;
  font-size: 12px;
}

.catalyst-condition span {
  font-weight: 800;
}

.catalyst-condition p {
  margin: 0;
  line-height: 1.55;
}

.catalyst-condition.confirm {
  color: #1f604b;
  background: #eaf6f0;
}

.catalyst-condition.invalidate {
  color: #943f31;
  background: #fff0ec;
}

.pattern-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.pattern-badge-alert {
  color: #fff1eb;
  background: #b63a2b;
  border: 1px solid #e87d67;
}

.status.mixed {
  background: #a86b1e;
}

.status.pending,
.status.not_ready {
  background: #66747c;
}

.hover-expand.is-collapsible::after {
  background: #fbe8dc;
  color: #a8462b;
}

.hover-expand.expanded {
  box-shadow: 0 14px 30px rgba(18, 35, 39, 0.15);
}

.button,
.nav-link,
.run-card,
.history-date-btn,
summary,
.hover-expand.is-collapsible {
  -webkit-tap-highlight-color: transparent;
}

.button:focus-visible,
.nav-link:focus-visible,
.run-card:focus-visible,
.history-date-btn:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(235, 152, 70, 0.55);
  outline-offset: 3px;
}

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

.ledger-table-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.ledger-table-card h3 {
  margin-bottom: 12px;
}

.ledger-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(39, 76, 61, 0.14);
  border-radius: 14px;
  background: #fffdf9;
}

.ledger-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
}

.ledger-table th,
.ledger-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(31, 35, 40, 0.09);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.ledger-table th {
  color: var(--muted);
  background: rgba(39, 76, 61, 0.06);
  font-size: 12px;
  font-weight: 800;
}

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

.ledger-table td:first-child strong,
.ledger-table td:first-child small {
  display: block;
}

.ledger-table td:first-child small {
  margin-top: 2px;
  color: var(--muted);
}

.ledger-table td:has(.ledger-details) {
  min-width: 142px;
  white-space: normal;
}

.ledger-details {
  min-width: 128px;
}

.ledger-details summary {
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.ledger-details[open] summary {
  margin-bottom: 8px;
}

.ledger-details p {
  margin: 0 0 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ledger-details p:last-child {
  margin-bottom: 0;
}

.ledger-empty {
  margin: 0;
  color: var(--muted);
}

.ledger-consultation-card {
  grid-column: 1 / -1;
}

.ledger-consultation-list {
  display: grid;
  gap: 10px;
}

.ledger-consultation-help {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.consultation-record {
  padding: 13px 15px;
  border: 1px solid rgba(30, 57, 45, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.consultation-record.corrupt {
  border-color: rgba(177, 69, 42, 0.32);
  background: rgba(255, 244, 235, 0.82);
}

.consultation-record summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.consultation-status {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: #26634d;
  font-size: 0.76rem;
  line-height: 1.5;
}

.consultation-status.corrupt {
  background: #a6412a;
}

.consultation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pnl.positive {
  color: #a83c28;
}

.pnl.negative {
  color: #176246;
}

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

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 292px minmax(0, 1fr);
  }

  .content {
    padding: 22px;
  }

  .hero {
    padding: 26px;
  }

  .report-context {
    min-width: 166px;
  }
}

@media (max-width: 860px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .ledger-table-grid {
    grid-template-columns: 1fr;
  }

  .ledger-table-card {
    padding: 14px;
  }

  .ledger-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .ledger-table,
  .ledger-table tbody,
  .ledger-table tr,
  .ledger-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .ledger-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .ledger-table tbody {
    display: grid;
    gap: 10px;
  }

  .ledger-table tr {
    padding: 8px 12px;
    border: 1px solid rgba(39, 76, 61, 0.14);
    border-radius: 14px;
    background: #fffdf9;
  }

  .ledger-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed rgba(31, 35, 40, 0.1);
    white-space: normal;
  }

  .ledger-table td:last-child {
    border-bottom: 0;
  }

  .ledger-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .ledger-table td:first-child strong,
  .ledger-table td:first-child small {
    display: inline;
  }

  .ledger-table td:first-child small {
    margin-left: 6px;
  }

  .shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .sidebar,
  .content {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .sidebar {
    padding: 16px;
    overflow: visible;
  }

  .sidebar .brand,
  .quick-panel:not(.run-panel) {
    display: none;
  }

  .nav-panel {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0;
    padding: 10px;
    background: rgba(17, 42, 37, 0.96) !important;
    backdrop-filter: blur(14px);
  }

  .nav-panel h2 {
    display: none;
  }

  .nav-group-label {
    display: none;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow-x: visible;
    padding: 0;
  }

  .nav-link {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    white-space: normal;
    text-align: center;
  }

  .nav-link::before {
    display: none;
  }

  .run-panel {
    display: none;
  }

  .content {
    padding: 16px;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .hero {
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 24px 20px;
  }

  .hero > div:first-child {
    min-width: 0;
    width: 100%;
  }

  .hero h2 {
    font-size: 28px;
  }

  .report-context {
    width: 100%;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .report-context-label {
    grid-row: span 2;
  }

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

  .report-trust-strip > div {
    min-height: 78px;
    padding: 12px 14px;
  }

  .global-research-notice {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .research-risk-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-pulse-grid,
  .market-signal-detail-grid,
  .mainline-overview-grid,
  .catalyst-news-grid,
  .catalyst-plan-grid {
    grid-template-columns: 1fr;
  }

  .market-pulse-card,
  .market-breadth-card,
  .market-strength-card,
  .market-sentiment-card,
  .mainline-overview-card,
  .macro-news-card,
  .catalyst-plan-card {
    min-width: 0;
    max-width: 100%;
  }

  .market-pulse-card {
    padding: 17px;
  }

  .market-pulse-card > strong {
    font-size: 29px;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title-row > span {
    align-self: flex-start;
  }

  .market-sentiment-card {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .sentiment-gauge {
    width: 82px;
  }

  .news-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .news-meta small {
    max-width: 100%;
    text-align: left;
  }
}

@media (max-width: 430px) {
  .sidebar {
    padding: 10px;
  }

  .nav-panel {
    padding: 8px;
  }

  .side-nav {
    gap: 6px;
  }

  .nav-link {
    min-height: 44px;
    padding: 8px 6px;
    font-size: 12px;
  }

  .content {
    padding: 12px;
  }

  .report-trust-strip > div {
    min-height: 0;
    padding: 11px 12px;
  }

  .report-trust-strip strong {
    font-size: 13px;
  }
}

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

@media screen and (max-width: 860px) {
  .dashboard-app-shell {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .dashboard-app-shell .dashboard-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .dashboard-app-shell .dashboard-sidebar {
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .dashboard-app-shell .dashboard-content {
    height: auto;
    overflow: visible;
  }

  .dashboard-app-shell .quick-panel:not(.run-panel) {
    display: block;
    margin: 10px 0 0;
  }

  .dashboard-app-shell .quick-panel .actions-vertical {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-app-shell .responsive-table-scroll,
  .responsive-table-scroll {
    max-width: 100%;
  }

  .dashboard-data-table {
    min-width: 1120px;
  }
}

/* Task 6 research sections keep long text and wide evidence tables accessible. */
.dashboard-document,
.dashboard-app-shell {
  max-width: 100vw;
  overflow-x: hidden;
}

.dashboard-nav-details > summary {
  margin-bottom: 0.7rem;
  color: var(--ink, #2b2620);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
}

.dashboard-nav-details:not([open]) > summary {
  margin-bottom: 0;
}

.dashboard-section-mount,
.dashboard-research-section,
.dashboard-research-section .panel {
  min-width: 0;
  max-width: 100%;
}

.dashboard-research-section .dashboard-section-heading {
  min-width: 0;
  flex-wrap: wrap;
}

.dashboard-research-section .dashboard-section-heading time {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.section-state {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #c8a85b;
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff8df;
  color: #493b16;
}

.section-state-blocked {
  border-color: #a9483b;
  background: #fff0ed;
  color: #67251d;
}

.expandable-text {
  margin: 0.35rem 0;
}

.expandable-text > summary {
  cursor: pointer;
  list-style-position: outside;
}

.expandable-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.expandable-open-label,
.expandable-close-label {
  display: inline-block;
  margin-top: 0.35rem;
  color: #8b3f25;
  font-weight: 700;
}

.expandable-close-label,
.expandable-text[open] .expandable-open-label {
  display: none;
}

.expandable-text[open] .expandable-close-label {
  display: inline-block;
}

.expandable-button {
  margin: 0.35rem 0;
  padding: 0.45rem 0.8rem;
  border: 1px solid #a95732;
  border-radius: 999px;
  background: #fff8ef;
  color: #78351f;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.expandable-button:focus-visible,
.responsive-table-scroll:focus-visible,
.server-pagination a:focus-visible {
  outline: 3px solid #1c6c65;
  outline-offset: 2px;
}

.responsive-table-viewport {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  contain: inline-size layout paint;
  overflow: hidden;
}

.responsive-table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  contain: inline-size layout paint;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.dashboard-data-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.dashboard-data-table th,
.dashboard-data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border, #ded7c8);
  text-align: right;
  white-space: nowrap;
}

.dashboard-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel, #fffdf8);
}

.dashboard-data-table th:first-child,
.dashboard-data-table th:nth-child(2),
.dashboard-data-table td:first-child,
.dashboard-data-table td:nth-child(2) {
  text-align: left;
}

.server-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.server-pagination a {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border, #ded7c8);
  border-radius: 8px;
  background: #fff;
  color: #713920;
  font-weight: 700;
}

/* Legacy warm dashboard restoration */
body:not(.dashboard-app-shell) {
  --bg: #f6f1e8;
  --paper: #fffaf2;
  --ink: #1f2328;
  --muted: #5e655f;
  --line: rgba(31, 35, 40, 0.12);
  --accent: #bf4f24;
  --accent-soft: #f2d9c7;
  --strong: #274c3d;
  --shadow: 0 18px 45px rgba(35, 26, 16, 0.12);
  background:
    radial-gradient(circle at top left, rgba(191, 79, 36, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(39, 76, 61, 0.12), transparent 24%),
    linear-gradient(180deg, #f7efe2 0%, var(--bg) 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body:not(.dashboard-app-shell) .shell {
  grid-template-columns: 360px minmax(0, 1fr);
}

body:not(.dashboard-app-shell) .sidebar {
  gap: 18px;
  padding: 28px 22px 40px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.86);
  backdrop-filter: blur(12px);
  scrollbar-color: rgba(39, 76, 61, 0.38) transparent;
}

body:not(.dashboard-app-shell) .content {
  padding: 28px;
}

body:not(.dashboard-app-shell) .sidebar .brand,
body:not(.dashboard-app-shell) .sidebar .panel {
  border-color: var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

body:not(.dashboard-app-shell) .sidebar .brand {
  padding: 22px;
  overflow: visible;
}

body:not(.dashboard-app-shell) .sidebar .brand::before,
body:not(.dashboard-app-shell) .sidebar .brand::after {
  content: none;
}

body:not(.dashboard-app-shell) .sidebar h1,
body:not(.dashboard-app-shell) .sidebar h2,
body:not(.dashboard-app-shell) .sidebar h3,
body:not(.dashboard-app-shell) .sidebar p,
body:not(.dashboard-app-shell) .sidebar li,
body:not(.dashboard-app-shell) .sidebar .run-card-title,
body:not(.dashboard-app-shell) .sidebar .run-card-meta {
  color: var(--ink);
}

body:not(.dashboard-app-shell) .sidebar .brand h1 {
  display: grid;
  gap: 8px;
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}

body:not(.dashboard-app-shell) .sidebar .brand h1 span {
  display: block;
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.35;
}

body:not(.dashboard-app-shell) .sidebar h2 {
  color: var(--ink);
  font-size: 20px;
  letter-spacing: 0;
}

body:not(.dashboard-app-shell) .nav-group-label {
  color: var(--muted);
}

body:not(.dashboard-app-shell) .nav-link {
  min-height: 48px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
}

body:not(.dashboard-app-shell) .nav-link.active,
body:not(.dashboard-app-shell) .nav-link[aria-current="page"] {
  border-color: var(--strong);
  color: #fff;
  background: var(--strong);
}

body:not(.dashboard-app-shell) .sidebar .button.primary {
  color: #fff;
  background: var(--accent);
}

body:not(.dashboard-app-shell) .sidebar .button.secondary {
  border-color: var(--strong);
  color: var(--strong);
  background: #fff;
}

body:not(.dashboard-app-shell) .sidebar .run-card {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

body:not(.dashboard-app-shell) .sidebar .run-card.active {
  border-color: var(--accent);
  background: #fff4e8;
}

/* Account-performance and model-consensus workbenches use denser, distinct
   visual layers so account facts, model availability and stock conclusions do
   not read like one undifferentiated card grid. */
.equity-kline-panel {
  overflow: hidden;
  padding: 0;
  border-color: rgba(36, 72, 59, 0.16);
  background:
    radial-gradient(circle at 88% 0%, rgba(236, 163, 92, 0.22), transparent 24rem),
    linear-gradient(145deg, #fffdf8 0%, #f7f1e7 100%);
}

.equity-kline-head {
  padding: 26px 28px 18px;
  border-bottom: 1px solid rgba(36, 72, 59, 0.1);
}

.equity-kicker {
  margin: 0 0 8px;
  color: #a64e2f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.equity-kline-panel h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.04em;
}

.equity-kline-panel .section-desc {
  max-width: 760px;
  margin: 10px 0 0;
  color: #59655d;
}

.equity-kline-panel .kline-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, 1fr));
  gap: 8px;
  min-width: min(100%, 360px);
}

.equity-kline-panel .kline-meta span {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(36, 72, 59, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.65);
}

.equity-kline-panel .kline-meta small {
  color: #6c746d;
  font-size: 11px;
}

.equity-kline-panel .kline-meta strong {
  color: #1f4f43;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.kline-summary-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 18px 28px;
}

.equity-kline-panel .kline-summary-strip .metric-card {
  min-height: 126px;
  padding: 15px;
  border-radius: 15px;
  border-color: rgba(36, 72, 59, 0.1);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.equity-kline-panel .kline-summary-strip .metric-card h3 {
  margin: 8px 0;
  color: #173e35;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.equity-kline-panel .kline-summary-strip .metric-detail {
  margin: 0;
  color: #687169;
  font-size: 12px;
  line-height: 1.5;
}

.equity-kline-panel .kline-wrap {
  position: relative;
  margin: 0 28px 28px;
  padding: 42px 14px 12px;
  border-color: rgba(36, 72, 59, 0.12);
  background:
    linear-gradient(rgba(52, 93, 76, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 93, 76, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(245,241,233,0.86));
  background-size: 42px 42px, 42px 42px, auto;
}

.equity-chart-legend {
  position: absolute;
  top: 13px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: #566158;
  font-size: 11px;
  font-weight: 700;
}

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

.equity-chart-legend span::before {
  display: inline-block;
  width: 15px;
  height: 7px;
  content: "";
  border-radius: 2px;
}

.equity-chart-legend .legend-candle::before { background: rgba(31, 109, 73, 0.62); }
.equity-chart-legend .legend-line::before { height: 3px; border-radius: 99px; background: #2563eb; }
.equity-chart-legend .legend-drawdown::before { background: rgba(155, 66, 47, 0.36); }

.serenity-discussion-panel,
.serenity-consensus-panel {
  border-color: rgba(36, 72, 59, 0.14);
  background:
    radial-gradient(circle at 94% 4%, rgba(234, 170, 102, 0.18), transparent 20rem),
    linear-gradient(145deg, #fffdf8, #faf7f0);
}

.serenity-discussion-panel .serenity-section-head {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(36, 72, 59, 0.1);
}

.serenity-discussion-panel .serenity-health {
  min-width: 265px;
  border-color: rgba(31, 109, 73, 0.22);
  background: linear-gradient(135deg, rgba(220, 239, 230, 0.9), rgba(255, 252, 245, 0.9));
  box-shadow: none;
}

.serenity-model-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.serenity-model-card {
  position: relative;
  min-height: 166px;
  padding: 18px;
  overflow: hidden;
  border-radius: 17px;
  box-shadow: none;
}

.serenity-model-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: 72px;
  content: "";
  border-radius: 0 17px 0 72px;
  background: rgba(31, 109, 73, 0.07);
}

.serenity-model-card.status-failed::after,
.serenity-model-card.status-unknown::after { background: rgba(155, 66, 47, 0.1); }

.serenity-model-card-head { position: relative; z-index: 1; }
.serenity-model-card-head h3 { font-size: 19px; }
.serenity-model-card .eyebrow { color: #8c725d; font-size: 11px; }
.serenity-model-state { min-height: 42px; color: #5c655e; }
.serenity-model-detail { border-color: rgba(36, 72, 59, 0.1); }

.serenity-consensus-panel > h2 { margin-bottom: 4px; }
.serenity-consensus-grid { grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); }

.serenity-consensus-card {
  min-height: 220px;
  padding: 18px;
  border-top: 3px solid #d28445;
  background: linear-gradient(155deg, #fff, #faf7ef);
}

/* Qwen3.8 review: make the account chart and model deliberation scannable. */
.equity-kline-panel .equity-kline-head {
  align-items: flex-start;
  gap: 18px;
}

.equity-kline-panel .kline-meta span:first-child {
  border-color: rgba(31, 94, 74, 0.5);
  background: linear-gradient(135deg, #1d5044, #2d6d5c);
}

.equity-kline-panel .kline-meta span:first-child :is(small, strong) {
  color: #fffdf8;
}

.equity-kline-panel .kline-summary-strip .metric-card {
  min-height: 102px;
}

.equity-kline-panel .kline-summary-strip .metric-card:first-child {
  border-left: 3px solid #2d6d5c;
}

.equity-kline-panel .kline-wrap {
  background:
    linear-gradient(to bottom, transparent 72%, rgba(42, 84, 70, 0.15) 72%, rgba(42, 84, 70, 0.15) calc(72% + 1px), transparent calc(72% + 1px)),
    linear-gradient(rgba(52, 93, 76, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 93, 76, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(245,241,233,0.86));
  background-size: 100% 100%, 100% 34px, 92px 100%, 100% 100%;
}

.equity-kline-panel .kline-wrap::after {
  content: "回撤区";
  position: absolute;
  right: 12px;
  top: calc(72% + 5px);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: #6c746d;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.serenity-discussion-panel .serenity-section-head {
  align-items: flex-start;
  gap: 18px;
}

.serenity-stage-note,
.serenity-health-detail {
  margin: 7px 0 0;
  color: #66716a;
  font-size: 12px;
}

.serenity-model-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.serenity-model-card {
  min-height: 156px;
  padding: 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.73);
  box-shadow: none;
}

.serenity-model-card::before {
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: #2d6d5c;
}

.serenity-model-card.status-failed,
.serenity-model-card.status-deferred {
  border-style: dashed;
  background: rgba(246, 244, 238, 0.7);
}

.serenity-model-card.status-failed::before,
.serenity-model-card.status-deferred::before {
  background: #8d8a81;
}

.serenity-model-state {
  display: -webkit-box;
  min-height: 38px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.serenity-consensus-panel {
  border-top: 3px solid #d28445;
}

.serenity-consensus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.serenity-consensus-head p {
  max-width: 390px;
  margin: 0;
  color: #66716a;
  font-size: 12px;
  line-height: 1.55;
}

.serenity-consensus-card {
  min-height: 210px;
  border-top: 1px solid rgba(36, 72, 59, 0.12);
  border-left: 3px solid #d28445;
  border-radius: 12px;
}

.serenity-consensus-card .consensus-status {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 10px 0;
  color: #66716a;
  font-size: 12px;
}

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

.consensus-models div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(238, 232, 220, 0.54);
}

.consensus-models :is(dt, dd) { margin: 0; }
.consensus-models dt { color: #6c746d; font-size: 10px; }
.consensus-models dd { margin-top: 3px; color: #27352f; font-size: 12px; line-height: 1.4; }
.consensus-conclusion { margin: 12px 0; color: #33443c; line-height: 1.55; }

.serenity-consensus-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.serenity-consensus-card h3 { margin: 0; font-size: 20px; }
.serenity-consensus-card .consensus-status { margin: 10px 0 14px; color: #8e4935; font-size: 13px; }
.serenity-consensus-card ul { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(36, 72, 59, 0.1); }

@media (max-width: 860px) {
  .equity-kline-head { padding: 20px 18px 16px; }
  .equity-kline-panel .kline-meta { width: 100%; margin-top: 16px; }
  .kline-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 18px; }
  .equity-kline-panel .kline-wrap { margin: 0 18px 18px; padding: 46px 8px 8px; }
  .equity-chart-legend { left: 12px; right: auto; justify-content: flex-start; }
  .serenity-discussion-panel .serenity-health { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
  .equity-kline-panel .kline-meta { grid-template-columns: 1fr; }
  .kline-summary-strip { grid-template-columns: 1fr; }
  .equity-kline-panel .kline-summary-strip .metric-card { min-height: 0; }
  .serenity-consensus-head { display: grid; gap: 8px; }
  .consensus-models { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  body:not(.dashboard-app-shell) {
    overflow-x: hidden;
  }

  body:not(.dashboard-app-shell) .sidebar {
    padding: 16px;
    background: rgba(255, 250, 242, 0.96);
  }

  body:not(.dashboard-app-shell) .sidebar .brand {
    display: block;
  }

  body:not(.dashboard-app-shell) .nav-panel {
    border: 1px solid var(--line);
    background: rgba(255, 250, 242, 0.98) !important;
  }

  body:not(.dashboard-app-shell) .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  body:not(.dashboard-app-shell) .market-pulse-grid,
  body:not(.dashboard-app-shell) .market-signal-detail-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }
}

/* Public tools: keep report access usable on small screens. */
.mobile-public-tools { display: none; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 1000; padding: 12px; background: #fff; color: #174f43; }
.skip-link:focus { top: 12px; }
.candidate-filter-panel label { display: block; margin-bottom: 8px; font-weight: 700; }
.candidate-filter-panel input { box-sizing: border-box; width: 100%; max-width: 520px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.candidate-filter-panel input:focus-visible { outline: 2px solid #237660; outline-offset: 2px; }
.view-section .list-card[hidden], .view-section .stock-card[hidden] { display: none !important; }
@media (max-width: 720px) {
  body:not(.dashboard-app-shell) .sidebar { padding: 12px; gap: 10px; }
  body:not(.dashboard-app-shell):has(.mobile-public-tools) .sidebar .nav-panel { display: none; }
  .mobile-public-tools { display: block; }
  .mobile-primary-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 6px; align-items: start; }
  .mobile-primary-nav > a, .mobile-more-menu > summary { display: flex; align-items: center; justify-content: center; min-height: 44px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: #fffaf2; color: #274a3f; text-decoration: none; font-size: 13px; cursor: pointer; }
  .mobile-primary-nav a[aria-current="page"] { background: #e6f2ea; font-weight: 700; }
  .mobile-more-menu { position: relative; }
  .mobile-more-menu nav { position: absolute; z-index: 20; right: 0; width: 180px; padding: 8px; background: #fffaf2; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px #203c3026; }
  .mobile-more-menu nav a, .mobile-report-tools nav a { display: flex; align-items: center; min-height: 44px; padding: 4px 8px; color: #274a3f; text-decoration: none; }
  .mobile-report-tools { margin-top: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fffaf2; }
  .mobile-report-tools summary { display: flex; align-items: center; min-height: 44px; font-size: 13px; cursor: pointer; }
  .mobile-downloads { display: flex; gap: 8px; }
  .mobile-downloads a { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 44px; border-radius: 8px; background: #e6f2ea; color: #174f43; text-decoration: none; }
  body:not(.dashboard-app-shell):has(.mobile-public-tools) .hero { display: none; }
  body:not(.dashboard-app-shell) .content { padding: 12px; }
}
