/* ═══════════════════════════════════════
   Belafonte Day — warm parchment (light)
   Belafonte Night — dark burgundy (dark)
   Based on macOS Terminal Themes by Jan T. Sott
   ═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=ZCOOL+QingKe+HuangYou&family=Noto+Sans+Mono+SC:wght@400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.7.0/lxgwwenkaimono-regular.css');

:root {
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", "Consolas", monospace;
  --font-cn:   "LXGW WenKai Mono", "Noto Sans Mono SC", "ZCOOL QingKe HuangYou", "Sarasa Gothic SC", var(--font-mono);

  /* Belafonte Day */
  --bg:         #fffaed;
  --bg-card:    #ded8c8;
  --border:     #b8b0a4;
  --text:       #45373c;
  --text-dim:   #5e5252;
  --text-muted: #8a827b;
  --accent:     #426a79;
  --accent-bg:  #cbd5d9;
  --accent-text:#2d4d59;
  --focus-text: #6f4515;
  --focus-strong:#d08b30;
  --focus-row:  #f3ead6;
  --red-text:   #be100e;
  --red-row:    #f0e4e3;
  --amber:      #d08b30;
  --header-bg:  #45373c;
  --header-fg:  #d5ccba;
  --shadow:     0 1px 2px rgba(69,55,60,.06);
  --shadow-hover: 0 2px 6px rgba(69,55,60,.10);
  --hover-row:  #e8e4dc;
  --tag-bg:     #ccc5b8;
}

[data-theme="dark"] {
  --bg:         #20111b;
  --bg-card:    #281822;
  --border:     #3d2d36;
  --text:       #b88f55;
  --text-dim:   #96754e;
  --text-muted: #6f5a43;
  --accent:     #5a8a9a;
  --accent-bg:  #233840;
  --accent-text:#7fb4c4;
  --focus-text: #d09a45;
  --focus-strong:#eaa549;
  --focus-row:  #352613;
  --red-text:   #d94a48;
  --red-row:    #2a1618;
  --amber:      #eaa549;
  --header-bg:  #2d3d42;
  --header-fg:  #d5ccba;
  --shadow:     0 1px 3px rgba(0,0,0,.25);
  --shadow-hover: 0 2px 10px rgba(0,0,0,.35);
  --hover-row:  #2a1e26;
  --tag-bg:     #3d2d36;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  font-family: var(--font-cn);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  transition: background .4s, color .4s;
}

.page { max-width: 1340px; margin: 0 auto; }

.theme-bar {
  max-width: 1340px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.theme-left {
  min-width: 0;
}

.theme-btn,
.back-link {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 30px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 14px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
  cursor: pointer; transition: color .25s, border-color .25s, box-shadow .25s, background .4s; box-shadow: var(--shadow);
  white-space: nowrap;
}

.theme-btn { width: 166px; }

.back-link {
  width: 128px;
  text-decoration: none;
}

.theme-btn:hover,
.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}

.back-link .back-icon {
  flex: 0 0 16px;
  line-height: 1;
  text-align: center;
}

.theme-btn .icon { flex: 0 0 18px; font-size: 14px; line-height: 1; text-align: center; }
.theme-btn .label-light,
.theme-btn .label-dark {
  width: 112px;
  text-align: left;
}
.theme-btn .label-light, .theme-btn .label-dark { display: none; }
[data-theme="light"] .theme-btn .label-light { display: inline; }
[data-theme="dark"]  .theme-btn .label-dark  { display: inline; }

.title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 8px;
}

h1 {
  margin: 0 0 8px;
  font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 19px; font-weight: 700; color: var(--text);
}

.title-row h1 { margin: 0; }

.generated-at {
  font-family: var(--font-mono); color: var(--text-muted); font-size: 11px;
}

p {
  margin: 8px 0 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.7;
}

a {
  color: var(--accent); text-decoration: none;
  font-size: 11px; font-family: var(--font-mono); transition: color .2s;
}

a:hover { color: var(--accent-text); text-decoration: underline; }

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

.summary div {
  border: 1px solid var(--border); background: var(--bg-card);
  border-radius: 6px; padding: 10px 12px;
  box-shadow: var(--shadow); transition: box-shadow .2s, background .4s;
}

.summary div:hover { box-shadow: var(--shadow-hover); }

.summary span {
  display: block; font-family: var(--font-mono); color: var(--text-muted);
  font-size: 10px; font-weight: 500; letter-spacing: .05em;
}

.summary strong {
  display: block; margin-top: 4px; font-family: var(--font-mono);
  font-size: 16px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
}

.summary .accent strong { color: var(--accent-text); }

.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.asset-history-wrap {
  max-height: calc(34px + 5 * 34px + 2px);
  overflow-y: auto;
}

.trade-history-wrap {
  max-height: calc(34px + 9 * 34px + 2px);
  overflow-y: auto;
}

.position-history-wrap {
  max-height: calc(34px + 9 * 34px + 2px);
  overflow-y: auto;
}

.asset-history-wrap th,
.asset-history-wrap td,
.position-history-wrap th,
.position-history-wrap td,
.trade-history-wrap th,
.trade-history-wrap td {
  height: 34px;
}

table {
  width: max-content; min-width: 100%; border-collapse: collapse;
  font-family: var(--font-cn); font-size: 12px; line-height: 1.55;
}

th, td {
  border: 1px solid var(--border); padding: 7px 9px;
  white-space: nowrap; transition: background .25s;
}

th {
  position: sticky; top: 0; z-index: 2;
  background: var(--header-bg); color: var(--header-fg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-weight: 600; font-size: 11px; letter-spacing: .04em; text-align: left;
  transition: background .4s;
}

th:first-child { border-radius: 5px 0 0 0; }
th:last-child  { border-radius: 0 5px 0 0; }

tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--hover-row) !important; }

tr:not(.buy):not(.sell):not(.hold) td { background: var(--bg-card); }
.buy td  {
  background: var(--focus-row);
  color: var(--focus-text);
}
.sell td { background: var(--red-row); }
.hold td { background: var(--bg-card); }

.buy td:first-child  {
  font-family: var(--font-mono); color: var(--focus-strong);
}
.sell td:first-child {
  font-family: var(--font-mono); font-weight: 700; color: var(--red-text);
}

.watchlist-table td.num-right,
.watchlist-table td.num-center,
.report-table td.num-right,
.report-table td.num-center {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.watchlist-table td.num-right,
.report-table td.num-right  { text-align: right; }
.watchlist-table td.num-center,
.report-table td.num-center { text-align: center; }

.account-bill-page .bill-meta { margin-bottom: 16px; }
.bill-section { margin-top: 18px; }
.bill-section h2 { margin-bottom: 8px; }
.empty { padding: 10px 0; color: var(--text-dim); }
.strategy-explanation > h2 { font-size: 22px; line-height: 1.35; margin-bottom: 14px; }
.strategy-explanation .strategy-body { font-size: 17px; line-height: 1.8; margin: 12px 0; }
.strategy-explanation .strategy-terms { font-size: 13px; line-height: 1.65; color: var(--text-dim); margin: 10px 0 0; }
.strategy-explanation .strategy-formula { display: inline-block; margin: 0 3px; vertical-align: -0.15em; }
.strategy-example { margin-top: 18px; }
.strategy-example h3 { font-size: 19px; line-height: 1.4; margin-bottom: 8px; }

.quick-section h2 {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.quick-card {
  display: block;
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 13px 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s, background .4s, transform .2s;
}

.quick-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.quick-card span {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .05em;
}

.quick-card strong {
  display: block;
  margin-top: 8px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.section-title-frame {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: max-content;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  margin-bottom: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.section-title-frame h2 {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.brief-page .brief-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.brief-kicker {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em;
}

.brief-hero h2 {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

.brief-status {
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  font-family: var(--font-cn);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  background: var(--focus-row);
  color: var(--focus-text);
}

.brief-status.warning {
  background: var(--red-row);
  color: var(--red-text);
}

.brief-summary {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
}

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

.brief-card {
  min-height: 142px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 13px 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.brief-card h2 {
  margin-bottom: 8px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
}

.brief-card ol {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.7;
}

h2 {
  margin: 0 0 6px; font-family: var(--font-mono); font-size: 13px;
  font-weight: 700; color: var(--text);
}

h2 + p { margin-top: 2px; }

.back-to-top {
  position: fixed; bottom: 22px; right: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  cursor: pointer; font-family: var(--font-mono); font-size: 15px;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-hover); opacity: 0; transform: translateY(12px);
  transition: opacity .3s, transform .3s; pointer-events: none; z-index: 100;
}

.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { filter: brightness(1.15); }

@media (min-width: 1920px) {
  body { font-size: 15px; }
  .title-row h1 { font-size: 24px; }
  .generated-at { font-size: 13px; }
  p { font-size: 14px; }
  .summary span { font-size: 11px; }
  .summary strong { font-size: 19px; }
  table { font-size: 14px; }
  th { font-size: 12.5px; }
  .summary { gap: 12px; }
  .summary div { padding: 14px 16px; }
  th, td { padding: 9px 12px; }
}

@media (min-width: 2560px) {
  body { font-size: 17px; }
  .title-row h1 { font-size: 28px; }
  .generated-at { font-size: 15px; }
  p { font-size: 16px; }
  .summary span { font-size: 12px; }
  .summary strong { font-size: 22px; }
  table { font-size: 16px; }
  th { font-size: 14px; }
  .summary { gap: 14px; }
  .summary div { padding: 16px 20px; }
  th, td { padding: 11px 14px; }
}

@media (max-width: 640px) {
  body { padding: 10px; }
  .summary { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
  .brief-page .brief-hero,
  .brief-grid,
  .brief-summary {
    grid-template-columns: 1fr;
  }
  .brief-status {
    min-width: 0;
    text-align: left;
  }
  th, td { padding: 5px 6px; font-size: 11px; }
  .back-to-top { bottom: 14px; right: 14px; width: 36px; height: 36px; }
}
