:root {
  color-scheme: light;
  --body: #f5f7fb;
  --white: #fff;
  --ink: #18243e;
  --muted: #5d6b80;
  --line: #e4eaf3;
  --blue: #315dd5;
  --navy: #112348;
  --gain: #007957;
  --loss: #be4249;
  --radius: 20px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--body);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid #6586ec; outline-offset: 3px; }
[hidden] { display: none !important; }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-inner, .shell { width: min(1160px, calc(100% - 80px)); margin: 0 auto; }
.topbar-inner { height: 70px; display: flex; gap: 48px; align-items: center; }
.brand { display: inline-flex; align-items: center; font-weight: 750; font-size: 16px; gap: 10px; white-space: nowrap; }
.brand-mark { width: 33px; height: 33px; background: var(--blue); border-radius: 10px; display: flex; align-items: end; justify-content: center; gap: 3px; padding-bottom: 8px; }
.brand-mark i { width: 4px; height: 8px; border-radius: 2px; background: #fff; }
.brand-mark i:nth-child(2) { height: 12px; opacity: .78; }
.brand-mark i:nth-child(3) { height: 17px; }
nav { align-self: stretch; display: flex; align-items: stretch; gap: 25px; }
nav a { padding: 0 3px; border-bottom: 2px solid transparent; display: grid; place-items: center; font-weight: 550; color: var(--muted); white-space: nowrap; }
nav a[aria-current] { color: var(--blue); border-color: var(--blue); }
.local { margin-left: auto; white-space: nowrap; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.local span { width: 7px; height: 7px; border-radius: 50%; background: #1d9c79; }
.account-controls { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.account-logout { border: 0; background: transparent; color: var(--blue); font-weight: 650; min-height: 40px; padding: 0 3px; white-space: nowrap; }
.account-logout:hover { text-decoration: underline; }
.auth-card { width: min(100%, 410px); margin: clamp(16px, 6vh, 72px) auto 0; padding: clamp(20px, 5vw, 34px); }
.auth-card .subtitle { line-height: 1.5; }
.auth-form { grid-template-columns: minmax(0, 1fr); margin-top: 22px; }
.auth-form .error { margin: 0; }
.auth-form .btn, .auth-owner { width: 100%; margin-top: 4px; }
.auth-owner { margin-top: 9px; }
.auth-switch { text-align: center; margin-top: 13px; color: var(--muted); }
.shell { padding: 42px 0 40px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; }
h1,h2,h3,p { margin: 0; }
h1 { letter-spacing: -.035em; font-size: 34px; line-height: 1.2; font-weight: 750; }
.subtitle { font-size: 14px; color: var(--muted); margin-top: 8px; }
.actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.btn { min-height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-weight: 650; white-space: nowrap; text-align: center; }
.btn:hover { background: #f1f5ff; }
.btn:active { transform: translateY(1px); }
.btn.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: #234cc0; }
.btn.danger { color: var(--loss); }
.icon { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.note-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #eaf0ff; border: 1px solid #dbe5ff; border-radius: 12px; padding: 9px 13px; margin-bottom: 18px; color: #304a8c; line-height: 1.45; }
.note-bar.warn { background: #fff6e4; border-color: #f4e3bf; color: #815012; }
.note-bar .note-content { display: flex; align-items: center; gap: 8px; }
.text-btn { border: 0; background: transparent; color: var(--blue); font-weight: 700; padding: 5px 3px; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.overview { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 22px; }
.cash-card { margin-bottom: 16px; }
.cash-card strong { display: block; margin-top: 5px; font-size: 21px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cash-card small { color: var(--muted); font-size: 12px; }
.cash-field { align-self: end; padding-bottom: 12px; }
.trade-preview { margin-top: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: 0 3px 10px #182c5410; min-width: 0; }
.total-card { position: relative; overflow: hidden; background: linear-gradient(114deg,#101e3d 0%,#142b58 70%,#19366f 100%); color: white; padding: 25px 26px 20px; box-shadow: 0 6px 18px #142d6121; border: 0; }
.total-card::before { content: ""; position: absolute; width: 292px; height: 292px; border-radius: 50%; border: 1px solid #ffffff17; top: -140px; right: -62px; box-shadow: 0 0 0 22px #ffffff08, 0 0 0 47px #ffffff07, 0 0 0 74px #ffffff06; pointer-events: none; }
.total-card > * { position: relative; }
.total-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 650; color: #c9d7ef; }
.currency { color: #e1eaff; background: #ffffff15; border: 1px solid #ffffff17; padding: 4px 8px; border-radius: 6px; font-size: 11px; letter-spacing: .08em; }
.amount { display: block; font-weight: 720; font-size: clamp(31px, 4.5vw, 51px); letter-spacing: -.055em; line-height: 1.08; margin: 13px 0 15px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.total-result { color: #c9d7ef; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.total-result strong { color: #83e1bf; font-size: 15px; font-variant-numeric: tabular-nums; }
.total-result strong.loss { color: #ffb5b8; }
.total-result strong.neutral { color: #e1ebff; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-top: 1px solid #ffffff23; margin-top: 23px; padding-top: 15px; }
.dates small { color: #b2c3e0; display: block; font-size: 11px; margin-bottom: 4px; }
.dates b { font-size: 13px; font-weight: 620; }
.allocation { padding: 23px 24px; }
h2 { font-size: 17px; font-weight: 730; letter-spacing: -.015em; }
.allocation-body { display: flex; align-items: center; gap: 22px; min-height: 155px; margin-top: 7px; }
.donut { width: 124px; flex: 0 0 124px; aspect-ratio: 1; padding: 15px; border-radius: 50%; display: grid; background: var(--ring, #e9eef7); }
.donut-inner { border-radius: 50%; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.donut-inner b { font-size: 25px; line-height: 1.05; }
.donut-inner span { color: var(--muted); font-size: 11px; }
.legend { min-width: 0; flex: 1; display: grid; gap: 10px; }
.legend-item { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; align-items: center; gap: 7px; font-size: 13px; }
.legend-item i { width: 8px; height: 8px; border-radius: 3px; }
.legend-item b { overflow: hidden; text-overflow: ellipsis; }
.legend-item span { color: var(--muted); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.list-card { overflow: hidden; }
.card-heading { display: flex; justify-content: space-between; align-items: center; padding: 19px 23px; gap: 10px; }
.count { color: var(--muted); font-size: 12px; margin-left: 8px; font-weight: 500; vertical-align: 1px; }
.list-head, .holding { display: grid; grid-template-columns: minmax(124px,1.45fr) minmax(40px,.45fr) minmax(85px,.8fr) minmax(80px,.8fr) minmax(84px,1fr) minmax(88px,.8fr) var(--holding-last-column, 22px); gap: 12px; align-items: center; text-align: right; }
.overview-holdings { --holding-last-column: minmax(66px,.7fr); }
.list-head { padding: 11px 23px; color: var(--muted); background: #f9fbfe; font-size: 12px; border-top: 1px solid #edf1f6; }
.list-head span:first-child { text-align: left; }
.holding { width: 100%; padding: 15px 23px; background: white; border: 0; border-top: 1px solid #edf1f6; color: var(--ink); font-variant-numeric: tabular-nums; }
button.holding:hover { background: #f9fbff; }
button.holding:focus-visible { outline-offset: -3px; }
.security { display: flex; align-items: center; gap: 11px; min-width: 0; text-align: left; }
.monogram { width: 37px; height: 37px; flex: 0 0 37px; border-radius: 10px; background: #edf1fe; color: #3656b3; display: grid; place-items: center; font-size: 13px; font-weight: 750; }
.monogram.alt { color: #237672; background: #e8f6f4; }
.stock-copy { min-width: 0; }
.stock-copy b,.stock-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-copy small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.stock-value { font-weight: 710; overflow-wrap: anywhere; }
.holding-average { overflow-wrap: anywhere; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.row-arrow { margin-left: auto; color: #7e8da7; }
.row-points { font-weight: 710; overflow-wrap: anywhere; }
.mobile-shares { display: none; }
.empty { padding: 30px 23px; border-top: 1px solid var(--line); color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.footer { color: var(--muted); font-size: 12px; margin-top: 17px; display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; line-height: 1.5; }
.manage-tools { margin-top: 18px; padding: 20px 23px; }
.manage-tools p { margin: 8px 0 13px; color: var(--muted); line-height: 1.55; }
dialog { color: var(--ink); width: min(480px,calc(100% - 28px)); max-height: 90dvh; border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 20px 75px #11234842; }
dialog::backdrop { background: #0c193364; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.dialog-heading h2 { font-size: 21px; overflow-wrap: anywhere; }
.dialog-heading button { border: 0; background: #eff3fa; color: var(--ink); padding: 9px; border-radius: 8px; }
.dialog-body { color: var(--muted); line-height: 1.55; margin-bottom: 13px; overflow-wrap: anywhere; }
.dialog-actions { margin-top: 17px; justify-content: flex-end; }
.position-actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
@media (max-width: 460px) { .position-actions { grid-template-columns: repeat(2,minmax(0,1fr)); } }
.fields { display: grid; gap: 11px; grid-template-columns: 1fr 1fr; }
.fields label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.fields .span { grid-column: 1 / -1; }
.fields .field-hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
.fields input,.fields select { width: 100%; min-width: 0; padding: 9px 10px; min-height: 43px; border-radius: 8px; border: 1px solid #cdd7e6; color: var(--ink); background: #fbfcff; font-size: 16px; }
.ticker-field { position: relative; min-width: 0; }
.ticker-dropdown { position: absolute; top: calc(100% + 5px); left: 0; width: calc(200% + 11px); z-index: 2; max-height: min(34dvh, 260px); overflow: auto; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 25px #11234826; }
.ticker-dropdown [role="option"] { width: 100%; min-height: 46px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: var(--white); }
.ticker-dropdown [role="option"]:hover,.ticker-dropdown [aria-selected="true"] { background: #edf2ff; }
.ticker-market,.ticker-name,.ticker-status { color: var(--muted); font-size: 12px; }
.ticker-name { grid-column: 1 / -1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticker-status { padding: 10px; }
.fields .check { display: flex; align-items: center; }
.fields .check input { width: 17px; min-height: auto; }
.error { color: var(--loss); margin-top: 9px; line-height: 1.45; }
dl { display: grid; grid-template-columns: minmax(100px,1fr) minmax(128px,1.2fr); gap: 0 12px; margin: 0; }
dt,dd { border-bottom: 1px solid var(--line); padding: 9px 0; margin: 0; overflow-wrap: anywhere; }
dt { color: var(--muted); }
dd { text-align: right; }
.toast { position: fixed; bottom: max(18px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #17284b; color: white; border-radius: 10px; padding: 12px 15px; z-index: 2; max-width: calc(100% - 28px); text-align: center; box-shadow: 0 7px 16px #142d6133; }
.loading { color: var(--muted); padding: 12px 0; }
@media(max-width: 800px) {
  .topbar-inner,.shell { width: calc(100% - 36px); }
  .allocation-body { gap: 12px; }
  .donut { width: 92px; flex-basis: 92px; padding: 10px; }
}
@media(max-width: 740px) {
  .list-head { display: none; }
  .holding { grid-template-columns: minmax(0,1fr) minmax(76px,auto) 16px; padding: 12px 13px; gap: 0 8px; }
  .overview-holdings :is(.list-head,.holding) { grid-template-columns: minmax(0,1.25fr) minmax(0,1fr) minmax(66px,.75fr); gap: 0 8px; }
  .overview-holdings .list-head { display: grid; padding: 9px 13px; }
  .overview-holdings .stock-value { grid-column: 2; grid-row: 1; align-self: auto; }
  .overview-holdings .holding .row-result { grid-column: 2; grid-row: 2; padding-top: 2px; overflow-wrap: anywhere; }
  .overview-holdings .security { grid-column: 1; grid-row: 1 / span 2; }
  .row-points { grid-column: 3; grid-row: 1 / span 2; }
  .stock-value { grid-column: 2; grid-row: 1; align-self: start; }
  .holding .row-result { grid-column: 2; grid-row: 1; align-self: end; font-size: 11px; padding-top: 19px; }
  .row-arrow { grid-column: 3; grid-row: 1; }
  .holding-average { grid-column: 1 / -1; grid-row: 3; padding: 5px 0 0 48px; text-align: left; font-size: 11px; }
  .hide-mobile { display: none; }
  .mobile-shares { display: inline; }
}
@media(max-width: 640px) {
  .topbar-inner,.shell { width: calc(100% - 28px); }
  .topbar-inner { height: 59px; gap: 22px; }
  .brand { font-size: 13px; gap: 6px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 8px; padding-bottom: 5px; }
  nav { gap: 14px; font-size: 13px; }
  .local { font-size: 11px; gap: 5px; }
  .account-controls { gap: 4px; }
  .account-controls:has(.account-logout:not([hidden])) .local, .account-name { display: none; }
  .account-logout { font-size: 12px; }
  .shell { padding-top: 24px; display: flex; flex-direction: column; }
  .page-heading { align-items: start; flex-wrap: wrap; margin-bottom: 15px; gap: 12px; }
  h1 { font-size: 27px; }
  .subtitle { margin-top: 5px; font-size: 12px; }
  .page-heading .actions { gap: 6px; }
  .page-heading .btn { min-height: 39px; padding: 7px 9px; font-size: 12px; }
  .page-heading .icon { width: 14px; height: 14px; }
  .note-bar { font-size: 12px; margin-bottom: 12px; }
  .overview { display: contents; }
  .total-card { padding: 19px 17px 16px; }
  .amount { font-size: 38px; margin: 11px 0; }
  .dates { margin-top: 15px; padding-top: 12px; }
  .list-card { order: 1; margin-top: 13px; }
  .allocation { order: 2; margin-top: 13px; padding: 15px 17px; }
  .footer,.manage-tools { order: 3; }
  .allocation-body { min-height: 105px; gap: 18px; margin-top: 4px; }
  .card-heading { padding: 15px 14px; }
  .manage-tools { padding: 16px; }
  .empty { padding: 20px 14px; flex-wrap: wrap; }
}
@media(max-width: 370px) {
  .topbar-inner { gap: 15px; }
  nav { gap: 11px; }
}

.history-item { padding: 14px 0; border-bottom: 1px solid var(--line, #dce3ee); overflow-wrap: anywhere; }
.history-item header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.history-item time, .history-item li span { color: var(--muted, #53647f); font-size: .86rem; }
.history-item ul { margin: 6px 0; padding: 0; list-style: none; }
.history-item ul:empty { display: none; }
.history-item li { margin: 4px 0; }
.history-item summary { cursor: pointer; font-weight: 600; }
.history-item details, .history-item p { margin: 8px 0 0; }
.history-more[hidden] { display: none; }
