/* DLTA web UI: one stylesheet for every page (tokens from the "DLTA site flow" design) */
:root {
  --bg: #0B0C0E; --panel: #121418; --panel-2: #181B20; --panel-3: #1F2329;
  --line: #23272E; --line-2: #2F343C;
  --text: #ECEAE4; --text-2: #A6AAB1; --text-3: #80868F;
  --accent: #F5B544; --accent-hi: #FFC965; --on-accent: #1A1306;
  --up: #5EE0A0; --down: #FF7A66; --up-bg: rgba(94,224,160,.12); --down-bg: rgba(255,122,102,.12);
  --info: #9CC5FF; --info-bg: rgba(127,180,255,.14);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
h1, h2, h3, p { margin: 0; }
ol, ul { margin: 0; }
code { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---------- type helpers ---------- */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--text-2); }
.muted { color: var(--text-3); }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sym { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.note { font-size: 13px; color: var(--text-3); }
.h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.h2 { font-size: 16px; font-weight: 600; }
.lede { font-size: 14px; color: var(--text-2); margin-top: 6px; max-width: 640px; }
.big-num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(34px, 4.6vw, 56px); font-weight: 500; letter-spacing: -.03em; line-height: 1; margin-top: 10px; overflow-wrap: anywhere; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--panel-2); color: var(--text); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); color: var(--on-accent); }
.btn-quiet { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.btn-quiet:hover { background: var(--panel-3); color: var(--text); }
.btn-danger { background: transparent; color: var(--down); border-color: rgba(255,122,102,.35); }
.btn-danger:hover { background: var(--down-bg); color: var(--down); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn:focus-visible, .linkish:focus-visible, .nav a:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.linkish { background: none; border: none; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; text-align: inherit; }
.linkish:hover { color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
form.inline { display: inline; margin: 0; }

/* ---------- pills, chips, live ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-family: var(--mono); font-size: 13px; font-weight: 500; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.pill.up { background: var(--up-bg); color: var(--up); } .pill.down { background: var(--down-bg); color: var(--down); }
.chip { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em; background: var(--panel-3); color: var(--text-2); }
.chip-BUY { background: var(--info-bg); color: var(--info); }
.chip-SELL { background: rgba(245,181,68,.14); color: var(--accent); }
.chip-DIVIDEND { background: var(--up-bg); color: var(--up); }
.chip-on { background: var(--up-bg); color: var(--up); }
.chip-off { background: var(--panel-3); color: var(--text-3); }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 4px rgba(94,224,160,.15); flex: none; }
.live.busy i { background: var(--accent); box-shadow: 0 0 0 4px rgba(245,181,68,.15); }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.pad { padding: 20px 24px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 16px 20px 6px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.row > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.mb { margin-bottom: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 24px; }
.page-head > div:first-child { min-width: 0; }
.back { display: inline-block; font-size: 14px; color: var(--text-2); margin-bottom: 16px; }
.back:hover { color: var(--text); }
.empty { padding: 40px 16px; text-align: center; color: var(--text-2); font-size: 14px; }
.empty .btn { margin-top: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 20px; }
.card-link { padding: 24px; color: inherit; display: flex; flex-direction: column; gap: 18px; transition: border-color .15s; }
.card-link:hover { border-color: var(--line-2); color: inherit; }

/* stat strip */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); overflow: hidden; }
.stat-strip > div { padding: 18px 20px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin: -1px 0 0 -1px; min-width: 0; }
.stat-strip .v { font-family: var(--mono); font-size: 20px; font-weight: 500; margin-top: 8px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* allocation */
.alloc { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--bg); }
.legend { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.legend > div { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.legend .name { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* list rows (portfolio rows on the dashboard) */
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: inherit; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(255,255,255,.02); color: inherit; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .end { text-align: right; flex: none; }

/* ---------- tables ---------- */
.tbl-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
tr.closed td { opacity: .6; }
tr[data-href] { cursor: pointer; }
.r { text-align: right; }
td.mono, td .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-2); }
.warn { color: var(--accent); }

/* ---------- toasts / notices ---------- */
.toast { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 20px; border: 1px solid; overflow-wrap: anywhere; }
.toast .linkish { color: inherit; font-size: 16px; line-height: 1; padding: 2px 4px; }
.toast-success { background: rgba(94,224,160,.08); border-color: rgba(94,224,160,.3); color: #BDF2D6; }
.toast-error { background: rgba(255,122,102,.08); border-color: rgba(255,122,102,.3); color: #FFC4BA; }
.toast-notice, .toast-warning, .toast-info { background: rgba(245,181,68,.08); border-color: rgba(245,181,68,.3); color: #FBDDA4; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label, .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field input, .field select, .field textarea, .input { width: 100%; min-height: 44px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); font: inherit; font-size: 15px; }
.field textarea { padding: 10px 12px; min-height: 72px; resize: vertical; }
.field input[type=file] { padding: 10px 12px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,181,68,.18); }
.field input:disabled { opacity: .6; }
.field .hint, .hint { font-size: 12px; color: var(--text-3); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 140px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; margin-bottom: 4px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.form-panel { max-width: 620px; padding: 24px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.input-mono { font-family: var(--mono) !important; }
.input-code { font-family: var(--mono) !important; font-size: 22px !important; letter-spacing: .3em; text-transform: uppercase; }
details.more { margin: 4px 0 8px; }
details.more summary { cursor: pointer; font-size: 13px; color: var(--text-2); padding: 6px 0 10px; }
details.more summary:hover { color: var(--text); }
.seg { display: inline-flex; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; gap: 2px; }
.seg button, .seg label { min-height: 34px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.seg button:hover, .seg label:hover { color: var(--text); }
.seg button.on, .seg input:checked + label { background: var(--panel-3); color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg-full { display: flex; width: 100%; }
.seg-full > * { flex: 1; }
code.ep { display: block; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 13px; color: var(--text); word-break: break-all; }

/* ticker search dropdown */
.ac-wrap { position: relative; }
.ac { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; max-height: 240px; overflow-y: auto; box-shadow: 0 20px 40px -12px rgba(0,0,0,.7); }
.ac button { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 10px 12px; background: none; border: none; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ac button:last-child { border-bottom: none; }
.ac button:hover, .ac button:focus { background: var(--panel-3); outline: none; }
.ac .msg { padding: 10px 12px; font-size: 13px; color: var(--text-3); }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(3,4,6,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-wrap.show { display: flex; }
.modal { width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 24px; box-shadow: 0 40px 80px -20px rgba(0,0,0,.8); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.modal-x { font-size: 22px; line-height: 1; width: 44px; height: 44px; margin: -10px -10px -10px 0; }
body.modal-open { overflow: hidden; }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 24px 16px; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand span { font-size: 16px; font-weight: 700; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 0 12px; }
.who { position: relative; padding-top: 14px; border-top: 1px solid var(--line); }
.who > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; margin: -6px; border-radius: 10px; cursor: pointer; }
.who > summary::-webkit-details-marker { display: none; }
.who > summary:hover, .who[open] > summary { background: var(--panel-2, rgba(255,255,255,.04)); }
.who > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.who .chev { margin-left: auto; flex: none; color: var(--text-3); transform: rotate(180deg); transition: transform .15s; }
.who[open] .chev { transform: none; }
.who-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 40; background: var(--panel-3); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.who-id { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; font-size: 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; min-width: 0; }
.who-id b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.who-item:hover, .who-item:focus-visible { background: rgba(255,255,255,.06); outline: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-3); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.who .name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.wrap { max-width: 1240px; margin: 0 auto; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { position: sticky; top: 0; z-index: 40; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 16px; border-right: none; border-bottom: 1px solid var(--line); overflow: visible; background: rgba(11,12,14,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .brand { padding: 0; }
  .brand svg { width: 26px; height: 26px; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 14px; padding: 0; }
  .who { border-top: none; padding-top: 0; }
  .who .name, .who .chev { display: none; }
  .who-menu { left: auto; right: 0; bottom: auto; top: calc(100% + 8px); width: 240px; }
  .nav { order: 3; width: 100%; flex-direction: row; gap: 4px; }
  .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; min-height: 52px; padding: 4px 2px; font-size: 11px; }
  .main { padding: 20px 16px 40px; }
  .pad { padding: 16px; }
  .form-panel { padding: 20px 16px; }
  .live span.long { display: none; }
}
@media (max-width: 520px) {
  .h1 { font-size: 24px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-strip > div { padding: 14px 16px; }
  .stat-strip .v { font-size: 17px; }
  th, td { padding: 12px 12px; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row .btn { flex: 1 1 auto; }
  .modal { padding: 20px 16px; }
}

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; }
.login-hero { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px; background: radial-gradient(90% 70% at 30% 20%, #1B1E24 0%, #0B0C0E 70%); }
.login-hero h1 { font-size: clamp(32px, 4.4vw, 60px); line-height: 1.04; letter-spacing: -.03em; font-weight: 600; max-width: 620px; }
.login-hero h1 span { color: var(--text-3); }
.login-form { flex: 1 1 380px; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--panel); border-left: 1px solid var(--line); }
.login-form form { width: 100%; max-width: 360px; }
@media (max-width: 520px) {
  .login-hero { padding: 24px 16px; gap: 28px; }
  .login-form { padding: 32px 16px 40px; border-left: none; border-top: 1px solid var(--line); }
}

/* ---------- desk display (ESP32, 320x170 ST7789 + 10-LED strip) ---------- */
.desk { position: relative; display: flex; align-items: center; justify-content: center; padding: 48px 24px 56px; border-radius: 16px; background: radial-gradient(120% 90% at 50% 0%, #20242B 0%, #121418 55%, #0D0F12 100%); overflow: hidden; }
.desk-sm { padding: 24px 12px 32px; }
.desk > .dv-holder { width: 100%; max-width: 560px; }
.dv-box { position: relative; width: 100%; max-width: 560px; margin: 18px auto 0; padding: 14px; border-radius: 22px; background: linear-gradient(180deg, #2C3037 0%, #1D2025 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), inset 0 -2px 0 rgba(0,0,0,.4), 0 30px 60px -20px rgba(0,0,0,.7), 0 12px 24px -12px rgba(0,0,0,.6); }
.dv-bezel { padding: 8px; border-radius: 10px; background: #050608; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.dv-scr { position: relative; container-type: inline-size; aspect-ratio: 320/170; background: #000; overflow: hidden; }
.dv-screen { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: #000; shape-rendering: crispEdges; }
.dv-tx { position: absolute; font-family: var(--pixel); line-height: 1; white-space: pre; font-size: 2.5cqw; }
.dv-tx.big { font-size: 5cqw; }
.dv-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8%; font-family: var(--pixel); font-size: 2.6cqw; line-height: 1.6; color: #808080; }
.dv-sleep { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity .3s; }
.dv-leds { position: absolute; left: 12%; right: 12%; top: -7px; height: 7px; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #3A3F47, #2C3037); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.dv-leds span { width: 8px; height: 4px; border-radius: 2px; background: #0c0d10; display: block; }
.dv-leds i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #323232; }
.dv-led-on { box-shadow: 0 -4px 12px 2px currentColor, 0 -1px 4px currentColor; animation: dv-breath 10s ease-in-out infinite; }
.dv-breath { animation: dv-breath 10s ease-in-out infinite; }
.dv-ring { animation: dv-ring 10s linear forwards; }
.dv-wifi { animation: dv-blink .5s step-end 6 forwards; }
.dv-nowifi { opacity: 0; }
.dv-paused * { animation-play-state: paused !important; }
@keyframes dv-breath { 0% { opacity: .65 } 25% { opacity: 1 } 50% { opacity: .65 } 75% { opacity: .3 } 100% { opacity: .65 } }
@keyframes dv-ring { from { stroke-dashoffset: 43.98 } to { stroke-dashoffset: 0 } }
@keyframes dv-blink { 0% { opacity: 1 } 60% { opacity: 0 } 100% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .dv-led-on, .dv-breath, .dv-wifi { animation: none; } .dv-ring { animation: none; stroke-dashoffset: 0; } }

/* screens list */
.scr-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 8px; }
.scr-item:hover { border-color: var(--line-2); }
.scr-item.on { border-color: var(--accent); background: var(--panel-2); }
.scr-item.off { opacity: .6; }
.scr-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; color: var(--text); min-height: 44px; }
.scr-pick .n { color: var(--text-3); font-size: 12px; width: 18px; flex: none; }
.scr-pick .t { flex: 1; min-width: 0; }
.scr-pick .t .sym, .scr-pick .t .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-acts { display: flex; gap: 6px; flex: none; }

/* a pill and its caption stay together when the row wraps */
.pair { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.hero-stats { margin: 24px -24px -24px; border-top: 1px solid var(--line); background: transparent; }
@media (max-width: 860px) { .hero-stats { margin: 20px -16px -16px; } }

/* ---------- quick switches (portfolio Active / In global) ---------- */
.quick-switches { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.qswitch { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.qswitch-label { font-size: 13px; color: var(--text-2); }
.switch { position: relative; width: 38px; height: 22px; flex: none; padding: 0; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-3); cursor: pointer; transition: background .15s, border-color .15s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: transform .15s, background .15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(16px); background: var(--on-accent); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch:disabled { opacity: .6; cursor: progress; }
.card-switches { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
/* "+" in a positions row: add a transaction for that symbol */
.row-add { min-width: 32px; padding: 0 10px; font-size: 16px; line-height: 1; }
.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; }
@media (prefers-reduced-motion: reduce) { .switch, .switch i { transition: none; } }
.card-link.is-off > :not(.card-switches) { opacity: .7; }
.seg input:disabled + label { opacity: .4; cursor: not-allowed; }
.seg-full label { flex: 1; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip-pick { border: 1px solid var(--line-2); cursor: pointer; font-family: var(--mono); }
.chip-pick:hover, .chip-pick:focus-visible { border-color: var(--accent); color: var(--text); outline: none; }

/* "Show on" display picker for screens */
.dev-pick { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.dev-pick legend { padding: 0; margin-bottom: 8px; }
.dev-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; white-space: nowrap; cursor: pointer; user-select: none; }
.dev-chip input { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; border: 1.5px solid var(--text-3); border-radius: 4px; background: transparent; display: grid; place-items: center; cursor: pointer; }
.dev-chip input:checked { background: var(--accent); border-color: var(--accent); }
.dev-chip input:checked::after { content: ""; width: 4px; height: 8px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.dev-chip input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dev-chip:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Allocation panel (dashboard + portfolio): Holdings / Currency views */
.alloc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.alloc-box .legend .sym { width: 72px; flex: none; overflow: hidden; text-overflow: ellipsis; }
.alloc-box.wide .legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 32px; }
.alloc-box:has(.seg input:checked) .alloc-view { display: none; }
.alloc-box:has(.seg input[value="holdings"]:checked) .alloc-view[data-view="holdings"],
.alloc-box:has(.seg input[value="type"]:checked) .alloc-view[data-view="type"],
.alloc-box:has(.seg input[value="sector"]:checked) .alloc-view[data-view="sector"],
.alloc-box:has(.seg input[value="industry"]:checked) .alloc-view[data-view="industry"],
.alloc-box:has(.seg input[value="country"]:checked) .alloc-view[data-view="country"],
.alloc-box:has(.seg input[value="currency"]:checked) .alloc-view[data-view="currency"] { display: block; }
.alloc-head .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.alloc-head .seg label { flex: none; }
.alloc-box .legend .lbl { flex: 0 1 auto; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.alloc-box .legend .lbl + .name { font-size: 12px; color: var(--text-3); text-align: right; }

/* Performance chart */
.perf { padding: 20px 24px; }
.perf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.perf-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.perf-controls .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.perf-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 14px 0 10px; font-size: 13px; color: var(--text-2); min-height: 20px; }
.perf-legend span { display: inline-flex; align-items: center; gap: 8px; }
.perf-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.perf-legend b { color: var(--text); font-weight: 500; }
.perf-wrap { position: relative; }
.perf-stage { min-height: 210px; }
.perf-stage svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.perf-msg { min-height: 210px; display: grid; place-items: center; color: var(--text-3); font-size: 14px; text-align: center; padding: 0 16px; }
.perf-tip { position: absolute; top: 6px; pointer-events: none; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.4); min-width: 170px; }
.perf-tip .d { color: var(--text-3); margin-bottom: 4px; }
.perf-tip div:not(.d) { display: flex; align-items: center; gap: 8px; }
.perf-tip i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.perf-tip b { margin-left: auto; padding-left: 12px; font-weight: 500; }
.perf-note { margin-top: 10px; color: var(--accent); }

/* Monthly / yearly bars */
.bars-box { flex: 1 1 360px; min-width: 0; }
.bars-box:has(.seg input[value="month"]:checked) .bars-view[data-per="year"],
.bars-box:has(.seg input[value="year"]:checked) .bars-view[data-per="month"] { display: none; }
.bars-total { margin-bottom: 14px; font-size: 20px; }
.bars-total .note { font-size: 13px; }
.bars { display: flex; align-items: stretch; gap: 3px; height: 150px; border-bottom: 1px solid var(--line); }
.bars .bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; border-radius: 3px; cursor: default; }
.bars .bar:hover { background: rgba(255,255,255,.03); }
.bars .up { height: var(--pos); display: flex; align-items: flex-end; }
.bars .dn { flex: 1; display: flex; align-items: flex-start; }
.bars.has-neg .dn { border-top: 1px solid var(--line-2); }
.bars i { display: block; width: 100%; background: var(--accent); }
.bars .up i { border-radius: 3px 3px 0 0; min-height: 0; }
.bars .dn i { background: var(--down); border-radius: 0 0 3px 3px; opacity: .85; }
.bars-few .bar { max-width: 56px; margin: 0 auto; }
.bars-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-3); }

/* Best & worst */
.bw { display: flex; flex-direction: column; gap: 10px; }
.bw-row { display: grid; grid-template-columns: 110px 1fr 76px 110px; align-items: center; gap: 14px; font-size: 14px; }
.bw-row .sym { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bw-row > .mono { text-align: right; }
.bw-track { display: flex; height: 12px; }
.bw-half { flex: 1; display: flex; }
.bw-half.neg { justify-content: flex-end; border-right: 1px solid var(--line-2); }
.bw-half.neg.alone { border-right: 0; }
.bw-half.pos:only-child i { border-radius: 3px; }
.bw-half i { display: block; height: 100%; }
.bw-half.pos i { background: var(--up); border-radius: 0 3px 3px 0; opacity: .85; }
.bw-half.neg i { background: var(--down); border-radius: 3px 0 0 3px; opacity: .85; }
.bw-gap { text-align: center; color: var(--text-3); letter-spacing: 4px; }
@media (max-width: 640px) {
  .bw-row { grid-template-columns: 74px 1fr 64px; gap: 10px; font-size: 13px; }
  .bw-gain { display: none; }
  .bars { height: 120px; gap: 2px; }
  .perf, .bars-box { padding: 16px !important; }
  .alloc-head .seg, .perf-controls .seg { flex-wrap: wrap; overflow: visible; }
}

/* Holdings treemap */
.tm-box { position: relative; }
.tm { position: relative; width: 100%; min-height: 200px; border-radius: 10px; overflow: hidden; background: var(--bg); }
.tm-group { position: absolute; }
.tm-head { height: 18px; padding: 2px 6px 0; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-tile { position: absolute; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; text-align: center; color: #fff; cursor: default; transition: filter .12s; }
.tm-tile:hover, .tm-tile:focus-visible { filter: brightness(1.18); outline: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
.tm-tile b { font-family: var(--mono); font-weight: 600; line-height: 1.1; text-shadow: 0 1px 2px rgba(0,0,0,.35); white-space: nowrap; }
.tm-tile span { font-family: var(--mono); font-size: 12px; opacity: .9; margin-top: 3px; }
.tm-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 190px; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.45); }
.tm-tip .s { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.tm-tip .n { color: var(--text-3); margin-bottom: 6px; max-width: 240px; }
.tm-tip div:not(.s):not(.n) { display: flex; justify-content: space-between; gap: 16px; padding: 1px 0; }
.tm-tip span { color: var(--text-3); }
.tm-tip b { font-weight: 500; font-family: var(--mono); }
.tm-tip b.up { color: var(--up); } .tm-tip b.down { color: var(--down); }
.tm-scale { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.tm-scale i { width: 140px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgb(214,76,62), #2A2F37 50%, rgb(38,166,108)); }
