*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #f6f5f1; --ink2: #ffffff; --ink3: #f1f0ea; --ink4: #ecebe5;
  --line: #e7e5de; --line2: #d9d7cf; --dim: #b3b1a9; --muted: #8f8d85;
  --sub: #5b5a55; --text: #34332f; --bright: #191918; --accent: #2a78d6;
  --red: #d03b3b; --green: #0a8a3c; --blue: #2a78d6; --purple: #7a4fd0; --teal: #1baf7a;
  --mono: "DM Mono", monospace; --serif: "Manrope", sans-serif; --sans: "Manrope", sans-serif;
  /* v0.9.13 - amber had no token; the freshness 'aging' state and the
     partial-failure toast both need one that is readable on either surface. */
  --amber-ink: #9a6b06; --amber-dot: #d9a520;
  /* v0.9.16 - FIFO lot-consumption strip on the sell estimator. */
  --lot-fill: rgba(217,165,32,.28); --lot-edge: #b98a12;
  --shadow-card: 0 1px 2px rgba(25,25,24,.04), 0 8px 24px -12px rgba(25,25,24,.10);
}

html, body { min-height: 100%; background: var(--ink); color: var(--text); font-family: var(--sans); font-size: 15px; }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--bright); text-decoration: underline; text-decoration-color: rgba(42,120,214, .65); }
a:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

img, svg { max-width: 100%; }
* { -webkit-tap-highlight-color: transparent; }
.position-item, .list-row, .nav-item, .snapshot-row, .news-row, .btn, .filter-tab, .t-tab { -webkit-tap-highlight-color: rgba(42,120,214,.15); }

.shell { display: grid; grid-template-rows: 52px 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--ink); }
.wordmark { font-family: var(--serif); font-size: 19px; color: var(--bright); display: flex; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; }
.wordmark-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.wordmark-logo { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; display: block; }
.auth-wordmark .wordmark-logo { width: 36px; height: 36px; }

.mobile-menu-btn { display: none; width: 40px; height: 40px; background: transparent; border: 1px solid var(--line2); border-radius: 4px; cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px; flex: 0 0 auto; }
.mobile-menu-btn span { display: block; width: 18px; height: 1.5px; background: var(--text); border-radius: 1px; transition: transform .2s, opacity .2s; }
.mobile-menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.mobile-menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mobile-menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.topbar-center { display: flex; align-self: stretch; min-width: 0; }
.t-tab { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: none; border: none; padding: 0 16px; height: 52px; cursor: pointer; transition: color .18s; }
.t-tab:hover, .cell-link:hover, .wordmark:hover { color: var(--sub); }
.t-tab.active { color: var(--bright); }
.topbar-right { display: flex; align-items: center; gap: 12px; position: relative; }
.t-clock, .t-status { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; white-space: nowrap; }
.t-status { display: flex; align-items: center; gap: 6px; }
.t-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 1px solid var(--line2); border-radius: 3px; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 10px; cursor: pointer; }
.icon-btn:hover { border-color: var(--dim); color: var(--accent); }
.file-btn input { display: none; }

.auth-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(25,25,24,.45); }
.auth-overlay[hidden] { display: none; }
.auth-panel { width: min(460px, 100%); border: 1px solid var(--line2); background: var(--ink2); border-radius: 4px; padding: 28px; box-shadow: 0 24px 70px -20px rgba(25,25,24,.25); }
.auth-wordmark { margin-bottom: 24px; cursor: default; }
.auth-panel h1 { font-family: var(--serif); font-size: 31px; line-height: 1.12; font-weight: 400; color: var(--bright); }
.auth-copy { color: var(--sub); line-height: 1.6; margin: 12px 0 22px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.auth-providers { display: flex; flex-direction: column; gap: 10px; }
.auth-providers[hidden], .auth-provider[hidden] { display: none; }   /* display above would otherwise beat the hidden attribute */
.auth-provider { width: 100%; justify-content: center; }
.auth-legal { margin: 14px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.auth-legal a { color: inherit; text-decoration: underline; }
.auth-providers #emailLinkForm { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line2); }
.auth-providers #emailLinkForm .modal-actions { justify-content: flex-start; }

.scroll { height: 100%; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.view { display: none; min-height: calc(100vh - 52px); }
.view.active { display: block; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 34px 36px 24px; border-bottom: 1px solid var(--line); }
.hero-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.hero-date, .section-title { font-family: var(--serif); font-size: 38px; font-weight: 400; color: var(--bright); line-height: 1.08; }
.hero-greeting { margin-top: 8px; color: var(--sub); max-width: 760px; line-height: 1.55; }
.hero-actions, .toolbar-row, .modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.metric { background: var(--ink); padding: 20px 24px; }
.metric-label, .sec-label, .cell-title, .modal label, .provider-box label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.metric-value { font-family: var(--serif); font-size: 30px; color: var(--bright); margin-top: 6px; }
.metric-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 5px; }
.up, .green { color: var(--green) !important; }
.dn, .red { color: var(--red) !important; }
.accent { color: var(--accent) !important; }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(280px, auto);
  gap: 1px;
  background: var(--line);
  grid-template-areas:
    "portfolio portfolio movers movers allocation allocation"
    "heatmap heatmap heatmap heatmap heatmap heatmap"
    "today today news news history history";
}
.cell-portfolio  { grid-area: portfolio; }
.cell-movers     { grid-area: movers; }
.cell-allocation { grid-area: allocation; }
.cell-heatmap    { grid-area: heatmap; min-height: 300px; }
.cell-today      { grid-area: today; }
.cell-news       { grid-area: news; }
.cell-history    { grid-area: history; }
.cell, .detail-section { min-height: 330px; background: var(--ink); padding: 22px 24px; overflow: hidden; }
.cell-head, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cell-title { color: var(--accent); display: flex; align-items: center; gap: 8px; }
.cell-title::before { content: ""; width: 3px; height: 13px; background: var(--accent); border-radius: 1px; }
.cell-link { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; background: none; border: none; cursor: pointer; text-transform: uppercase; }

.split-layout { display: grid; min-height: calc(100vh - 52px); grid-template-columns: 340px 1fr; }
.three-col { grid-template-columns: 230px 1fr 330px; }
.tasks-layout { grid-template-columns: 1fr 330px; }
.portfolio-layout { grid-template-columns: 410px 1fr; }
.intel-layout { grid-template-columns: 260px 1fr; }
.history-layout { grid-template-columns: 330px 1fr; }
.profile-layout { grid-template-columns: 1fr 360px; }

.panel { border-right: 1px solid var(--line); background: var(--ink); min-width: 0; }
.compact-panel { min-height: calc(100vh - 52px); }
.panel-head { padding: 15px 20px 14px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.sec-badge { font-family: var(--mono); font-size: 10px; color: var(--dim); background: var(--ink3); border: 1px solid var(--line2); padding: 3px 8px; border-radius: 2px; }
.summary-card, .panel-stats { padding: 22px 20px; border-bottom: 1px solid var(--line); }
.summary-value { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--bright); }
.summary-row { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.summary-stat { min-width: 86px; }
.summary-stat strong { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; }
.summary-stat span { display: block; margin-top: 4px; font-family: var(--mono); font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }

.position-list, .list-scroll, .news-feed, .workspace-body { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.position-item, .list-row, .news-row, .activity-row, .lot-row, .snapshot-row, .nav-item { border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s, border-color .15s; }
.position-item { padding: 14px 20px; }
.position-item:hover, .position-item.active, .list-row:hover, .list-row.selected, .nav-item:hover, .nav-item.active, .snapshot-row:hover, .snapshot-row.active { background: var(--ink3); }
.position-item.active, .list-row.selected, .nav-item.active, .snapshot-row.active { border-left: 2px solid var(--accent); }
.row-top, .row-meta, .asset-title-row, .db-row, .lot-row, .activity-row, .snapshot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.asset-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.ticker { font-family: var(--mono); font-size: 14px; color: var(--bright); font-weight: 500; }
.muted, .asset-name, .small { color: var(--muted); font-size: 12px; }
.pnl-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(25,25,24,.05); }
.mono { font-family: var(--mono); font-size: 12px; }
.alloc-track { height: 3px; background: var(--line2); overflow: hidden; border-radius: 2px; margin-top: 8px; }
.alloc-fill { height: 100%; border-radius: 2px; }

.workspace { display: flex; flex-direction: column; min-width: 0; min-height: calc(100vh - 52px); }
.workspace-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 32px 22px; border-bottom: 1px solid var(--line); }
.asset-title { font-family: var(--serif); font-size: 34px; color: var(--bright); line-height: 1; }
.price-block { text-align: right; }
.price-block .summary-value { font-size: 31px; }

.kmetrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 18px; }
.km { background: var(--ink2); padding: 13px 14px; }
.km-val { font-family: var(--mono); font-size: 13px; color: var(--text); }
.km-lbl { font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: 5px; }

.chart-panel { border-bottom: 1px solid var(--line); min-height: 330px; }
.chart-toolbar, .list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 32px 0; }
.chart-control-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.range-tabs { display: flex; gap: 2px; }
.range-tab, .filter-tab { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--muted); background: none; border: 0; padding: 6px 11px; cursor: pointer; border-radius: 2px; }
.range-tab.active, .filter-tab.active { color: var(--accent); background: rgba(42,120,214, .07); }
.chart-style-tabs { margin-left: auto; }
.chart-legend { display: flex; gap: 16px; font-family: var(--mono); font-size: 10px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; margin-right: 5px; }
.dot.green { background: var(--green); }
.dot.accent { background: var(--accent); }
.chart-stat { font-family: var(--mono); font-size: 10px; color: var(--text); letter-spacing: .06em; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line2); }
.chart-stat.up { color: var(--green); }
.chart-stat.dn { color: var(--red); }
.chart-empty { font-family: var(--mono); font-size: 11px; fill: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.line-chart { width: calc(100% - 64px); min-height: 250px; margin: 12px 32px 18px; }
.chart-canvas { position: relative; width: calc(100% - 64px); height: 320px; margin: 14px 32px 18px; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(180deg, rgba(42,120,214,.02) 0%, rgba(255,255,255,0) 60%); overflow: hidden; }
.chart-canvas canvas { display: block; }
.chart-canvas .tv-lightweight-charts { border-radius: 4px; }
.chart-empty-msg { margin: 0 32px 18px; padding: 40px 16px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; border: 1px dashed var(--line2); border-radius: 4px; }

.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.detail-section { min-height: 270px; }
.lot-row, .activity-row { padding: 10px 0; font-family: var(--mono); font-size: 11px; }
.portfolio-health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.health-card { background: var(--ink3); border: 1px solid var(--line2); border-radius: 3px; padding: 10px; }
.health-card strong { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--bright); }
.health-card span { display: block; margin-top: 4px; font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.alloc-stack { display: flex; gap: 1px; height: 5px; border-radius: 3px; overflow: hidden; background: var(--line2); margin: 16px 0 10px; }
.alloc-piece { height: 100%; }
.connection-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 10px; }
.connection-row:last-child { border-bottom: none; }
.connection-row span:first-child { color: var(--sub); }
.connection-row span:last-child { color: var(--muted); text-align: right; }

.profile-form { padding: 28px 32px; max-width: 820px; }
.profile-form > label { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.profile-side { border-right: 0; border-left: 1px solid var(--line); }
.profile-account { padding: 8px 20px 22px; }
.profile-stat { padding: 14px 0; border-bottom: 1px solid var(--line); }
.profile-stat span { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.profile-stat strong { display: block; margin-top: 6px; color: var(--text); font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }

.activity-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; text-align: right; }
.danger-link { color: var(--red); }
.nav-list { padding: 8px 0; }
.nav-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; }
.nav-name { color: var(--sub); font-size: 13px; }
.nav-count { font-family: var(--mono); font-size: 10px; color: var(--dim); }

.list-toolbar { justify-content: flex-start; padding: 0; border-bottom: 1px solid var(--line); }
.list-toolbar .filter-tab { height: 44px; padding: 0 18px; border-radius: 0; border-bottom: 2px solid transparent; }
.list-toolbar .filter-tab.active { border-bottom-color: var(--accent); background: transparent; color: var(--bright); }
.list-toolbar .btn { margin-left: auto; margin-right: 18px; }

.list-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; }
.check { width: 17px; height: 17px; border: 1px solid var(--line2); border-radius: 3px; flex: 0 0 auto; margin-top: 1px; }
.check.done { background: var(--green); border-color: var(--green); }
.check.done::after { content: ""; display: block; width: 8px; height: 4px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translate(-1px, 4px); margin: auto; }

.tag { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; border-radius: 2px; padding: 2px 7px; border: 1px solid var(--line2); color: var(--sub); }
.tag.finance, .tag.etf, .tag.stock { color: var(--blue); background: rgba(42,120,214, .08); border-color: rgba(42,120,214, .22); }
.tag.crypto, .tag.health { color: var(--green); background: rgba(10,138,60, .08); border-color: rgba(10,138,60, .22); }
.tag.committed { color: var(--green); }
.tag.research { color: var(--accent); }
.tag.raw { color: var(--muted); }
.tag.business, .tag.tech { color: var(--purple); background: rgba(122,79,208, .08); border-color: rgba(122,79,208, .22); }

.detail-card { padding: 20px; }
.detail-card h2 { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--bright); line-height: 1.25; margin-bottom: 12px; }
.detail-card p { color: var(--sub); line-height: 1.7; margin: 12px 0; }
.db-row { border-bottom: 1px solid var(--line); padding: 7px 0; font-family: var(--mono); font-size: 11px; }

.news-feed { padding: 0 0 24px; }
.news-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; padding: 18px 32px; }
.news-num { font-family: var(--mono); color: var(--dim); font-size: 11px; }
.news-title { color: var(--text); font-size: 16px; line-height: 1.45; }
.news-title a { color: var(--text); display: inline; }
.news-title a::after { content: " OPEN"; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--accent); margin-left: 8px; white-space: nowrap; }
.news-title a:hover { color: var(--bright); }
.news-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.news-source { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 2px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line2); color: var(--sub); }
.news-source.theblock { color: #c2491a; border-color: rgba(194,73,26,.3); background: rgba(194,73,26,.06); }
.news-source.coindesk { color: #a5640a; border-color: rgba(165,100,10,.3); background: rgba(165,100,10,.06); }
.news-source.cointelegraph { color: #8a6d00; border-color: rgba(138,109,0,.3); background: rgba(138,109,0,.06); }
.news-source.yahoo { color: #7a4fa0; border-color: rgba(122,79,160,.3); background: rgba(122,79,160,.06); }
.news-source.alphavantage { color: var(--blue); border-color: rgba(42,120,214,.3); background: rgba(42,120,214,.06); }

.news-toolbar.list-toolbar { padding-left: 16px; }
.news-toolbar.list-toolbar .filter-tab { height: 40px; padding: 0 14px; }

.sentiment-pill { display: inline-block; padding: 2px 7px; border-radius: 999px; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--line2); }
.sentiment-pill.bullish, .sentiment-pill.somewhat-bullish { color: var(--green); border-color: rgba(10,138,60,.35); background: rgba(10,138,60,.08); }
.sentiment-pill.bearish, .sentiment-pill.somewhat-bearish { color: var(--red); border-color: rgba(208,59,59,.35); background: rgba(208,59,59,.08); }
.sentiment-pill.neutral { color: var(--muted); }

.provider-box { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; min-width: min(420px, 45vw); }
.provider-box label { grid-column: 1 / -1; }

.btn { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; padding: 8px 14px; border-radius: 2px; cursor: pointer; transition: all .15s; border: 1px solid; text-transform: uppercase; }
.btn-primary { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #000000; }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--line2); }
.btn-ghost:hover { color: var(--sub); border-color: var(--dim); }
.btn-danger { color: var(--red); border-color: rgba(208,59,59, .28); background: transparent; }
.full { width: 100%; justify-content: center; }

input, textarea, select { width: 100%; background: var(--ink3); border: 1px solid var(--line2); border-radius: 2px; color: var(--text); padding: 9px 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 78px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(25,25,24,.45); z-index: 50; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--ink2); border: 1px solid var(--line2); border-radius: 4px; padding: 24px; box-shadow: 0 22px 70px -18px rgba(25,25,24,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-title { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--bright); }
.modal-close { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.modal label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.field-with-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.field-with-action .btn { height: 100%; min-width: 92px; }
.modal-note { font-size: 12px; color: var(--muted); line-height: 1.5; border: 1px solid var(--line2); padding: 10px; margin: 4px 0 14px; }

.empty { padding: 22px 0; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.snapshot-row { padding: 14px 18px; align-items: flex-start; }
.report { padding: 30px 34px; }
.report h1 { font-family: var(--serif); font-size: 34px; font-weight: 400; color: var(--bright); margin-bottom: 20px; }
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); margin-bottom: 28px; }
.report-section { border-top: 1px solid var(--line); padding: 20px 0; }
.report-section h2 { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-bottom: 12px; }

/* TABLET (≤1120px) */
@media (max-width: 1120px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100vh; }
  .topbar { position: sticky; top: 0; z-index: 40; height: auto; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar-center { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .topbar-center::-webkit-scrollbar { display: none; }
  .t-tab { height: 38px; flex: 0 0 auto; padding: 0 12px; }
  .scroll { height: auto; overflow: visible; }
  .hero, .workspace-head { flex-direction: column; align-items: stretch; padding: 28px 20px 22px; }
  .hero-summary, .overview-grid, .detail-grid, .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-areas: none; }
  .cell-portfolio, .cell-movers, .cell-allocation, .cell-heatmap, .cell-today, .cell-news, .cell-history { grid-area: auto; }
  .split-layout, .three-col, .tasks-layout, .portfolio-layout, .intel-layout, .history-layout, .profile-layout { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-side { border-left: 0; }
  .workspace, .compact-panel { min-height: auto; }
  .workspace-body, .position-list, .list-scroll, .news-feed { overflow: visible; }
  .position-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portfolio-layout .position-list { border-top: 1px solid var(--line); }
  .chart-toolbar { align-items: flex-start; padding: 12px 20px 0; flex-wrap: wrap; }
  .chart-control-group { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .chart-style-tabs { margin-left: 0; }
  .range-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .range-tabs::-webkit-scrollbar { display: none; }
  .kmetrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .asset-actions { align-items: flex-start; }
  .price-block { text-align: left; }
  .news-row { grid-template-columns: 34px 1fr; }
  .news-row .tag { grid-column: 2; width: max-content; }
  .provider-box { min-width: 0; width: 100%; }
  .profile-form { padding: 24px 20px; max-width: none; }
  .chart-canvas { width: calc(100% - 40px); margin: 14px 20px 18px; height: 280px; }
  .chart-empty-msg { margin: 0 20px 18px; }
}

/* MOBILE (≤780px) — slide-out nav */
@media (max-width: 780px) {
  html, body { font-size: 14px; }
  body { -webkit-text-size-adjust: 100%; }
  .t-clock { display: none; }
  .topbar { gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); flex-wrap: nowrap; }
  .wordmark { font-size: 18px; flex: 1 1 auto; min-width: 0; }
  .wordmark-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wordmark-logo { width: 28px; height: 28px; }
  .mobile-menu-btn { display: flex; }

  .topbar-center {
    position: fixed; top: 0; left: 0; right: 0; width: 100%;
    flex-direction: column; background: var(--ink2); border-bottom: 1px solid var(--line2);
    box-shadow: 0 12px 28px -10px rgba(25,25,24,.18);
    padding: max(60px, calc(env(safe-area-inset-top) + 56px)) 16px 16px;
    transform: translateY(-100%); transition: transform .25s ease;
    z-index: 35; overflow-y: auto; max-height: 100vh; align-items: stretch;
  }
  .topbar-center.open { transform: translateY(0); }
  .topbar-center::-webkit-scrollbar { display: none; }
  .topbar-center .t-tab { height: 48px; padding: 0 16px; text-align: left; justify-content: flex-start; border-bottom: 1px solid var(--line); border-radius: 0; width: 100%; font-size: 13px; }
  .topbar-center .t-tab.active { border-bottom-color: var(--accent); color: var(--accent); background: rgba(42,120,214,.04); }

  .topbar-right { gap: 6px; flex-shrink: 0; flex-wrap: nowrap; }
  .topbar-right .icon-btn { width: 36px; height: 36px; min-width: 36px; }
  .topbar-right .t-status { display: none; }

  .hero { padding: 22px 16px 18px; }
  .hero-date, .section-title { font-size: 28px; }
  .hero-greeting { font-size: 13px; }
  .hero-summary, .overview-grid, .detail-grid, .report-grid, .form-grid, .kmetrics { grid-template-columns: 1fr; }
  .cell, .detail-section { min-height: auto; padding: 18px 16px; }
  .metric { padding: 16px 18px; }
  .metric-value { font-size: 26px; }
  .summary-card, .panel-stats { padding: 18px 16px; }
  .panel-head { padding: 13px 16px; }
  .position-list { display: block; }
  .position-item, .list-row, .snapshot-row { padding: 14px 16px; min-height: 56px; }
  .position-item:hover, .list-row:hover { background: var(--ink2); }
  .row-top, .row-meta, .db-row, .lot-row, .activity-row, .snapshot-row { align-items: flex-start; }
  .row-meta { flex-wrap: wrap; gap: 6px; }
  .asset-title { font-size: 28px; }
  .asset-title-row { align-items: flex-start; }
  .asset-actions .toolbar-row, .hero-actions, .modal-actions, .toolbar-row { align-items: stretch; }
  .asset-actions .btn, .hero-actions .btn, .toolbar-row .btn, .modal-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .chart-toolbar { flex-direction: column; padding: 12px 16px 0; gap: 10px; }
  .chart-control-group { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
  .chart-style-tabs { margin-left: 0; }
  .chart-legend { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .chart-stat { margin-left: 0; padding-left: 0; border-left: 0; }
  .chart-canvas { width: calc(100% - 24px); height: 240px; margin: 12px 12px 16px; }
  .chart-empty-msg { margin: 0 12px 16px; padding: 28px 12px; }
  .line-chart { width: calc(100% - 24px); margin: 12px 12px 16px; }
  .btn { min-height: 40px; padding: 10px 14px; }
  .btn-primary, .btn-ghost, .btn-danger { min-height: 44px; }
  input, textarea, select { font-size: 16px; padding: 11px 12px; min-height: 44px; }
  textarea { min-height: 88px; }
  .provider-box { min-width: 0; grid-template-columns: 1fr; padding-top: 8px; }
  .news-toolbar.list-toolbar { padding-left: 4px; padding-right: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .news-toolbar.list-toolbar::-webkit-scrollbar { display: none; }
  .news-toolbar.list-toolbar .filter-tab { flex: 0 0 auto; padding: 0 14px; height: 42px; }
  .news-row { grid-template-columns: 1fr; gap: 8px; padding: 16px 14px; }
  .news-row .tag { grid-column: 1; }
  .news-num { order: -1; font-size: 10px; }
  .news-title { font-size: 15px; line-height: 1.4; }
  .news-title a::after { display: none; }
  .profile-form { padding: 20px 16px; max-width: none; }
  .profile-account { padding: 4px 16px 20px; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; padding: 20px 16px; padding-bottom: max(20px, env(safe-area-inset-bottom)); animation: modal-slide-up .22s ease-out; }
  @keyframes modal-slide-up { from { transform: translateY(20px); opacity: .85; } to { transform: translateY(0); opacity: 1; } }
  .modal-head { margin-bottom: 14px; }
  .modal-title { font-size: 22px; }
  .modal-close { width: 36px; height: 36px; }
  .field-with-action { grid-template-columns: 1fr; }
  .field-with-action .btn { min-height: 44px; }

  .auth-overlay { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .auth-panel { padding: 24px 18px; }
  .auth-panel h1 { font-size: 26px; }
}

/* SMALL PHONES (≤380px) */
@media (max-width: 380px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .wordmark { font-size: 16px; }
  .wordmark-logo { width: 24px; height: 24px; }
  .topbar-right .icon-btn { width: 34px; height: 34px; min-width: 34px; font-size: 9px; }
  .hero-date, .section-title { font-size: 24px; }
  .modal-title { font-size: 19px; }
  .chart-canvas { height: 220px; }
}

/* LANDSCAPE phone fixes */
@media (max-width: 920px) and (orientation: landscape) and (max-height: 500px) {
  .hero { padding: 16px 16px 12px; }
  .hero-date { font-size: 24px; }
  .chart-canvas { height: 200px; }
  .modal { max-height: 96vh; }
}

/* Touch device hover overrides */
@media (hover: none) {
  .position-item:hover, .list-row:hover, .nav-item:hover, .snapshot-row:hover { background: transparent; }
  .position-item.active, .list-row.selected, .nav-item.active, .snapshot-row.active { background: var(--ink3); }
  .btn:hover { transform: none; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .modal-overlay { padding-bottom: env(safe-area-inset-bottom); }
}

/* Sync conflict banner */
.conflict-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: linear-gradient(180deg, rgba(208,59,59,.18), rgba(208,59,59,.05));
  border-bottom: 1px solid rgba(208,59,59,.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: max(10px, env(safe-area-inset-top)) 20px 10px;
  animation: conflict-slide-down .25s ease-out;
}
@keyframes conflict-slide-down { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.conflict-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1280px; margin: 0 auto; flex-wrap: wrap; }
.conflict-banner-text { font-size: 13px; color: var(--text); line-height: 1.4; }
.conflict-banner-text strong { color: var(--red); margin-right: 6px; }
.conflict-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.conflict-banner-actions .btn { min-height: 36px; padding: 6px 14px; }

@media (max-width: 780px) {
  .conflict-banner { padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
  .conflict-banner-inner { flex-direction: column; align-items: stretch; }
  .conflict-banner-actions { justify-content: stretch; }
  .conflict-banner-actions .btn { flex: 1; }
}

/* Price alerts */
.alert-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 88;
  background: linear-gradient(180deg, rgba(42,120,214,.18), rgba(42,120,214,.03));
  border-bottom: 1px solid rgba(42,120,214,.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: max(10px, env(safe-area-inset-top)) 20px 10px;
  animation: conflict-slide-down .25s ease-out;
}
.alert-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1280px; margin: 0 auto; flex-wrap: wrap; }
.alert-banner-text { font-size: 13px; color: var(--text); line-height: 1.4; }
.alert-banner-text strong { color: var(--accent); margin-right: 6px; }
.alert-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.alert-banner-actions .btn { min-height: 36px; padding: 6px 14px; }

.alert-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.alert-row.triggered { background: rgba(42,120,214,.04); }
.alert-row.paused { opacity: .55; }
.alert-symbol { font-family: var(--mono); color: var(--bright); font-size: 14px; font-weight: 500; letter-spacing: .04em; }
.alert-condition { font-family: var(--mono); font-size: 12px; color: var(--sub); margin-top: 4px; }
.alert-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.alert-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.alert-actions .btn { padding: 4px 10px; font-size: 10px; min-height: 30px; }

.alert-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1px solid var(--line2);
}
.alert-status-pill.active { color: var(--green); border-color: rgba(10,138,60,.4); background: rgba(10,138,60,.08); }
.alert-status-pill.triggered { color: var(--accent); border-color: rgba(42,120,214,.4); background: rgba(42,120,214,.08); }
.alert-status-pill.paused { color: var(--muted); }
.alert-status-pill.dismissed { color: var(--dim); }

.checkbox-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--sub);
  text-transform: none;
  letter-spacing: 0;
}
.checkbox-row input[type="checkbox"] {
  width: auto !important;
  min-height: 0 !important;
  margin: 0;
}

@media (max-width: 780px) {
  .alert-banner { padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
  .alert-banner-inner { flex-direction: column; align-items: stretch; }
  .alert-banner-actions { justify-content: stretch; }
  .alert-banner-actions .btn { flex: 1; }
  .alert-row { grid-template-columns: 1fr; padding: 14px 16px; }
}

/* Push notifications panel */
.push-status { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 14px; }
.push-status-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 11px; }
.push-status-row .mono { font-size: 11px; }


/* User chip + dropdown */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 8px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: color .15s;
}
.user-chip:hover .user-chip-name { color: var(--bright); }
.user-chip[aria-expanded="true"] .user-chip-name { color: var(--accent); }
.user-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #d4b487);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.user-chip-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  letter-spacing: .04em;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-anon .user-chip-avatar { background: var(--ink3); color: var(--muted); }
.user-chip-anon .user-chip-name { color: var(--muted); }

.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--ink2);
  border: 1px solid var(--line2);
  border-radius: 6px;
  box-shadow: 0 18px 44px -14px rgba(25,25,24,.20);
  padding: 6px;
  z-index: 60;
}
.user-menu[hidden] { display: none; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--ink3); color: var(--bright); }
.user-menu-divider { height: 1px; background: var(--line); margin: 4px 0; }
.user-menu-danger { color: var(--red); }
.user-menu-danger:hover { background: rgba(208,59,59, .08); color: var(--red); }

@media (max-width: 780px) {
  .user-chip-name { display: none; }
  .user-chip { padding: 0 4px; gap: 0; }
  .user-menu { right: 12px; top: 56px; }
}

/* Priority tags (replacing category tags) */
.tag.priority-high { color: var(--accent); border-color: rgba(42,120,214, .35); background: rgba(42,120,214, .08); }
.tag.priority-medium { color: var(--sub); }
.tag.priority-low { color: var(--muted); }

/* Footer */
.app-footer {
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--dim);
  text-transform: uppercase;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
@media (max-width: 1120px) {
  .app-footer { padding: 14px 12px max(14px, env(safe-area-inset-bottom)); }
}


/* Icon-only buttons (refresh, etc.) */
.btn.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  min-height: 0;
  border-radius: 4px;
}
.btn.icon-only svg { display: block; }
.btn-ghost.icon-only:hover { color: var(--accent); border-color: var(--dim); }
@media (max-width: 780px) {
  .btn.icon-only { width: 40px; height: 40px; flex: 0 0 auto !important; }
}


/* Overview Movers cell — compact horizontal bars */
.movers-grid { display: flex; flex-direction: column; gap: 8px; }
.mover-bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  cursor: pointer;
  transition: background .12s;
  border-radius: 3px;
}
.mover-bar-row:hover { background: var(--ink2); }
.mover-ticker {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--bright);
  letter-spacing: .03em;
}
/* Divergent track — center line, fills grow outward to either side */
.mover-track {
  position: relative;
  height: 6px;
  background: var(--line2);
  border-radius: 999px;
}
.mover-track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: var(--dim);
}
.mover-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  transition: width .35s ease;
}
.mover-fill.up {
  left: 50%;
  background: linear-gradient(90deg, rgba(10,138,60,.45), var(--green));
}
.mover-fill.dn {
  right: 50%;
  background: linear-gradient(90deg, var(--red), rgba(208,59,59,.45));
}
.mover-pct {
  font-size: 11px;
  text-align: right;
}


/* Beta invitations panel */
.invite-form { padding: 4px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.invite-form .form-grid { gap: 12px; }
.invitations-list { display: flex; flex-direction: column; }
.invitation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.invitation-row:last-child { border-bottom: 0; }
.invitation-email {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--bright);
  letter-spacing: .02em;
}
.invitation-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11px;
}
.invitation-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1px solid var(--line2);
}
.invitation-pill.pending { color: var(--accent); border-color: rgba(42,120,214,.35); background: rgba(42,120,214,.08); }
.invitation-pill.accepted { color: var(--green); border-color: rgba(10,138,60,.35); background: rgba(10,138,60,.08); }
.invitation-pill.expired { color: var(--muted); }
.invitation-pill.revoked { color: var(--red); border-color: rgba(208,59,59,.35); background: rgba(208,59,59,.08); }
.invitation-actions { display: flex; gap: 6px; flex-shrink: 0; }
.invitation-actions .btn { padding: 4px 10px; font-size: 10px; min-height: 30px; }
@media (max-width: 780px) {
  .invitation-row { flex-direction: column; align-items: flex-start; }
  .invitation-actions { width: 100%; justify-content: flex-end; }
}


/* Metric sparkline */
.metric { position: relative; }
.metric-spark {
  display: block;
  width: 100%;
  height: 22px;
  margin: 6px 0 4px;
  pointer-events: none;
}

/* Allocation cell layout */
.allocation-layout {
  display: flex;
  gap: 18px;
  align-items: center;
  min-height: 140px;
}
.allocation-donut-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-svg { display: block; }
.donut-center {
  font-family: var(--mono);
  font-size: 13px;
  fill: var(--bright);
  font-weight: 500;
}
.donut-center-sub {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.allocation-legend {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  min-width: 0;
}
.allocation-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.allocation-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}
.allocation-label { color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.allocation-pct { color: var(--sub); font-size: 11px; }
.allocation-class-line {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .04em;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}
.allocation-class-line strong {
  color: var(--accent);
  font-weight: 400;
  margin-right: 4px;
}

@media (max-width: 780px) {
  .allocation-layout { flex-direction: column; gap: 14px; }
  .allocation-legend { width: 100%; }
}


/* Overview performance chart */
.overview-perf {
  background: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px 18px;
  position: relative;
}
.overview-perf-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 16px;
  flex-wrap: wrap;
}
.overview-perf-head .sec-label { display: inline-block; }
.overview-perf-summary {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  letter-spacing: .04em;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line2);
}
.overview-perf-summary.up { color: var(--green); }
.overview-perf-summary.dn { color: var(--red); }
.overview-perf-canvas {
  position: relative;
  width: 100%;
  height: 280px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(42,120,214,.02) 0%, rgba(255,255,255,0) 60%);
  margin-bottom: 12px;
}
.overview-perf-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px dashed var(--line2);
  border-radius: 4px;
}
@media (max-width: 780px) {
  .overview-perf { padding: 14px 16px 18px; }
  .overview-perf-canvas { height: 260px; margin-bottom: 14px; }
  .overview-perf-summary { margin-left: 0; padding-left: 0; border-left: 0; display: block; margin-top: 4px; }
}


/* Overview heatmap */
.heatmap-canvas {
  position: relative;
  width: 100%;
  height: 240px;
  background: var(--ink2);
  border-radius: 4px;
  overflow: hidden;
}
.heatmap-tile {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 2px;
  border: 1px solid rgba(25,25,24,.08);
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.heatmap-tile:hover { border-color: rgba(25,25,24,.55); transform: scale(1.01); z-index: 2; }
.heatmap-tile .heatmap-ticker {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--bright);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.heatmap-tile .heatmap-pct {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  opacity: 0.85;
  white-space: nowrap;
}
.heatmap-tile.size-sm { padding: 4px 6px; }
.heatmap-tile.size-sm .heatmap-ticker { font-size: 11px; }
.heatmap-tile.size-sm .heatmap-pct { font-size: 9px; }
.heatmap-tile.size-md .heatmap-ticker { font-size: 13px; }
.heatmap-tile.size-md .heatmap-pct { font-size: 11px; }
.heatmap-tile.size-lg .heatmap-ticker { font-size: 16px; }
.heatmap-tile.size-lg .heatmap-pct { font-size: 12px; }
.heatmap-caption {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .04em;
  margin-top: 10px;
  text-align: right;
}
.heatmap-legend-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.heatmap-legend-swatch.up { background: rgba(10,138,60,0.7); }
.heatmap-legend-swatch.dn { background: rgba(208,59,59,0.7); }
.heatmap-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

@media (max-width: 780px) {
  .heatmap-canvas { height: 200px; }
}


/* Benchmark toggles on the performance chart */
.overview-perf-controls {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.benchmark-tabs .range-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.benchmark-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.55;
  transition: opacity .15s;
}
.benchmark-tabs .range-tab.active .benchmark-dot { opacity: 1; }
.overview-perf-summary-row {
  display: flex;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  flex-wrap: wrap;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line2);
}
.perf-stat { color: var(--muted); }
.perf-stat strong { color: var(--text); font-weight: 400; }
.perf-stat.up strong { color: var(--green); }
.perf-stat.dn strong { color: var(--red); }
@media (max-width: 780px) {
  .overview-perf-controls { width: 100%; gap: 10px; }
  .overview-perf-summary-row { margin-left: 0; padding-left: 0; border-left: 0; }
  /* Range tabs are 5 buttons - give them their own row below benchmarks + export. */
  .overview-perf-controls .benchmark-tabs { order: 1; }
  .overview-perf-controls .overview-perf-export { order: 2; margin-left: auto; }
  .overview-perf-controls .range-tabs:not(.benchmark-tabs) {
    order: 3;
    flex-basis: 100%;
    max-width: 100%;
    justify-content: flex-start;
  }
}


/* Sparkline hover tooltip */
.metric { cursor: default; }
.metric-spark { cursor: crosshair; }
.spark-tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: rgba(17,17,20,.96);
  border: 1px solid var(--line2);
  border-radius: 4px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--bright);
  line-height: 1.4;
  white-space: nowrap;
  transform: translate(-50%, -110%);
  opacity: 0;
  transition: opacity .12s;
  box-shadow: 0 6px 16px rgba(25,25,24,.18);
}
.spark-tooltip.visible { opacity: 1; }
.spark-tooltip .spark-tooltip-date { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
.spark-tooltip .spark-tooltip-value { color: var(--bright); font-size: 11px; }
.spark-hover-marker {
  fill: var(--accent);
  stroke: var(--ink);
  stroke-width: 1;
}

/* Donut transitions */
.donut-svg circle { transition: stroke-dasharray .55s cubic-bezier(.4,.0,.2,1), stroke-dashoffset .55s cubic-bezier(.4,.0,.2,1); }

/* Performance chart export button */
.overview-perf-export { color: var(--muted); }
.overview-perf-export:hover { color: var(--accent); border-color: var(--dim); }

/* Heatmap mobile fallback — when canvas is narrow, prefer a vertical list of horizontal bars */
@media (max-width: 780px) {
  .heatmap-canvas.heatmap-list { height: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; background: transparent; }
  .heatmap-canvas.heatmap-list .heatmap-tile {
    position: relative;
    left: 0; top: 0;
    width: 100% !important;
    height: 32px !important;
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: transparent !important;
    border: 0;
  }
  .heatmap-canvas.heatmap-list .heatmap-tile:hover { transform: none; }
  .heatmap-canvas.heatmap-list .heatmap-tile .heatmap-bar-track {
    position: relative;
    height: 6px;
    background: var(--line2);
    border-radius: 999px;
    overflow: hidden;
  }
  .heatmap-canvas.heatmap-list .heatmap-tile .heatmap-bar-fill {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    border-radius: 999px;
  }
}

/* Portfolio tab — value-first section header. The big mono number replaces
   the implicit "Portfolio" title; eyebrow above carries the section identity,
   sub-line below shows day + total P&L in one scan. Lives at the top of
   #portfolioView, above the split-layout. */
.portfolio-head { padding: 18px 24px 16px; border-bottom: 1px solid var(--line); }
.portfolio-head .hero-eyebrow { margin: 0 0 6px; }
.portfolio-head-value { font-family: var(--mono); font-size: 36px; font-weight: 500; letter-spacing: -0.01em; color: var(--bright); line-height: 1.05; margin: 0 0 8px; }
.portfolio-head-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--sub); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.portfolio-head-sub .sep { color: var(--dim); }
@media (max-width: 780px) {
  .portfolio-head { padding: 14px 16px 12px; }
  .portfolio-head-value { font-size: 30px; }
  .portfolio-head-sub { font-size: 10.5px; }
}

/* =========================================================================
 * News redesign (v0.4 mockup) — hero card, trending strip, coverage map,
 * sentiment color bars, save/read state, mark-all-read footer.
 * ========================================================================= */
.news-hero { padding: 0 18px; }
.news-hero-card {
  background: var(--ink2);
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 14px 16px 12px;
  margin: 6px 0 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.news-hero-card:hover { background: var(--ink3); }
.news-hero-card.pos { border-left-color: var(--green); }
.news-hero-card.neg { border-left-color: var(--red); }
.news-hero-card.read { opacity: 0.6; }
.news-hero-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.news-hero-card.pos .news-hero-tag { color: var(--green); }
.news-hero-card.neg .news-hero-tag { color: var(--red); }
.news-hero-headline {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--bright);
  line-height: 1.3;
  margin: 0 0 10px;
  letter-spacing: -0.005em;
}
.news-hero-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.news-hero-foot .sep { color: var(--dim); }
.news-hero-foot .grow { flex: 1; }

.news-trending {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 0 18px;
  margin: 0 0 12px;
}
.news-trending .trend-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.news-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  background: var(--ink3);
  color: var(--sub);
  border: 0.5px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
}
.news-pill:hover { color: var(--bright); background: var(--ink4); }
.news-pill.active {
  background: rgba(42,120,214, 0.14);
  color: var(--accent);
  border-color: rgba(42,120,214, 0.3);
}
.news-pill-dot { width: 5px; height: 5px; border-radius: 50%; }
.news-pill-ct { font-size: 10px; color: var(--dim); margin-left: 2px; }
.news-pill.active .news-pill-ct { color: var(--accent); }

.coverage-map { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; }
.coverage-row {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 0.5px solid transparent;
  transition: all 0.12s;
}
.coverage-row:hover { background: var(--ink3); border-color: var(--line); }
.coverage-row.active {
  background: rgba(42,120,214, 0.08);
  border-color: rgba(42,120,214, 0.22);
}
.coverage-top { display: flex; justify-content: space-between; align-items: baseline; }
.coverage-sym {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--bright);
  letter-spacing: 0.04em;
}
.coverage-chg { font-family: var(--mono); font-size: 10.5px; }
.coverage-mid {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.04em;
}
.coverage-bar {
  display: flex;
  height: 3px;
  margin-top: 5px;
  border-radius: 1px;
  overflow: hidden;
  background: var(--ink);
}
.coverage-bar > span { display: block; height: 100%; }
.coverage-bar .pos { background: var(--green); }
.coverage-bar .neu { background: var(--muted); }
.coverage-bar .neg { background: var(--red); }

.filter-tab .filter-ct {
  margin-left: 5px;
  color: var(--dim);
  font-size: 10px;
}
.filter-tab.active .filter-ct { color: var(--accent); }

.news-feed { display: flex; flex-direction: column; }
.news-item {
  display: grid;
  grid-template-columns: 3px 1fr;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 0.5px solid var(--line);
  cursor: pointer;
  transition: opacity 0.15s, background 0.12s;
}
.news-item:hover { background: var(--ink2); }
.news-item.read { opacity: 0.5; }
.news-sent-bar { width: 3px; align-self: stretch; border-radius: 1px; margin-top: 2px; }
.news-sent-bar.pos { background: var(--green); }
.news-sent-bar.neu { background: var(--muted); }
.news-sent-bar.neg { background: var(--red); }
.news-content { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.news-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.news-tk {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.news-tk.mkt { color: var(--muted); }
.news-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex: 1;
  min-width: 0;
}
.news-meta .sep { color: var(--dim); margin: 0 6px; }
.news-sent-label.pos { color: var(--green); }
.news-sent-label.neg { color: var(--red); }
.news-sent-label.neu { color: var(--muted); }
.news-actions { display: inline-flex; gap: 2px; margin-left: auto; }
.news-act {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.news-act:hover { color: var(--accent); background: var(--ink3); }
.news-act.saved { color: var(--accent); }
.news-headline {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}

.news-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-top: 0.5px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.news-footer button {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: var(--accent);
  cursor: pointer;
}
.news-footer button:hover { color: var(--bright); }
.news-foot-num { color: var(--text); }

@media (max-width: 780px) {
  .news-hero { padding: 0 12px; }
  .news-hero-card { padding: 12px 14px; margin: 4px 0 12px; }
  .news-hero-headline { font-size: 16px; }
  .news-trending { padding: 0 12px 4px; overflow-x: auto; flex-wrap: nowrap; }
  .news-trending::-webkit-scrollbar { height: 4px; }
  .news-trending::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 2px; }
  .news-item { padding: 10px 12px; }
  .news-footer { padding: 10px 12px; }
}

/* =========================================================================
 * Shared section redesign (Tasks / Alerts / History / Overview)
 * Hero card + sub-line + item color bars + footer.
 * Same visual idioms as the News redesign so the system reads as one app.
 * ========================================================================= */
.section-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin: 6px 0 0; }
.section-hero { padding: 0 18px; }
.section-hero-card {
  background: var(--ink2);
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 14px 16px 12px;
  margin: 6px 0 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.section-hero-card:hover { background: var(--ink3); }
.section-hero-card.up, .section-hero-card.pos { border-left-color: var(--green); }
.section-hero-card.dn, .section-hero-card.neg { border-left-color: var(--red); }
.section-hero-card.warn { border-left-color: #b97f0a; }
.section-hero-card.neu { border-left-color: var(--accent); }
.section-hero-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.section-hero-card.up .section-hero-tag, .section-hero-card.pos .section-hero-tag { color: var(--green); }
.section-hero-card.dn .section-hero-tag, .section-hero-card.neg .section-hero-tag { color: var(--red); }
.section-hero-card.warn .section-hero-tag { color: #b97f0a; }
.section-hero-headline {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--bright);
  line-height: 1.3;
  margin: 0 0 6px;
  letter-spacing: -0.005em;
}
.section-hero-headline-mono { font-family: var(--mono); letter-spacing: 0.005em; }
.section-hero-lede {
  font-size: 12.5px;
  color: var(--sub);
  margin: 0 0 8px;
  line-height: 1.5;
}
.section-hero-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
}
.section-hero-foot .sep { color: var(--dim); }
.section-hero-foot .grow { flex: 1; }

/* Item bar (priority / status / P&L direction stripe on the left of list rows) */
.item-bar-row { position: relative; padding-left: 14px !important; }
.item-bar {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 1px;
}
.item-bar.bar-hi { background: var(--red); }
.item-bar.bar-md { background: #b97f0a; }
.item-bar.bar-lo { background: var(--muted); }
.item-bar.bar-up, .item-bar.bar-pos { background: var(--green); }
.item-bar.bar-dn, .item-bar.bar-neg { background: var(--red); }
.item-bar.bar-neu { background: var(--muted); }

/* Compact row inner layout (used by Alerts + History rows) */
.item-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.item-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.item-tk {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  min-width: 38px;
}
.item-name { font-size: 12.5px; color: var(--text); flex: 1; min-width: 0; }
.item-price { font-family: var(--mono); font-size: 12px; color: var(--bright); font-weight: 500; }
.item-sub {
  display: flex;
  gap: 6px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
}
.item-sub .sep { color: var(--dim); margin: 0; }
.item-title { font-size: 13px; color: var(--text); line-height: 1.4; }

/* Task row — checkbox sits between the bar and the content. */
.task-row { display: grid !important; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.task-row.done .item-title { text-decoration: line-through; color: var(--dim); }
.task-row.done { opacity: 0.7; }

/* Section footer — running counts + one action, same idiom as news-footer. */
.section-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-top: 0.5px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.section-footer button {
  background: transparent; border: none; padding: 0;
  font-family: inherit; font-size: inherit; letter-spacing: inherit;
  color: var(--accent); cursor: pointer;
}
.section-footer button:hover { color: var(--bright); }

/* History — section-level header above the split-layout */
.history-head { padding: 18px 24px 8px; border-bottom: 1px solid var(--line); }
.history-head .hero-eyebrow { margin: 0; }
.history-head .section-title { margin: 4px 0 0; }

@media (max-width: 780px) {
  .section-hero { padding: 0 12px; }
  .section-hero-card { padding: 12px 14px; margin: 4px 0 12px; }
  .section-hero-headline { font-size: 16px; }
  .section-footer { padding: 10px 12px; }
  .history-head { padding: 14px 16px 8px; }
}

/* =========================================================================
 * Mobile layout order fix (v0.4.6)
 * News + Alerts share .intel-layout, whose DOM order is sidebar-then-workspace.
 * On desktop that's correct (left rail). On mobile the grid collapses to one
 * column in source order, which stacked the coverage map / alert filters ABOVE
 * the page title + hero — contradicting the mobile mockups, where the hero
 * leads. Reorder so the workspace comes first; the secondary sidebar follows.
 * Also render the coverage map as the compact horizontal-scroll strip the
 * mockup showed, instead of a tall vertical list at the bottom.
 * ========================================================================= */
/* Inline coverage strip is hidden on desktop (the left sidebar shows it there). */
.coverage-inline { display: none; }

@media (max-width: 780px) {
  /* News + Alerts (.intel-layout): lead with the workspace, not the sidebar. */
  .intel-layout > .workspace { order: -1; }
  /* News: surface coverage inline (right after the trending pills) instead of
     the desktop sidebar, so it sits near the top rather than below the feed.
     Hide the sidebar's coverage list + its header; the Refresh Intel button
     stays in the sidebar (which now collapses below the feed). */
  #intelView .compact-panel .coverage-map,
  #intelView .compact-panel .panel-head { display: none; }
  .coverage-inline { display: flex; }
  /* Compact horizontal-scroll card strip (applies to the inline coverage). */
  .intel-layout .coverage-map {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 12px 12px;
    margin: 0 -2px;
    -webkit-overflow-scrolling: touch;
  }
  .intel-layout .coverage-map::-webkit-scrollbar { height: 4px; }
  .intel-layout .coverage-map::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 2px; }
  .intel-layout .coverage-row { flex: 0 0 auto; min-width: 152px; }
}

/* =========================================================================
 * Home view (v0.5.0) — replaces Overview as the primary dashboard.
 * Big mono portfolio value leads, performance chart below, holdings rail on
 * the right (stacks below on mobile), spotlight card, and a 3-panel below-fold
 * strip for today's tasks / latest news / alerts. Removes the redundant
 * Movers / Allocation / Heatmap cards — the holdings rail covers allocation
 * visually, and the spotlight surfaces the biggest mover explicitly.
 * ========================================================================= */
.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; }

.home-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px 32px 6px; }
.home-head .hero-eyebrow { margin: 0 0 6px; }
.home-head .hero-greeting { font-size: 13px; color: var(--sub); margin: 0; max-width: 560px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; padding: 14px 32px 18px; align-items: start; }
.home-main { min-width: 0; }
.home-value {
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 500;
  color: var(--bright);
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0 0 8px;
}
.home-day { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: 14px; margin: 0 0 4px; }
.home-day .arr { font-size: 11px; }
.home-day .sub { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin-left: auto; }
.home-total { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin: 2px 0 20px; }
.home-spotlight { padding: 0; margin: 16px 0 0; }
.home-perf { padding: 0; }
.home-perf .overview-perf-head { padding: 0 0 10px; }
.home-perf .overview-perf-canvas { width: 100%; margin: 8px 0 0; }
.home-perf .overview-perf-empty { margin: 0; }

.home-rail { background: var(--ink2); border: 1px solid var(--line); border-radius: 4px; padding: 0; align-self: start; }
.home-rail .rail-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.home-rail .rail-head .sec-label { color: var(--sub); }
.rail-count { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.04em; }
.rail-list { display: flex; flex-direction: column; }
.rail-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 60px auto; gap: 10px;
  align-items: center; padding: 11px 16px;
  border-bottom: 0.5px solid rgba(25,25,24,.06);
  cursor: pointer; transition: background 0.12s;
}
.rail-row:last-child { border-bottom: none; }
.rail-row:hover { background: rgba(25,25,24,.03); }
.rail-row-left { min-width: 0; }
.rail-tk { font-family: var(--serif); font-size: 15px; font-weight: 500; color: var(--bright); letter-spacing: -0.005em; line-height: 1.15; }
.rail-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.04em; margin-top: 2px; }
.rail-spark { display: block; height: 22px; width: 60px; }
.rail-right { text-align: right; font-family: var(--mono); }
.rail-val { font-size: 12.5px; color: var(--bright); font-weight: 500; line-height: 1.15; }
.rail-pct { font-size: 10.5px; margin-top: 2px; }
.rail-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 12px 16px 14px; padding: 10px;
  border: 0.5px dashed rgba(42,120,214,0.3); border-radius: 3px;
  color: var(--accent); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  cursor: pointer; background: transparent;
}
.rail-add:hover { background: rgba(42,120,214,0.04); }

.home-below { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; padding: 8px 32px 32px; }
.below-panel { background: var(--ink2); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; min-height: 140px; }
.below-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.below-row {
  display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; gap: 10px;
  padding: 8px 0; border-bottom: 0.5px solid rgba(25,25,24,.06);
  align-items: start; cursor: pointer;
}
.below-row:last-child { border-bottom: none; }
.below-bar { width: 3px; align-self: stretch; border-radius: 1px; min-height: 18px; }
.below-bar.bar-hi { background: var(--red); }
.below-bar.bar-md { background: #b97f0a; }
.below-bar.bar-lo { background: var(--muted); }
.below-bar.bar-pos { background: var(--green); }
.below-bar.bar-neg { background: var(--red); }
.below-bar.bar-neu { background: var(--muted); }
.below-title { font-size: 12.5px; color: var(--text); line-height: 1.4; }
.below-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.04em; margin-top: 3px; }
.below-tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }

@media (max-width: 1120px) {
  .home-below { grid-template-columns: 1fr 1fr; }
  .home-below .below-panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-rail { margin-top: 8px; }
}

@media (max-width: 780px) {
  .home-head { padding: 18px 16px 4px; }
  .home-grid { padding: 8px 16px 16px; gap: 16px; }
  .home-value { font-size: 34px; }
  .home-below { grid-template-columns: 1fr; padding: 8px 16px 18px; }
  .home-below .below-panel:last-child { grid-column: auto; }
}

/* =========================================================================
 * Position page (v0.5.1) — replaces the old portfolioView split-pane layout.
 * Reached by tapping a holding on Home. Single-column flow: header (Back +
 * eyebrow + name + big price + day change) -> chart -> 6-cell stats grid ->
 * Lots / Tax / Activity detail sections side-by-side -> Edit/Add trade
 * actions. The Portfolio tab is removed from the top nav; this view is now
 * purely a drilldown destination from Home.
 * ========================================================================= */
.position-header { padding: 22px 32px 14px; border-bottom: 1px solid var(--line); }
.position-back {
  background: transparent; border: 0; color: var(--accent); padding: 0;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  cursor: pointer; margin-bottom: 12px;
}
.position-back:hover { color: var(--bright); }
.position-eyebrow { margin: 0 0 6px; }
.position-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.position-title-block { min-width: 0; }
.position-title {
  font-family: var(--serif); font-size: 32px; font-weight: 500;
  color: var(--bright); letter-spacing: -0.01em; line-height: 1.1; margin: 0;
}
.position-name { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin: 4px 0 0; }
.position-price-block { text-align: right; }
.position-price { font-family: var(--mono); font-size: 32px; font-weight: 500; color: var(--bright); letter-spacing: -0.005em; line-height: 1; }
.position-day { font-family: var(--mono); font-size: 13px; margin-top: 6px; }
.position-day .arr { font-size: 11px; margin-right: 2px; }

.position-body { padding: 16px 32px 24px; }
.position-chart { padding: 0; }

.pos-stats-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  margin: 18px 0 16px;
  border: 1px solid var(--line); border-radius: 4px;
}
.pos-stat-cell {
  padding: 12px 14px;
  border-right: 0.5px solid rgba(25,25,24,.06);
}
.pos-stat-cell:last-child { border-right: none; }
.pos-stat-lab { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }
.pos-stat-val { font-family: var(--mono); font-size: 14px; color: var(--bright); font-weight: 500; margin-top: 4px; }

.position-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px;
  margin-top: 16px;
}

.position-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.position-actions .btn { min-width: 140px; }

@media (max-width: 1120px) {
  .pos-stats-grid { grid-template-columns: repeat(3, 1fr); }
  .pos-stat-cell:nth-child(3) { border-right: none; }
  .pos-stat-cell:nth-child(-n+3) { border-bottom: 0.5px solid rgba(25,25,24,.06); }
  .position-detail-grid { grid-template-columns: 1fr 1fr; }
  .position-detail-grid .detail-section:last-child { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
  .position-header { padding: 18px 16px 14px; }
  .position-title-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .position-title { font-size: 26px; }
  .position-price-block { text-align: left; }
  .position-price { font-size: 28px; }
  .position-body { padding: 12px 16px 18px; }
  .pos-stats-grid { grid-template-columns: 1fr 1fr; }
  .pos-stat-cell:nth-child(2n) { border-right: none; }
  .pos-stat-cell { border-bottom: 0.5px solid rgba(25,25,24,.06); }
  .pos-stat-cell:nth-last-child(-n+2) { border-bottom: none; }
  .position-detail-grid { grid-template-columns: 1fr; }
  .position-detail-grid .detail-section:last-child { grid-column: auto; }
  .position-actions { flex-direction: column; }
  .position-actions .btn { width: 100%; }
}

/* =========================================================================
 * More tab (v0.5.2) — consolidates History, Profile, Invitations, push
 * notifications, export, app info, and sign-out into a single secondary
 * destination so the four primary tabs (Home/Tasks/News/Alerts) stay focused.
 * Each row routes to an existing view or fires an existing handler.
 * ========================================================================= */
.more-head { padding: 26px 32px 14px; border-bottom: 1px solid var(--line); }
.more-head .hero-eyebrow { margin: 0 0 6px; }
.more-head .section-title { margin: 4px 0 6px; }
.more-head .section-sub { margin: 0; max-width: 560px; }

.more-list { padding: 18px 32px 36px; max-width: 720px; }

.more-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 14px 4px;
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid var(--line);
  cursor: pointer;
  font: inherit; color: inherit;
  text-align: left;
  transition: background 0.12s;
}
.more-item:hover { background: rgba(25,25,24,.025); }
.more-item:last-child { border-bottom: none; }
.mi-left { display: flex; align-items: center; gap: 14px; }
.mi-icon {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--ink3); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sub);
  flex-shrink: 0;
}
.mi-icon-danger { color: var(--red); }
.mi-text { display: flex; flex-direction: column; }
.mi-name { font-family: var(--serif); font-size: 15px; color: var(--bright); line-height: 1.25; letter-spacing: -0.005em; }
.mi-name-danger { color: var(--red); }
.mi-sub { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; margin-top: 2px; }
.mi-right { color: var(--dim); flex-shrink: 0; }

@media (max-width: 780px) {
  .more-head { padding: 18px 16px 12px; }
  .more-list { padding: 14px 16px 24px; }
}

/* =========================================================================
 * Bottom-tab nav (v0.5.3) — primary mobile navigation.
 * Visible only at <=780px. The top topbar-center drawer is hidden on mobile
 * (replaced by these thumb-reachable tabs). Home/Tasks/News/Alerts/More.
 * ========================================================================= */
.bottom-tabs {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 62px;
  padding: 6px 4px max(6px, env(safe-area-inset-bottom)) 4px;
  background: var(--ink);
  border-top: 1px solid var(--line2);
  z-index: 30;
}
.bt-tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: transparent; border: 0;
  color: var(--dim);
  cursor: pointer;
  padding: 4px 0;
  transition: color .12s;
}
.bt-tab svg { display: block; }
.bt-tab span {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .08em; text-transform: uppercase;
}
.bt-tab.active { color: var(--accent); }
.bt-tab:hover { color: var(--sub); }

@media (max-width: 780px) {
  .bottom-tabs { display: flex; }
  /* Hide the old slide-down drawer + hamburger on mobile — bottom tabs replace them. */
  .mobile-menu-btn { display: none !important; }
  .topbar-center { display: none !important; }
  /* Leave room at the bottom so content does not hide behind the tab bar. */
  main.scroll { padding-bottom: calc(62px + max(0px, env(safe-area-inset-bottom))); }
}

/* =========================================================================
 * Daylight Bento re-skin (v0.6.0) — Concept 2 design system.
 * Layered on top of the original rules: light surfaces, Manrope/DM Mono,
 * rounded cards with soft shadows, pill controls, blue accent.
 * ========================================================================= */

body { font-weight: 500; }
strong, b { font-weight: 700; }

/* Topbar — floating pill nav */
.shell { grid-template-rows: auto 1fr; }
.topbar { height: auto; padding: 10px 28px; background: color-mix(in srgb, var(--ink) 88%, transparent); backdrop-filter: blur(12px); }
.wordmark { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.wordmark-dot { box-shadow: none; }
.topbar-center { align-items: center; align-self: center; gap: 2px; background: var(--ink4); border-radius: 999px; padding: 4px; }
.t-tab { font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: 0; text-transform: none; height: auto; padding: 7px 16px; border-radius: 999px; }
.t-tab.active { background: var(--ink2); color: var(--bright); box-shadow: 0 1px 2px rgba(25,25,24,.06), 0 4px 12px -6px rgba(25,25,24,.14); }
.user-chip { border-radius: 999px; }

/* Typography — Manrope displays */
.hero-date, .section-title, .metric-value, .summary-value, .asset-title, .auth-panel h1,
.modal-title, .detail-card h2, .report h1, .position-title { font-weight: 800; letter-spacing: -0.02em; }
.home-value { font-family: var(--sans); font-weight: 800; letter-spacing: -0.025em; font-size: 46px; }
.rail-tk, .mi-name { font-family: var(--sans); font-weight: 800; }
.cell-title { color: var(--sub); }
.hero-eyebrow { letter-spacing: .16em; }

/* Buttons & inputs */
.btn { font-family: var(--sans); font-size: 13px; font-weight: 800; letter-spacing: 0; text-transform: none; border-radius: 999px; padding: 9px 17px; }
.btn-primary { color: #fff; background: var(--bright); border-color: var(--bright); }
.btn-primary:hover { background: #000; border-color: #000; }
.btn-ghost { background: var(--ink2); box-shadow: var(--shadow-card); }
.icon-btn { border-radius: 10px; }
input, textarea, select { border-radius: 12px; background: #fdfdfb; }
.check { border-radius: 6px; }
.check.done::after { border-left-color: #fff; border-bottom-color: #fff; }

/* Pills for range/filter tabs */
.range-tabs { background: var(--ink3); border-radius: 999px; padding: 3px; gap: 0; }
.range-tab { border-radius: 999px; padding: 5px 11px; }
.range-tab.active { background: var(--bright); color: #fff; }
.filter-tab { border-radius: 999px; }
.list-toolbar { padding: 8px 18px; gap: 6px; }
.list-toolbar .filter-tab { height: 34px; padding: 0 15px; border-radius: 999px; border-bottom: 0; }
.list-toolbar .filter-tab.active { background: var(--bright); color: #fff; border-bottom: 0; }
.filter-tab.active { color: #fff; background: var(--bright); }

/* Chips, tags, badges */
.tag, .sec-badge, .news-source, .rail-count { border-radius: 999px; }
.mi-icon, .health-card { border-radius: 12px; }

/* Card-ification of grid cells */
.overview-grid, .hero-summary, .detail-grid, .report-grid, .kmetrics { gap: 14px; background: transparent; border: 0; }
.overview-grid { padding: 18px 28px 8px; }
.hero-summary { padding: 16px 28px 4px; border-bottom: 0; }
.cell, .detail-section, .metric, .km {
  background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card);
}
.metric { padding: 18px 20px; }
.detail-section { padding: 20px 22px; }
.pos-stats-grid { border-radius: 16px; background: var(--ink2); box-shadow: var(--shadow-card); overflow: hidden; }
.home-rail, .below-panel { border-radius: 18px; box-shadow: var(--shadow-card); background: var(--ink2); }
.rail-add { border-radius: 12px; }
.chart-canvas { border-radius: 16px; background: var(--ink2); }
.chart-canvas .tv-lightweight-charts { border-radius: 16px; }
.chart-empty-msg { border-radius: 14px; }
.modal { border-radius: 20px; }
.modal-overlay { backdrop-filter: blur(3px); }
.modal-note { border-radius: 12px; }
.auth-panel { border-radius: 22px; box-shadow: 0 24px 70px -20px rgba(25,25,24,.25); }
.auth-overlay { backdrop-filter: blur(4px); }
.summary-card { border-bottom-color: var(--line); }
.panel { background: transparent; }
.bottom-tabs { background: color-mix(in srgb, var(--ink2) 92%, transparent); backdrop-filter: blur(12px); }
.bt-tab.active { color: var(--accent); }
.heatmap-tile { border-radius: 6px; }
.section-hero, .news-hero { border-radius: 16px; }

/* Overview perf chart — live pulsing dot (Concept 3 carry-over) */
.overview-perf-canvas { position: relative; }
.live-dot { position: absolute; width: 0; height: 0; z-index: 3; pointer-events: none; }
.live-dot-core { position: absolute; left: -4.5px; top: -4.5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--ink2); box-sizing: content-box; }
.live-dot-pulse { position: absolute; left: -4.5px; top: -4.5px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--accent); animation: livePulse 1.8s ease-out infinite; }
@keyframes livePulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot-pulse { animation: none; opacity: 0; } }

/* ===== v0.6.1 feature layer: insight card, streak, alert meters, history insights, dividends ===== */

/* Home insight card (allocation drift) */
.home-insight { padding: 0; margin: 14px 0 0; }
.insight-card { background: linear-gradient(150deg, #fdf6e8, #fbefdc); border: 1px solid #f0dfc0; border-radius: 16px; padding: 16px 18px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.insight-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); }
.insight-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #9a7a33; }
.insight-msg { font-size: 13.5px; font-weight: 600; color: var(--bright); line-height: 1.55; margin-top: 8px; }
.insight-msg b { color: #8a5b00; }
.insight-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.insight-foot .grow { flex: 1; }

/* Snapshot streak chip */
.streak-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; color: var(--accent); background: rgba(42,120,214,.08); border-radius: 999px; padding: 2px 9px; letter-spacing: .04em; }

/* Alert distance-to-trigger meter */
.alert-meter { display: flex; align-items: center; gap: 12px; margin-top: 9px; max-width: 480px; }
.alert-meter-track { flex: 1; height: 7px; border-radius: 999px; background: var(--ink3); overflow: hidden; }
.alert-meter-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9ec5f4, var(--accent)); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.alert-meter.hot .alert-meter-fill { background: linear-gradient(90deg, #f3cf8e, #b97f0a); }
.alert-meter.past .alert-meter-fill { background: var(--red); }
.alert-meter-note { font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.alert-meter.hot .alert-meter-note b { color: #b97f0a; }

/* Holdings rail: est. dividend income */
.rail-income { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); font-weight: 600; }
.rail-income b { font-family: var(--mono); font-weight: 500; color: var(--green); font-size: 12px; }

/* History insights strip: heatmap + monthly recap */
.history-insights { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; padding: 4px 32px 16px; }
.insight-panel { background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); padding: 16px 18px; }
.heatmap-hint { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.pl-heatmap { display: grid; grid-template-columns: repeat(18, 1fr); gap: 4px; margin-top: 10px; }
.pl-cell { aspect-ratio: 1; border-radius: 5px; cursor: pointer; transition: transform .12s; min-width: 0; }
.pl-cell:hover { transform: scale(1.2); outline: 2px solid var(--bright); z-index: 2; }
.pl-heatmap-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.pl-heatmap-months { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.pl-heatmap-legend { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.pl-heatmap-legend i { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.recap-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--bright); margin: 6px 0 4px; }
.recap-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--sub); font-weight: 600; }
.recap-row:first-of-type { border-top: 0; }
.recap-row b { font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--bright); }
.recap-row b.up { color: var(--green); } .recap-row b.dn { color: var(--red); }

@media (max-width: 1120px) { .history-insights { grid-template-columns: 1fr; padding: 4px 20px 14px; } .pl-heatmap { grid-template-columns: repeat(14, 1fr); } }
@media (max-width: 780px) { .history-insights { padding: 4px 16px 12px; } .pl-heatmap { grid-template-columns: repeat(10, 1fr); } .alert-meter-note { white-space: normal; } }

/* Fix: .alert-row's legacy 3-col grid vs .item-bar-row markup (bar is absolute,
   so content was landing in the 56px column). */
.alert-row.item-bar-row { grid-template-columns: minmax(0, 1fr) auto; }

/* =========================================================================
 * v0.7.0 BENTO ARCHITECTURE — mockup-exact presentation layer.
 * DOM emitted by bento.js into the rebuilt index.html. Legacy component
 * styles above remain for modals, auth, forms, banners, bottom tabs.
 * ========================================================================= */

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 36px; }
@media (max-width: 780px) { .wrap { padding: 0 16px; } }

/* Topbar as mockup header */
.topbar.bento-top { border-bottom: 0; background: var(--ink); backdrop-filter: none; padding: 22px 0 18px; }
.topbar.bento-top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; }
.brand { display: flex; align-items: center; gap: 11px; background: none; border: 0; cursor: pointer; text-align: left; }
.brand .mark { width: 34px; height: 34px; border-radius: 11px; background: var(--bright); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; font-family: var(--sans); }
.brand .bt { font-weight: 800; font-size: 16px; letter-spacing: -.01em; color: var(--bright); line-height: 1.2; }
.brand .bt small { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.seg { display: flex; background: #ecebe5; border-radius: 99px; padding: 4px; }
.seg .t-tab { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--sub); padding: 8px 18px; border-radius: 99px; height: auto; letter-spacing: 0; text-transform: none; transition: all .2s; }
.seg .t-tab.active { background: var(--ink2); color: var(--bright); box-shadow: var(--shadow-card); }
.hdr-right { display: flex; align-items: center; gap: 12px; }
.search-pill { display: flex; align-items: center; gap: 8px; background: var(--ink2); border: 1px solid var(--line); border-radius: 99px; padding: 9px 16px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow-card); cursor: default; white-space: nowrap; }
.kbd { font-family: var(--mono); font-size: 10.5px; background: var(--ink3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--sub); }
.user-chip { display: flex; align-items: center; gap: 0; background: none; border: 0; cursor: pointer; padding: 0; }
.user-chip-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #2a78d6, #7db1ea); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; font-family: var(--sans); }
.user-chip-name { display: none; }

/* Page scaffolding */
.greet { padding: 6px 0 22px; }
.greet h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); }
.greet p { font-size: 13.5px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.greet p b { font-weight: 800; }
.page-h { padding: 4px 0 20px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.page-h h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); }
.page-h p { font-size: 13.5px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.btn.pri { border: 0; font-family: var(--sans); font-weight: 800; font-size: 13px; border-radius: 99px; padding: 10px 18px; cursor: pointer; background: var(--bright); color: #fff; }
.btn.pri:hover { background: #000; }
.btn.gh { border: 1px solid var(--line); font-family: var(--sans); font-weight: 800; font-size: 13px; border-radius: 99px; padding: 10px 18px; cursor: pointer; background: var(--ink2); color: var(--bright); box-shadow: var(--shadow-card); }

/* Bento grid + tiles */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; padding-bottom: 56px; }
.tile { background: var(--ink2); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-card); padding: 22px; position: relative; transition: transform .2s, box-shadow .2s; min-width: 0; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(25,25,24,.05), 0 16px 36px -14px rgba(25,25,24,.14); }
.t-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 10px; }
.t-label { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; font-family: var(--sans); }
.t-more { font-size: 12.5px; font-weight: 700; color: var(--accent); text-decoration: none; background: none; border: 0; cursor: pointer; font-family: var(--sans); white-space: nowrap; }
.badge2 { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; padding: 4px 11px; border-radius: 99px; }
.badge2.up { color: var(--green); background: #e5f3ea; }
.badge2.dn { color: var(--red); background: #fdeeee; }
.ranges { display: flex; background: var(--ink3); border-radius: 99px; padding: 3px; width: max-content; }
.ranges button, .ranges .range-tab { border: 0; background: none; font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 5px 11px; border-radius: 99px; cursor: pointer; letter-spacing: 0; }
.ranges button.active, .ranges .range-tab.active { background: var(--bright); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 99px; padding: 5px 12px; cursor: pointer; }
.chip.on, .chip.active { background: #eaf1fb; border-color: #c4d9f3; color: var(--accent); }
.tip2 { position: absolute; pointer-events: none; background: var(--bright); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 12px; opacity: 0; transition: opacity .15s; z-index: 4; white-space: nowrap; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.tip2 .d { font-family: var(--mono); font-size: 10px; opacity: .65; letter-spacing: .08em; }
.tip2 .v { font-weight: 800; font-size: 14px; margin-top: 2px; }

/* HOME tiles */
.worth { grid-column: span 8; }
.worth .val, .perf .val { font-size: 44px; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; color: var(--bright); }
.worth .val small { font-size: 22px; color: var(--muted); font-weight: 700; }
.worth .sub, .perf .sub { display: flex; gap: 10px; align-items: center; margin-top: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.vs { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.worth .ranges { position: absolute; top: 22px; right: 22px; }
.worth .chart-wrap { position: relative; margin: 4px 0 0; }
.worth .overview-perf-empty { border: 1px dashed var(--line2); border-radius: 14px; padding: 34px 16px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.bench-row { display: flex; gap: 6px; margin-top: 10px; }

.alloc { grid-column: span 4; display: flex; flex-direction: column; }
.donut-box { display: flex; align-items: center; gap: 18px; flex: 1; margin-top: 6px; }
.donut-hold { position: relative; width: 150px; height: 150px; flex: none; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-center .n { font-size: 19px; font-weight: 800; color: var(--bright); }
.donut-center .l { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dlegend { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dl-row { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.dl-row .sw { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.dl-row .nm { color: var(--bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-row .pc { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--sub); min-width: 46px; text-align: right; }
.dl-row .dv { font-family: var(--mono); font-size: 12px; color: var(--bright); min-width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.dl-row[data-select-asset] { cursor: pointer; }
.dlegend { gap: 0; }
.dlegend .dl-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.dlegend .dl-row:last-child { border-bottom: 0; }
.alloc-mode { font: inherit; font-size: 12px; font-weight: 700; color: var(--bright); background: var(--ink2); border: 1px solid var(--line); border-radius: 99px; padding: 5px 26px 5px 12px; height: auto; width: auto; cursor: pointer; }
.alloc-rebal { align-self: flex-start; margin-top: 10px; padding: 0; }

.movers { grid-column: span 4; }
.mv-row { display: grid; grid-template-columns: 52px 1fr 64px; align-items: center; gap: 10px; margin-top: 13px; }
.mv-t { font-size: 13px; font-weight: 800; color: var(--bright); }
.mv-bar { height: 16px; border-radius: 5px; position: relative; background: var(--ink3); overflow: hidden; }
.mv-fill { position: absolute; top: 0; bottom: 0; border-radius: 0 5px 5px 0; }
.mv-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line2); }
.mv-v { font-family: var(--mono); font-size: 12px; text-align: right; }
.mv-v.up { color: var(--green); } .mv-v.down { color: var(--red); }

.taskt { grid-column: span 4; }
.ring-row { display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; }
.ring-txt .n { font-size: 17px; font-weight: 800; color: var(--bright); }
.ring-txt .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.tkh { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); }
.tkh:first-of-type { border-top: 0; }
.tkh .cb { width: 17px; height: 17px; border-radius: 6px; border: 1.5px solid var(--line2); cursor: pointer; flex: none; display: grid; place-items: center; color: transparent; font-size: 10px; transition: all .2s; background: none; padding: 0; }
.tkh.done .cb { background: var(--green); border-color: var(--green); color: #fff; }
.tkh .tx { font-size: 13px; font-weight: 600; flex: 1; color: var(--bright); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tkh.done .tx { color: var(--muted); text-decoration: line-through; }
.tkh .due { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.tkh .due.hot { color: var(--red); }

.fgt { grid-column: span 4; }
.al { display: flex; gap: 11px; align-items: flex-start; padding: 11px 2px; border-top: 1px solid var(--line); }
.al:first-of-type { border-top: 0; }
.al .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; flex: none; }
.al .ic.trig { background: #fdeeee; color: var(--red); }
.al .ic.arm { background: #fdf3e2; color: #b97f0a; }
.al .tx { font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--bright); }
.al .tx b { font-weight: 800; }
.al .tm { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.newst { grid-column: span 8; }
.news-cards { display: flex; gap: 14px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; scrollbar-width: none; }
.news-card2 { flex: 0 0 240px; border: 1px solid var(--line); border-radius: 16px; padding: 15px; text-decoration: none; transition: border-color .2s, background .2s; background: #fdfdfb; cursor: pointer; }
.news-card2:hover { border-color: var(--line2); background: #faf9f5; }
.news-card2 .src { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; gap: 8px; }
.news-card2 .src .tk2 { color: var(--accent); font-weight: 500; }
.news-card2 .hl { font-size: 13px; font-weight: 700; color: var(--bright); line-height: 1.45; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-card2 .ago { font-size: 11px; color: var(--muted); margin-top: 9px; font-weight: 600; }

.streak { grid-column: span 4; background: linear-gradient(150deg, #1c2f4e 0%, #132038 55%, #0f1a2e 100%); border: 0; color: #fff; }
.streak .t-label { color: #9db4d8; }
.streak .n { font-size: 38px; font-weight: 800; margin-top: 10px; }
.streak .l { font-size: 13px; color: #b9c9e4; font-weight: 600; margin-top: 2px; }
.dots { display: flex; gap: 6px; margin-top: 16px; }
.dot7 { width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,.10); display: grid; place-items: center; font-size: 10px; color: #8ea6cc; font-weight: 700; }
.dot7.on { background: #3987e5; color: #fff; }

/* PORTFOLIO page */
.perf { grid-column: span 8; }
.perf .val { font-size: 36px; margin-top: 6px; }
.perf-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.perf-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.chart-legend2 { display: flex; gap: 16px; font-size: 12px; color: var(--sub); font-weight: 600; margin-top: 2px; }
.chart-legend2 i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.alloc2 { grid-column: span 4; }
.tophold { grid-column: span 4; display: flex; flex-direction: column; }
.d-row2 { margin-top: 12px; }
.d-top2 { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--bright); }
.d-top2 .pc { font-family: var(--mono); color: var(--sub); font-weight: 500; }
.d-bar2 { height: 8px; border-radius: 99px; background: var(--ink3); margin-top: 6px; position: relative; }
.d-fill2 { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; }
.d-tgt2 { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--bright); border-radius: 2px; }
.d-note2 { font-size: 11px; color: var(--muted); margin-top: 5px; font-weight: 600; }
.d-note2 b.over { color: #b97f0a; } .d-note2 b.ok { color: var(--green); }
.holdings { grid-column: span 12; padding: 10px 6px 6px; }
.holdings .t-head { padding: 8px 14px 2px; }
.tile table { width: 100%; border-collapse: collapse; }
.tile th { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--line); font-family: var(--sans); }
.tile th:first-child { text-align: left; }
.tile td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-size: 13px; color: var(--bright); }
.tile tr:last-child td { border-bottom: 0; }
.tile tbody tr { cursor: pointer; transition: background .15s; }
.tile tbody tr:hover { background: #faf9f5; }
.tile td.asset { text-align: left; font-family: var(--sans); }
.a-cell { display: flex; align-items: center; gap: 11px; }
.a-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 10px; color: #fff; flex: none; font-family: var(--sans); }
.a-nm .t { font-size: 13.5px; font-weight: 800; color: var(--bright); }
.a-nm .s { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tile td .up { color: var(--green); } .tile td .down { color: var(--red); }
.w-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.w-bar { width: 64px; height: 6px; border-radius: 99px; background: var(--ink3); position: relative; overflow: visible; }
.w-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: var(--accent); }
.w-t { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--bright); }
.income { grid-column: span 4; }
.income .total { font-size: 26px; font-weight: 800; margin: 6px 0 10px; color: var(--bright); }
.income .total small { font-size: 13px; color: var(--muted); font-weight: 700; }
.div-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.div-row:first-of-type { border-top: 0; }
.div-ic { width: 30px; height: 30px; border-radius: 9px; background: #e5f3ea; color: var(--green); display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.div-t { font-size: 13px; font-weight: 700; flex: 1; color: var(--bright); }
.div-t small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.div-v { font-family: var(--mono); font-size: 12.5px; color: var(--green); }
.insight2 { grid-column: span 4; background: linear-gradient(150deg, #fdf6e8, #fbefdc); border-color: #f0dfc0; }
.insight2 .t-label { color: #9a7a33; }
.insight2 .msg { font-size: 14px; font-weight: 700; line-height: 1.5; margin-top: 10px; color: var(--bright); }
.insight2 .msg b { color: #8a5b00; }
.insight2 .fix { margin-top: 14px; display: flex; gap: 8px; }
.insight2 .fix .btn.pri, .insight2 .fix .btn.gh { font-size: 12px; padding: 8px 15px; }
.rebal { grid-column: span 4; }
.rb-row { display: grid; grid-template-columns: 46px 1fr 90px; gap: 10px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--line); }
.rb-row:first-of-type { border-top: 0; }
.rb-t { font-weight: 800; font-size: 13px; color: var(--bright); }
.rb-a { font-size: 12px; font-weight: 700; }
.rb-a.buy { color: var(--green); } .rb-a.sell { color: var(--red); }
.rb-v { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--sub); }
.rebal-note { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 12px; }
.rebal-note b { color: var(--bright); }

/* POSITION page */
.back { font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 14px; background: none; border: 0; cursor: pointer; font-family: var(--sans); }
.back:hover { color: var(--bright); }
.pos-h { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-bottom: 20px; }
.ph-l { display: flex; gap: 16px; align-items: center; }
.ph-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; box-shadow: var(--shadow-card); font-family: var(--sans); }
.ph-t h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); }
.ph-t p { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--green); background: #e5f3ea; border-radius: 99px; padding: 3px 10px; letter-spacing: .08em; vertical-align: middle; }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: liveblink 1.6s infinite; }
@keyframes liveblink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.ph-r { text-align: right; }
.ph-r .p { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); }
.ph-r .d { font-size: 13.5px; font-weight: 800; margin-top: 2px; }
.ph-r .d.up { color: var(--green); } .ph-r .d.dn { color: var(--red); }
.ph-r .pv-line { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.ph-r .pv-line b { font-weight: 800; color: var(--bright); }
.ph-r .pv-line .up { color: var(--green); } .ph-r .pv-line .dn { color: var(--red); }
.chart-tile { grid-column: span 12; padding-bottom: 12px; }
.chart-tile .chart-canvas { width: 100%; margin: 10px 0 0; height: 300px; border: 0; background: transparent; }
.chart-tile .chart-empty-msg { margin: 10px 0 0; }
.chart-tile .t-head { flex-wrap: wrap; gap: 10px; }
.ct-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats2 { grid-column: span 12; display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.stat2 { background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); padding: 16px 18px; min-width: 0; }
.stat2 .l { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat2 .v { font-size: 21px; font-weight: 800; margin-top: 6px; color: var(--bright); }
.stat2 .s { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.stat2 .v.up { color: var(--green); } .stat2 .v.dn { color: var(--red); }
.lots { grid-column: span 12; }
.lots td:first-child { text-align: left; font-family: var(--sans); font-weight: 700; font-size: 12.5px; }
.lots th, .lots td { padding: 10px 10px; font-size: 12.5px; }
.lt { font-family: var(--mono); font-size: 9.5px; padding: 2px 8px; border-radius: 99px; letter-spacing: .05em; }
.lt.long { background: #e5f3ea; color: var(--green); } .lt.short { background: #fdf3e2; color: #b97f0a; }
.act { grid-column: span 3; }
.ac-row { display: flex; gap: 11px; align-items: flex-start; padding: 10px 2px; border-top: 1px solid var(--line); }
.ac-row:first-of-type { border-top: 0; }
.ac-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.ac-ic.buy { background: #e5f3ea; color: var(--green); } .ac-ic.sell { background: #fdeeee; color: var(--red); }
.ac-ic.alrt { background: #fdf3e2; color: #b97f0a; } .ac-ic.div2 { background: #eaf1fb; color: var(--accent); }
.ac-t { font-size: 12.5px; font-weight: 700; line-height: 1.4; color: var(--bright); }
.ac-m { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.taxt { grid-column: span 12; }
.taxt .est { font-size: 24px; font-weight: 800; margin: 8px 0 2px; color: var(--bright); }
.taxt .es { font-size: 12px; color: var(--muted); font-weight: 600; }
.meter2 { height: 10px; border-radius: 99px; background: var(--ink3); margin-top: 14px; position: relative; overflow: hidden; }
.meter2 .m1 { position: absolute; top: 0; bottom: 0; left: 0; background: var(--green); }
.meter2 .m2 { position: absolute; top: 0; bottom: 0; background: #b97f0a; }
.mlegend { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; font-weight: 700; color: var(--sub); flex-wrap: wrap; }
.mlegend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.tax-tip { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 12px; }
.tax-tip b { color: var(--bright); } .tax-tip b.gain { color: var(--green); }
.newsline { grid-column: span 4; }
.nl-row { display: flex; gap: 14px; overflow-x: auto; margin-top: 10px; scrollbar-width: none; }
.nl-card { flex: 0 0 250px; border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: #fdfdfb; text-decoration: none; cursor: pointer; }
.nl-card .s2 { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.nl-card .h { font-size: 12.5px; font-weight: 700; color: var(--bright); line-height: 1.45; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nl-card .a { font-size: 10.5px; color: var(--muted); margin-top: 7px; font-weight: 600; }
.pos-actions2 { grid-column: span 12; display: flex; justify-content: flex-end; gap: 10px; }

/* TASKS page */
.qadd { display: flex; align-items: center; gap: 12px; background: var(--ink2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-card); padding: 6px 8px 6px 18px; margin-bottom: 20px; }
.qadd .plus { color: var(--accent); font-size: 19px; font-weight: 800; }
.qadd input { flex: 1; border: 0; outline: 0; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--bright); background: none; padding: 10px 0; width: auto; }
.qadd input::placeholder { color: var(--muted); font-weight: 500; }
.qadd .hint { font-family: var(--mono); font-size: 10.5px; color: var(--muted); background: var(--ink3); border-radius: 8px; padding: 5px 10px; white-space: nowrap; }
.qadd .btn.pri { border-radius: 12px; }
.tcol { grid-column: span 4; display: flex; flex-direction: column; gap: 10px; min-height: 340px; align-content: start; }
.cnt { font-family: var(--mono); font-size: 11px; background: var(--ink3); color: var(--sub); border-radius: 99px; padding: 2px 9px; }
.tk2 { border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; background: #fdfdfb; cursor: pointer; transition: all .15s; }
.tk2:hover { border-color: var(--line2); transform: translateY(-1px); box-shadow: var(--shadow-card); }
.tk2-top { display: flex; align-items: flex-start; gap: 10px; }
.tk2 .cb { width: 17px; height: 17px; border-radius: 6px; border: 1.5px solid var(--line2); cursor: pointer; flex: none; margin-top: 1px; display: grid; place-items: center; color: transparent; font-size: 10px; transition: all .2s; background: none; padding: 0; }
.tk2.done .cb { background: var(--green); border-color: var(--green); color: #fff; }
.tk2 .tx { font-size: 13.5px; font-weight: 700; line-height: 1.45; flex: 1; color: var(--bright); }
.tk2.done .tx { color: var(--muted); text-decoration: line-through; }
.tk2-meta { display: flex; gap: 8px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
.pri2 { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; padding: 2.5px 8px; border-radius: 99px; text-transform: uppercase; font-weight: 500; }
.pri2.high { color: var(--red); background: #fdeeee; }
.pri2.med { color: #b97f0a; background: #fdf3e2; }
.pri2.low { color: var(--sub); background: var(--ink3); }
.tk-tick { font-family: var(--mono); font-size: 10px; color: var(--accent); background: #eaf1fb; border-radius: 99px; padding: 2.5px 8px; }
.due2 { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-left: auto; }
.due2.hot { color: var(--red); }
.tside { grid-column: span 12; display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.focus { grid-column: span 4; background: linear-gradient(150deg, #1c2f4e, #132038); border: 0; color: #fff; }
.focus .t-label { color: #9db4d8; }
.focus .big { font-size: 17px; font-weight: 800; line-height: 1.5; margin-top: 10px; }
.focus .why { font-size: 12.5px; color: #b9c9e4; font-weight: 600; margin-top: 8px; line-height: 1.5; }
.focus .go { margin-top: 16px; display: inline-block; background: #3987e5; color: #fff; font-weight: 800; font-size: 12.5px; border-radius: 99px; padding: 9px 16px; border: 0; cursor: pointer; font-family: var(--sans); }
.ttrend { grid-column: span 4; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 110px; margin-top: 16px; padding: 0 4px; }
.bgrp { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bgrp .bar2 { width: 100%; max-width: 24px; border-radius: 5px 5px 0 0; background: var(--teal); min-height: 2px; }
.bgrp .bar2.today { background: var(--accent); }
.bgrp .d { font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.bgrp .n { font-family: var(--mono); font-size: 10px; color: var(--sub); }
.tlink { grid-column: span 4; }
.lk-row { display: flex; gap: 11px; align-items: flex-start; padding: 11px 2px; border-top: 1px solid var(--line); }
.lk-row:first-of-type { border-top: 0; }
.lk-ic { width: 28px; height: 28px; border-radius: 9px; background: #eaf1fb; color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.lk-t { font-size: 12.5px; font-weight: 700; line-height: 1.45; color: var(--bright); }
.lk-m { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* NEWS page */
.filters2 { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.fc { font-family: var(--sans); font-weight: 700; font-size: 12.5px; color: var(--sub); background: var(--ink2); border: 1px solid var(--line); border-radius: 99px; padding: 8px 16px; cursor: pointer; box-shadow: var(--shadow-card); transition: all .2s; }
.fc.on, .fc.active { background: var(--bright); color: #fff; border-color: var(--bright); }
.fc .n { font-family: var(--mono); font-size: 10px; opacity: .6; margin-left: 5px; }
.tick2 { font-family: var(--mono); font-size: 10.5px; color: var(--accent); background: #eaf1fb; border-radius: 99px; padding: 3px 10px; }
.sent2 { font-family: var(--mono); font-size: 10px; border-radius: 99px; padding: 3px 10px; letter-spacing: .05em; text-transform: uppercase; }
.sent2.pos, .sent2.bullish, .sent2.somewhat-bullish { color: var(--green); background: #e5f3ea; }
.sent2.neg, .sent2.bearish, .sent2.somewhat-bearish { color: var(--red); background: #fdeeee; }
.sent2.neu, .sent2.neutral { color: var(--sub); background: var(--ink3); }
.ago2 { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-left: auto; }
.cover { grid-column: span 4; }
.cv-row { display: grid; grid-template-columns: 52px 1fr 30px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.cv-row:first-of-type { border-top: 0; }
.cv-t { font-weight: 800; font-size: 13px; color: var(--bright); }
.cv-bar { height: 8px; border-radius: 99px; background: var(--ink3); overflow: hidden; }
.cv-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.cv-n { font-family: var(--mono); font-size: 11px; color: var(--sub); text-align: right; }
.digest { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.digest .d-t { font-size: 13px; font-weight: 800; color: var(--bright); }
.digest p { font-size: 12px; color: var(--sub); font-weight: 600; line-height: 1.55; margin-top: 6px; }
.digest .go { color: var(--accent); font-weight: 800; font-size: 12.5px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; font-family: var(--sans); }
.feed { grid-column: span 8; padding: 8px 6px; }
.feed .t-head { padding: 8px 16px 2px; }
.n-row2 { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 15px 16px; border-radius: 14px; cursor: pointer; transition: background .15s; border-bottom: 1px solid var(--line); }
.n-row2:last-child { border-bottom: 0; }
.n-row2:hover { background: #faf9f5; }
.n-src { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.n-h { font-size: 14.5px; font-weight: 700; line-height: 1.45; margin-top: 6px; color: var(--bright); }
.n-row2.read .n-h { color: var(--muted); font-weight: 600; }
.n-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; justify-content: space-between; }
.save2 { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: none; cursor: pointer; color: var(--muted); font-size: 13px; transition: all .2s; }
.save2.on { background: #fdf3e2; border-color: #f0dfc0; color: #b97f0a; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.ntrend { grid-column: span 4; }
.tr-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--line); }
.tr-row:first-of-type { border-top: 0; }
.tr-rank { font-family: var(--mono); font-size: 11px; color: var(--muted); width: 16px; }
.tr-t { font-weight: 800; font-size: 13px; flex: 1; color: var(--bright); }
.tr-t small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.tr-n { font-family: var(--mono); font-size: 11px; color: var(--sub); }
.tr-s { font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.tr-s.pos { color: var(--green); background: #e5f3ea; } .tr-s.neg { color: var(--red); background: #fdeeee; } .tr-s.neu { color: var(--sub); background: var(--ink3); }

/* ALERTS page */
.alist { grid-column: span 8; display: flex; flex-direction: column; gap: 14px; }
.al-card { background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); padding: 18px 20px; }
.al-card.trig { border-color: #f3c8c8; background: linear-gradient(150deg, #fff, #fdf6f6); }
.al-card.pausedc { opacity: .7; }
.al-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.al-ic2 { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 15px; flex: none; }
.al-ic2.trig { background: #fdeeee; color: var(--red); }
.al-ic2.arm { background: #fdf3e2; color: #b97f0a; }
.al-ic2.paused { background: var(--ink3); color: var(--muted); }
.al-t2 { font-size: 14.5px; font-weight: 800; flex: 1; color: var(--bright); min-width: 200px; }
.al-t2 small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.status2 { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; padding: 4px 11px; border-radius: 99px; text-transform: uppercase; }
.status2.trig { color: var(--red); background: #fdeeee; }
.status2.arm { color: #b97f0a; background: #fdf3e2; }
.status2.paused { color: var(--muted); background: var(--ink3); }
.switch { width: 38px; height: 22px; border-radius: 99px; background: #e0ded6; position: relative; cursor: pointer; transition: background .2s; flex: none; border: 0; padding: 0; }
.switch:after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.switch.on { background: var(--green); }
.switch.on:after { left: 19px; }
.dist { margin-top: 14px; }
.d-lab { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.d-track { height: 8px; border-radius: 99px; background: var(--ink3); margin-top: 6px; position: relative; }
.d-fillx { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: linear-gradient(90deg, #9ec5f4, #2a78d6); }
.d-now { position: absolute; top: -4px; width: 2.5px; height: 16px; background: var(--bright); border-radius: 2px; }
.d-notex { font-size: 11.5px; font-weight: 700; color: var(--sub); margin-top: 8px; }
.d-notex b { color: var(--bright); }
.al-foot { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; font-weight: 700; flex-wrap: wrap; }
.al-foot button, .al-foot a { color: var(--accent); text-decoration: none; background: none; border: 0; cursor: pointer; font-weight: 700; font-size: 12px; padding: 0; font-family: var(--sans); }
.al-foot .mutedlink { color: var(--muted); }
.arail { grid-column: span 4; display: flex; flex-direction: column; gap: 18px; }
.qform label { display: block; font-size: 11.5px; font-weight: 800; color: var(--sub); text-transform: uppercase; letter-spacing: .03em; margin: 13px 0 6px; }
.qform input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--bright); background: #fdfdfb; outline: none; }
.qform input:focus { border-color: var(--accent); }
.cond { display: flex; gap: 8px; }
.cond button { flex: 1; border: 1px solid var(--line); background: #fdfdfb; border-radius: 12px; padding: 10px 6px; font-family: var(--sans); font-weight: 700; font-size: 12px; color: var(--sub); cursor: pointer; }
.cond button.on { border-color: var(--accent); background: #eaf1fb; color: var(--accent); }
.qform .btn.pri { width: 100%; margin-top: 16px; }
.qform .tipnote { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 10px; }
.pusht { background: linear-gradient(150deg, #1c2f4e, #132038); border: 0; color: #fff; }
.pusht .t-label { color: #9db4d8; }
.pusht #pushStatus { color: #b9c9e4; font-size: 12px; font-weight: 600; margin-top: 8px; line-height: 1.5; }
.pusht #pushStatus .btn, .pusht #pushStatus button { margin-top: 10px; }
.histt .h-row { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--sub); }
.histt .h-row:first-of-type { border-top: 0; }
.histt .h-row b { color: var(--bright); }
.histt .tm { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-left: auto; }

/* HISTORY page */
.heat { grid-column: span 8; }
.hm { display: grid; grid-template-columns: repeat(18, 1fr); gap: 5px; margin-top: 6px; }
.hmcell { aspect-ratio: 1; border-radius: 6px; cursor: pointer; position: relative; transition: transform .15s; }
.hmcell:hover { transform: scale(1.18); z-index: 2; outline: 2px solid var(--bright); }
.hmcell.sel { outline: 2.5px solid var(--bright); }
.hm-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 8px; }
.hm-leg { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; }
.hm-leg i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.hm-months { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .1em; display: flex; gap: 64px; }
.recap2 { grid-column: span 4; background: linear-gradient(150deg, #1c2f4e, #132038); border: 0; color: #fff; }
.recap2 .t-label { color: #9db4d8; }
.recap2 h3 { font-size: 19px; font-weight: 800; margin-top: 8px; }
.recap2 .rrow { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.09); font-size: 13px; font-weight: 600; color: #c9d6ea; }
.recap2 .rrow:first-of-type { border-top: 0; margin-top: 10px; }
.recap2 .rrow b { color: #fff; font-family: var(--mono); font-weight: 500; }
.recap2 .rrow b.up { color: #34d399; } .recap2 .rrow b.dn { color: #f0a0a0; }
.dayt { grid-column: span 7; }
.dayt .dh { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.dayt h3 { font-size: 17px; font-weight: 800; color: var(--bright); }
.dayt .cap { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.dstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.ds { background: #faf9f5; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.ds .l { font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ds .v { font-size: 16px; font-weight: 800; margin-top: 4px; color: var(--bright); }
.ds .v.up { color: var(--green); } .ds .v.dn { color: var(--red); }
.dreport { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.dreport .r-t { font-size: 12.5px; font-weight: 800; color: var(--sub); text-transform: uppercase; letter-spacing: .03em; }
.dreport p { font-size: 13.5px; color: var(--sub); font-weight: 500; line-height: 1.65; margin-top: 8px; }
.snaps { grid-column: span 5; }
.sn { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 11px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 10px; }
.sn:hover { background: #faf9f5; }
.sn:first-of-type { border-top: 0; }
.sn.selrow { background: #f4f8fd; }
.sn .d { font-size: 13px; font-weight: 700; color: var(--bright); }
.sn .d small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.sn .v { font-family: var(--mono); font-size: 12.5px; color: var(--bright); }
.sn .pl { font-family: var(--mono); font-size: 12px; text-align: right; }
.sn .pl.up { color: var(--green); } .sn .pl.down { color: var(--red); }
.htip2 { position: fixed; pointer-events: none; background: var(--bright); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 12px; opacity: 0; transition: opacity .1s; z-index: 10; white-space: nowrap; }
.htip2 .d { font-family: var(--mono); font-size: 10px; opacity: .65; }
.htip2 .v { font-weight: 800; margin-top: 2px; }

/* Responsive collapse */
@media (max-width: 1000px) {
  .drove, .tophold, .worth, .alloc, .movers, .taskt, .fgt, .watch, .upcoming, .newst, .streak, .perf, .alloc2, .holdings,
  .income, .insight2, .rebal, .lots, .act, .taxt, .newsline, .tcol, .focus, .ttrend, .tlink,
  .nbrief, .cover, .feed, .ntrend, .alist, .arail, .heat, .recap2, .dayt, .snaps { grid-column: span 12; }
  .worth .ranges { position: static; margin-top: 10px; }
  .stats2 { grid-template-columns: repeat(2, 1fr); }
  .hm { grid-template-columns: repeat(12, 1fr); }
  .seg { display: none; }
}

/* v0.7.0 fix: alert/conflict banners flow above the header instead of overlaying it */
.alert-banner, .conflict-banner { position: relative !important; top: auto !important; left: auto !important; right: auto !important; z-index: 5; }

/* =========================================================================
 * v0.7.1 — user-menu anchor fix, black logo, command palette, DARK MODE
 * ========================================================================= */

.hdr-right { position: relative; }
.user-menu { border-radius: 14px; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; display: block; filter: brightness(0); }

/* Command palette */
.cmdk-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(25,25,24,.35); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; }
.cmdk-overlay[hidden] { display: none; }
.cmdk { width: min(560px, 100%); background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 70px -20px rgba(25,25,24,.35); overflow: hidden; }
.cmdk input { width: 100%; border: 0; outline: 0; background: none; font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--bright); padding: 17px 20px; border-bottom: 1px solid var(--line); }
.cmdk input::placeholder { color: var(--muted); font-weight: 500; }
.cmdk-results { max-height: 46vh; overflow: auto; padding: 8px; }
.cmdk-group { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: var(--sans); }
.cmdk-item.on, .cmdk-item:hover { background: var(--ink3); }
.cmdk-item .ci { width: 28px; height: 28px; border-radius: 9px; background: var(--ink3); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--sub); flex: none; }
.cmdk-item.on .ci { background: var(--ink4); }
.cmdk-item .ct { font-size: 13.5px; font-weight: 700; color: var(--bright); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cs { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); font-weight: 600; }
.cmdk-empty { padding: 22px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- DARK MODE ---------- */
html[data-theme="dark"] {
  --ink: #0f0f11; --ink2: #17171b; --ink3: #1f1f25; --ink4: #26262d;
  --line: #26262d; --line2: #33333c; --dim: #4a4a55; --muted: #8b8b98;
  --sub: #a9a9b7; --text: #d8d8e0; --bright: #f3f3f7;
  --accent: #3987e5; --red: #e05252; --green: #2fb371; --blue: #3987e5; --purple: #9085e9; --teal: #1baf7a;
  --amber-ink: #e0aa3a; --amber-dot: #e0aa3a;
  --lot-fill: rgba(224,170,58,.26); --lot-edge: #e0aa3a;
  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.55);
}
html[data-theme="dark"] body { background: var(--ink); color: var(--text); }
html[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }
html[data-theme="dark"] .brand .mark { background: #f3f3f7; color: #0f0f11; }
html[data-theme="dark"] .seg { background: #1c1c22; }
html[data-theme="dark"] .kbd, html[data-theme="dark"] .cnt, html[data-theme="dark"] .qadd .hint { background: var(--ink3); border-color: var(--line2); color: var(--sub); }
html[data-theme="dark"] .btn.pri, html[data-theme="dark"] .qadd .btn.pri { background: #f3f3f7; color: #0f0f11; }
html[data-theme="dark"] .btn.pri:hover { background: #ffffff; }
html[data-theme="dark"] .ranges button.active, html[data-theme="dark"] .ranges .range-tab.active,
html[data-theme="dark"] .fc.on, html[data-theme="dark"] .fc.active { background: #f3f3f7; color: #0f0f11; border-color: #f3f3f7; }
html[data-theme="dark"] .btn-primary { background: #f3f3f7; color: #0f0f11; border-color: #f3f3f7; }
html[data-theme="dark"] .tk2, html[data-theme="dark"] .news-card2, html[data-theme="dark"] .nl-card,
html[data-theme="dark"] .cond button, html[data-theme="dark"] .qform input { background: #1c1c22; }
html[data-theme="dark"] .news-card2:hover, html[data-theme="dark"] .tile tbody tr:hover,
html[data-theme="dark"] .n-row2:hover, html[data-theme="dark"] .sn:hover { background: #22222a; }
html[data-theme="dark"] .ds { background: #1c1c22; }
html[data-theme="dark"] .sn.selrow { background: rgba(57,135,229,.12); }
html[data-theme="dark"] input, html[data-theme="dark"] textarea, html[data-theme="dark"] select { background: var(--ink3); color: var(--text); border-color: var(--line2); }
/* tinted chips */
html[data-theme="dark"] .badge2.up, html[data-theme="dark"] .lt.long, html[data-theme="dark"] .div-ic,
html[data-theme="dark"] .ac-ic.buy, html[data-theme="dark"] .sent2.pos, html[data-theme="dark"] .sent2.bullish,
html[data-theme="dark"] .sent2.somewhat-bullish, html[data-theme="dark"] .tr-s.pos, html[data-theme="dark"] .live { background: rgba(47,179,113,.16); }
html[data-theme="dark"] .badge2.dn, html[data-theme="dark"] .al .ic.trig, html[data-theme="dark"] .al-ic2.trig,
html[data-theme="dark"] .status2.trig, html[data-theme="dark"] .sent2.neg, html[data-theme="dark"] .sent2.bearish,
html[data-theme="dark"] .sent2.somewhat-bearish, html[data-theme="dark"] .tr-s.neg, html[data-theme="dark"] .ac-ic.sell { background: rgba(224,82,82,.16); }
html[data-theme="dark"] .al .ic.arm, html[data-theme="dark"] .al-ic2.arm, html[data-theme="dark"] .status2.arm,
html[data-theme="dark"] .lt.short, html[data-theme="dark"] .pri2.med, html[data-theme="dark"] .ac-ic.alrt,
html[data-theme="dark"] .save2.on { background: rgba(217,149,15,.16); border-color: rgba(217,149,15,.3); color: #dfa940; }
html[data-theme="dark"] .pri2.high { background: rgba(224,82,82,.16); }
html[data-theme="dark"] .tk-tick, html[data-theme="dark"] .tick2, html[data-theme="dark"] .ac-ic.div2,
html[data-theme="dark"] .lk-ic, html[data-theme="dark"] .chip.on, html[data-theme="dark"] .chip.active { background: rgba(57,135,229,.16); border-color: rgba(57,135,229,.35); }
/* insight + triggered cards */
html[data-theme="dark"] .insight2 { background: linear-gradient(150deg, #262013, #1f1a0f); border-color: #4a3c1c; }
html[data-theme="dark"] .insight2 .t-label { color: #c9a35a; }
html[data-theme="dark"] .insight2 .msg b { color: #e5b567; }
html[data-theme="dark"] .al-card.trig { background: linear-gradient(150deg, #1b1b20, #261618); border-color: #5c2e2e; }
/* tooltips */
html[data-theme="dark"] .tip2, html[data-theme="dark"] .htip2 { background: #26262d; }
/* switches / meters */
html[data-theme="dark"] .switch { background: #33333c; }
html[data-theme="dark"] .mv-bar, html[data-theme="dark"] .d-track, html[data-theme="dark"] .d-bar2,
html[data-theme="dark"] .cv-bar, html[data-theme="dark"] .w-bar, html[data-theme="dark"] .meter2 { background: #26262d; }
/* legacy surfaces (modals, auth, banners already var-driven) */
html[data-theme="dark"] .modal, html[data-theme="dark"] .auth-panel { background: var(--ink2); }
html[data-theme="dark"] .chart-canvas { background: transparent; }
html[data-theme="dark"] .overview-perf-empty, html[data-theme="dark"] .chart-empty-msg { border-color: var(--line2); }

/* ============ v0.7.5 — scrub + delta toggle layer ============ */
/* Delta badges toggle $ / % display on tap (Robinhood-style). */
#homeSubRow .badge2, #perfSub .badge2, #positionDay { cursor: pointer; user-select: none; -webkit-user-select: none; }
/* Perf chart owns touch gestures so a finger drag scrubs instead of scrolling. */
#perfWrap { touch-action: none; }

/* v0.7.6 — charts are fixed-viewport now; stop drag-scrubbing from selecting page text. */
#portfolioChart, #overviewPerfChart, #perfWrap { -webkit-user-select: none; user-select: none; }

/* ============ v0.7.7 — asset logos ============ */
/* Real logo covers the colored letter tile; if it 404s the tile shows through. */
.a-ic, .ph-ic, .ci { position: relative; overflow: hidden; }
.a-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: #fff; }

/* =========================================================================
 * v0.7.8 — Profile page on the bento system + hybrid mobile layout
 * ========================================================================= */

/* ---- Profile (all sizes) ---- */
.profile-bento { align-items: start; }
.profile-main { grid-column: span 8; }
.profile-side2 { grid-column: span 4; }
.profile-form label, #invitationsPanel .invite-form label {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.profile-form input, .profile-form select, .profile-form textarea,
#invitationsPanel .invite-form input {
  width: 100%; margin-top: 7px; background: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; font-family: var(--sans); font-size: 14px;
  font-weight: 600; color: var(--bright); outline: none; box-sizing: border-box;
}
.profile-form input:focus, .profile-form select:focus, .profile-form textarea:focus,
#invitationsPanel .invite-form input:focus { border-color: var(--accent); }
.profile-form input[readonly] { color: var(--muted); }
.profile-form .form-grid, #invitationsPanel .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-form .form-grid .wide, #invitationsPanel .form-grid .wide { grid-column: 1 / -1; }
.profile-form > label { display: block; margin-top: 14px; }
.profile-form .modal-note { margin-top: 14px; font-size: 12px; color: var(--muted); background: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.profile-form .modal-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.profile-side2 .profile-stat { padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-side2 .profile-stat:last-child { border-bottom: 0; }
.profile-side2 .profile-stat strong { font-weight: 700; margin-top: 4px; }
#invitationsPanel .cell-head { margin-top: 30px; display: flex; justify-content: space-between; align-items: center; }
#invitationsPanel .cell-title { font-family: var(--sans); font-size: 15px; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--bright); }
#invitationsPanel .sec-badge { border-radius: 99px; font-size: 10px; padding: 4px 10px; background: var(--ink); border: 1px solid var(--line); color: var(--muted); }
#invitationsPanel .invite-form { border: 0; padding: 0 0 6px; margin: 12px 0 4px; }
#invitationsPanel .modal-actions { margin-top: 12px; display: flex; gap: 12px; align-items: center; }
.invitation-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.invitation-row:last-child { border-bottom: 0; }
.invitation-email { font-weight: 800; font-size: 13.5px; color: var(--bright); }
.invitation-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); margin-top: 3px; flex-wrap: wrap; }
.invitation-pill { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; }
.invitation-pill.pending { background: #fdf3dd; color: #b97f0a; }
.invitation-pill.accepted { background: #e5f3ea; color: var(--green); }
.invitation-pill.expired, .invitation-pill.revoked { background: #f0efe9; color: var(--muted); }
.invitation-actions { display: flex; gap: 8px; flex: none; }
html[data-theme="dark"] .invitation-pill.pending { background: #37301d; color: #e0b45c; }
html[data-theme="dark"] .invitation-pill.accepted { background: #1d3226; color: #56c288; }
html[data-theme="dark"] .invitation-pill.expired, html[data-theme="dark"] .invitation-pill.revoked { background: #26262d; color: #8f8d85; }

/* ---- Hybrid mobile layout (approved mockup: Robinhood top, bento below) ---- */
@media (max-width: 780px) {
  /* Header: compact — logo, stretchy search, avatar */
  .topbar.bento-top { padding: 10px 0; }
  .topbar.bento-top .wrap { gap: 10px; }
  .brand .bt small { display: none; }
  .brand .bt { font-size: 15px; }
  .brand-logo { width: 28px; height: 28px; }
  .hdr-right { flex: 1; display: flex; gap: 10px; align-items: center; min-width: 0; }
  .search-pill { flex: 1; min-width: 0; justify-content: flex-start; padding: 8px 14px; }
  .search-pill .kbd { display: none; }
  .user-chip-name { display: none; }

  /* Bottom tabs — bento look */
  .bottom-tabs { height: 64px; background: color-mix(in srgb, var(--ink2) 96%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .bt-tab { color: #b5b3ab; }
  .bt-tab span { font-family: var(--sans); text-transform: none; font-size: 9.5px; font-weight: 800; letter-spacing: 0; }
  .bt-tab.active { color: var(--bright); }

  /* Home: hero-first, edge-to-edge axis-less chart, underline range pills */
  .greet { display: none; }
  #homeView .bento { display: flex; flex-direction: column; gap: 14px; }
  #homeView .tile.worth { order: 0; } #homeView .alloc { order: 1; }
  #homeView .taskt { order: 2; } #homeView .fgt { order: 3; }
  #homeView .newst { order: 4; } #homeView .movers { order: 5; } #homeView .streak { order: 6; }
  .tile.worth { background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; display: flex; flex-direction: column; }
  .tile.worth .t-head { order: 0; margin-bottom: 0; }
  .tile.worth .val { order: 1; font-size: 36px; }
  .tile.worth .sub { order: 2; }
  .tile.worth .chart-wrap { order: 3; margin: 8px -16px 0; }
  .tile.worth .ranges { order: 4; position: static; display: flex; margin: 0 -16px; padding: 0 8px; border-bottom: 1px solid var(--line); background: none; border-radius: 0; }
  .tile.worth .bench-row { order: 5; margin-top: 12px; }
  .tile.worth .ranges .range-tab, #chartRangeTabs .range-tab, #perfRanges button {
    flex: 1; background: none !important; color: var(--muted); border-radius: 0;
    padding: 10px 0 12px; position: relative; border: 0; box-shadow: none;
  }
  .tile.worth .ranges .range-tab.active, #chartRangeTabs .range-tab.active, #perfRanges .active {
    color: var(--bright); background: none !important;
  }
  .tile.worth .ranges .range-tab.active::after, #chartRangeTabs .range-tab.active::after, #perfRanges .active::after {
    content: ""; position: absolute; left: 26%; right: 26%; bottom: 0; height: 3px; border-radius: 3px; background: var(--bright);
  }

  /* Portfolio: perf chart stretches, underline pills */
  .tile.perf { padding: 16px 16px 10px; }
  .perf-top { flex-direction: column; align-items: stretch; gap: 6px; }
  .perf-right { display: flex; flex-direction: column; gap: 6px; }
  #perfRanges { display: flex; margin: 0 -16px; padding: 0 8px; border-bottom: 1px solid var(--line); background: none; border-radius: 0; }
  #perfWrap { margin: 6px -16px 0; }

  /* Holdings table -> Robinhood rows: logo/name | spark | price + pill */
  .holdings { padding: 6px 14px 8px; }
  .holdings thead { display: none; }
  .holdings tr { display: grid; grid-template-columns: minmax(0,1fr) 58px auto; grid-template-areas: "a s p" "a s t"; align-items: center; column-gap: 10px; row-gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .holdings tbody tr:last-child { border-bottom: 0; }
  .holdings td { padding: 0; border: 0; }
  .holdings td.asset { grid-area: a; min-width: 0; }
  /* Column map (v0.7.10): 1 asset · 2 units · 3 price · 4 today · 5 trend · 6 value · 7 weight · 8 P&L */
  .holdings td:nth-child(3) { grid-area: p; text-align: right; font-family: var(--mono); font-size: 13.5px; }
  .holdings td:nth-child(4) { grid-area: t; text-align: right; }
  .holdings td:nth-child(5) { grid-area: s; }
  .holdings td:nth-child(2), .holdings td:nth-child(6), .holdings td:nth-child(7), .holdings td:nth-child(8) { display: none; }
  .holdings td:nth-child(4) .up, .holdings td:nth-child(4) .down {
    display: inline-block; min-width: 62px; text-align: center; font-family: var(--mono);
    font-size: 11.5px; padding: 3px 8px; border-radius: 8px; color: #fff !important;
  }
  .holdings td:nth-child(4) .up { background: var(--green); }
  .holdings td:nth-child(4) .down { background: var(--red); }

  /* Position: stacked hero, flat edge-to-edge chart, sticky CTA */
  .pos-h { flex-direction: column; align-items: stretch; gap: 4px; }
  .ph-rg { flex-direction: column; align-items: flex-start !important; gap: 4px !important; }
  .ph-r .p { font-size: 34px; }
  .ph-cta { position: fixed; left: 16px; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 29; display: flex !important; gap: 10px; }
  .ph-cta .btn { flex: 1; padding: 14px 0; border-radius: 99px; font-size: 15px; text-align: center; justify-content: center; box-shadow: 0 8px 24px rgba(25,25,24,.28); }
  .ph-cta .btn.gh { background: var(--ink2); }
  #positionView .wrap { padding-bottom: 84px; }
  .tile.chart-tile { background: none; border: 0; box-shadow: none; border-radius: 0; padding: 0; display: flex; flex-direction: column; }
  .chart-tile .t-head { order: 2; display: flex; flex-direction: column-reverse; gap: 10px; margin: 0; }
  .chart-tile .chart-canvas { order: 1; margin: 0 -16px; }
  #chartRangeTabs { display: flex; width: 100%; margin: 0 -16px; padding: 0 8px; border-bottom: 1px solid var(--line); background: none; border-radius: 0; box-sizing: content-box; }
  .chart-tile .ct-left { display: flex; gap: 8px; justify-content: center; }
  .stats2 { grid-template-columns: repeat(2, 1fr); }

  /* Profile mobile */
  .profile-bento { display: flex; flex-direction: column; }
}

/* v0.7.8 fixes — mobile range rows stretch full-width; chart canvas loses its
   border/tint so the edge-to-edge look is seamless. */
@media (max-width: 780px) {
  .tile.worth .ranges, #chartRangeTabs, #perfRanges { width: auto; }
  .tile.worth .ranges .range-tab, #chartRangeTabs .range-tab, #perfRanges button { flex: 1 1 0 !important; text-align: center; }
  .overview-perf-canvas { border: 0; border-radius: 0; background: none; margin-bottom: 0; }
  .chart-canvas { border: 0 !important; border-radius: 0 !important; background: none !important; }
}

/* v0.7.8 fixes round 2 — mobile position hero left-aligned; range rows stretch
   inside centered flex parents. */
@media (max-width: 780px) {
  .ph-r { text-align: left; }
  .ph-r .d { justify-content: flex-start; }
  .chart-tile .t-head { align-items: stretch; }
  .perf-right { width: 100%; align-items: stretch; }
}

/* v0.7.8 fixes round 3 — wide tables scroll inside their card instead of
   stretching the mobile layout viewport (which pushed the fixed bottom bars
   off-screen); body overflow backstop. */
@media (max-width: 780px) {
  html, body { overflow-x: hidden; }
  .tile.lots, .tile.act { overflow-x: auto; }
  .tile.lots table { min-width: 500px; }
}

/* =========================================================================
 * v0.7.9 — mobile overflow fix, holdings price/value toggle + sorting,
 * More view typography
 * ========================================================================= */

/* More view — body copy in the theme's sans, not mono */
.more-head .section-sub { font-family: var(--sans); font-size: 13.5px; letter-spacing: 0; font-weight: 500; color: var(--muted); }
.mi-sub { font-family: var(--sans); font-size: 12px; letter-spacing: 0; }

/* Sortable holdings headers (desktop) */
.holdings th[data-sort] { cursor: pointer; user-select: none; }
.holdings th[data-sort]:hover { color: var(--bright); }
.holdings th.sorted { color: var(--bright); }
.holdings th.sorted::after { content: " ▼"; font-size: 8px; color: var(--accent); }
.holdings th.sorted.asc::after { content: " ▲"; }
.hold-tools { display: none; }

@media (max-width: 780px) {
  /* Overflow fix: a chart canvas's intrinsic width could ratchet flex/grid
     tiles wider than the viewport (min-width:auto), shoving every card past
     the right edge. Clamp tiles and canvases; clip the wrap as a backstop. */
  .view .wrap { overflow-x: clip; }
  .bento .tile { min-width: 0; max-width: 100%; }
  #homeView .bento > .tile { width: 100%; box-sizing: border-box; }
  .overview-perf-canvas, .chart-canvas { max-width: 100%; min-width: 0; overflow: hidden; }
  .chart-wrap { min-width: 0; }
  .tile.worth .sub { flex-wrap: wrap; }

  /* Holdings tools row: Price/Value toggle + sort */
  .hold-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 2px 10px; flex-wrap: wrap; }
  .hv-toggle { display: flex; background: var(--ink3); border-radius: 99px; padding: 3px; }
  .hv-toggle .chip { border: 0; background: none; font-family: var(--mono); font-size: 11px; padding: 5px 13px; border-radius: 99px; color: var(--muted); cursor: pointer; }
  .hv-toggle .chip.on { background: var(--bright); color: #fff; border-color: transparent; }
  .hold-sort { display: flex; gap: 6px; align-items: center; }
  #holdSortSel { font-family: var(--mono); font-size: 11px; background: var(--ink2); border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px; color: var(--bright); outline: none; }
  #holdSortDir { border: 1px solid var(--line); background: var(--ink2); border-radius: 99px; padding: 5px 12px; font-size: 12px; color: var(--bright); cursor: pointer; }

  /* Value mode: right column shows market value + total P&L pill */
  .holdings.hv-value td:nth-child(3), .holdings.hv-value td:nth-child(4) { display: none; }
  .holdings.hv-value td:nth-child(6) { display: block; grid-area: p; text-align: right; font-family: var(--mono); font-size: 13.5px; }
  .holdings.hv-value td:nth-child(8) { display: block; grid-area: t; text-align: right; }
  .holdings.hv-value td:nth-child(8) .up, .holdings.hv-value td:nth-child(8) .down {
    display: inline-block; min-width: 62px; text-align: center; font-family: var(--mono);
    font-size: 11.5px; padding: 3px 8px; border-radius: 8px; color: #fff !important;
  }
  .holdings.hv-value td:nth-child(8) .up { background: var(--green); }
  .holdings.hv-value td:nth-child(8) .down { background: var(--red); }
  .holdings.hv-value td:nth-child(8) span:last-child { display: none; }
}

/* =========================================================================
 * v0.7.10 — Units column (desktop). The quantity moves out of the muted
 * asset sub-line into its own scannable column for broker reconciliation;
 * mobile keeps the sub-line and hides the column (see the ≤780px block).
 * Deliberately NOT sortable: units aren't comparable across assets.
 * ========================================================================= */
.td-units { white-space: nowrap; }
.td-units small { font-family: var(--sans); font-size: 10px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.th-units, .td-units { width: 1%; }
.a-nm .s-qty { display: none; }          /* desktop: shown in the Units column instead */
@media (max-width: 780px) {
  .a-nm .s-qty { display: inline; }      /* mobile: keep it inline under the ticker */
}

/* =========================================================================
 * v0.7.11 — REAL fix for the mobile "widgets extend past the right edge" bug.
 *
 * `.shell` is a CSS grid and `main.scroll` is a grid item. Grid/flex items
 * default to `min-width: auto`, which refuses to shrink below the content's
 * max-content width — so the scroller laid itself out at 1240px (Home, the
 * .wrap max-width) or 669px (Tasks) inside a 390px track, pushing every card
 * past the screen. v0.7.9's `overflow-x: clip` only hid the resulting
 * scrollbar; the cards were still too wide and simply got cut off.
 *
 * min-width:0 lets the item shrink to its track. Applied at every viewport,
 * not just mobile — a narrow desktop window hit the same bug.
 * ========================================================================= */
.shell { min-width: 0; }
.shell > main.scroll, .shell > .topbar { min-width: 0; }
main.scroll > .view, .view > .wrap { min-width: 0; }

/* v0.7.11 — Tasks quick-add: the mono hint chip is `white-space: nowrap` and
   304px wide, which forced the flex row (and so the card) past a phone screen.
   Hide it on mobile — the placeholder already explains the syntax — and let
   the row's input shrink. */
@media (max-width: 780px) {
  .qadd { flex-wrap: wrap; padding: 6px 8px 6px 14px; }
  .qadd .hint { display: none; }
  .qadd input { min-width: 0; }
}

/* v0.7.11 — Tasks columns carry a 340px min-height so the three desktop
   columns align; on a phone they stack, so empty columns became large blank
   cards. Let them size to content. */
@media (max-width: 780px) {
  .tcol { min-height: 0; }
}

/* =========================================================================
 * v0.8.0 — Activity ledger (master view + position mount)
 * ========================================================================= */
.act-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-a { background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-card); min-width: 0; }
.kpi-a .l { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi-a .v { font-size: 23px; font-weight: 800; margin-top: 6px; letter-spacing: -.01em; color: var(--bright); }
.kpi-a .v.up { color: var(--green); } .kpi-a .v.dn { color: var(--red); }
.kpi-a .v small { font-size: 14px; color: var(--muted); font-weight: 700; }
.kpi-a .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-weight: 700; }
.act-tile { grid-column: span 8; }
/* The ledger table needs ~950px. In the Activity TAB the ledger is the only tile in its grid, so a
 * 2/3-width card (span 8) clipped the table on windows under ~1500px and left the right third of
 * the row empty. Full width there, plus a scroll container as a safety net for widths between the
 * stacked mobile layout and the point where the table fits. Scoped: on the position page the same
 * .act-tile class correctly sits at span 8 beside the news tile. */
#activityView .act-tile { grid-column: span 12; }
#activityTableWrap { overflow-x: auto; }
/* Same safety net for the position page's per-holding ledger (#activityList): it sits in a span-8 tile beside the news tile,
 * and between the stacked mobile layout and ~1500px the table is wider than the tile. Scroll inside the card instead of spilling out. */
/* ROOT CAUSE of the position page ledger being clipped on tablets and phones: the responsive rule that makes tiles
 * full width (max-width: 1000px) lists .act but not .act-tile, and the later `.act-tile { span 8 }` above beat it, so the
 * ledger stayed at two thirds of the screen. Below 1000px every Activity tile is full width. */
@media (max-width: 1000px) { .act-tile, #activityView .act-tile { grid-column: span 12; } }
#activityList { overflow-x: auto; max-width: 100%; }

.act-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.act-filters .sel { font-family: var(--mono); font-size: 11px; background: var(--ink2); border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; color: var(--bright); outline: none; }
.act-date { font-family: var(--mono) !important; font-size: 12.5px !important; white-space: nowrap; }
.act-warn { font-family: var(--sans); font-size: 10.5px; color: var(--amber, #b97f0a); font-weight: 700; margin-top: 4px; white-space: normal; }
.lot-box { padding: 4px 0 6px; }
.lot-h { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.lot-line { display: flex; gap: 14px; align-items: center; justify-content: flex-end; padding: 7px 0; border-bottom: 1px dashed var(--line); font-family: var(--mono); font-size: 12px; color: var(--bright); flex-wrap: wrap; }
.lot-line:last-child { border-bottom: 0; }
.lot-line .d { color: var(--muted); font-size: 11px; margin-right: auto; }
.term { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.term.long { background: #e5f3ea; color: var(--green); }
.term.short { background: #fdf3dd; color: #b97f0a; }
.term.split { background: #eef0f4; color: #5b6270; }
.term.na { color: #c9c7bf; }
.tax-disc { background: #fdf6e8; border: 1px solid #f0dfc0; border-radius: 14px; padding: 12px 14px; font-size: 12px; color: #7a5c12; font-weight: 600; margin-top: 14px; }
html[data-theme="dark"] .act-pill.buy, html[data-theme="dark"] .term.long { background: #1d3226; color: #56c288; }
html[data-theme="dark"] .act-pill.sell { background: #33211f; color: #e08585; }
html[data-theme="dark"] .term.short { background: #37301d; color: #e0b45c; }
html[data-theme="dark"] .term.split { background: #26262d; color: #a8adb8; }
html[data-theme="dark"] .lot-row td { background: #1b1b20; }
html[data-theme="dark"] .tax-disc { background: #2a2417; border-color: #443a22; color: #d8bd7e; }

/* Mobile: the ledger becomes stacked cards (a 10-column table cannot work at 390px) */
@media (max-width: 780px) {
  .act-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-a { padding: 13px 15px; border-radius: 16px; }
  .kpi-a .v { font-size: 19px; }
  .act-filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .act-filters .chips { flex: none; }
  .act-filters .sel { flex: none; }
  /* Card layout keyed on CELL CLASSES, not nth-child: the master mount has an
     Asset column and the position mount does not, so positional rules collide. */
  .lot-line { justify-content: flex-start; font-size: 11.5px; gap: 8px; }
  .lot-line .d { margin-right: 0; width: 100%; }
}

/* v0.8.0 fix — the expanded FIFO-lot row must span the whole table on desktop
   (observed computing as display:block, collapsing it to one column width),
   and the ledger filter selects must not inherit the global `select{width:100%}`. */
.act-filters .sel { width: auto; flex: 0 0 auto; min-width: 0; }
.act-filters .chips { display: flex; gap: 6px; }
@media (max-width: 780px) {
}

/* =========================================================================
 * v0.9.2 — 1H range everywhere + per-asset change period on holdings
 * ========================================================================= */

/* Seven pills instead of six. `.ranges` is width:max-content, so on a phone the
   row would push the tile wider than the viewport (the v0.7.11 bug class).
   Let it shrink and scroll instead of overflowing. */
.ranges { max-width: 100%; }
@media (max-width: 780px) {
  .ranges { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ranges::-webkit-scrollbar { display: none; }
  .ranges button, .ranges .range-tab { padding: 5px 9px; flex: 0 0 auto; }
}

/* Change column: dollar move + percent for the ONE period selected top-right.
   Not .up/.down — those carry a blanket green/red pill rule on this cell at
   ≤780px (v0.7.9) and the cell is now two figures, not one pill. */
.td-chg { white-space: nowrap; }
.td-chg .chg-amt { font-family: var(--mono); }
.td-chg .chg-amt.pos { color: var(--green); }
.td-chg .chg-amt.neg { color: var(--red); }
.td-chg .chg-pct { color: var(--muted); font-size: 11px; }
.td-chg .chg-wait { color: var(--muted); }
.holdings th[data-sort="day"] { white-space: nowrap; }
/* The period badge on the header: Change and Total P&L are both dollars now,
   so the window the Change figure covers has to be readable without looking up
   at the dropdown. */
.holdings th .th-per {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--muted);
  background: var(--ink3); border-radius: 99px; padding: 2px 6px; margin-left: 5px;
}

/* Bulk period control sits with the mobile holdings tools */
.hold-period { display: flex; align-items: center; }
#holdPeriodAll {
  width: auto; font-family: var(--mono); font-size: 11px; background: var(--ink2);
  border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px;
  color: var(--bright); outline: none;
}

@media (max-width: 780px) {
  /* Column 4 sits in grid-area `t`. It stacks: coloured dollar move over the
     muted percent. A pill would have to widen for six-figure numbers and that
     squeezes long asset names onto four lines. */
  .holdings td:nth-child(4) {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 0; line-height: 1.3;
  }
  .holdings.hv-value td:nth-child(4) { display: none; }
  .td-chg .chg-amt { font-size: 13.5px; font-weight: 700; }
  .td-chg .chg-pct { font-size: 11.5px; }
}

/* Desktop keeps its clickable sort headers, but the "set every row" period
   control is worth surfacing there too — otherwise a 20-row table means 20
   individual pickers to compare the same window. */
@media (min-width: 781px) {
  .hold-tools { display: flex; justify-content: flex-end; align-items: center; margin-top: -2px; padding: 0 2px 8px; }
  .hold-tools .hv-toggle, .hold-tools .hold-sort { display: none; }
  #holdPeriodAll { font-size: 10.5px; padding: 5px 9px; }
}

/* =========================================================================
 * v0.9.4 — edit / delete a single ledger entry
 * ========================================================================= */


/* popover */

/* The filter strip shared the tile head with the "Transaction Ledger" label,
   leaving it 206px wide to hold 560px of controls — "Newest first" started
   315px off-screen, reachable only by swiping a narrow band most people would
   never think to swipe. Give it its own row AND let it wrap: 560px of controls
   does not fit one 358px line however it is sliced, so wrapping is the fix and
   the horizontal scroller has to go with it. */
@media (max-width: 780px) {
  .act-tile .t-head { flex-wrap: wrap; row-gap: 10px; }
  .act-tile .t-head .act-filters {
    flex-basis: 100%; width: 100%;
    flex-wrap: wrap; overflow-x: visible; row-gap: 8px; padding-bottom: 0;
  }
  /* Slightly tighter so the wrapped rows stay compact. */
  .act-tile .act-filters .sel { font-size: 10.5px; padding: 7px 9px; }
}

/* =========================================================================
 * v0.9.6 — failure states that are actually visible
 * ========================================================================= */
.sync-pill {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; align-items: center; gap: 9px; max-width: min(92vw, 440px);
  padding: 9px 12px 9px 11px; border-radius: 99px;
  background: var(--ink2); border: 1px solid var(--line2); color: var(--bright);
  box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 12.5px; line-height: 1.3;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.sync-pill.warn .dot { background: #e0a53a; }
.sync-pill.bad  .dot { background: var(--red); }
.sync-pill .retry {
  border: 1px solid var(--line2); background: none; color: var(--bright); border-radius: 99px;
  padding: 4px 10px; font: inherit; font-size: 11.5px; cursor: pointer; margin-left: 2px;
}
@media (max-width: 780px) { .sync-pill { left: 12px; right: 12px; bottom: calc(74px + env(safe-area-inset-bottom)); max-width: none; } }

.boot-error {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px;
  background: rgba(25,25,24,.55); backdrop-filter: blur(4px);
}
.boot-error-card {
  width: min(480px, 100%); background: var(--ink2); border: 1px solid var(--line2); border-radius: 18px; padding: 26px 26px 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.boot-error-card .be-eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.boot-error-card h2 { margin: 8px 0 8px; font-size: 22px; }
.boot-error-card p { margin: 0 0 18px; color: var(--muted); line-height: 1.5; }
.be-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================================================================
 * v0.9.7 — first run: one card, one button; empty chrome hidden until there
 * is something to show. Zero reads neutral.
 * ========================================================================= */
.badge2.flat { color: var(--muted); background: var(--ink3); }
.ph-r .d.flat, .d.flat { color: var(--muted); }

.first-run-card { grid-column: 1 / -1; padding: 30px 30px 26px; }
.first-run-card .fr-eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.first-run-card h2 { margin: 8px 0 8px; font-size: 28px; letter-spacing: -.01em; }
.first-run-card > p { margin: 0 0 18px; max-width: 62ch; color: var(--muted); font-size: 15px; line-height: 1.55; }
.fr-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.fr-actions .btn.pri { padding: 12px 20px; font-size: 15px; }
.fr-actions .fr-soon { opacity: .55; cursor: not-allowed; }
.fr-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; border-top: 1px solid var(--line); padding-top: 18px; }
.fr-steps > div { display: flex; gap: 10px; align-items: flex-start; }
.fr-steps .n { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--bright); color: var(--ink2); font-family: var(--mono); font-size: 11px; display: grid; place-items: center; margin-top: 1px; }
.fr-steps b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.fr-steps span:not(.n) { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* Home: hide everything that is empty by definition on a fresh account */
#homeView.first-run .tile.worth, #homeView.first-run .tile.alloc, #homeView.first-run .tile.movers,
#homeView.first-run .tile.taskt, #homeView.first-run .tile.fgt, #homeView.first-run .tile.newst,
#homeView.first-run .tile.streak { display: none; }
/* Portfolio */
#portfolioView.first-run .tile.perf, #portfolioView.first-run .tile.alloc2, #portfolioView.first-run .tile.holdings,
#portfolioView.first-run .tile.income, #portfolioView.first-run .tile.rebal, #portfolioView.first-run #portInsight { display: none; }
/* Position: no chart toolbar, no lots/ledger/tax/news for a symbol that does not exist */
#positionView.first-run .tile.chart-tile, #positionView.first-run .pos-kpis, #positionView.first-run .pos-cols, #positionView.first-run .tile.lots,
#positionView.first-run .tile.act, #positionView.first-run .tile.taxt, #positionView.first-run .tile.newsline,
#positionView.first-run .ph-cta, #positionView.first-run #positionEditBtn { display: none; }

@media (max-width: 780px) {
  .first-run-card { padding: 22px 18px 20px; }
  .first-run-card h2 { font-size: 24px; }
  .fr-actions .btn { width: 100%; justify-content: center; }
  .fr-steps { grid-template-columns: 1fr; }
}

/* =========================================================================
 * v0.9.8 — trust fixes
 * ========================================================================= */
/* Position page: v0.9.8 paired the lots tile with the tax tile on one row
   (span 8 + span 4) because Activity had gone full-width and left six empty
   columns beside lots.
   REMOVED in v0.9.16. The dead space is now solved differently - Activity is
   span 8 with Intel as a span-4 sidebar - and lots and the sell estimator each
   own a full row. The canonical declarations are with the other tile spans
   (search "grid-column: span" near .lots / .taxt above); these duplicates sat
   1000 lines further down and silently won the cascade. */

/* Mobile lots table: 539 px on a 390 px screen, Gain and Term clipped with no
   scroll affordance. Drop Value (it is qty × price, shown above the table) and
   let the remaining five columns fit. */
@media (max-width: 780px) {
  .tile.lots table { min-width: 0; width: 100%; }
  .lots .lot-val { display: none; }
  .lots th, .lots td { padding: 9px 6px; font-size: 11.5px; }
  .lots td:first-child { font-size: 11.5px; white-space: nowrap; }
}

/* v0.9.9 — build version at the foot of the avatar menu */
.user-menu-version {
  margin-top: 4px; padding: 8px 12px 4px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; color: var(--muted); user-select: all;
}
.user-menu-version.mismatch { color: var(--red); }


/* ===========================================================================
   v0.9.12 - Home hero sub-row, and the tappable contribution marker.
   =========================================================================== */

/* Two tiers, not four facts in one grey run-on. The badge is what people came
   for, so it gets a line to itself; everything lifetime drops a size and a
   shade below it. */
#homeSubRow { flex-direction: column; align-items: flex-start; gap: 4px; }
#homeSubRow .sub-primary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#homeSubRow .sub-word { font-size: 12.5px; color: var(--muted); font-weight: 600; }
#homeSubRow .sub-secondary { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
#homeSubRow .sub-secondary .vs { font-size: 11.5px; opacity: .82; }

/* Separators are generated, never typed. The old line concatenated its parts
   by hand and shipped "past month+$17,637" when one of them forgot its " · ". */
#homeSubRow .sub-secondary .vs + .vs::before { content: "\00b7"; margin-right: 6px; opacity: .55; }

/* Contribution marker popover. Dark in both themes, like the chart tooltip it
   sits beside - it is an overlay on the chart, not part of the page surface. */
.ov-marker-pop {
  position: absolute;
  transform: translate(-50%, -118%);
  z-index: 12;
  padding: 8px 10px;
  background: rgba(17, 17, 20, .94);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 10px;
  color: #f5f5f2;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
}
.ov-marker-pop-date { color: #8f8d85; }
.ov-marker-pop-amt { font-weight: 700; margin-top: 1px; }
.ov-marker-pop-amt.up { color: #4ade80; }
.ov-marker-pop-amt.dn { color: #f87171; }
.ov-marker-pop-note { color: #8f8d85; margin-top: 3px; font-size: 10px; letter-spacing: .02em; }


/* ===========================================================================
   v0.9.13 - refresh control, freshness readout, and the toast the app never had.
   =========================================================================== */

/* --- the control, identical on Home and Portfolio ------------------------ */
.head-tools { display: inline-flex; align-items: center; gap: 9px; margin-left: auto; }
.perf-top .t-label { display: flex; align-items: center; gap: 9px; }
.perf-top .t-label > span:first-child { flex: none; }

.btn.rf { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; font-size: 12px; line-height: 1; }
.btn.rf .rf-ico { display: inline-block; font-size: 13px; line-height: 1; }
.btn.rf[disabled] { cursor: default; opacity: .72; }
.btn.rf.working .rf-ico { animation: rf-spin .75s linear infinite; }
@keyframes rf-spin { to { transform: rotate(360deg); } }
.btn.rf.done { border-color: var(--green); color: var(--green); }
.btn.rf.fail { border-color: var(--red); color: var(--red); }
/* Motion is decoration here - the disabled state and the label already carry
   the meaning, so honour the OS setting and drop the spin. */
@media (prefers-reduced-motion: reduce) {
  .btn.rf.working .rf-ico { animation: none; }
}

/* --- freshness ----------------------------------------------------------- */
.freshness { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.freshness-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.freshness.live .freshness-dot { animation: fresh-pulse 2.4s ease-in-out infinite; }
.freshness.aging { color: var(--amber-ink); } .freshness.aging .freshness-dot { background: var(--amber-dot); }
.freshness.stale { color: var(--red); }  .freshness.stale .freshness-dot { background: var(--red); }
.freshness.closed, .freshness.idle { color: var(--muted); }
.freshness.closed .freshness-dot, .freshness.idle .freshness-dot { background: var(--muted); }
@keyframes fresh-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .freshness.live .freshness-dot { animation: none; } }

/* On a narrow screen the label is the first thing to go: the coloured dot
   still carries the state, and the button needs the room more than the words
   "Updated 12m ago" do. The full text stays in the title attribute. */
@media (max-width: 560px) {
  .freshness { gap: 0; }
  .freshness > span:last-child { display: none; }
  .btn.rf .rf-label { display: none; }
  .btn.rf { padding: 7px 9px; }
}

/* --- toast --------------------------------------------------------------- */
.toast-host {
  position: fixed; z-index: 200; display: flex; flex-direction: column; gap: 8px;
  right: 18px; bottom: 18px; max-width: min(400px, calc(100vw - 36px));
  pointer-events: none;
}
/* Mobile: full width along the bottom, and lifted clear of the tab bar and the
   iOS home indicator. env() is a no-op where it is not supported. */
@media (max-width: 700px) {
  .toast-host {
    right: 12px; left: 12px; max-width: none;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: 12px;
  background: var(--ink2); border: 1px solid var(--line2);
  color: var(--text); font-size: 12.5px; line-height: 1.45;
  box-shadow: var(--shadow-card), 0 10px 30px rgba(0, 0, 0, .16);
  opacity: 0; transform: translateY(8px); transition: opacity .22s ease, transform .22s ease;
}
.toast.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; transform: none; } }
.toast-ic { flex: none; font-size: 13px; line-height: 1.35; font-weight: 700; }
.toast b { font-weight: 700; }
.toast-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.toast.good { border-color: var(--green); } .toast.good .toast-ic { color: var(--green); }
.toast.warn { border-color: var(--amber-dot); } .toast.warn .toast-ic { color: var(--amber-ink); }
.toast.bad  { border-color: var(--red); }   .toast.bad  .toast-ic { color: var(--red); }


/* ===========================================================================
   v0.9.13.2 - stop the Portfolio header reflowing when the chart is hovered.
   ===========================================================================
   .perf-top is a wrapping flex row. Its left column had no flex basis and no
   min-width, so its width was whatever its widest child happened to be - and
   that child is #perfSub, whose text CHANGES on hover. With "vs SPY" on, the
   resting row carries a ~55-character benchmark note; scrubbing replaced it
   with a date. The column narrowed, .perf-right stopped needing to wrap, and
   the range tabs jumped from under the value up to the top-right - taking the
   header height, and therefore the chart's vertical position, with them. At the
   chart's top edge that becomes a mouseenter/mouseleave oscillation.

   bento.js now keeps the row's content stable (perfSubHtml). This is the second
   half: make the wrap decision independent of content width altogether, so the
   bug cannot return through some future edit to the sub-row text.

   - left column: flex 1 1 0 + min-width 0  -> takes the leftover space and is
     allowed to shrink, rather than dictating the row's width. min-width:0 is
     the load-bearing part; without it a flex item refuses to shrink below its
     content and wraps instead.
   - right column: flex none -> always its natural width, never pushed down by
     whatever the left column is currently saying.                             */
.perf-top > :first-child { flex: 1 1 0; min-width: 0; }
.perf-top .perf-right { flex: 0 0 auto; }

/* The sub-row must also not change HEIGHT between resting and scrubbing, or the
   chart still moves - just vertically instead of horizontally. Reserving one
   line does that without pinning a pixel height to a particular font. */
#perfSub { min-height: 1.65em; }

/* v0.9.13.3 - the last 17 pixels.
   ---------------------------------------------------------------------------
   Measured on the deployed 0.9.13.2 build, sweeping the .tile.perf width from
   1400px down to 320px: heights matched at every width EXCEPT 560px and 400px,
   where the row was one line taller at rest than while scrubbing.

   Cause: the two states carry the same benchmark note now, but the BADGE text
   still differs in length - "▲ +$10,470 (6.94%) past 3 months" against
   "▼ −$17,048 (11.45%) JUN 7". At narrow widths the longer one wrapped inside
   the badge and the shorter one did not, so the row gained a line on
   mouse-leave and the chart moved under the cursor again. Smaller than the
   original jump, and invisible on a wide desktop, which is exactly why it
   needed measuring rather than eyeballing.

   nowrap makes the badge exactly one line whatever it says. Verified over the
   same sweep afterwards: every width matches, and the badge's scrollWidth never
   exceeds its clientWidth - zero overflow even at 320px, the narrowest phone. */
.badge2 { white-space: nowrap; }
#homeSubRow .sub-secondary { min-height: 1.45em; }

/* The Portfolio hero now uses heroNumberHtml() like Home, so it emits a <small>
   for the cents. Only `.worth .val small` was styled, so without this the cents
   would render at the full 36px instead of small and muted - the numbers would
   match while looking different, which is half the problem. */
.perf .val small { font-size: 19px; color: var(--muted); font-weight: 700; }

/* Proportional digits are not the same width, so a value ticking from $111,111
   to $888,888 physically resizes the hero while you scrub - which nudges
   everything laid out beside it. .val is Manrope, not the mono face, so this is
   real. tabular-nums makes every digit one width and the jitter disappears. */
.worth .val, .perf .val, .ph-r .p, .ph-r .d, .badge2, .freshness, #perfSub .vs {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Same class of bug as .perf-top, in the position header: .ph-rg wraps, and
   #positionPrice drives .ph-r's width while the scrub rewrites it. Pinning the
   CTA group's basis stops a digit-count change from wrapping the buttons. */
.ph-rg .ph-cta { flex: 0 0 auto; }
.ph-rg .ph-r { flex: 0 1 auto; }

@media (max-width: 780px) {
  /* 780px, matching the existing rule that flips .perf-top to a column. Once it
     stacks, the left column must stop claiming leftover space on a zero basis or
     the stacked layout can collapse to nothing. */
  .perf-top > :first-child { flex: 1 1 auto; }
}


/* ===========================================================================
   v0.9.16 - asset view: Activity + Intel side by side, live sell estimator,
   compact intel list. Spans above are desktop-only; the existing
   @media (max-width:1000px) rule already collapses all of these to span 12,
   so the mobile stack needs no new span rules - only the component styles
   below, which are written fluid rather than fixed-width.
   =========================================================================== */

/* ---- Intel, compact list (replaces the horizontal .nl-row card scroller) -- */
.nl-list { display: flex; flex-direction: column; margin-top: 6px; }
.nl-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
  cursor: pointer; text-decoration: none;
}
.nl-item:last-child { border-bottom: 0; }
.nl-item:hover .nl-t { color: var(--accent); }
/* Sentiment rail. classify_sentiment() has always returned this and the
   position view threw it away - it costs one element to show. */
.nl-s { width: 3px; align-self: stretch; border-radius: 2px; background: var(--line2); flex: none; }
.nl-s.pos { background: var(--green); }
.nl-s.neg { background: var(--red); }
.nl-t {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.nl-a { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; padding-top: 2px; }

/* ---- Live sell estimator -------------------------------------------------- */
.sell-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sell-qty { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); }
.taxt .est { font-size: 26px; font-weight: 800; margin: 6px 0 2px; color: var(--bright); font-variant-numeric: tabular-nums; }
.taxt .es { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.sell-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 3px;
  background: var(--line2); outline: none; margin: 16px 0 4px; cursor: pointer;
}
.sell-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bright); border: 3px solid var(--ink2); box-shadow: 0 0 0 1px var(--line2); cursor: pointer;
}
.sell-range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--bright);
  border: 3px solid var(--ink2); box-shadow: 0 0 0 1px var(--line2); cursor: pointer;
}
.sell-range:focus-visible { box-shadow: 0 0 0 3px rgba(57,135,229,.35); }

.sell-presets { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0 2px; }
.sell-presets .chip { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; }

.sell-lots-label { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-top: 16px; }
.sell-strip { display: flex; gap: 3px; height: 26px; margin: 7px 0 6px; border-radius: 7px; overflow: hidden; }
/* v0.9.17 - proportional, but with a floor.
   A real position had 267 of 337 units in one lot, so pure `flex: qty` gave that
   lot ~80% of the strip and squeezed five others into unreadable slivers - which
   defeats the point, since the strip exists to show WHICH lots a sale consumes.
   A min-width keeps every lot legible while the flex basis still communicates
   relative size. It does compress the largest lot slightly; that is the trade,
   and it is the right way round - the big lot is still obviously the big one. */
.sell-seg { position: relative; background: var(--ink3); border: 1px solid var(--line2); border-radius: 5px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  min-width: 46px; }
.sell-seg .fill { position: absolute; inset: 0 auto 0 0; background: var(--lot-fill); border-right: 1px solid var(--lot-edge); }
.sell-seg span { position: relative; z-index: 1; font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.sell-lotnote { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.sell-cells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
@media (min-width: 620px) { .sell-cells { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sell-cell { background: var(--ink3); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.sell-cell .k { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }
.sell-cell .v { font-family: var(--mono); font-size: 16px; font-weight: 800; color: var(--bright);
  margin-top: 5px; font-variant-numeric: tabular-nums; }
.sell-cell .v.up { color: var(--green); } .sell-cell .v.dn { color: var(--red); }

.sell-settings { margin-top: 12px; font-size: 12px; color: var(--muted); }
.sell-settings summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 12px; }
.sell-settings input { width: 68px; background: var(--ink3); border: 1px solid var(--line2); color: var(--text);
  border-radius: 8px; padding: 6px 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; margin: 0 4px; }
.sell-disc { font-size: 11px; color: var(--muted); margin-top: 12px; line-height: 1.5; opacity: .85; }

/* Touch targets on a phone: the thumb and the presets both grow. */
@media (max-width: 700px) {
  .sell-range { height: 6px; margin: 18px 0 6px; }
  .sell-range::-webkit-slider-thumb { width: 26px; height: 26px; }
  .sell-range::-moz-range-thumb { width: 26px; height: 26px; }
  .sell-presets .chip { padding: 9px 13px; font-size: 12px; }
  .sell-strip { height: 30px; }
}

/* =========================================================================
 * Feature switches (lib/features.js). Elements tagged data-feature="x" are hidden while
 * that feature is off; <html> carries a .no-x class. Presentation only - no data is removed.
 * ========================================================================= */
html.no-tasks [data-feature="tasks"],
html.no-history [data-feature="history"] { display: none !important; }

/* Rebalance the 12-column Home grid when tiles disappear, so no row is left half empty:
 * without the Tasks tile, Allocation + Fear & greed share a row (6 + 6); without the Snapshot
 * streak tile, the Intel tile takes the full width. */
html.no-tasks #homeView .alloc,
html.no-tasks #homeView .watch,
html.no-tasks #homeView .upcoming,
html.no-tasks #homeView .fgt { grid-column: span 6; }
html.no-history #homeView .newst { grid-column: span 12; }

/* =========================================================================
 * Theme toggle (header). One control, two inline icons: the moon is shown in light mode
 * ("go dark") and the sun in dark mode ("go light"). Switching is pure CSS on <html data-theme>.
 * ========================================================================= */
.theme-toggle { width: 36px; height: 36px; flex: 0 0 36px; display: inline-grid; place-items: center; padding: 0; border-radius: 50%; background: var(--ink2); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow-card); cursor: pointer; transition: color .15s, border-color .15s, transform .15s; }
.theme-toggle:hover { color: var(--accent); border-color: var(--line2); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (max-width: 780px) {
  .theme-toggle { width: 34px; height: 34px; flex-basis: 34px; }
}
@media (prefers-reduced-motion: reduce) { .theme-toggle { transition: none; } }

/* =========================================================================
 * Live prices (live.js). The hero numbers tint briefly when a price moves, and the freshness pill
 * reads "Live" while quotes are streaming in.
 * ========================================================================= */
#homeValue[data-flash="up"], #positionPrice[data-flash="up"] { animation: num-flash-up .9s ease-out; }
#homeValue[data-flash="down"], #positionPrice[data-flash="down"] { animation: num-flash-down .9s ease-out; }
@keyframes num-flash-up { 0% { color: var(--green); } 100% { color: inherit; } }
@keyframes num-flash-down { 0% { color: var(--red); } 100% { color: inherit; } }
.freshness.live.streaming { color: var(--green); font-weight: 700; }
.freshness.live.streaming .freshness-dot { animation: live-dot-ping 1.6s ease-out infinite; }
@keyframes live-dot-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) {
  #homeValue[data-flash], #positionPrice[data-flash] { animation: none; }
  .freshness.live.streaming .freshness-dot { animation: none; }
}

/* The Live tag beside "NET WORTH": auto right-margin keeps it next to the label while the header
 * tools stay pushed to the far right. [hidden] is restated because .freshness sets display. */
.live-tag { margin: 0 auto 0 10px; }
.live-tag[hidden] { display: none; }

/* =========================================================================
 * Live search dropdown (search-ui.js) and asset preview page (asset-preview.js)
 * ========================================================================= */
.search-box { position: relative; display: flex; align-items: center; gap: 8px; width: 250px; background: var(--ink2); border: 1px solid var(--line); border-radius: 99px; padding: 0 12px; height: 36px; box-shadow: var(--shadow-card); transition: width .2s ease, border-color .15s, box-shadow .15s; }
.search-box.open, .search-box:focus-within { width: 340px; border-color: var(--bright); }
.sb-ic { flex: none; color: var(--muted); }
.search-box .sb-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; box-shadow: none; border-radius: 0; padding: 0; height: 100%; font: inherit; font-size: 13px; color: var(--bright); }
.search-box .sb-input::placeholder { color: var(--muted); }
.sb-clear { flex: none; border: 0; background: var(--ink3); color: var(--sub); width: 18px; height: 18px; border-radius: 50%; line-height: 16px; font-size: 14px; padding: 0; cursor: pointer; }
.sb-clear:hover { color: var(--bright); }
.search-box.open .sb-kbd { display: none; }
.search-drop { position: absolute; top: calc(100% + 8px); right: 0; width: max(100%, 420px); max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain; background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.18); padding: 6px; z-index: 60; animation: sr-in .12s ease-out; }
@keyframes sr-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sr-title { display: flex; align-items: center; gap: 8px; padding: 10px 12px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sr-title > span:first-child { flex: 1; }
.sr-clear { border: 0; background: none; color: var(--sub); font: inherit; font-size: 11px; font-weight: 700; text-transform: none; letter-spacing: 0; cursor: pointer; text-decoration: underline; padding: 0; }
.sr-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; cursor: pointer; min-width: 0; }
.sr-row[aria-selected="true"] { background: var(--ink3); }
.sr-ic { position: relative; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ink3); color: var(--sub); display: grid; place-items: center; font-size: 11px; font-weight: 800; overflow: hidden; }
.sr-ic .a-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.sr-glyph { font-size: 14px; }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sr-sym { font-weight: 800; font-size: 13.5px; color: var(--bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-name { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-row mark { background: none; color: inherit; font-weight: 900; text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px; }
.sr-tag { flex: none; font-size: 11px; color: var(--muted); text-align: right; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-held { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 99px; background: var(--ink3); color: var(--sub); font-weight: 700; font-size: 10px; }
.sr-q { flex: none; display: flex; flex-direction: column; align-items: flex-end; min-width: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.sr-q:empty { display: none; }
.sr-px { font-weight: 700; color: var(--bright); }
.sr-ch { font-size: 11px; font-weight: 700; color: var(--muted); }
.sr-ch.up, .pv-change.up { color: var(--green); }
.sr-ch.dn, .pv-change.dn { color: var(--red); }
.sr-note { padding: 14px 12px; font-size: 12.5px; color: var(--muted); }
.sr-err { color: var(--red); }
.sr-skel-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.sr-skel-row i { width: 32px; height: 32px; border-radius: 50%; background: var(--ink3); }
.sr-skel-row b { flex: 1; height: 12px; border-radius: 6px; background: var(--ink3); }
.sr-skel-row i, .sr-skel-row b { animation: sr-pulse 1.2s ease-in-out infinite; }
@keyframes sr-pulse { 50% { opacity: .45; } }
.sr-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--sub); animation: sr-rot .7s linear infinite; display: inline-block; }
@keyframes sr-rot { to { transform: rotate(360deg); } }

/* preview page */
.pv-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 2px 0 18px; }
.pv-id { flex: 1; min-width: 200px; }
.pv-id h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pv-id p { font-size: 14px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.pv-id .pv-tag { font-size: 12px; }
.pv-held { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--ink3); color: var(--sub); letter-spacing: 0; }
.pv-px { text-align: right; }
.pv-price { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); font-variant-numeric: tabular-nums; }
.pv-price small { font-size: .6em; opacity: .6; }
.pv-change { font-size: 13.5px; font-weight: 700; color: var(--muted); min-height: 1.3em; font-variant-numeric: tabular-nums; }
.btn.ghost { border: 1px solid var(--line); background: var(--ink2); color: var(--bright); font-weight: 800; font-size: 13px; border-radius: 99px; padding: 10px 18px; cursor: pointer; font-family: var(--sans); }
.pv-chart-tile { margin-bottom: 16px; }
.pv-ranges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.pv-ranges button { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.pv-ranges button.on { background: var(--bright); color: var(--ink2); }
.pv-chart-wrap { position: relative; height: 340px; }
.pv-chart { position: absolute; inset: 0; }
.pv-chart-state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; background: var(--ink2); }
.pv-chart-state[hidden] { display: none; }
.pv-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.pv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin-top: 8px; }
.pv-stat { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pv-stat span { color: var(--muted); }
.pv-stat b { color: var(--bright); text-transform: capitalize; }
.pv-news { display: flex; flex-direction: column; margin-top: 6px; }
.pv-news-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.pv-news-item:hover .pv-news-t { text-decoration: underline; }
.pv-news-t { font-size: 13.5px; font-weight: 700; color: var(--bright); }
.pv-news-m, .pv-muted { font-size: 12px; color: var(--muted); }
.pv-muted { padding: 10px 0; }
html[data-theme="dark"] .search-drop { box-shadow: 0 18px 50px rgba(0,0,0,.55); }
html[data-theme="dark"] .pv-ranges button.on { color: #0f0f11; }
@media (max-width: 780px) {
  .search-box, .search-box.open, .search-box:focus-within { flex: 1; width: auto; min-width: 0; }
  .search-box .sb-kbd { display: none; }
  .search-box.open { position: fixed; left: 8px; right: 8px; top: 8px; height: 40px; width: auto; z-index: 61; }
  .search-drop { position: fixed; left: 8px; right: 8px; top: 56px; width: auto; max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); }
  .sr-tag { max-width: 90px; }
  .pv-cols { grid-template-columns: 1fr; }
  .pv-px { text-align: left; width: 100%; }
  .pv-chart-wrap { height: 260px; }
  #previewView .wrap { padding-bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { .search-drop, .sr-spin, .sr-skel-row i, .sr-skel-row b { animation: none; } }
#pvPrice[data-flash="up"] { animation: num-flash-up .9s ease-out; }
#pvPrice[data-flash="down"] { animation: num-flash-down .9s ease-out; }
@media (prefers-reduced-motion: reduce) { #pvPrice[data-flash] { animation: none; } }

/* =========================================================================
 * Home: Market mood (two slim fear & greed meters) and the header alert bell (home-widgets.js)
 * ========================================================================= */
.fgt { grid-column: span 4; }
.fg-body { display: flex; flex-direction: column; }
.fg-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 96px; gap: 12px; align-items: center; padding: 9px 0; font-size: 13px; }
.fg-k { font-weight: 700; color: var(--bright); }
.fg-meter { position: relative; height: 7px; border-radius: 7px; background: linear-gradient(90deg, #e24b4a 0%, #ef9f27 25%, #b4b2a9 50%, #97c459 75%, #3b8f1d 100%); }
.fg-meter i { position: absolute; top: -4px; width: 4px; height: 15px; margin-left: -2px; border-radius: 2px; background: var(--bright); box-shadow: 0 0 0 2px var(--ink2); transition: left .8s cubic-bezier(.2,.8,.2,1); }
.fg-load .fg-meter { opacity: .35; }
.fg-v { text-align: right; white-space: nowrap; }
.fg-v b { font-size: 16px; font-weight: 800; color: var(--bright); font-variant-numeric: tabular-nums; }
.fg-v em { font-style: normal; font-size: 11.5px; font-weight: 800; }
.fg-err { grid-template-columns: 54px minmax(0, 1fr) auto; }
.fg-msg { font-size: 12px; color: var(--muted); }
.fg-retry { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; }
.fg-info { margin-top: 6px; font-size: 12px; color: var(--muted); }
.fg-info summary { cursor: pointer; font-weight: 700; color: var(--sub); list-style: none; }
.fg-info summary::-webkit-details-marker { display: none; }
.fg-info summary::before { content: "\24d8  "; }
.fg-info p { margin: 8px 0 4px; line-height: 1.5; }
.fg-d { margin-top: 12px; }
.fg-dh { font-weight: 800; color: var(--bright); }
.fg-dh small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.fg-comp { display: grid; grid-template-columns: 1fr 30px; gap: 2px 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fg-comp:last-of-type { border-bottom: 0; }
.fg-comp span { color: var(--bright); font-weight: 700; display: flex; flex-direction: column; }
.fg-comp small { color: var(--muted); font-weight: 500; font-size: 11px; }
.fg-comp b { text-align: right; color: var(--bright); font-variant-numeric: tabular-nums; }
.fg-comp em { grid-column: 1 / -1; height: 4px; background: var(--ink3); border-radius: 4px; overflow: hidden; }
.fg-comp em u { display: block; height: 100%; background: var(--sub); border-radius: 4px; }
.fg-src { margin-top: 6px; font-size: 11px; color: var(--muted); }
.fg-src a { color: var(--accent); text-decoration: none; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .fg-meter i { transition: none; } }

.alert-bell { position: relative; width: 36px; height: 36px; flex: 0 0 36px; display: inline-grid; place-items: center; padding: 0; border-radius: 50%; background: var(--ink2); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow-card); cursor: pointer; transition: color .15s, border-color .15s; }
.alert-bell:hover { color: var(--bright); border-color: var(--bright); }
.alert-bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bell-badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center; color: #fff; background: var(--muted); box-sizing: border-box; border: 2px solid var(--ink2); line-height: 13px; }
.bell-badge[hidden] { display: none; }
.bell-badge.hot { background: var(--red); }
.bell-badge.warm { background: #d98a1c; }
@media (max-width: 780px) { .alert-bell { width: 34px; height: 34px; flex-basis: 34px; } }

/* Home polish: total inside the donut hole must fit; movers rows spread down the taller tile */
.donut-hold .donut-center .n { font-size: 15px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.donut-hold .donut-center .l { font-size: 9px; }
.donut-center > div { max-width: 84px; }
.movers { display: flex; flex-direction: column; }
.movers #homeMovers { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; }
.movers #homeMovers .mv-row { margin-top: 0; }
@media (max-width: 780px) {
  .alloc .donut-box { flex-direction: column; align-items: stretch; gap: 14px; }
  .alloc .donut-hold { align-self: center; }
  .alloc .alloc-rebal { margin-top: 6px; }
}

/* Stats block (asset preview): label above value, 3 columns for stocks and 2 for crypto */
.pv-cols { grid-template-columns: 1.35fr 1fr; }
.pv-stats { display: grid; gap: 22px 18px; margin-top: 14px; }
.pv-stats.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pv-stats.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pv-stats .pv-stat { display: flex; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 0; border-bottom: 0; font-size: 12.5px; min-width: 0; }
.pv-stats .pv-stat span { color: var(--muted); font-weight: 600; }
.pv-stats .pv-stat b { font-size: 17px; font-weight: 700; color: var(--bright); text-transform: none; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pv-stats.is-loading .pv-stat b { opacity: .35; }
.pv-stats-src { margin-top: 16px; font-size: 11px; color: var(--muted); min-height: 1.2em; }
@media (max-width: 780px) { .pv-cols { grid-template-columns: 1fr; } .pv-stats.cols-3 { gap: 18px 12px; } .pv-stats .pv-stat b { font-size: 15px; } }

/* Attribution for the chart library (its license requires a visible credit now that the logo is off the charts) */
.app-credit { padding: 28px 16px 96px; text-align: center; font-size: 11.5px; color: var(--muted); }
.app-credit a { color: var(--sub); text-decoration: underline; }

/* Position page Stats tile: full width, so let the columns flow instead of fixing 2 or 3 */
.pstats { grid-column: span 12; }
.pstats[hidden] { display: none; }
.pstats .pv-stats.cols-3, .pstats .pv-stats.cols-2 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
#positionView.first-run .tile.pstats { display: none; }

/* =========================================================================
 * Guided "Add to portfolio" flow (add-flow-ui.js)
 * ========================================================================= */
.add-modal { width: min(520px, 100%); }
.add-steps { list-style: none; display: flex; gap: 6px; margin: 0 0 16px; padding: 0; }
.add-steps li { flex: 1; font-size: 12px; font-weight: 700; color: var(--muted); border-top: 2px solid var(--line); padding-top: 6px; }
.add-steps li.on { color: var(--bright); border-color: var(--bright); }
.add-steps li.done { color: var(--sub); border-color: var(--sub); }
.add-segs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.add-seg { display: inline-flex; background: var(--ink3); border-radius: 99px; padding: 3px; flex-wrap: wrap; }
.add-seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 99px; color: var(--muted); cursor: pointer; }
.add-seg button.on { background: var(--bright); color: var(--ink2); }
.add-lb { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 14px 0 5px; }
.add-in { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--bright); background: var(--ink2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.add-in:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.add-row > div { min-width: 0; }
.add-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; min-height: 1.3em; }
.add-link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; }
.add-res { border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; max-height: 260px; overflow-y: auto; background: var(--ink2); }
.add-res[hidden] { display: none; }
.add-rt { padding: 8px 12px 3px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.add-ri { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13px; cursor: pointer; border-radius: 8px; margin: 0 4px; }
.add-ri[aria-selected="true"], .add-ri:hover { background: var(--ink3); }
.add-ri b { color: var(--bright); }
.add-ri small, .add-sub { color: var(--muted); font-size: 12px; }
.add-tagc { white-space: nowrap; }
.add-note { padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.add-note.err { color: var(--red); }
.add-sel { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--ink3); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.add-sel-t { font-weight: 800; color: var(--bright); font-size: 15px; }
.add-sel-t small { font-weight: 500; }
.add-sel-r { text-align: right; }
.add-px { font-size: 20px; font-weight: 800; color: var(--bright); font-variant-numeric: tabular-nums; }
.add-live { font-size: 11px; font-weight: 700; color: var(--green); }
.add-chip { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--ink2); color: var(--sub); white-space: nowrap; }
.add-more { margin-top: 12px; font-size: 13px; }
.add-more summary { cursor: pointer; font-weight: 700; color: var(--sub); }
.add-tg { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; font-weight: 700; color: var(--bright); }
.add-tg small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.add-sw { position: relative; width: 38px; height: 22px; flex: none; border: 0; border-radius: 99px; background: var(--line2, #c9c7c0); cursor: pointer; padding: 0; transition: background .15s; }
.add-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.add-sw.on { background: var(--green); }
.add-sw.on::after { left: 19px; }
.add-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.add-tot, .add-rv { background: var(--ink3); border-radius: 14px; padding: 12px 14px; margin-top: 14px; font-size: 13px; }
.add-tot:empty { display: none; }
.add-tot > div, .add-rv > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.add-tot span, .add-rv span { color: var(--muted); }
.add-tot b, .add-rv b { color: var(--bright); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.add-warn { font-size: 12.5px; color: #b26a00; margin-top: 8px; }
.add-warn:empty { display: none; }
.add-warn.bad { color: var(--red); }
.add-fine { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.add-msg { font-size: 12.5px; color: var(--red); margin-top: 10px; }
.add-msg[hidden] { display: none; }
.add-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
html[data-theme="dark"] .add-warn { color: #e0a24a; }
html[data-theme="dark"] .add-seg button.on { color: #0f0f11; }
@media (max-width: 520px) { .add-row { grid-template-columns: 1fr; gap: 0; } .add-modal { padding: 18px; } }
@media (prefers-reduced-motion: reduce) { .add-sw, .add-sw::after { transition: none; } }
.add-actions { position: sticky; bottom: -24px; background: var(--ink2); padding: 14px 0 0; margin-bottom: -6px; z-index: 1; }
@media (max-width: 520px) { .add-actions { bottom: -18px; } }

/* Anchor the add flow to the top of the screen: its height changes with every step and with the search results, and
 * a vertically centred modal would slide its controls around under the pointer. */
#addModal { align-items: flex-start; padding-top: min(9vh, 72px); }
#addModal .add-modal { max-height: calc(100vh - min(9vh, 72px) - 24px); }

/* =========================================================================
 * Today's movers (movers-ui.js): headline, gainers and losers by dollar impact, sparklines
 * ========================================================================= */
.movers #homeMovers { display: block; flex: none; justify-content: initial; }
.mv2-seg { display: inline-flex; background: var(--ink3); border-radius: 99px; padding: 2px; }
.mv2-seg button { border: 0; background: none; font: inherit; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; color: var(--muted); cursor: pointer; }
.mv2-seg button.on { background: var(--bright); color: var(--ink2); }
.mv2-hero { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mv2-net { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.mv2-netp { font-size: 13px; font-weight: 700; }
.mv2-net.up, .mv2-netp.up, .mv2-sub .up { color: var(--green); }
.mv2-net.dn, .mv2-netp.dn, .mv2-sub .dn { color: var(--red); }
.mv2-net.flat, .mv2-netp.flat { color: var(--muted); }
.mv2-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.mv2-sub b { font-weight: 700; color: var(--bright); }
.mv2-sec { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted); padding: 14px 0 2px; }
.mv2-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 56px 66px; gap: 10px; align-items: center; padding: 7px 4px 5px; margin: 0 -4px; font-size: 13px; cursor: pointer; border-radius: 10px; }
.mv2-row:hover, .mv2-row:focus-visible { background: var(--ink3); outline: none; }
.mv2-ic { position: relative; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; overflow: hidden; }
.mv2-ic .a-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.mv2-id { min-width: 0; }
.mv2-sym { font-weight: 800; color: var(--bright); display: flex; align-items: center; gap: 6px; }
.mv2-tag { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--ink3); color: var(--sub); letter-spacing: .03em; }
.mv2-nm { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv2-spark path { stroke: var(--muted); }
.mv2-spark.up path { stroke: var(--green); }
.mv2-spark.dn path { stroke: var(--red); }
.mv2-val { display: flex; flex-direction: column; align-items: stretch; }
.mv2-pill { text-align: center; padding: 3px 0; border-radius: 99px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--ink3); color: var(--muted); }
.mv2-pill.up { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.mv2-pill.dn { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.mv2-alt { text-align: right; font-size: 10.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.mv2-bar { grid-column: 2 / 5; height: 3px; background: var(--ink3); border-radius: 3px; position: relative; margin-top: -1px; }
.mv2-bar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; background: var(--muted); }
.mv2-bar i.up { background: var(--green); }
.mv2-bar i.dn { background: var(--red); }
.mv2-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.mv2-more { border: 0; background: none; padding: 0; margin-top: 8px; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer; }

/* Home greeting row: text on the left, the Add button on the right */
.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.greet-text { min-width: 0; }
.greet-note { font-weight: 500; color: var(--muted); }
.add-btn { flex: none; border: 0; border-radius: 99px; background: var(--bright); color: var(--ink2); font: inherit; font-size: 13px; font-weight: 800; padding: 9px 18px; cursor: pointer; margin-bottom: 4px; }
.add-btn:hover { opacity: .88; }
.add-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#homeView.first-run .add-btn { display: none; }
@media (max-width: 520px) { .greet-note { display: none; } .add-btn { padding: 8px 14px; } }

/* Net worth stat row (renderHomeStats) and a clearer benchmark label */
.worth-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ws-cell { min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.ws-cell span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.ws-cell b { display: block; margin-top: 2px; font-size: 15px; font-weight: 800; color: var(--bright); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-cell b em { font-style: normal; font-size: 11.5px; font-weight: 700; opacity: .8; }
.ws-cell b.up { color: var(--green); } .ws-cell b.dn { color: var(--red); }
.ws-btn { cursor: pointer; border-radius: 8px; }
.ws-btn:hover b { text-decoration: underline; }
.ws-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.bench-lbl { font-size: 11px; font-weight: 700; color: var(--muted); align-self: center; margin-right: 2px; }
@media (max-width: 640px) { .worth-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; } }
@media (max-width: 780px) { .tile.worth .worth-stats { order: 5; margin-top: 12px; } .tile.worth .bench-row { order: 6; } }

/* Allocation: drift against the target weights */
.dl-row .dr { min-width: 74px; text-align: right; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-row .dr.ok { color: var(--muted); }
.dl-row .dr.over { color: #b26a00; }
.dl-row .dr.under { color: var(--accent); }
.dl-row .dr.none { color: var(--muted); font-weight: 500; }
html[data-theme="dark"] .dl-row .dr.over { color: #e0a24a; }
.dl-hint { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.45; }

/* The Allocation tile lays itself out by its OWN width (the window width says nothing about a half-width tile):
 * donut beside the legend when there is room, stacked above it when there is not, and no dollar column when even that is tight. */
.alloc { container: alloc / inline-size; }
@container alloc (max-width: 500px) {
  .alloc .donut-box { flex-direction: column; align-items: stretch; gap: 14px; }
  .alloc .donut-hold { align-self: center; }
}
@container alloc (max-width: 340px) { .alloc .dl-row .dv { display: none; } }

/* =========================================================================
 * Home: Watchlist (watchlist-ui.js)
 * ========================================================================= */
.watch { grid-column: span 4; }
.wl-count { font-weight: 700; color: var(--muted); margin-left: 4px; }
.wl-search { margin: 4px 0 8px; position: relative; }
.wl-search[hidden] { display: none; }
.wl-search .add-res { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; box-shadow: 0 12px 30px rgba(0,0,0,.14); }
.wl-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 50px 78px 22px; gap: 10px; align-items: center; padding: 8px 4px; margin: 0 -4px; border-radius: 10px; font-size: 13px; cursor: pointer; }
.wl-row + .wl-row { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.wl-row:hover, .wl-row:focus-visible { background: var(--ink3); outline: none; }
.wl-id { min-width: 0; }
.wl-sym { font-weight: 800; color: var(--bright); }
.wl-nm { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-px { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.wl-px b { font-weight: 800; color: var(--bright); }
.wl-px span { font-size: 11px; font-weight: 700; color: var(--muted); }
.wl-px .up { color: var(--green); } .wl-px .dn { color: var(--red); }
.wl-x { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; opacity: 0; border-radius: 50%; width: 22px; height: 22px; }
.wl-row:hover .wl-x, .wl-row:focus-within .wl-x, .wl-x:focus-visible { opacity: 1; }
.wl-x:hover { color: var(--red); background: var(--ink3); }
@media (hover: none) { .wl-x { opacity: .55; } }
.wl-empty { text-align: center; padding: 22px 8px 14px; color: var(--muted); font-size: 12.5px; }
.wl-empty b { display: block; color: var(--bright); font-size: 14px; margin-bottom: 4px; }
.wl-empty p { margin: 0 0 12px; }
.wl-big { border: 0; border-radius: 99px; background: var(--bright); color: var(--ink2); font: inherit; font-size: 13px; font-weight: 800; padding: 8px 16px; cursor: pointer; }
html[data-theme="dark"] .wl-search .add-res { box-shadow: 0 12px 30px rgba(0,0,0,.5); }
@media (max-width: 1000px) { .watch { grid-column: span 12; } }
@media (max-width: 780px) { #homeView .watch { order: 2; } }
#homeView.first-run .tile.watch { display: none; }

/* =========================================================================
 * Home: Upcoming earnings and dividends (events-ui.js)
 * ========================================================================= */
.upcoming { grid-column: span 4; }
.up-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 4px; margin: 0 -4px; border-radius: 10px; cursor: pointer; }
.up-row + .up-row { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.up-row:hover, .up-row:focus-visible { background: var(--ink3); outline: none; }
.up-dt { text-align: center; background: var(--ink3); border-radius: 10px; padding: 5px 0; line-height: 1.1; }
.up-dt b { display: block; font-size: 16px; font-weight: 800; color: var(--bright); font-variant-numeric: tabular-nums; }
.up-dt span { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.up-t { font-size: 13px; font-weight: 800; color: var(--bright); }
.up-t em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.up-d { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.up-empty { padding: 18px 4px 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.up-load { opacity: .7; }
.up-retry, .up-more { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; }
.up-more { display: block; margin-top: 8px; text-decoration: none; }
.up-foot { margin-top: 12px; font-size: 11px; color: var(--muted); }
@media (max-width: 1000px) { .upcoming { grid-column: span 12; } }
@media (max-width: 780px) { #homeView .upcoming { order: 4; } }
#homeView.first-run .tile.upcoming { display: none; }

/* =========================================================================
 * Portfolio: KPI strip and benchmark legend (renderPortfolioKpis / renderPerfLegend)
 * ========================================================================= */
.pf-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 3px; min-width: 0; text-align: left; background: var(--ink2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-card); font: inherit; color: inherit; }
.kpi-l { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }
.kpi-v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-d { font-size: 11.5px; font-weight: 600; color: var(--sub); font-variant-numeric: tabular-nums; }
.kpi .up, .kpi-v.up, .kpi-d.up { color: var(--green); } .kpi .dn, .kpi-v.dn, .kpi-d.dn { color: var(--red); }
.kpi-v.flat, .kpi-d.flat { color: var(--muted); }
.kpi-btn { cursor: pointer; }
.kpi-btn:hover { border-color: var(--bright); }
.kpi-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-legend2 { flex-wrap: wrap; align-items: center; }
.chart-legend2 .lg-r { font-variant-numeric: tabular-nums; }
.chart-legend2 .lg-r.up { color: var(--green); } .chart-legend2 .lg-r.dn { color: var(--red); }
.chart-legend2 .lg-quiet { color: var(--muted); }
.chart-legend2 .lg-chip { margin-left: auto; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--ink3); color: var(--bright); }
@media (max-width: 1000px) { .pf-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .pf-kpis .kpi:first-child { grid-column: 1 / -1; } .kpi { padding: 12px 14px; } .kpi-v { font-size: 20px; } }
#portfolioView.first-run .pf-kpis { display: none; }


/* Portfolio: Top holdings card */
.th-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) 84px auto; align-items: center; gap: 10px; width: 100%; padding: 10px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.th-row:last-of-type { border-bottom: 0; }
.th-row:hover { background: var(--ink2); }
.th-dot { width: 10px; height: 10px; border-radius: 50%; }
.th-id { display: flex; flex-direction: column; min-width: 0; }
.th-id b { font-size: 13px; color: var(--bright); }
.th-id small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-w { display: flex; align-items: center; gap: 6px; }
.th-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--ink3); overflow: hidden; }
.th-bar i { display: block; height: 100%; border-radius: 99px; }
.th-w em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--sub); min-width: 28px; text-align: right; }
.th-pill { font-family: var(--mono); font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--ink3); color: var(--sub); }
.th-pill.up { background: rgba(31, 158, 99, .12); color: var(--green); }
.th-pill.dn { background: rgba(214, 69, 65, .12); color: var(--red); }
.th-more { font-size: 11.5px; color: var(--muted); padding: 8px 4px 2px; }



/* Portfolio: What drove your return */
.drove { grid-column: span 8; }
.drove-total { font-size: 12px; color: var(--muted); }
.drove-total b.up { color: var(--green); } .drove-total b.dn { color: var(--red); }
.dv-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 9px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.dv-row:hover { background: var(--ink2); }
.dv-id { display: flex; flex-direction: column; min-width: 0; }
.dv-id b { font-size: 13px; color: var(--bright); }
.dv-id small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-bar { height: 8px; border-radius: 99px; background: var(--ink3); overflow: hidden; }
.dv-bar i { display: block; height: 100%; border-radius: 99px; }
.dv-bar i.up { background: var(--green); } .dv-bar i.dn { background: var(--red); }
.dv-usd { font-family: var(--mono); font-size: 12.5px; font-weight: 700; min-width: 74px; text-align: right; }
.dv-usd.up { color: var(--green); } .dv-usd.dn { color: var(--red); }


/* Position page: KPI strip, two columns, and the phone action bar */
.pos-kpis { margin: 4px 0 18px; }
.kpi-d.warn { color: #b97f0a; }
.pos-cols { grid-column: span 12; display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 18px; align-items: start; }
.pos-main, .pos-side { display: grid; gap: 18px; min-width: 0; align-content: start; }
.pos-cols .tile { grid-column: auto; }
.pos-cols .act-tile .act-filters { flex-wrap: wrap; }
.pill-note { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-right: auto; margin-left: 10px; }
.lr-main { min-width: 0; } .lr-end { text-align: right; flex: none; }
.lr-end b.up { color: var(--green); } .lr-end b.dn { color: var(--red); }
.pt-line { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.pt-line b { font-size: 22px; color: var(--bright); } .pt-line span { font-size: 12px; color: var(--muted); }
.pt-bar { height: 8px; border-radius: 99px; background: var(--ink3); position: relative; margin-top: 8px; }
.pt-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); }
.pt-bar i.over { background: #c98a12; } .pt-bar i.on { background: var(--green); }
.pt-tgt { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--bright); border-radius: 2px; }
.pt-note { font-size: 12.5px; color: var(--sub); margin: 10px 0 8px; line-height: 1.45; }
.pt-note b { color: var(--bright); }
.pt-actions { display: flex; gap: 8px; }
.pt-income { font-size: 12px; color: var(--muted); margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.pt-income b { color: var(--bright); }
.pa-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.pa-row:first-child { border-top: 0; }
.pa-t { min-width: 0; flex: 1; } .pa-t b { display: block; font-size: 13px; color: var(--bright); } .pa-t small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.pa-bar { height: 6px; border-radius: 99px; background: var(--ink3); margin-top: 6px; overflow: hidden; } .pa-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pill-s { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--ink3); color: var(--sub); flex: none; }
.pill-s.bl { background: rgba(42, 120, 214, .12); color: var(--accent); } .pill-s.am { background: rgba(185, 127, 10, .14); color: #b97f0a; }
@media (max-width: 1000px) {
  .pos-cols { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
  .pos-main, .pos-side { display: contents; }
  .pos-cols #posTargetTile { order: 1; } .pos-cols #posAlertsTile { order: 2; } .pos-cols .pos-lots { order: 3; }
  .pos-cols #posStatsTile { order: 4; } .pos-cols .act-tile { order: 5; } .pos-cols .newsline { order: 6; } .pos-cols .taxt { order: 7; }
}
@media (max-width: 640px) {
  .pos-kpis .kpi:first-child { grid-column: 1 / -1; }
}

/* Activity: KPI strip, ledger as a month-grouped list, side tiles */
.act-k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.act-cols { grid-column: span 12; display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 18px; align-items: start; }
.act-side { display: grid; gap: 18px; min-width: 0; align-content: start; }
#activityView .act-cols .act-tile { grid-column: auto; min-width: 0; }
.act-search { min-width: 150px; }
.al-mh { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 4px 4px; }
.al-mh:first-child { padding-top: 4px; }
.al-row { border-top: 1px solid var(--line); }
.al-mh + .al-row { border-top: 0; }
.al-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 4px; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 10px; }
.al-head:hover { background: var(--ink); }
.al-icw { flex: none; display: inline-flex; }
.al-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; }
.al-ic.cash { background: #e0a021; }
.al-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.al-main b { font-size: 13.5px; color: var(--bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-main small { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-end { flex: none; text-align: right; display: flex; flex-direction: column; }
.al-end b { font-size: 13.5px; color: var(--bright); } .al-end b.up, .al-end small.up { color: var(--green); } .al-end b.dn, .al-end small.dn { color: var(--red); }
.al-end small { font-size: 11.5px; font-weight: 700; }
.al-detail { padding: 2px 4px 14px 48px; }
.al-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px 14px; }
.al-cell span { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.al-cell b { font-size: 13px; color: var(--bright); font-family: var(--mono); font-weight: 600; } .al-cell b .up { color: var(--green); } .al-cell b .dn { color: var(--red); }
.al-actions { display: flex; gap: 8px; margin-top: 12px; }
.al-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--ink2); font: inherit; font-size: 12.5px; font-weight: 700; color: var(--bright); cursor: pointer; }
.al-actions button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.al-actions button.danger { color: var(--red); }
.ay-bars { display: flex; align-items: flex-end; gap: 16px; padding: 4px 8px 0; min-height: 130px; }
.ay-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; text-align: center; }
.ay-col i { display: block; width: 100%; max-width: 64px; border-radius: 8px 8px 0 0; background: var(--muted); }
.ay-col i.up { background: var(--green); } .ay-col i.dn { background: var(--red); }
.ay-col small { font-size: 11px; color: var(--muted); font-weight: 700; } .ay-col b { font-size: 12px; font-family: var(--mono); color: var(--bright); } .ay-col b.up { color: var(--green); } .ay-col b.dn { color: var(--red); }
.an-row { padding: 9px 0; border-top: 1px solid var(--line); } .an-row:first-child { border-top: 0; }
.an-row b { display: block; font-size: 13px; color: var(--bright); } .an-row small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.an-disc { font-size: 11px; color: var(--muted); margin-top: 8px; }
@media (max-width: 1000px) {
  .act-cols { display: flex; flex-direction: column; align-items: stretch; }
  .act-k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .al-detail { padding-left: 4px; }
  .act-search { flex: 1 1 100%; width: 100%; }
  .act-k4 .kpi:first-child { grid-column: auto; }
}

.lot-row2 { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line); }
.lot-row2:first-child { border-top: 0; }
.lot-row2 b { display: block; font-size: 13.5px; color: var(--bright); }
.lot-row2 small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.al-cell .term { display: inline-block; }


/* News: your brief, day groups, "you hold" lines */
.nbrief { grid-column: span 8; background: linear-gradient(150deg, #1c2f4e 0%, #132038 60%, #0f1a2e 100%); border: 0; color: #fff; display: flex; flex-direction: column; gap: 10px; }
.nb-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8fb8ff; }
.nb-lead { margin: 0; font-size: 16px; line-height: 1.5; color: #fff; } .nb-lead b { color: #fff; }
.nb-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.nb-list li { font-size: 13.5px; color: #dbe6f7; } .nb-list li b { color: #fff; } .nb-list li span { color: #8fa5c6; margin: 0 4px; }
.nb-go { align-self: flex-start; background: #fff; color: #111; border-color: #fff; }
.nb-note { font-size: 11px; color: #8fa5c6; }
.n-day { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 16px 4px; }
.n-day:first-child { padding-top: 4px; }
.n-sum { font-size: 12.5px; color: var(--sub); font-weight: 500; margin-top: 5px; line-height: 1.5; }
.n-impact { margin-top: 7px; font-size: 12px; color: var(--sub); background: var(--ink3); border-radius: 9px; padding: 5px 10px; display: inline-block; }
.n-impact b { color: var(--bright); } .n-impact b.up { color: var(--green); } .n-impact b.dn { color: var(--red); }
.n-gaps:empty { display: none; }
.n-gaps { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.n-gap { font-size: 12px; color: #b97f0a; font-weight: 600; line-height: 1.5; } .n-gap b { color: var(--bright); }
@media (max-width: 1000px) { .nbrief { grid-column: span 12; } }


/* Alerts: KPI strip, needs-attention, suggestions */
.al-cards { display: flex; flex-direction: column; gap: 14px; }
.al-attn { border-color: #e6c977; background: #fffdf5; }
html[data-theme="dark"] .al-attn { background: #2a2416; border-color: #5a4a1f; }
.al-warn { color: #b97f0a; }
.kpi-v.warn { color: #b97f0a; }
.an-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.an-item:first-of-type { border-top: 0; }
.an-t { min-width: 0; flex: 1 1 220px; } .an-t b { display: block; font-size: 14px; color: var(--bright); } .an-t small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.an-btns { display: flex; gap: 8px; }
.sg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.sg-row:first-of-type { border-top: 0; }
.sg-t { min-width: 0; } .sg-t b { display: block; font-size: 13.5px; color: var(--bright); } .sg-t small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.al-attn[hidden], .al-suggest[hidden] { display: none; }
@media (max-width: 640px) { .an-btns { width: 100%; } .an-btns .btn { flex: 1; justify-content: center; min-height: 44px; } }


/* =========================================================================
 * Guided "Edit position" (edit-flow-ui.js)
 * ========================================================================= */
#editModal { align-items: flex-start; padding-top: min(9vh, 72px); }
.ef-modal { max-height: calc(100vh - min(9vh, 72px) - 24px); overflow-y: auto; }
.ef-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ef-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: 11px; color: #fff; flex: none; background: var(--accent); }
.ef-ht { min-width: 0; flex: 1; } .ef-ht .modal-title { margin: 0; } .ef-ht small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.ef-pill { border-radius: 99px; background: var(--ink3); padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--sub); white-space: nowrap; } .ef-pill b { color: var(--bright); }
.ef-q { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; } .ef-q2 { margin-top: 14px; }
.ef-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; background: var(--ink2); font: inherit; color: inherit; cursor: pointer; }
.ef-opt:hover { border-color: var(--bright); } .ef-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ef-oi { width: 34px; height: 34px; border-radius: 10px; background: var(--ink3); display: grid; place-items: center; font-size: 16px; flex: none; }
.ef-ot { flex: 1; min-width: 0; } .ef-ot b { display: block; font-size: 14px; color: var(--bright); } .ef-ot small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-go { color: var(--muted); font-size: 20px; }
.ef-danger { text-align: center; margin-top: 14px; } .ef-del { color: var(--red); text-decoration: none; }
.ef-back { border: 0; background: none; padding: 0; margin-bottom: 10px; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent); cursor: pointer; }
.ef-big { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; } .ef-big > span:last-child { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.ef-bigv { display: inline-flex; align-items: baseline; gap: 2px; } .ef-bigv em { font-style: normal; font-size: 24px; font-weight: 800; color: var(--muted); }
.ef-num { width: 4.2ch; min-width: 0; font: inherit; font-size: 36px; font-weight: 800; letter-spacing: -.02em; color: var(--bright); background: none; border: 0; border-bottom: 2px solid var(--line); padding: 0; -moz-appearance: textfield; }
.ef-num::-webkit-outer-spin-button, .ef-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ef-num:focus { outline: none; border-color: var(--accent); }
.ef-track { position: relative; margin: 16px 0 6px; height: 28px; }
.ef-range { width: 100%; height: 28px; margin: 0; background: none; accent-color: var(--accent); cursor: pointer; }
.ef-now { position: absolute; top: 2px; bottom: 2px; width: 2px; background: var(--bright); opacity: .7; border-radius: 2px; pointer-events: none; z-index: 1; }
.ef-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 700; }
.ef-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.ef-chip { border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--sub); background: var(--ink2); cursor: pointer; }
.ef-chip.on { background: var(--bright); color: var(--ink2); border-color: var(--bright); }
.ef-prev { background: var(--ink3); border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--sub); margin-top: 10px; line-height: 1.5; } .ef-prev b { color: var(--bright); }
.ef-am { color: #b97f0a; font-weight: 700; }
.ef-note { border: 1px dashed #b97f0a; border-radius: 12px; padding: 8px 12px; font-size: 12px; color: #b97f0a; margin-top: 10px; } .ef-note[hidden] { display: none; }
.ef-seg { margin: 4px 0 8px; } .ef-sub { font-size: 13px; color: var(--sub); margin: 8px 0 12px; line-height: 1.5; } .ef-sub b { color: var(--bright); } .ef-warnp { color: var(--red); }
.ef-sw { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ef-swb { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; position: relative; overflow: hidden; }
.ef-swb.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.ef-swc { background: conic-gradient(#e33, #ee3, #3e3, #3ee, #33e, #e3e, #e33); } .ef-swc input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.ef-lock { font-size: 12px; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }
.ef-foot { position: sticky; bottom: -24px; display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 14px 0 0; border-top: 1px solid var(--line); background: var(--ink2); z-index: 1; flex-wrap: wrap; }
.ef-n { flex: 1; min-width: 110px; color: var(--muted); font-size: 12.5px; }
.ef-foot .btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 520px) { .ef-foot { bottom: -18px; } .ef-modal { padding: 18px; } }
html[data-theme="dark"] .ef-range { color-scheme: dark; }


/* Polish: the News brief is as tall as its text (not stretched to the Coverage card), and the Activity ledger's filters
 * sit on their own row under the title instead of wrapping beside it at in-between widths. */
.nbrief { align-self: start; }
#activityView .act-cols .act-tile .t-head { flex-direction: column; align-items: stretch; gap: 10px; }
#activityView .act-cols .act-tile .t-head .act-filters { width: 100%; }

/* =========================================================================
 * Phone layout fixes (mobile review, v0.9.57). Kept at the end of the file on purpose: several base rules above are
 * declared after the responsive blocks, and a later rule of equal weight wins, which is how these bugs happened.
 * ========================================================================= */
@media (max-width: 1000px) {
  /* "What drove your return" kept its desktop 8-of-12 width on phones: its base rule sits after the collapse above */
  .drove { grid-column: span 12; }
}
.dv-row { grid-template-columns: minmax(96px, 180px) minmax(0, 1fr) auto; }

/* one Live indicator per card: when the Live tag beside the title shows, the older freshness dot on the right stays hidden */
.t-head:has(.live-tag:not([hidden])) .head-tools [data-freshness] { display: none; }

/* suggested alerts: .btn sets no background, so the button fell back to the browser's light grey under light text */
.sg-row .btn { background: var(--bright); color: var(--ink2); border-color: var(--bright); border-radius: 99px; flex: none; }

/* the sell estimator's slider picked up the phone rule that gives every input a 44px box */
.sell-range { min-height: 0; height: 4px; padding: 0; border: 0; box-shadow: none; background: var(--line2); }
/* News → Latest: the list has only 6px side padding (each story row brings its own), so the empty message sat on the edge */
.feed > .empty { padding-inline: 16px; }
/* a chart built at one width and shown after the screen turned (rotation) must not spill past its card */
.pv-chart { overflow: hidden; }

@media (max-width: 640px) {
  /* chip and range rows: one line that scrolls sideways, instead of one chip wrapping alone onto a second line */
  .filters2, .pv-ranges, #holdFilters {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  .filters2::-webkit-scrollbar, .pv-ranges::-webkit-scrollbar, #holdFilters::-webkit-scrollbar { display: none; }
  .filters2 > *, .pv-ranges > *, #holdFilters > * { flex: none; }
  /* Holdings: the filter chips get their own row under the title instead of squeezing beside it */
  .holdings > .t-head { flex-wrap: wrap; row-gap: 10px; }
  .holdings > .t-head #holdFilters { order: 3; width: 100%; }

  /* Activity: the ledger filters wrap (see the 780px block above); the search takes a whole line so its placeholder fits,
     and the type chips scroll sideways inside their line instead of running past the card on a 320px phone */
  .act-tile .t-head .act-filters .act-search { flex: 1 1 100%; width: 100%; }
  .act-tile .t-head .act-filters #actTypeChips { flex: 0 1 auto; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .act-tile .t-head .act-filters #actTypeChips::-webkit-scrollbar { display: none; }
  .act-tile .t-head .act-filters #actTypeChips > * { flex: none; }

  /* Profile: one column, and every card full width (the column aligned cards to the start, shrinking them) */
  .profile-bento { align-items: stretch; }
  .profile-bento > .tile { width: 100%; }
  #profileForm .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  /* the Live tag is short enough to keep its word on a phone; the two bare dots it replaces meant nothing */
  .live-tag.freshness { gap: 6px; }
  .live-tag.freshness > span:last-child { display: inline; }
}
