:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --navy: #0b1b2b;
  --navy-light: #162e47;
  --gold: #c69b4e;
  --gold-soft: #f9f3e6;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --crimson: #dc2626;
  --crimson-soft: #fef2f2;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(11, 27, 43, 0.06);
  --shadow-lg: 0 12px 32px rgba(11, 27, 43, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Header & Hero */
.topbar {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.brand-badge {
  background: linear-gradient(135deg, #d4af66, #a87c32);
  color: #0b1b2b;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.nav-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.72);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-btn.active {
  color: #0b1b2b;
  background: #fff;
  font-weight: 600;
}

.hero {
  background: linear-gradient(135deg, #0b1b2b 0%, #152c45 60%, #1c3a57 100%);
  color: #fff;
  padding: 44px 20px 56px;
  border-bottom: 3px solid var(--gold);
}
.hero-inner {
  max-width: 1240px;
  margin: 0 auto;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(198, 155, 78, 0.16);
  border: 1px solid rgba(198, 155, 78, 0.45);
  color: #f3d69b;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 3.6vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.3px;
}
.hero-sub {
  margin: 0 0 28px;
  max-width: 820px;
  color: rgba(255,255,255,0.82);
  font-size: 15.5px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 16px 18px;
}
.kpi-label {
  font-size: 12px;
  color: rgba(255,255,255,0.68);
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #f6dca4;
  line-height: 1.2;
}
.kpi-note {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  margin-top: 4px;
}

/* Main Container */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.tab-panel { display: none; animation: fadeIn 0.25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 18px;
}
.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: var(--gold);
  border-radius: 2px;
}
.section-desc {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 13.5px;
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

/* Scheme Cards */
.scheme-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.scheme-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.scheme-card.recommended {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 35%);
}
.scheme-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 10px;
  width: fit-content;
}
.badge-gold { background: var(--gold-soft); color: #8c6216; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-emerald { background: var(--emerald-soft); color: var(--emerald); }
.scheme-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--navy);
}
.scheme-ratio {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.scheme-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  flex: 1;
}
.scheme-list li {
  margin-bottom: 8px;
  padding-left: 16px;
  position: relative;
}
.scheme-list li::before {
  content: "•";
  color: var(--gold);
  font-weight: bold;
  position: absolute;
  left: 0;
}
.scheme-channel {
  font-size: 12.5px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: #fff;
}
th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f8fafc;
  color: var(--navy);
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr.highlight-row { background: #fffbf0; font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--emerald); font-weight: 600; }
.neg { color: var(--crimson); font-weight: 600; }

/* Controls & Sliders */
.controls-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.control-group label span.val {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--navy);
  cursor: pointer;
}
select, .btn {
  font-family: inherit;
  font-size: 13.5px;
  border-radius: 8px;
}
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}
.preset-pills {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.pill {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-secondary);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.pill:hover, .pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: var(--surface-alt); border-color: #cbd5e1; }
.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-light); }
.btn-gold {
  background: var(--gold);
  color: #0b1b2b;
  border-color: var(--gold);
}
.btn-gold:hover { filter: brightness(0.95); }

/* Charts */
.chart-box {
  position: relative;
  width: 100%;
  height: 320px;
  margin-bottom: 12px;
}
.chart-box.small { height: 210px; }
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.notice-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 14px;
}

/* Financial Output Cards */
.fin-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.fin-stat {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.fin-stat .label { font-size: 12px; color: var(--ink-muted); }
.fin-stat .big { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; }

/* Checklist */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.checklist-item:hover { background: var(--surface-alt); }
.checklist-item.done { background: #f0fdf4; border-color: #bbf7d0; }
.checklist-item.done .chk-title { text-decoration: line-through; color: var(--ink-muted); }
.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--emerald);
  cursor: pointer;
}
.chk-day {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--navy);
  color: #fff;
  margin-right: 8px;
}
.chk-title { font-weight: 600; font-size: 14.5px; color: var(--navy); }
.chk-meta { font-size: 12.5px; color: var(--ink-muted); margin-top: 4px; }

/* Document Hub */
.doc-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 20px;
  align-items: start;
}
.doc-sidebar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 78px;
}
.doc-nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.doc-nav-item:hover { background: var(--surface-alt); }
.doc-nav-item.active {
  background: var(--navy);
  color: #fff;
}
.doc-nav-item .d-title { font-size: 13.5px; font-weight: 600; display: block; }
.doc-nav-item .d-sub { font-size: 11.5px; opacity: 0.72; display: block; margin-top: 2px; }

.doc-viewer {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.doc-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.doc-body {
  padding: 26px 30px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink);
  overflow-x: auto;
}
.doc-body h1 { font-size: 24px; border-bottom: 2px solid var(--border); padding-bottom: 10px; margin-top: 0; color: var(--navy); }
.doc-body h2 { font-size: 19px; margin-top: 26px; color: var(--navy); border-left: 4px solid var(--gold); padding-left: 10px; }
.doc-body h3 { font-size: 16px; margin-top: 20px; color: var(--navy-light); }
.doc-body blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  background: var(--surface-alt);
  border-left: 4px solid var(--gold);
  color: var(--ink-secondary);
  border-radius: 0 8px 8px 0;
}
.doc-body code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: #0f172a;
}
.doc-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}
.doc-body pre code { background: transparent; color: inherit; padding: 0; }
.doc-body table { margin: 14px 0; border: 1px solid var(--border); }

footer {
  text-align: center;
  padding: 24px 20px 36px;
  color: var(--ink-muted);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
  background: #fff;
}

@media (max-width: 960px) {
  .kpi-grid, .fin-summary { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2, .doc-layout { grid-template-columns: 1fr; }
  .doc-sidebar { position: static; }
  .doc-body { padding: 18px; }
}
@media (max-width: 600px) {
  .topbar-inner { flex-direction: column; height: auto; padding: 10px 14px; align-items: stretch; }
  .kpi-grid, .fin-summary { grid-template-columns: 1fr; }
}
