:root {
  --bg: #f6f4ef;
  --bg-2: #eeebe4;
  --card: #fffdfa;
  --ink: #16191d;
  --ink-2: #4b4f55;
  --ink-3: #878a8f;
  --line: #e8e4db;
  --line-2: #d7d2c7;
  --main: #1f5468;
  --accent: #1c2a38;
  --accent-ink: #f7f2e8;
  --gold: #a8844c;
  --up: #c4453b;
  --down: #2c8460;
  --up-bg: rgba(196, 69, 59, .09);
  --down-bg: rgba(44, 132, 96, .1);
  --eq: #c26a3d;
  --bd: #3d6688;
  --gd: #bf9a4a;
  --cm: #7b6896;
  --cash: #bdb8ae;
  --bench: #bbb5a9;
  --warn: #8a5a14;
  --warn-bg: #f6ecd6;
  --tab: rgba(250, 248, 243, .82);
  --ink-panel: radial-gradient(120% 140% at 100% 0%, #2a4152 0%, rgba(42, 65, 82, 0) 55%), linear-gradient(165deg, #18232e 0%, #0f161d 100%);
  --g-brand: var(--ink-panel);
  --g-green: radial-gradient(120% 140% at 100% 0%, #2b5a5a 0%, rgba(43, 90, 90, 0) 60%), linear-gradient(165deg, #16302f 0%, #0e1d1f 100%);
  --g-graphite: linear-gradient(165deg, #2a2926 0%, #1a1917 100%);
  --shadow: 0 0 0 1px rgba(30, 26, 18, .045), 0 1px 2px rgba(30, 26, 18, .04), 0 10px 28px -18px rgba(30, 26, 18, .18);
  --radius: 20px;
  --radius-s: 16px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", Georgia, serif;
  --num: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  color-scheme: light;
}

/* Light is the default; the toggle in the top bar sets data-theme="dark". */
:root[data-theme="dark"] {
  --bg: #0d0e10;
  --bg-2: #1e1f22;
  --card: #16171a;
  --ink: #ece8df;
  --ink-2: #a9a59c;
  --ink-3: #7c7972;
  --line: #26272a;
  --line-2: #35363a;
  --main: #8fbcd0;
  --accent: #d8bf8e;
  --accent-ink: #16171a;
  --gold: #d8bf8e;
  --up: #e0675b;
  --down: #4fb487;
  --up-bg: rgba(224, 103, 91, .14);
  --down-bg: rgba(79, 180, 135, .14);
  --eq: #dd8a5c;
  --bd: #6f9cc2;
  --gd: #d8b766;
  --cm: #a592c2;
  --cash: #5a5852;
  --bench: #5f5d57;
  --warn: #e2b061;
  --warn-bg: rgba(226, 176, 97, .12);
  --tab: rgba(22, 23, 26, .82);
  --ink-panel: radial-gradient(120% 140% at 100% 0%, #233847 0%, rgba(35, 56, 71, 0) 55%), linear-gradient(165deg, #141c24 0%, #0d1217 100%);
  --g-green: radial-gradient(120% 140% at 100% 0%, #234a4a 0%, rgba(35, 74, 74, 0) 60%), linear-gradient(165deg, #122726 0%, #0c1717 100%);
  --g-graphite: linear-gradient(165deg, #232220 0%, #171614 100%);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .05) inset, 0 12px 30px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
main { flex: 1; width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.num, .mono { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--ink-3); }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ top bar + tab bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--tab);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  padding-top: env(safe-area-inset-top);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 18px; letter-spacing: .06em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: 4px; background: var(--bg-2); border-radius: 999px; padding: 3px; }
.nav a {
  text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 600;
  padding: 6px 16px; border-radius: 999px; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .06); }
.account-link { text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 650; padding: 7px 12px; border-radius: 999px; }
.account-link:hover, .account-link.on { color: var(--ink); background: var(--bg-2); }
.topbar-end { display: flex; align-items: center; gap: 6px; }
.theme-toggle { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer; }
.theme-toggle:hover { color: var(--ink); background: var(--bg-2); }
.theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon, :root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

.tabbar {
  display: none;
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  height: 66px; border-radius: 26px; background: var(--tab);
  backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .28), 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent) inset;
  grid-template-columns: repeat(3, 1fr); padding: 6px; z-index: 30;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 20px; color: var(--ink-3); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabbar a i { width: 46px; height: 28px; border-radius: 14px; display: grid; place-items: center; transition: background .2s; }
.tabbar a i svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); }
.tabbar a.on i { background: color-mix(in srgb, var(--accent) 14%, transparent); }

@media (max-width: 759px) {
  .topbar-in { height: 54px; }
  .nav { display: none; }
  .account-link { font-size: 13px; padding: 6px 10px; }
  .tabbar { display: grid; }
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.foot { max-width: 1120px; margin: 56px auto 0; padding: 22px 16px 28px; color: var(--ink-3); font-size: 12.5px; border-top: 1px solid var(--line); width: 100%; }

/* ------------------------------------------------------------ building blocks */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; min-width: 0;
}
@media (max-width: 640px) { .card { padding: 20px 18px; border-radius: 22px; } }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-h h3 { font-size: 16.5px; font-weight: 650; letter-spacing: 0; }
.card-h .aside { font-size: 12.5px; color: var(--ink-3); }

.eyebrow { font-size: 12px; font-weight: 600; color: var(--gold); letter-spacing: .14em; }
.section { padding: 72px 0 0; }
.section > .wrap > h2, .section-title { font-family: var(--serif); font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; letter-spacing: .01em; line-height: 1.3; margin: 8px 0 10px; }
.section-lead { color: var(--ink-2); max-width: 620px; margin-bottom: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 24px; border-radius: 999px; border: 0;
  font-weight: 650; font-size: 15.5px; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background .15s, opacity .15s, box-shadow .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-ghost { background: var(--bg-2); color: var(--ink); }
.btn-ghost:hover { background: var(--line); }
.btn-soft { background: var(--bg-2); color: var(--ink); }
.btn-soft:hover { background: var(--line); }
.btn-danger { background: transparent; color: var(--up); }
.btn-s { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.buy { background: var(--up-bg); color: var(--up); }
.chip.sell { background: var(--down-bg); color: var(--down); }
.dot { width: 10px; height: 10px; border-radius: 4px; display: inline-block; flex: none; }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .14); }

.field { display: block; }
.field label, .field .lbl { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.input {
  width: 100%; height: 50px; border-radius: 16px; border: 1px solid transparent; background: var(--bg-2);
  padding: 0 16px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.money-input { position: relative; }
.money-input .input { font-family: var(--num); font-size: 30px; font-weight: 700; height: 70px; padding-left: 44px; letter-spacing: -.02em; border-radius: 20px; }
.money-input::before { content: "¥"; position: absolute; left: 18px; top: 50%; transform: translateY(-52%); font-size: 24px; color: var(--ink-3); font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick button { border: 0; background: var(--bg-2); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); font-family: var(--num); }
.quick button:hover { color: var(--ink); background: var(--line); }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.hint.err { color: var(--up); }

/* ------------------------------------------------------------ hero */
.hero { padding: 16px 0 8px; position: relative; }
.hero-grid {
  --h-eq: #e0956a; --h-bd: #7fa6c6; --h-gd: #dcc07e; --h-cm: #a896c4;
  --h-ink: #f3eee4; --h-ink-2: rgba(243, 238, 228, .68); --h-gold: #dcc499;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; max-width: 1088px;
  background: var(--ink-panel); color: var(--h-ink); border-radius: 28px; padding: 56px 56px 52px; position: relative; overflow: hidden; isolation: isolate;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 30px 60px -36px rgba(15, 22, 29, .7);
}
.hero-grid::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(80% 90% at 85% 30%, #000 0%, transparent 75%); mask-image: radial-gradient(80% 90% at 85% 30%, #000 0%, transparent 75%);
}
.hero-grid::after {
  content: ""; position: absolute; left: 56px; right: 56px; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(220, 196, 153, .55), transparent);
}
.hero .eyebrow { color: var(--h-gold); letter-spacing: .18em; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.hero .eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .7; }
.hero h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 54px); line-height: 1.16; letter-spacing: .01em; font-weight: 700; margin: 18px 0 18px; position: relative; }
.hero h1 em { font-style: normal; color: var(--h-gold); }
.hero .lead { font-size: 16px; line-height: 1.8; color: var(--h-ink-2); max-width: 500px; position: relative; }
.hero-cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; position: relative; }
.hero .btn-primary { background: var(--h-gold); color: #17140f; box-shadow: 0 10px 26px -14px rgba(220, 196, 153, .7); }
.hero .btn-primary:hover { filter: none; background: #e6d2ab; }
.hero .btn-ghost { background: transparent; color: var(--h-ink); box-shadow: 0 0 0 1px rgba(243, 238, 228, .22) inset; }
.hero .btn-ghost:hover { background: rgba(243, 238, 228, .06); box-shadow: 0 0 0 1px rgba(243, 238, 228, .4) inset; }
.hero-art { position: relative; max-width: 340px; justify-self: center; width: 100%; }
.hero-art .donut { position: relative; aspect-ratio: 1; }
.hero-art .donut::before { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 1px rgba(243, 238, 228, .08); transform: scale(1.12); }
.hero-art .donut .num { font-family: var(--serif); font-weight: 600 !important; letter-spacing: 0 !important; }
.hero-art .muted { color: var(--h-ink-2) !important; }
.hero-art .alloc-legend { color: var(--h-ink-2); justify-content: center; gap: 8px 18px; margin-top: 22px !important; }
.hero-art .alloc-legend b { color: var(--h-ink); font-weight: 600; }
.hero-art .alloc-legend .dot { width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 860px) {
  .hero { padding-top: 8px; }
  .hero-grid { grid-template-columns: 1fr; gap: 0; padding: 34px 22px 24px; border-radius: 24px; margin: 0 16px; }
  .hero-grid::after { left: 24px; right: 24px; }
  .hero .lead { font-size: 15px; line-height: 1.75; }
  .hero-cta { margin-top: 24px; }
  .hero-cta .btn { flex: 1 1 auto; height: 48px; padding: 0 18px; }
  .hero-art {
    max-width: none; margin-top: 28px; padding-top: 22px; border-top: 1px solid rgba(243, 238, 228, .1);
    display: grid; grid-template-columns: 128px 1fr; gap: 22px; align-items: center;
  }
  .hero-art .donut::before { display: none; }
  .hero-art .donut .num { font-size: 26px !important; }
  .hero-art .donut .muted { font-size: 10.5px !important; }
  .hero-art .donut .muted + .num + .muted { display: none; }
  .hero-art .alloc-legend { flex-direction: column; align-items: stretch; margin-top: 0 !important; gap: 8px; }
  .hero-art .alloc-legend span { justify-content: flex-start; }
  .hero-art .alloc-legend b { margin-left: auto; }
}

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.kpi { padding: 22px 24px 20px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.kpi .v { font-family: var(--num); font-size: clamp(24px, 3.2vw, 32px); font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpi { padding: 16px 18px; } .kpi:nth-child(3) { border-left: 0; } .kpi:nth-child(n+3) { border-top: 1px solid var(--line); } }

/* ------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { font-size: 11px; fill: var(--ink-3); font-family: var(--num); }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--line-2); }
.chart .cross { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.chart .draw { stroke-dasharray: 1; animation: draw 1.2s cubic-bezier(.3, .6, .2, 1) both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.tip {
  position: absolute; pointer-events: none; z-index: 3; background: var(--ink); color: var(--bg);
  border-radius: 14px; padding: 9px 12px; font-size: 12.5px; line-height: 1.55; white-space: nowrap;
  box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .4); transform: translate(-50%, -100%); opacity: 0; transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip b { font-family: var(--num); font-weight: 650; }
.tip .row { display: flex; align-items: center; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 4px; border-radius: 4px; display: inline-block; }

.chart-card .card-h { flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; }

/* heatmap */
.heat { display: grid; grid-template-columns: 44px repeat(12, 1fr) 58px; gap: 4px; font-family: var(--num); font-size: 11.5px; }
.heat .h { color: var(--ink-3); text-align: center; padding: 2px 0; font-weight: 500; }
.heat .y { color: var(--ink-2); font-weight: 650; display: flex; align-items: center; }
.heat .c { border-radius: 8px; text-align: center; padding: 8px 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.heat .t { text-align: right; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; }
@media (max-width: 640px) {
  .heat { grid-template-columns: 34px repeat(12, 1fr) 44px; gap: 3px; font-size: 9.5px; }
  .heat .c { padding: 6px 0; border-radius: 5px; }
  .heat .c span, .heat .h small { display: none; }
}

/* sleeves */
.sleeves { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 960px) { .sleeves { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .sleeves { grid-template-columns: 1fr; } }
.sleeve { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.sleeve::before { content: ""; position: absolute; left: 0; top: 22px; width: 3px; height: 26px; border-radius: 0 3px 3px 0; background: var(--c); }
.sleeve h4 { margin: 6px 0 2px; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; }
.sleeve h4 .num { font-size: 22px; color: var(--c); font-weight: 650; }
.sleeve .role { color: var(--ink-2); font-size: 13.5px; margin-bottom: 12px; }
.sleeve ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sleeve li { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 8px; }
.sleeve li .n { font-weight: 650; }
.sleeve li .d { color: var(--ink-3); font-size: 12.5px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; counter-reset: s; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: transparent; box-shadow: 0 0 0 1px var(--gold) inset; color: var(--gold); font-weight: 600; font-family: var(--serif); margin-bottom: 14px; }
.step h4 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.step p { color: var(--ink-2); font-size: 14px; }

.notes { display: grid; gap: 10px; }
.note { display: flex; gap: 12px; padding: 16px 18px; background: var(--card); border-radius: var(--radius-s); box-shadow: var(--shadow); font-size: 14px; color: var(--ink-2); }
.note b { color: var(--ink); }
.note .ic { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); font-weight: 800; font-size: 13px; }

/* ------------------------------------------------------------ start / calculator */
.calc { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
.orders { display: grid; }
.order {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 4px; border-top: 1px solid var(--line); min-height: 76px;
}
.order:first-child { border-top: 0; }
.order .side { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.order .side.buy { background: var(--up-bg); color: var(--up); }
.order .side.sell { background: var(--down-bg); color: var(--down); }
.order .nm { font-weight: 650; font-size: 15.5px; line-height: 1.3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.order .sub { font-size: 12.5px; color: var(--ink-3); font-family: var(--num); margin-top: 3px; }
.order .qty { text-align: right; }
.order .qty .s { font-family: var(--num); font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; }
.order .qty .a { font-size: 12.5px; color: var(--ink-3); font-family: var(--num); }
.order.done > div { opacity: .5; }
.order.done .nm { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.summary-line { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; color: var(--ink-2); }
.summary-line b { color: var(--ink); font-family: var(--num); }
.alloc-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bg-2); gap: 2px; }
.alloc-bar > i { display: block; height: 100%; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.alloc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.alloc-legend b { font-family: var(--num); color: var(--ink); font-weight: 650; }

/* ------------------------------------------------------------ dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 14px; }
@media (max-width: 960px) { .dash { grid-template-columns: 1fr; } .dash > .col { display: contents; } }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 22px; }
.dash-head h1 { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.value-card { background: var(--ink-panel); color: #f3eee4; box-shadow: 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 26px 50px -30px rgba(15, 22, 29, .7); position: relative; overflow: hidden; }
.value-card::after {
  content: ""; position: absolute; left: 22px; right: 22px; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(220, 196, 153, .55), transparent);
}
.value-card > * { position: relative; }
.value-card .muted { color: rgba(255, 255, 255, .78) !important; }
.value-card .total { font-family: var(--num); font-size: clamp(38px, 6vw, 50px); font-weight: 650; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.value-card .total small { font-size: .5em; opacity: .85; margin-right: 4px; font-weight: 650; }
.value-card .up, .value-card .down { color: #f3eee4 !important; }
.value-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.value-row > div { background: rgba(243, 238, 228, .06); box-shadow: 0 0 0 1px rgba(243, 238, 228, .08) inset; border-radius: 14px; padding: 12px 13px; min-width: 0; }
.value-row .k { font-size: 12.5px; color: rgba(243, 238, 228, .62); }
.value-row .v { font-family: var(--num); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.value-row .v small { font-size: 12.5px; font-weight: 600; margin-left: 3px; }
@media (max-width: 420px) { .value-row .v { font-size: 14.5px; } }

.status-card { position: relative; overflow: hidden; }
.status-card .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; padding: 5px 11px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.status-card.hot .badge { background: var(--up-bg); color: var(--up); }
.status-card.hot .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.status-card h2 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin: 12px 0 4px; }
.status-card .desc { color: var(--ink-2); font-size: 14px; }
.status-card:not(.hot) { background: var(--g-graphite); color: #fff; box-shadow: 0 26px 44px -26px rgba(0, 0, 0, .5); }
.status-card:not(.hot) .desc, .status-card:not(.hot) .muted { color: rgba(255, 255, 255, .78); }
.status-card:not(.hot) .badge { background: rgba(255, 255, 255, .16); color: #fff; }
.status-card:not(.hot) .linkish { color: rgba(255, 255, 255, .8); }
.status-card:not(.hot) .btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; }
.countdown { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 2px; }
.countdown .n { font-family: var(--num); font-size: 88px; font-weight: 600; letter-spacing: -.05em; line-height: .95; }
.countdown .muted { font-size: 17px; font-weight: 600; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin: 14px 0 6px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .35s cubic-bezier(.2,.8,.2,1); }
.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-2); background: transparent;
  display: grid; place-items: center; color: transparent; transition: background .2s, border-color .2s, color .2s; flex: none;
}
.check svg { width: 16px; height: 16px; }
.check.on { background: var(--accent); border-color: transparent; color: #fff; }
.order .acts { display: flex; align-items: center; gap: 8px; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-3); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }
.plan-tips { font-size: 13px; color: var(--ink-2); background: var(--bg-2); border-radius: 16px; padding: 12px 14px; margin: 16px 0; display: grid; gap: 4px; }
.status-card:not(.hot) .plan-tips { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.holdings { width: 100%; border-collapse: collapse; font-size: 14px; }
.holdings th { text-align: right; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 0 0 8px; }
.holdings th:first-child, .holdings td:first-child { text-align: left; }
.holdings td { text-align: right; padding: 12px 0; border-top: 1px solid var(--line); font-family: var(--num); font-variant-numeric: tabular-nums; vertical-align: middle; }
.holdings td:first-child { font-family: var(--font); }
.holdings .nm { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.holdings .cd { font-size: 12px; color: var(--ink-3); font-family: var(--num); padding-left: 18px; }
.wbar { position: relative; height: 6px; background: var(--bg-2); border-radius: 999px; margin-top: 6px; width: 72px; margin-left: auto; }
.wbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.wbar b { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--ink); border-radius: 1px; opacity: .7; }
@media (max-width: 520px) { .holdings .hide-s { display: none; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline li:first-child { border-top: 0; }
.timeline .d { color: var(--ink-3); font-family: var(--num); font-size: 12.5px; }
.timeline .r { font-family: var(--num); text-align: right; font-weight: 650; }

.empty { text-align: center; padding: 26px 10px; color: var(--ink-3); font-size: 14px; }
.empty svg { width: 42px; height: 42px; margin-bottom: 8px; opacity: .6; }

.me-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.me-item { display: block; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.me-item:hover { transform: translateY(-2px); }
.me-item .nm { font-weight: 700; font-size: 16px; }
.me-item .v { font-family: var(--num); font-size: 26px; font-weight: 750; margin-top: 6px; }

/* ------------------------------------------------------------ sheet / dialog */
.sheet-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .34); z-index: 50; opacity: 0; transition: opacity .2s; }
.sheet-mask.on { opacity: 1; }
.sheet {
  position: fixed; z-index: 51; left: 50%; bottom: 0; width: min(520px, 100%);
  transform: translate(-50%, 100%); background: var(--card); border-radius: 28px 28px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto;
  transition: transform .3s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -10px 40px -10px rgba(0,0,0,.3);
}
.sheet.on { transform: translate(-50%, 0); }
.sheet .grab { width: 38px; height: 5px; background: var(--line-2); border-radius: 3px; margin: 0 auto 14px; }
.sheet h3 { font-size: 20px; font-weight: 750; margin-bottom: 4px; }
.sheet .desc { color: var(--ink-2); font-size: 14px; margin-bottom: 16px; }
.sheet .acts { display: flex; gap: 10px; margin-top: 18px; }
.sheet .acts .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; border-radius: 28px; transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .18s; padding-bottom: 22px; }
  .sheet.on { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cal-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; padding: 6px 0; }
.cal-row .nm { font-size: 14px; font-weight: 650; }
.cal-row .cd { font-size: 12px; color: var(--ink-3); font-family: var(--num); }
.cal-row .input { height: 44px; text-align: right; font-family: var(--num); }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--bg-2); border-radius: 16px; padding: 6px 6px 6px 14px; font-family: var(--num); font-size: 13.5px; }
.linkbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px); text-align: center;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .4);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 759px) { #toast { bottom: calc(96px + env(safe-area-inset-bottom)); } }

.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--line), var(--bg-2)); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

.fade-in { animation: fin .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes fin { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
