:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #151a1e;
  --muted: #64717d;
  --line: #dce3e0;
  --blue: #245fc7;
  --green: #16784f;
  --red: #bd3d38;
  --amber: #9f6818;
  --cyan: #08798b;
  --violet: #6a4bb3;
  --shadow: 0 16px 34px rgba(21, 26, 30, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.learning-path-panel:not([open]) > .learning-path-body,
.watchlist-panel:not([open]) > .watchlist,
.course-catalog:not([open]) > .course-lesson-list,
.course-lesson:not([open]) > .course-lesson-body {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  padding: 14px 28px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.top-link,
.nav-link {
  text-decoration: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quant-shell {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 22px 28px 44px;
}

.risk-disclaimer {
  margin-bottom: 14px;
  border: 1px solid #e6d8b8;
  border-radius: 8px;
  background: #fff8e8;
  color: #5e4520;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.learning-path-panel {
  margin-bottom: 16px;
  scroll-margin-top: 86px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.learning-path-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.learning-path-panel > summary::-webkit-details-marker,
.watchlist-panel > summary::-webkit-details-marker,
.course-catalog > summary::-webkit-details-marker,
.course-lesson > summary::-webkit-details-marker {
  display: none;
}

.learning-path-summary {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.learning-path-summary > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.learning-path-summary strong {
  font-size: 15px;
}

.learning-path-summary small {
  color: var(--muted);
  font-size: 12px;
}

.summary-action {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.learning-path-body {
  border-top: 1px solid var(--line);
  padding: 18px 16px 20px;
}

.learning-path-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.learning-path-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.learning-path-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.readonly-note,
.learning-access-note {
  max-width: 390px;
  border-left: 3px solid var(--blue);
  background: #f1f5fb;
  padding: 8px 10px;
  color: #405267 !important;
  font-size: 12px !important;
  line-height: 1.5;
}

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

.course-lesson {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.course-lesson.is-featured {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.course-lesson > summary {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.course-sequence {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.course-lesson > summary strong {
  font-size: 14px;
  line-height: 1.35;
}

.course-lesson > summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.course-lesson-body {
  padding: 0 12px 13px;
  color: #31404b;
  font-size: 13px;
  line-height: 1.65;
}

.course-lesson-body p {
  margin: 0 0 8px;
}

.course-lesson-body ul {
  margin: 0;
  padding-left: 20px;
}

.course-catalog {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.course-catalog > summary {
  padding: 13px 2px 2px;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.course-lesson-list {
  max-height: 520px;
  overflow: auto;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  align-items: stretch;
}

.research-form,
.watchlist-panel,
.decision-card,
.signal-card,
.risk-card,
.chart-section,
.validation-panel,
.workspace-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.research-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #2c3944;
  font-size: 12px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

textarea {
  min-height: 118px;
  padding: 11px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(36, 95, 199, 0.7);
  box-shadow: 0 0 0 3px rgba(36, 95, 199, 0.12);
}

.symbol-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.symbol-row input {
  min-height: 48px;
  font-size: 28px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
}

.primary-button,
.ghost-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  font-weight: 900;
}

.primary-button {
  min-width: 132px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0 18px;
}

.ghost-button,
.small-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
}

.small-button {
  min-height: 32px;
  font-size: 12px;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.watchlist-panel {
  padding: 18px;
}

.watchlist-panel > summary.panel-head {
  align-items: center;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

.watchlist-panel[open] > summary.panel-head {
  margin-bottom: 12px;
}

.case-library-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.case-library-heading strong {
  font-size: 18px;
  line-height: 1.2;
}

.case-library-heading small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.case-summary-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.case-toggle {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.course-lesson-toggle {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-head span,
#providerBadge {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.watchlist {
  display: grid;
  gap: 8px;
  max-height: 272px;
  overflow: auto;
  padding-right: 2px;
}

.watch-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.field-note {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.watch-chip.is-active {
  border-color: rgba(36, 95, 199, 0.55);
  background: #edf3ff;
}

.watch-symbol {
  font-size: 14px;
  font-weight: 950;
}

.watch-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.watch-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-note {
  min-width: 0;
  overflow: hidden;
  color: #6c7560;
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-score {
  color: var(--blue);
  font-size: 13px;
  font-weight: 950;
}

.decision-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.55fr) minmax(260px, 0.7fr);
  gap: 16px;
  margin-top: 16px;
}

.decision-card,
.signal-card,
.risk-card {
  padding: 18px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(36, 95, 199, 0.24);
  border-radius: 999px;
  background: #edf3ff;
  color: var(--blue);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
}

.decision-card h2,
.signal-card h2 {
  margin: 12px 0 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.decision-card p,
.signal-card p {
  margin: 10px 0 0;
  color: #31404b;
  line-height: 1.65;
}

.decision-card.good {
  border-color: rgba(22, 120, 79, 0.28);
}

.decision-card.warning {
  border-color: rgba(159, 104, 24, 0.34);
}

.decision-card.danger {
  border-color: rgba(189, 61, 56, 0.34);
}

.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.signal-card .ghost-button {
  width: 100%;
  margin-top: 16px;
}

.risk-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.risk-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 11px;
  color: #31404b;
  font-size: 13px;
  line-height: 1.45;
}

.risk-item.ok {
  border-color: rgba(22, 120, 79, 0.26);
  background: rgba(22, 120, 79, 0.08);
  color: var(--green);
  font-weight: 850;
}

.risk-item.neutral {
  background: #f4f6f8;
  color: #40505d;
  font-weight: 750;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.metric-card strong {
  display: block;
  margin-top: 9px;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.chart-section {
  margin-top: 16px;
  overflow: hidden;
}

.chart-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 12px 12px 0;
}

.chart-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 900;
}

.chart-tabs button.is-active {
  border-color: var(--line);
  border-bottom-color: var(--surface);
  background: var(--surface);
  color: var(--ink);
}

.chart-frame {
  position: relative;
  min-height: 340px;
  padding: 14px;
}

#mainChart {
  display: block;
  width: 100%;
  height: 340px;
}

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

.validation-panel {
  padding: 18px;
}

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

.validation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 11px;
}

.validation-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.validation-row strong {
  color: var(--ink);
  font-size: 18px;
}

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

.workspace-grid.is-single {
  grid-template-columns: 1fr;
}

.workspace-panel {
  min-height: 280px;
  padding: 18px;
}

.sweep-table {
  width: 100%;
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 7px;
  text-align: right;
  white-space: nowrap;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.trade-list,
.news-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.trade-row,
.news-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 11px;
}

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

.side {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 950;
}

.side.BUY {
  background: rgba(22, 120, 79, 0.11);
  color: var(--green);
}

.side.SELL {
  background: rgba(189, 61, 56, 0.1);
  color: var(--red);
}

.trade-main,
.news-row h3 {
  min-width: 0;
}

.trade-main strong,
.news-row h3 {
  display: block;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-main span,
.trade-row time,
.news-row p,
.news-meta,
.muted-line,
.empty-state {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.news-row h3 a {
  color: var(--ink);
  text-decoration: none;
}

.news-row p {
  margin: 7px 0 0;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 6px;
}

.sentiment-negative {
  color: var(--red);
}

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

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

.action-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding-left: 20px;
}

.action-list li {
  color: #31404b;
  line-height: 1.55;
}

#reviewerPrompt {
  min-height: 140px;
  color: #31404b;
}

.loading-overlay {
  position: relative;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: center;
  padding: 18px;
}

.article-page-shell {
  min-height: 100vh;
}

.article-detail-layout {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 28px 24px 52px;
}

.article-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.detail-meta,
.article-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.detail-title {
  max-width: 820px;
  margin: 20px 0 0;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.detail-summary {
  max-width: 820px;
  margin: 16px 0 0;
  color: #31404b;
  font-size: 17px;
  line-height: 1.75;
}

.detail-tags {
  margin-top: 18px;
}

.original-section {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.original-section h2,
.article-section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.original-section > p {
  color: #40505d;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.source-link,
.lesson-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.source-link.is-disabled {
  cursor: not-allowed;
  color: var(--muted);
}

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

.article-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.article-learning-section .learning-access-note {
  max-width: none;
  margin: 14px 0;
}

.article-learning-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.learning-task {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.learning-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.learning-task h4 {
  margin: 10px 0 0;
  font-size: 16px;
}

.learning-task p,
.learning-task li {
  color: #40505d;
  font-size: 13px;
  line-height: 1.6;
}

.learning-task ul {
  padding-left: 20px;
}

.learning-excerpt {
  border-left: 2px solid var(--line);
  padding-left: 10px;
}

.monitor-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

@media (max-width: 1120px) {
  .control-panel,
  .decision-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .status-pill {
    max-width: 100%;
  }

  .quant-shell {
    padding: 16px;
  }

  .symbol-row,
  .metric-strip,
  .validation-grid,
  .workspace-grid,
  .decision-grid {
    grid-template-columns: 1fr;
  }

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

  .symbol-row input {
    font-size: 24px;
  }

  .primary-button {
    width: 100%;
  }

  .decision-card h2,
  .signal-card h2 {
    font-size: 28px;
  }

  .chart-tabs {
    overflow-x: auto;
  }

  .chart-tabs button {
    flex: 0 0 auto;
  }

  #mainChart {
    height: 300px;
  }

  .chart-frame {
    min-height: 300px;
  }

  .trade-row {
    grid-template-columns: 1fr;
  }

  .learning-path-panel {
    scroll-margin-top: 16px;
  }

  .learning-path-panel > summary,
  .learning-path-heading,
  .article-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .learning-path-summary {
    align-items: flex-start;
  }

  .summary-action {
    align-self: flex-end;
  }

  .readonly-note {
    max-width: none;
    width: 100%;
  }

  .course-starter,
  .article-learning-cards {
    grid-template-columns: 1fr;
  }

  .watchlist-panel {
    padding: 14px;
  }

  .watchlist-panel > summary.panel-head {
    align-items: flex-start;
  }

  #providerBadge {
    white-space: nowrap;
  }

  .article-detail-layout {
    padding: 16px 14px 36px;
  }

  .article-detail {
    padding: 20px 16px;
  }

  .detail-title {
    font-size: 28px;
  }

  .detail-summary {
    font-size: 15px;
  }
}

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