:root {
  --bg: #0f1115;
  --bg-soft: #161a21;
  --card: #1b2027;
  --card-2: #20262f;
  --line: #2a3039;
  --text: #e8edf4;
  --muted: #93a0b2;
  --muted-2: #6b7889;
  --accent: #4f9dff;
  --green: #2fbf71;
  --yellow: #e8c84b;
  --orange: #f08a3c;
  --red: #ef4c5b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 70% -10%, #1b2330 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* topbar */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 28px; line-height: 1; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }

/* layout */
.layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 28px;
  align-items: start;
}
.col-input { display: flex; flex-direction: column; gap: 18px; }
.col-result { position: sticky; top: 78px; }

/* card */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.step-no {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: rgba(79, 157, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(79, 157, 255, 0.35);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  margin-top: 2px;
}
.card-head h2 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); }
.muted.small, .empty-hint.small { font-size: 12.5px; }
p.muted { margin: 2px 0 0; font-size: 12.5px; }

/* asset form */
.asset-form { display: flex; flex-direction: column; gap: 8px; }
.asset-form-row { display: flex; gap: 8px; }
input, select {
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 11px;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color .15s ease;
}
input:focus, select:focus { border-color: var(--accent); }
#assetClass { flex: 1 1 auto; }
.amount-field { position: relative; flex: 1 1 auto; }
.amount-prefix { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 14px; }
.amount-field input { padding-left: 24px; }
.primary-btn {
  flex: 0 0 auto;
  background: var(--accent);
  border: none;
  color: #06121f;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  transition: filter .15s ease;
}
.primary-btn:hover { filter: brightness(1.08); }

/* asset list */
.asset-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.asset-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.asset-dot { width: 10px; height: 10px; border-radius: 50%; }
.asset-main { min-width: 0; }
.asset-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-class { font-size: 11.5px; color: var(--muted); }
.asset-amt { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--text); }
.asset-wt { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); min-width: 42px; text-align: right; }
.del-btn {
  background: transparent; border: none; color: var(--muted-2);
  cursor: pointer; font-size: 17px; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.del-btn:hover { color: var(--red); }

.empty-hint { color: var(--muted-2); font-size: 13px; padding: 10px 2px; }

/* allocation bar */
.alloc-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin-top: 14px; background: var(--card-2); }
.alloc-bar .seg { height: 100%; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 9px; }
.alloc-legend .lg { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.alloc-legend .lg i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* factors */
.factor-list { display: flex; flex-direction: column; gap: 7px; }
.factor {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.factor:hover { border-color: rgba(79,157,255,.4); }
.factor.on { border-color: rgba(240,138,60,.55); background: rgba(240,138,60,.08); }
.factor.auto { cursor: default; opacity: .92; }
.factor input { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--orange); }
.factor-text { min-width: 0; }
.factor-title { font-size: 13.5px; font-weight: 600; }
.factor-desc { font-size: 11.5px; color: var(--muted); }
.factor-pts { margin-left: auto; flex: 0 0 auto; font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.auto-tag { font-size: 10px; color: var(--orange); border: 1px solid rgba(240,138,60,.4); border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: middle; }

/* result */
.result-card { display: flex; flex-direction: column; gap: 16px; }
.gauge-wrap { position: relative; width: 100%; max-width: 320px; margin: 4px auto 0; }
.gauge { width: 100%; height: auto; display: block; overflow: visible; }
.gauge-track { fill: none; stroke: var(--card-2); stroke-width: 14; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: var(--green); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 251.3; stroke-dashoffset: 251.3; transition: stroke-dashoffset .6s ease, stroke .4s ease; }
.gauge-needle { stroke: var(--text); stroke-width: 3; stroke-linecap: round;
  transform-box: fill-box; transform-origin: 100px 110px; transform: rotate(-90deg);
  transition: transform .6s cubic-bezier(.34,1.2,.64,1); }
.gauge-hub { fill: var(--text); }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; }
.score-num { font-size: 46px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.score-band { font-size: 13px; font-weight: 600; margin-top: 2px; color: var(--muted); }

.score-summary { font-size: 12.5px; }

.block h3 { margin: 0 0 8px; font-size: 14px; }
.contrib-list { display: flex; flex-direction: column; gap: 7px; }
.contrib {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
}
.contrib-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; grid-column: 1 / -1; }
.contrib-label { font-size: 13px; }
.contrib-val { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.contrib-track { grid-column: 1 / -1; height: 6px; background: var(--card-2); border-radius: 4px; overflow: hidden; }
.contrib-bar { height: 100%; border-radius: 4px; transition: width .5s ease; }

.action-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.action-list li {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 13px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
}
.action-list li::before { content: "→"; color: var(--accent); flex: 0 0 auto; font-weight: 700; }
.action-list li.good::before { content: "✓"; color: var(--green); }

.disclaimer { font-size: 11px; color: var(--muted-2); margin: 2px 0 0; }

.site-foot {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
  padding: 22px 18px 36px; color: var(--muted-2); font-size: 12px;
}
.site-foot .dot { opacity: .5; }

/* responsive */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .col-result { position: static; }
}
@media (max-width: 480px) {
  .asset-form-row { flex-wrap: wrap; }
  .amount-field { flex: 1 1 120px; }
  #assetClass { flex: 1 1 140px; }
  .primary-btn { flex: 1 1 100%; }
  .topbar-actions .ghost-btn { padding: 7px 9px; font-size: 12px; }
  .brand-sub { display: none; }
}
