/* Archivo (SIL OFL, fonts/OFL.txt), self-hosted: the CSP allows no font CDN. Width is its voice: wide for the
   net worth figure, condensed for instrument symbols, normal for everything else. */
@font-face{font-family:Archivo;src:url(fonts/archivo.woff2) format("woff2");font-weight:100 900;font-stretch:62% 125%;font-display:swap}
/* Theme tokens: dark is the default; theme.js sets data-theme before first paint. Colour is signal only:
   green = built, profit or live; red = loss or error; amber = waiting. Chrome and primary actions stay neutral. */
:root{color-scheme:dark;--bg:#15181d;--panel:#1a1e24;--raised:#20252d;--field:#111418;--head:#171b20;--row-hover:#1f242b;--control:#232830;--control-hover:#2c323b;--border:#2a3038;--line:#242931;--control-border:#3a414b;--text:#e4e7ec;--strong:#fff;--soft:#c0c6cf;--muted:#959ca8;--faint:#858d99;--green:#63d69b;--red:#ff8a80;--warn:#f0c270;--ink:#eceff3;--ink-hover:#fff;--on-ink:#15181d;--brand:#63d69b;--on-brand:#0f2a1c;--rule-a:#d9dee5;--rule-b:#6f7885;--track:#2c323b;--tick:#15181d99;--good-bg:#1a2e24;--good-border:#2f5a42;--warn-bg:#2e2718;--warn-border:#5e4c2a;--bad-bg:#2c1c1c;--bad-border:#633535;--selected-bg:#1e3328;--toast-bg:#eceff3;--toast-text:#15181d;--shadow:#0009;--backdrop:#080a0dd0}
:root[data-theme=light]{color-scheme:light;--bg:#eef0f3;--panel:#fff;--raised:#fff;--field:#fff;--head:#f6f7f9;--row-hover:#f7f8fa;--control:#fff;--control-hover:#eef0f3;--border:#dcdfe5;--line:#e8eaee;--control-border:#c9ced6;--text:#171a1f;--strong:#0b0d10;--soft:#39404a;--muted:#57606c;--faint:#5e6773;--green:#137a47;--red:#bb3328;--warn:#865900;--ink:#171a1f;--ink-hover:#2d323a;--on-ink:#fff;--brand:#168a53;--on-brand:#fff;--rule-a:#23272e;--rule-b:#9aa2ad;--track:#e3e6ea;--tick:#ffffffb3;--good-bg:#e5f4eb;--good-border:#a9d6ba;--warn-bg:#fbf2dd;--warn-border:#e1c37f;--bad-bg:#fcefed;--bad-border:#e7b2ab;--selected-bg:#e5f4eb;--toast-bg:#171a1f;--toast-text:#fff;--shadow:#10141a24;--backdrop:#1a1f2659}

/* Base */
:root{font-family:Archivo,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text);background:var(--bg);font-synthesis:none;-webkit-font-smoothing:antialiased}*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}button{border:1px solid var(--control-border);border-radius:8px;background:var(--control);color:inherit;padding:10px 15px;cursor:pointer;font-size:13px;font-weight:600}button:hover{background:var(--control-hover)}button:disabled{opacity:.4;cursor:not-allowed}button.primary{background:var(--ink);color:var(--on-ink);border-color:var(--ink)}button.primary:hover{background:var(--ink-hover);border-color:var(--ink-hover)}button.quiet{border-color:transparent;background:transparent;color:var(--muted)}button.quiet:hover{color:var(--strong);background:var(--control)}a{color:var(--muted);text-decoration:none}a:hover{color:var(--strong)}input,select{width:100%;border:1px solid var(--control-border);border-radius:8px;background:var(--field);color:var(--text);padding:10px 12px;min-height:42px}input:focus,select:focus,button:focus-visible,a:focus-visible,summary:focus-visible{outline:2px solid var(--strong);outline-offset:3px}input:focus,select:focus{outline-offset:1px}label{display:flex;flex-direction:column;gap:8px;font-size:13px;font-weight:600;color:var(--soft)}label small{font-size:12px;font-weight:400;line-height:1.5;color:var(--muted)}h2{font-size:26px;font-weight:720;font-stretch:112%;letter-spacing:-.01em;margin:0}h3{font-size:16px;font-weight:650}.muted{color:var(--muted);font-size:14px;line-height:1.6;margin:8px 0}.small{font-size:13px}.unit{font-size:12px;font-weight:500;color:var(--faint);margin-left:6px}.sub{display:block;font-size:12px;font-weight:400;color:var(--faint);margin-top:5px}.positive{color:var(--green)}.negative,.error{color:var(--red)}

/* Header */
header{max-width:1440px;margin:auto;padding:16px 40px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--border);gap:20px}.brand{color:var(--strong);display:flex;gap:11px;align-items:center;font-size:16px;font-weight:720;font-stretch:112%}.brand-mark{display:grid;place-items:center;width:34px;height:34px;background:var(--brand);color:var(--on-brand);border-radius:9px;font-size:14px;font-weight:800;font-stretch:125%;letter-spacing:-.5px}.header-actions{display:flex;gap:16px;align-items:center;font-size:13px}.header-actions #connection{display:block;position:relative;border:0;background:none;padding:0 0 0 16px;color:var(--soft);font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#connection::before{content:"";position:absolute;left:0;top:50%;width:8px;height:8px;margin-top:-4px;border-radius:50%;background:var(--faint)}#connection.good::before{background:var(--green);box-shadow:0 0 0 3px var(--good-bg)}#connection.warn{color:var(--warn)}#connection.warn::before{background:var(--warn)}
.project-menu{position:relative;flex-shrink:0}.project-menu>summary{list-style:none;cursor:pointer;min-height:40px;touch-action:manipulation}.project-menu>summary::-webkit-details-marker{display:none}.project-menu>summary:after{content:"⌄";font-size:16px;color:var(--muted);margin-left:2px}.project-menu>summary:focus-visible{border-radius:5px}.project-menu>nav{position:absolute;top:calc(100% + 8px);left:0;z-index:60;width:220px;max-width:calc(100vw - 24px);padding:6px;background:var(--raised);border:1px solid var(--control-border);border-radius:10px;box-shadow:0 12px 32px var(--shadow)}.project-menu>nav a{display:block;padding:12px;border-radius:6px;font-size:14px;font-stretch:100%;font-weight:500;color:var(--soft);white-space:nowrap}.project-menu>nav a:hover,.project-menu>nav a:focus-visible{background:var(--control-hover);color:var(--strong)}.project-menu>nav a[aria-current=page]{background:var(--selected-bg);color:var(--green)}.login-project-menu{position:absolute;top:10px;left:16px;z-index:60}
/* Theme toggle: shows the theme a click switches to. */
.theme-toggle{display:grid;place-items:center;width:36px;height:36px;padding:0;flex-shrink:0}.theme-toggle svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.theme-toggle .icon-moon,:root[data-theme=light] .theme-toggle .icon-sun{display:none}:root[data-theme=light] .theme-toggle .icon-moon{display:block}.login-theme-toggle{position:absolute;top:12px;right:16px}

/* Net worth band and its measuring rule: one bar per exchange, ticks every tenth. */
main{max-width:1440px;margin:auto;padding:34px 40px 40px}.net-worth{margin-bottom:28px}.net-worth-head{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:12px}.net-worth h1{margin:0;font-size:15px;font-weight:600;color:var(--soft)}.total-value{font-size:30px;font-weight:650;font-stretch:108%;letter-spacing:-.015em;line-height:1.2;color:var(--strong);font-variant-numeric:tabular-nums}.allocation{position:relative;display:flex;gap:3px;max-width:880px;margin-top:26px}.allocation::after{content:"";position:absolute;left:0;right:0;top:0;height:12px;background:repeating-linear-gradient(90deg,var(--tick) 0 1px,transparent 1px 10%);pointer-events:none}.rule-part{flex:0 1 0;min-width:0}.rule-bar{display:block;height:12px;background:var(--rule-a);transform-origin:left;animation:rule-draw .9s cubic-bezier(.2,.7,.2,1) both}.rule-part:nth-child(even) .rule-bar{background:var(--rule-b);animation-delay:.1s}.rule-label{display:block;margin-top:10px;font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}.rule-label strong{color:var(--text);font-weight:600}@keyframes rule-draw{from{transform:scaleX(0)}}.net-worth-meta{display:flex;flex-wrap:wrap;gap:6px 22px;margin:18px 0 0;font-size:13px;color:var(--muted)}

/* Exchange panels: the top edge repeats the exchange's tone in the rule above. */
.exchange-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.exchange-card{border:1px solid var(--border);border-top:2px solid var(--rule-a);border-radius:12px;padding:20px 24px 18px;background:var(--panel)}.exchange-card:nth-child(even){border-top-color:var(--rule-b)}.exchange-heading{display:flex;justify-content:space-between;align-items:center;gap:8px}.exchange-name{font-size:16px;font-weight:720;font-stretch:112%}.exchange-value{font-size:30px;font-weight:650;font-stretch:108%;letter-spacing:-.015em;font-variant-numeric:tabular-nums;margin:14px 0;color:var(--strong)}.exchange-value .sub{font-size:12px;letter-spacing:0;font-stretch:100%;margin-top:6px}.wallet-line{display:flex;justify-content:space-between;gap:12px;font-size:13px;color:var(--muted);padding:7px 0;border-top:1px solid var(--line)}.wallet-line span:last-child{color:var(--text);font-variant-numeric:tabular-nums}.exchange-card>.small.muted{margin:12px 0 0}.badge{display:inline-block;border:1px solid var(--control-border);border-radius:100px;padding:3px 9px;color:var(--muted);font-size:11px;font-weight:600;white-space:nowrap}.badge.good{color:var(--green);border-color:var(--good-border);background:var(--good-bg)}.badge.warn{color:var(--warn);border-color:var(--warn-border);background:var(--warn-bg)}.badge.bad{color:var(--red);border-color:var(--bad-border)}
.cash-summary{border-top:1px solid var(--border);margin-top:10px;padding-top:14px}.cash-title{font-size:13px;font-weight:650;color:var(--soft);margin-bottom:8px}.cash-row{display:flex;justify-content:space-between;flex-wrap:wrap;gap:5px 10px;margin:7px 0;font-size:13px}.cash-row>span:first-child{color:var(--muted)}.cash-row>strong,.cash-row>span:last-child{font-variant-numeric:tabular-nums}.cash-row>strong{font-weight:650}.cash-details{font-size:12px;color:var(--muted);line-height:1.5;margin-top:12px}.cash-details summary{cursor:pointer;color:var(--soft)}.cash-details .cash-row{font-size:12px}.cash-note{font-size:12px;color:var(--muted);line-height:1.5;margin:10px 0 0}.valuation-note{font-size:12px;color:var(--faint);line-height:1.6;margin:14px 2px 30px;max-width:80ch}

/* Desk: tabs, filters and the holdings/builders table */
.desk{border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--panel)}.desk-toolbar{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:12px 16px;border-bottom:1px solid var(--border)}.tabs{display:flex;gap:2px}.tab{position:relative;border:0;border-radius:8px;background:transparent;color:var(--muted);padding:10px 14px;white-space:nowrap;font-size:14px;font-weight:650}.tab:hover{background:var(--control);color:var(--text)}.tab.active,.tab.active:hover{color:var(--strong);background:transparent}.tab.active::after{content:"";position:absolute;left:14px;right:14px;bottom:3px;height:2px;border-radius:2px;background:var(--strong)}.tab span{font-size:12px;margin-left:6px;color:var(--faint);font-variant-numeric:tabular-nums}.filters{display:flex;gap:10px}.filters select{width:150px;font-size:13px;min-height:36px;padding:7px 8px}.filters input{width:200px;font-size:13px;min-height:36px;padding:7px 10px}
.builder-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:12px 20px;border-bottom:1px solid var(--border)}.builder-toolbar label{flex-direction:row;align-items:center;gap:8px;font-size:13px}.builder-toolbar select{width:auto;min-height:36px;padding:7px 8px;font-size:13px}.builder-list-summary{margin-left:auto;font-size:13px;color:var(--muted)}
.table-scroll{overflow-x:auto;overflow-anchor:none;overscroll-behavior-x:contain}table{width:100%;border-collapse:collapse;font-size:13px;white-space:nowrap}th{font-weight:600;text-align:left;color:var(--faint);font-size:12px;padding:11px 16px;background:var(--head);border-bottom:1px solid var(--border)}td{padding:15px 16px;border-top:1px solid var(--line);vertical-align:middle}tbody tr:first-child td{border-top:0}tbody tr:hover td{background:var(--row-hover)}td.numeric,th.numeric{text-align:right;font-variant-numeric:tabular-nums}.instrument{font-size:14px;font-weight:720;font-stretch:88%;letter-spacing:.01em;color:var(--strong)}.row-actions{display:flex;justify-content:flex-end;gap:6px}.row-actions button{padding:6px 11px;font-size:12px;white-space:nowrap}.builder-controls{flex-direction:column;align-items:stretch}
/* Builder progress: the same rule, from the holding at creation (left) to the target (right), ticks every quarter. */
.build-rule{position:relative;display:block;width:120px;margin:10px 0 0 auto}.build-rule::after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(90deg,var(--tick) 0 1px,transparent 1px 25%);pointer-events:none}.build-rule progress{display:block;width:100%;height:6px;-webkit-appearance:none;appearance:none;border:0;border-radius:0;background:var(--track);overflow:hidden}.build-rule progress::-webkit-progress-bar{background:var(--track)}.build-rule progress::-webkit-progress-value{background:var(--green)}.build-rule progress::-moz-progress-bar{background:var(--green)}
.builder-reason{max-width:280px;white-space:normal;line-height:1.5}.exchange-error{max-width:280px;white-space:normal;color:var(--warn);line-height:1.5}.pace-cell{min-width:170px;max-width:210px;white-space:normal}.price-limit-summary{max-width:190px;white-space:normal}.pace-cell .sub span,.price-limit-summary span{white-space:nowrap}.builder-reason{min-width:150px}.sizing-cell{min-width:200px;max-width:260px;white-space:normal;font-size:12px;line-height:1.5}.sizing-cell strong{font-weight:650}.sizing-cap{display:block;color:var(--muted);margin-top:2px}.sizing-cap.binding{color:var(--green);font-weight:650}
.empty{padding:56px 24px;text-align:center;color:var(--muted);line-height:1.7;font-size:14px}.empty strong{font-size:17px;display:block;font-weight:650;color:var(--text);margin-bottom:8px}.desk-footer{display:flex;justify-content:space-between;align-items:center;min-height:50px;padding:8px 20px;border-top:1px solid var(--border);font-size:12px;color:var(--muted)}footer{max-width:1440px;margin:auto;padding:0 40px 30px;color:var(--faint);display:flex;justify-content:space-between;font-size:12px;gap:16px}.notice{padding:12px 15px;border:1px solid var(--bad-border);background:var(--bad-bg);border-radius:8px;margin-bottom:20px;font-size:13px;line-height:1.6}

/* Sign-in */
.login-shell{min-height:100vh;display:grid;place-items:center;padding:24px}.login-card{width:100%;max-width:400px;padding:34px;border:1px solid var(--border);background:var(--panel);border-radius:14px}.login-card .brand-mark{width:44px;height:44px;font-size:16px;border-radius:11px;margin-bottom:26px}.login-card h1{font-size:32px;font-weight:760;font-stretch:118%;letter-spacing:-.02em;line-height:1.1;margin:0 0 6px;color:var(--strong)}.login-card label{margin-top:28px}.login-card button{width:100%;margin:8px 0}.login-card .error{font-size:13px}

/* Builder dialog */
dialog{color:inherit;background:var(--raised);border:1px solid var(--control-border);border-radius:14px;padding:28px;width:min(590px,94vw);max-height:90dvh;overflow-y:auto;box-shadow:0 25px 90px var(--shadow)}dialog::backdrop{background:var(--backdrop);backdrop-filter:blur(3px)}.dialog-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.icon-button{font-size:26px;line-height:1;padding:2px 9px;background:transparent;border:0;color:var(--muted)}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.full{grid-column:1/-1}.holding-context{padding:14px;border:1px solid var(--control-border);border-radius:8px;margin:20px 0;color:var(--soft);background:var(--field);font-size:13px;line-height:1.6}.execution-settings{margin:22px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:16px 0}.execution-settings summary{cursor:pointer;font-size:14px;font-weight:600}.execution-settings summary span{float:right;font-size:12px;font-weight:400;color:var(--muted)}.execution-settings .form-grid{padding-top:20px}.full-button{width:100%}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin:22px 0 12px}#preview{border-top:1px solid var(--control-border);margin-top:24px;padding-top:10px}#builder-error{font-size:13px;line-height:1.5}.review-row{display:flex;justify-content:space-between;gap:18px;font-size:14px;padding:8px 0;border-bottom:1px solid var(--line)}.review-row span:first-child{color:var(--muted)}
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);padding:14px 22px;background:var(--toast-bg);color:var(--toast-text);border-radius:10px;font-size:14px;z-index:10;box-shadow:0 10px 60px var(--shadow);max-width:90vw}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}[hidden]{display:none!important}

/* Responsive */
@media(max-width:1320px){td,th{padding-left:12px;padding-right:12px}}
@media(max-width:1100px){.desk-toolbar{flex-wrap:wrap}.filters{margin-left:auto}}
@media(max-width:640px){header{padding:10px 12px;gap:8px}.header-actions{gap:6px;min-width:0}.header-actions a{display:none}.header-actions #connection{max-width:110px;font-size:12px}.header-actions button{padding:7px 6px;font-size:12px;white-space:nowrap}.header-actions .theme-toggle{width:30px;height:30px}.header-actions .theme-toggle svg{width:15px;height:15px}.project-menu .brand{gap:7px;font-size:14px}.project-menu .brand-mark{width:28px;height:28px;font-size:12px;border-radius:7px}
main{padding:22px 16px 28px}.net-worth{margin-bottom:22px}.net-worth-head{margin-bottom:10px}.net-worth-head button{font-size:12px;padding:9px 12px;white-space:nowrap}.total-value{font-size:21px;font-stretch:100%}.allocation{margin-top:18px}.rule-label{font-size:12px}.net-worth-meta{font-size:12px;gap:4px 14px;margin-top:14px}
.exchange-cards{gap:10px}.exchange-card{padding:14px 12px}.exchange-name{font-size:14px}.exchange-heading{align-items:flex-start;flex-direction:column}.exchange-value{font-size:21px;font-stretch:100%;margin:10px 0}.wallet-line{font-size:11px;padding:6px 0}.cash-title,.cash-row{font-size:11px}.cash-details,.cash-details .cash-row,.cash-note{font-size:10px}.valuation-note{font-size:11px;margin-bottom:24px}.badge{font-size:10px}
.desk-toolbar{padding:10px;gap:10px}.tabs{width:100%}.tab{font-size:13px;padding:8px 10px;flex:1}.tab.active::after{left:10px;right:10px}.filters{width:100%;margin:0}.filters select{width:135px;font-size:12px}.filters input{width:calc(100% - 145px);font-size:12px}.builder-toolbar{padding:12px 10px;gap:12px}.builder-toolbar label{flex:1;min-width:0;flex-direction:column;align-items:stretch;gap:6px;font-size:12px}.builder-toolbar select{width:100%;min-width:0;font-size:12px}.builder-list-summary{width:100%;margin-left:0;font-size:12px}
table{font-size:12px}th{font-size:11px}td,th{padding:12px}.sub{font-size:11px}.instrument{font-size:13px}.row-actions button{font-size:11px}.sizing-cell{font-size:11px}.desk-footer{padding:8px 12px;font-size:11px}.desk-footer button{font-size:11px}footer{padding:0 16px 24px;flex-direction:column;gap:8px;font-size:11px}
dialog{padding:22px 18px}.form-grid{gap:14px}.execution-settings summary span{font-size:11px}.dialog-actions{gap:8px}.dialog-actions button{padding:11px;font-size:12px}}
@media(max-width:360px){header{flex-wrap:wrap}.header-actions{margin-left:auto}.exchange-cards{grid-template-columns:1fr}.tabs{min-width:0}.tab{min-width:0;font-size:12px;padding:8px 6px}.tab span{margin-left:3px}}
/* Above phone width the actions column stays pinned while a wide table scrolls beneath it. */
@media(min-width:641px){td:last-child,th:last-child{position:sticky;right:0;z-index:1;box-shadow:inset 1px 0 0 var(--line)}td:last-child{background:var(--panel)}th:last-child{background:var(--head)}tbody tr:hover td:last-child{background:var(--row-hover)}}
@media(prefers-reduced-motion:reduce){.rule-bar{animation:none}}
