:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --line: #eceef1;
  --text: #1f2329;
  --muted: #6b7280;
  --red: #c62828;
  --green: #1b7f4b;
  --amber: #b7791f;
  --main: #c62828;
  --hero1: #fff7f7;
  --hero2: #fce4e5;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--red); }
.down { color: var(--green); }
.pos { color: var(--red); }
.neg { color: var(--green); }

/* ---------- nav ---------- */
.nav {
  display: flex; align-items: center; gap: 24px;
  height: 64px; padding: 0 26px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 19px;
}
.brandname { font-size: 19px; font-weight: 700; color: var(--red); letter-spacing: .2px; }
.tag { font-size: 11px; color: var(--muted); }
.navlinks { display: flex; gap: 6px; flex: 1; }
.navlinks a {
  color: var(--muted); padding: 7px 14px; border-radius: 16px; font-size: 13px;
}
.navlinks a.on { color: var(--red); background: #fdecec; font-weight: 600; }
.navlinks a:hover { text-decoration: none; background: #f7f8fa; }
.navright { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.navright .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.userchip { background: #f7f8fa; border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; color: #4b5563; }
.btn-ghost {
  border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 5px 12px;
  color: var(--muted); font-size: 12px; cursor: pointer;
}
.btn-ghost:hover { color: var(--red); border-color: #f3c7c7; }

/* ---------- layout ---------- */
.container { max-width: 1440px; margin: 0 auto; padding: 18px 26px 40px; }
.foot { text-align: center; color: #a9aeb8; font-size: 11px; padding: 26px 0 34px; }
.page-title { margin: 6px 0 2px; font-size: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(17, 24, 39, .04); padding: 18px;
}
h2, h3, h4 { margin: 0 0 10px; }
h4 { font-size: 14px; }

/* ---------- hero ---------- */
.hero {
  position: relative; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--hero1), var(--hero2));
  padding: 20px 22px 14px; display: grid; grid-template-columns: 210px 1fr; gap: 18px;
}
.hero-label { font-size: 11px; color: var(--muted); }
.ring {
  --pct: 50; width: 116px; height: 116px; border-radius: 50%;
  background: conic-gradient(var(--main) calc(var(--pct) * 1%), #e8eaee 0);
  display: flex; align-items: center; justify-content: center; margin: 8px 0;
}
.ring-in {
  width: 92px; height: 92px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-in b { font-size: 34px; line-height: 1; color: var(--main); }
.ring-in span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hero-note { font-size: 11px; color: var(--muted); }
.hero-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-content: start; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.kpi span { display: block; font-size: 11px; color: var(--muted); }
.kpi b { font-size: 19px; }
.kpi .nums { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; font-size: 19px; font-weight: 700; }
.kpi small { display: block; color: #9aa0a6; font-size: 10px; margin-top: 2px; }
.hero-scale { grid-column: 1 / -1; margin-top: 4px; }
.scale { position: relative; display: flex; gap: 4px; }
.scale .seg { flex: 1; height: 7px; border-radius: 4px; display: block; }
.seg1 { background: #1b5e20; } .seg2 { background: #43a047; } .seg3 { background: #e6a23c; }
.seg4 { background: #d32f2f; } .seg5 { background: #8c1016; }
.scale .marker {
  position: absolute; top: -6px; width: 2px; height: 19px; background: var(--main); transform: translateX(-1px);
}
.scale-labels { display: flex; font-size: 10px; color: var(--muted); margin-top: 4px; }
.scale-labels span { flex: 1; text-align: center; }

/* ---------- index strip ---------- */
.index-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.index-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.index-card b { font-size: 18px; margin-right: 8px; white-space: nowrap; }
.index-card .chg { font-size: 12px; font-weight: 600; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 10px; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: #eceef1; border-radius: 10px; padding: 3px; }
.seg-item { padding: 6px 14px; border-radius: 8px; font-size: 12px; color: #4b5563; }
.seg-item.on { background: #fff; color: var(--red); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.seg-item:hover { text-decoration: none; }

/* ---------- plan cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan { padding: 16px; display: flex; flex-direction: column; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; }
.plan-head h3 { font-size: 16px; margin: 0; }
.score-chip {
  min-width: 40px; text-align: center; border: 3px solid #f0c3c3; color: var(--red);
  border-radius: 50%; font-size: 13px; font-weight: 700; padding: 8px 4px;
}
.plan-body { margin-top: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin: 5px 0; }
.range { height: 6px; background: #f0f1f3; border-radius: 4px; overflow: hidden; }
.range i { display: block; height: 100%; background: linear-gradient(90deg, #f3a3a3, #c62828); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; margin: 8px 0; }
.grid2 div { display: flex; justify-content: space-between; }
.state { background: #f3f4f6; color: var(--muted); border-radius: 10px; padding: 2px 8px; font-size: 11px; }
.tagline { font-size: 11px; color: var(--muted); background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin-top: 8px; }
.card-link { margin-top: 10px; font-size: 12px; }

/* ---------- empty / panels ---------- */
.empty h3 { font-size: 16px; }
.empty-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.empty-stats div { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.empty-stats span { display: block; color: var(--muted); font-size: 11px; }
.empty-stats b { font-size: 16px; }
.empty-stats small { display: block; color: #9aa0a6; font-size: 10px; }
.panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #f0f1f3; font-size: 12px; }
.list li:last-child { border-bottom: 0; }
.report-snippet { white-space: pre-wrap; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 7px 8px; border-bottom: 1px solid #f5f6f8; }

/* ---------- forms ---------- */
.form-card label { display: block; margin-bottom: 14px; font-size: 13px; }
input, select {
  width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 13px; background: #fafbfc; color: var(--text);
}
input:focus, select:focus { outline: 2px solid #f3c7c7; background: #fff; }
.btn {
  background: var(--red); color: #fff; border: 0; border-radius: 9px; padding: 10px 20px;
  font-size: 13px; cursor: pointer;
}
.btn:hover { background: #b71c1c; }
.inline-form { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.inline-form input[type=text] { margin: 0; }
.searchbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.searchbar .inline-form input { width: 380px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.alert { background: #fdecec; color: #9b1c1c; border: 1px solid #f6d3d3; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.alert.ok { background: #e8f5ed; border-color: #c9e7d4; color: #1b7f4b; }

/* ---------- stock ---------- */
.stock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.price-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price-line b { font-size: 30px; white-space: nowrap; }
.price-line .chg { font-size: 14px; font-weight: 600; }
.stock-score { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.small-ring { width: 86px; height: 86px; }
.small-ring .ring-in { width: 66px; height: 66px; }
.small-ring b { font-size: 24px; }
.dims { display: flex; flex-direction: column; gap: 8px; }
.dim { display: grid; grid-template-columns: 46px 1fr 32px; align-items: center; gap: 8px; font-size: 12px; }
.bar { height: 7px; background: #f0f1f3; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--main); }
.horizon-scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hs { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.hs span { display: block; font-size: 11px; color: var(--muted); }
.hs b { font-size: 20px; display: block; }
.hs small { color: #9aa0a6; font-size: 10px; }
.chart { width: 100%; height: 260px; }

/* ---------- funds ---------- */
.funds-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0; }
.kpi-card span { display: block; color: var(--muted); font-size: 12px; }
.kpi-card b { font-size: 24px; }

/* ---------- reports ---------- */
.report { margin-bottom: 14px; }
.report-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.report-text { white-space: pre-wrap; font: 12px/1.6 "SF Mono", Menlo, monospace; margin: 0; color: #374151; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(120deg, #fff7f7, #f3f4f6); }
.login-card { width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: 0 10px 30px rgba(17,24,39,.06); }
.login-brand { margin-bottom: 6px; }
.login-form { margin-top: 18px; }
.login-form label { display: block; font-size: 13px; }
.login-form button { width: 100%; margin-top: 14px; }

/* ---------- bucket palettes ---------- */
body.bucket-strong { --main: #8c1016; --hero1: #fff3f3; --hero2: #f8dadb; }
body.bucket-up { --main: #c62828; --hero1: #fff7f7; --hero2: #fce4e5; }
body.bucket-mid { --main: #b7791f; --hero1: #fffcf5; --hero2: #fbf0d9; }
body.bucket-down { --main: #1b7f4b; --hero1: #f5fbf6; --hero2: #e1f1e6; }
body.bucket-weak { --main: #14532d; --hero1: #f2faf4; --hero2: #d9ecdf; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cards, .panels, .index-strip, .hero-kpis { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .navlinks { overflow-x: auto; }
}
@media (max-width: 640px) {
  .nav { height: 56px; flex-wrap: nowrap; padding: 0 12px; gap: 10px; overflow: hidden; }
  .container { padding: 12px 14px 30px; }
  .brandname { font-size: 16px; }
  .logo { width: 28px; height: 28px; font-size: 16px; }
  .tag, .navright .hint, .navright .userchip { display: none; }
  .navlinks { flex: 1; overflow-x: auto; flex-wrap: nowrap; gap: 2px; }
  .navlinks a { white-space: nowrap; padding: 6px 10px; font-size: 12px; }
  .navright { gap: 6px; }
  .btn-ghost { padding: 4px 10px; }
  .cards, .panels, .index-strip, .funds-cards { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 16px; gap: 10px; }
  .hero-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  .ring { width: 92px; height: 92px; margin: 0; }
  .ring-in { width: 72px; height: 72px; }
  .ring-in b { font-size: 27px; }
  .hero-note { width: 100%; font-size: 10px; }
  .hero-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 8px 10px; }
  .kpi b, .kpi .nums { font-size: 16px; }
  .index-card b { font-size: 16px; }
  .searchbar .inline-form input { width: 100%; }
  .inline-form { flex-wrap: wrap; }
  .grid2 { gap: 4px 8px; }
  .plan-head h3 { font-size: 15px; }
  .stock-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .price-line b { font-size: 24px; }
  .two-col { grid-template-columns: 1fr; }
  .horizon-scores { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .hs b { font-size: 16px; }
}
