:root {
  --ink: #17303d;
  --ink-2: #294652;
  --paper: #f3f2ed;
  --card: #fffefa;
  --line: #dcdcd4;
  --muted: #718087;
  --coral: #dc684c;
  --mint: #498679;
  --gold: #c49845;
  --blue: #54758e;
  --shadow: 0 18px 50px rgba(23, 48, 61, 0.09);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: white; color: var(--ink); border-radius: 8px; }
.skip-link:focus { top: 16px; }
.eyebrow { margin: 0 0 9px; color: var(--muted); font-size: 11px; font-weight: 760; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.light { color: #a8bdc4; }
.subtle { color: var(--muted); }

.login-page { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr); background: var(--ink); color: white; position: relative; overflow: hidden; }
.login-page::before { content: ""; position: absolute; width: 470px; height: 470px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; left: -160px; bottom: -220px; box-shadow: 0 0 0 90px rgba(255,255,255,.025), 0 0 0 180px rgba(255,255,255,.015); }
.login-brand { position: absolute; display: flex; align-items: center; gap: 12px; left: clamp(28px, 5vw, 80px); top: 42px; font-size: 18px; font-weight: 750; z-index: 2; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px 11px 11px 4px; background: var(--coral); color: white; display: inline-grid; place-items: center; font-family: Georgia, serif; font-weight: 700; }
.login-copy { align-self: center; padding: 120px clamp(36px, 8vw, 130px); max-width: 820px; position: relative; z-index: 1; }
.login-copy .eyebrow { color: #f2a58f; }
.login-copy h1 { margin: 0; max-width: 650px; font-family: Georgia, "Songti SC", serif; font-size: clamp(46px, 6vw, 78px); font-weight: 560; line-height: 1.13; letter-spacing: -.035em; }
.login-copy > p:not(.eyebrow) { max-width: 510px; color: #adc0c6; font-size: 16px; line-height: 1.8; }
.login-metric { display: flex; align-items: center; gap: 10px; margin-top: 38px; color: #cfdbde; font-size: 13px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #76b9a6; box-shadow: 0 0 0 6px rgba(118,185,166,.12); }
.login-panel { background: #ecebe5; color: var(--ink); display: grid; place-content: center; padding: 48px; position: relative; }
.login-card { width: min(390px, 100%); background: var(--card); padding: 42px; border-radius: 3px 28px 3px 3px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 10px; font-family: Georgia, "Songti SC", serif; font-size: 31px; font-weight: 570; }
.login-card > p { margin-top: 0; font-size: 14px; }
label { display: block; margin: 19px 0 8px; font-size: 12px; font-weight: 760; letter-spacing: .03em; }
label small { font-weight: 500; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid #d6d8d3; background: #fafaf7; color: var(--ink); border-radius: 10px; outline: none; padding: 13px 14px; transition: border .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(73,134,121,.12); }
textarea { resize: vertical; }
.password-field { position: relative; }
.password-field input { padding-right: 68px; }
.text-button { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--mint); padding: 7px; cursor: pointer; font-size: 12px; font-weight: 700; }
.form-error { min-height: 19px; color: #b94334; font-size: 12px; }
.primary-button, .secondary-button { border: 0; border-radius: 10px; min-height: 44px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; cursor: pointer; font-weight: 720; font-size: 13px; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button { background: var(--coral); color: white; box-shadow: 0 9px 22px rgba(220,104,76,.22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(220,104,76,.28); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.primary-button.wide { width: 100%; justify-content: space-between; margin-top: 7px; padding-inline: 20px; }
.secondary-button { background: #edf0ed; color: var(--ink); border: 1px solid #dfe3df; }
.secondary-button:hover { background: #e5eae6; }
.login-footnote { position: absolute; bottom: 24px; color: #7f8a8f; font-size: 11px; }

.app-shell { min-height: 100svh; }
.topbar { height: 76px; padding: 0 clamp(22px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(243,242,237,.92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(15px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > div { display: grid; }
.brand strong { font-size: 17px; }
.brand small { font-size: 8px; color: var(--muted); letter-spacing: .15em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.live-status { display: flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--muted); font-size: 12px; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: #5e9a7e; box-shadow: 0 0 0 5px rgba(94,154,126,.12); }
.live-status.offline i { background: #b47e6f; }
.icon-button, .avatar-button { border: 1px solid #d9dbd6; background: rgba(255,255,255,.6); color: var(--ink); width: 39px; height: 39px; border-radius: 11px; display: grid; place-items: center; cursor: pointer; text-decoration: none; font-weight: 700; }
.avatar-button { border-radius: 50%; background: var(--ink); color: white; border: 0; }
.dashboard { max-width: 1440px; margin: 0 auto; padding: 50px clamp(20px, 5vw, 72px) 80px; }
.greeting-row { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 30px; }
.greeting-row h1 { font-family: Georgia, "Songti SC", serif; font-size: clamp(37px, 5vw, 54px); line-height: 1; margin: 0 0 14px; font-weight: 560; letter-spacing: -.03em; }
.greeting-row p:last-child { color: var(--muted); margin: 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(330px, .82fr); gap: 20px; }
.net-card, .allocation-card, .account-card, .holdings-card, .activity-card { background: var(--card); border: 1px solid rgba(23,48,61,.07); box-shadow: 0 10px 35px rgba(23,48,61,.04); }
.net-card { background: var(--ink); color: white; padding: 30px 32px 22px; border-radius: 3px 28px 3px 3px; min-height: 350px; overflow: hidden; }
.allocation-card { padding: 30px; border-radius: 3px 24px 3px 3px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.card-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 23px; font-weight: 570; }
.muted-light { color: #9db0b6; font-size: 11px; margin: 0; }
.secure-pill, .count-pill { font-size: 10px; border-radius: 999px; padding: 7px 10px; letter-spacing: .04em; }
.secure-pill { color: #c3d3d6; border: 1px solid rgba(255,255,255,.14); }
.count-pill { color: var(--muted); background: #eff0ec; }
.net-value { margin: 30px 0 8px; font-size: clamp(38px, 5vw, 61px); line-height: 1; font-family: Georgia, "Times New Roman", serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.change-line { color: #afc0c5; font-size: 12px; }
.change-line strong { color: #9ed0b4; }
.chart-wrap { height: 116px; margin: 16px -3px 0; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-axis { display: flex; justify-content: space-between; color: #758d95; font-size: 9px; letter-spacing: .08em; }
.allocation-body { display: flex; align-items: center; gap: 32px; margin-top: 35px; }
.donut { flex: 0 0 auto; width: 148px; height: 148px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--coral) 0 25%, var(--mint) 25% 50%, var(--gold) 50% 75%, var(--blue) 75% 100%); position: relative; }
.donut::after { content: ""; width: 88px; height: 88px; border-radius: 50%; background: var(--card); position: absolute; }
.donut > div { position: relative; z-index: 1; text-align: center; }
.donut strong { font-family: Georgia, serif; font-size: 27px; }
.donut small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.allocation-list { flex: 1; display: grid; gap: 14px; }
.allocation-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; font-size: 11px; }
.allocation-item i { width: 7px; height: 7px; border-radius: 50%; }
.allocation-item b { font-weight: 600; }
.allocation-item span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin: 54px 0 18px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 29px; font-weight: 570; }
.section-heading > p { color: var(--muted); font-size: 11px; }
.section-actions { display: flex; align-items: center; gap: 16px; }
.section-actions p { color: var(--muted); font-size: 11px; margin: 0; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.account-card { border-radius: 3px 18px 3px 3px; padding: 22px; min-width: 0; }
.account-title { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 20px; }
.account-title-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-card-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.account-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px 10px 10px 3px; color: white; font-family: Georgia, serif; font-weight: 700; }
.account-card h3 { margin: 0; font-size: 14px; }
.account-card .account-total { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.asset-list { display: grid; gap: 1px; background: #ecece6; border-top: 1px solid #ecece6; }
.asset-row { background: var(--card); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px; }
.asset-row-main { min-width: 0; border: 0; background: transparent; padding: 13px 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; text-align: left; cursor: pointer; align-items: center; }
.asset-row-main:only-child { grid-column: 1 / -1; }
.asset-row-main:hover .asset-name { color: var(--coral); }
.asset-delete { width: 27px; height: 27px; border: 0; background: transparent; color: #9a9f9b; border-radius: 7px; cursor: pointer; }
.asset-delete:hover { color: var(--coral); background: #f5ebe7; }
.account-add-detail { width: 100%; border: 0; background: var(--card); color: var(--mint); text-align: left; padding: 13px 0 2px; font-size: 10px; font-weight: 700; cursor: pointer; }
.asset-name { font-size: 11px; color: #4d6068; transition: color .2s; overflow: hidden; text-overflow: ellipsis; }
.asset-value { font-family: Georgia, serif; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty-detail { color: var(--muted); font-size: 11px; padding: 17px 0 2px; }
.bottom-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 22px; }
.holdings-card, .activity-card { padding: 27px; border-radius: 3px 22px 3px 3px; }
.holdings-list, .activity-list { margin-top: 22px; }
.holding-header, .holding-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) repeat(3, minmax(85px, .8fr)) 72px; align-items: center; gap: 12px; }
.holding-header { color: var(--muted); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; padding: 0 8px 10px; border-bottom: 1px solid var(--line); }
.holding-row { padding: 15px 8px; border-bottom: 1px solid #ecece7; font-size: 12px; }
.holding-row strong { display: block; font-size: 12px; }
.holding-row small { color: var(--muted); font-size: 9px; }
.holding-row .profit.positive { color: var(--mint); }
.holding-row .profit.negative { color: var(--coral); }
.holding-actions { display: flex; gap: 4px; }
.tiny-button { width: 29px; height: 29px; border: 1px solid #e0e2de; background: #f6f6f2; border-radius: 8px; cursor: pointer; }
.activity-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid #ecece7; }
.activity-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(73,134,121,.09); }
.activity-item strong { display: block; font-size: 11px; }
.activity-item span { color: var(--muted); font-size: 9px; }
.empty-state { padding: 32px 12px; color: var(--muted); text-align: center; font-size: 12px; border: 1px dashed #d9dbd6; border-radius: 12px; }
footer { max-width: 1440px; margin: 0 auto; border-top: 1px solid var(--line); padding: 24px clamp(20px, 5vw, 72px) 32px; display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; letter-spacing: .08em; }

.editor-dialog { width: min(510px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 3px 24px 3px 3px; color: var(--ink); box-shadow: 0 30px 100px rgba(9,29,38,.35); }
.editor-dialog::backdrop { background: rgba(14,33,42,.58); backdrop-filter: blur(3px); }
.editor-dialog form { padding: 30px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 570; }
.dialog-intro { color: var(--muted); margin: 8px 0 0; font-size: 11px; line-height: 1.6; }
.close-button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #e1e2dc; background: #f6f6f2; cursor: pointer; font-size: 21px; }
.money-input { position: relative; }
.money-input span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 36px; font-family: Georgia, serif; font-size: 24px; }
.calculator-help { margin: 7px 0 0; color: var(--mint); font-size: 10px; }
input.expression-error { border-color: #b94334; box-shadow: 0 0 0 3px rgba(185,67,52,.1); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.weekly-dialog { width: min(760px, calc(100% - 28px)); max-height: min(860px, calc(100svh - 28px)); }
.weekly-dialog form { max-height: min(860px, calc(100svh - 28px)); overflow: auto; }
.weekly-date-row { display: grid; grid-template-columns: minmax(180px, .65fr) minmax(230px, 1fr); gap: 18px; align-items: end; margin: 4px 0 24px; }
.weekly-preview { min-height: 48px; border: 1px solid #dfe2dd; border-radius: 11px; background: #f1f3ef; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.weekly-preview span { color: var(--muted); font-size: 10px; }
.weekly-preview strong { font-family: Georgia, serif; font-size: 20px; font-variant-numeric: tabular-nums; }
.weekly-fields { display: grid; gap: 15px; }
.weekly-group { border: 1px solid #e2e3dd; border-radius: 3px 15px 3px 3px; padding: 18px; background: #fbfbf7; }
.weekly-group-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.weekly-group-heading i { width: 8px; height: 8px; border-radius: 50%; }
.weekly-group-heading h3 { margin: 0; font-size: 13px; }
.weekly-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 13px; }
.weekly-field label { margin: 0 0 6px; font-size: 10px; color: #53676e; }
.weekly-field .money-input input { font-family: inherit; font-size: 12px; padding: 11px 11px 11px 31px; }
.weekly-field .money-input span { left: 12px; font-size: 11px; }
.weekly-stock { display: grid; grid-template-columns: minmax(110px, 1.2fr) repeat(3, minmax(90px, 1fr)); gap: 9px; align-items: end; padding: 11px 0; border-top: 1px solid #e5e6e0; }
.weekly-stock:first-of-type { border-top: 0; }
.weekly-stock-name { padding-bottom: 10px; min-width: 0; }
.weekly-stock-name strong, .weekly-stock-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekly-stock-name strong { font-size: 11px; }
.weekly-stock-name small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.weekly-stock label { margin-top: 0; }
.input-help { color: var(--muted); font-size: 10px; line-height: 1.6; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 120px); background: var(--ink); color: white; border-radius: 10px; padding: 12px 18px; font-size: 12px; z-index: 100; box-shadow: var(--shadow); opacity: 0; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

body.privacy .money { filter: blur(7px); user-select: none; }
body.loading .dashboard { opacity: .7; }

@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; }
  .allocation-body { justify-content: center; }
}

@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; background: #ecebe5; }
  .login-page::before, .login-copy { display: none; }
  .login-brand { color: var(--ink); top: 28px; left: 25px; }
  .login-panel { min-height: 100svh; padding: 86px 20px 45px; }
  .login-card { padding: 30px 24px; }
  .login-footnote { bottom: 16px; }
  .topbar { height: 66px; }
  .brand small, .live-status { display: none; }
  .dashboard { padding-top: 35px; }
  .greeting-row { align-items: flex-start; }
  .greeting-row .primary-button { width: 44px; padding: 0; flex: 0 0 44px; }
  .greeting-row .primary-button span:first-child { display: none; }
  .net-card, .allocation-card, .holdings-card, .activity-card { padding: 23px 20px; }
  .allocation-body { gap: 20px; }
  .donut { width: 128px; height: 128px; }
  .account-grid, .bottom-grid { grid-template-columns: 1fr; }
  .section-heading > p { display: none; }
  .section-actions p { display: none; }
  .holding-header { display: none; }
  .holding-row { grid-template-columns: 1fr auto; gap: 8px; }
  .holding-row > span { font-size: 10px; }
  .holding-row > span:nth-of-type(1)::before { content: "市值 "; color: var(--muted); }
  .holding-row > span:nth-of-type(2)::before { content: "现价 "; color: var(--muted); }
  .holding-row > span:nth-of-type(3)::before { content: "盈亏 "; color: var(--muted); }
  .holding-actions { grid-column: 2; grid-row: 1 / span 2; }
  footer { display: grid; gap: 7px; }
}

@media (max-width: 430px) {
  .top-actions { gap: 6px; }
  .icon-button { width: 36px; height: 36px; }
  .greeting-row h1 { font-size: 38px; }
  .net-value { font-size: 38px; }
  .allocation-body { align-items: flex-start; }
  .donut { width: 112px; height: 112px; }
  .donut::after { width: 68px; height: 68px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .weekly-date-row, .weekly-inputs { grid-template-columns: 1fr; }
  .weekly-stock { grid-template-columns: 1fr 1fr; }
  .weekly-stock-name { grid-column: 1 / -1; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
