:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --line: #d8dee6;
  --text: #16202a;
  --muted: #667180;
  --blue: #255c99;
  --green: #18715d;
  --red: #b6403a;
  --amber: #a66a1f;
  --ink: #101820;
  --shadow: 0 12px 30px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  padding: 22px 18px;
  background: #111820;
  color: #fff;
  border-right: 1px solid #263442;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e6edf5;
  color: #111820;
  font-weight: 800;
}

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

.brand span {
  margin-top: 4px;
  color: #aeb9c4;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

nav a {
  color: #cbd5df;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

nav a:hover,
nav a.active {
  background: #24313f;
  color: #fff;
}

main {
  margin-left: 236px;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tag {
  border-radius: 6px;
  color: var(--green);
  background: #edf7f4;
  border-color: #cbe6dd;
}

.tag.muted {
  color: var(--muted);
  background: var(--surface-soft);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

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

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

.summary-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.4fr);
  gap: 18px;
  margin-bottom: 18px;
}

.strategy-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.strategy-meta div,
.metric-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

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

.strategy-meta strong,
.metric-card strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.notice {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: #fff8ec;
  color: #634315;
  font-size: 13px;
  line-height: 1.55;
}

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

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pos {
  color: var(--green);
}

.neg {
  color: var(--red);
}

.chart-wrap {
  width: 100%;
  height: 360px;
}

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

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 520px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.legend i {
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(520px, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.weight-item {
  display: grid;
  grid-template-columns: 120px 1fr 54px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.callout {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: #f2f6fb;
  color: #2b4054;
  font-size: 13px;
  line-height: 1.6;
}

.callout p {
  margin: 6px 0 0;
}

#history,
#library,
#method {
  margin-top: 18px;
}

.history-grid {
  display: grid;
  gap: 8px;
}

.strategy-card,
.method article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.history-head,
.history-row {
  display: grid;
  grid-template-columns: 116px 180px minmax(320px, 1.4fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
}

.history-head {
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-row {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.history-row strong {
  line-height: 1.8;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: #334253;
  font-size: 12px;
}

.op {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: #334253;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.op.buy {
  background: #edf7f4;
  color: var(--green);
}

.op.sell {
  background: #fff0ef;
  color: var(--red);
}

.op.hold {
  background: #eef2f6;
  color: #506173;
}

.op-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.etf-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.strategy-card .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.strategy-card p,
.method article p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  .summary-grid,
  .two-col,
  .strategy-list,
  .method-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .history-head {
    display: none;
  }

  .history-row {
    grid-template-columns: 110px 1fr;
  }

  .history-row .chips {
    grid-column: span 2;
  }
}

@media (max-width: 780px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 16px;
  }

  nav {
    grid-template-columns: repeat(5, max-content);
    overflow-x: auto;
  }

  main {
    margin-left: 0;
    padding: 16px;
  }

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

  .summary-grid,
  .two-col,
  .strategy-list,
  .method-grid,
  .metric-grid,
  .history-grid,
  .strategy-meta {
    grid-template-columns: 1fr;
  }

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

  .history-row .chips {
    grid-column: auto;
  }

  h1 {
    font-size: 24px;
  }
}
