/* Quantcept chat layout and components, Solix enterprise palette. */
:root {
  --bg: #f6f9fa;
  --bg-elevated: #fff;
  --bg-inset: #eef3f6;
  --bg-hover: #0d192d0b;
  --bg-accent-soft: #0088cf14;
  --chip: #e6edf2;
  --bubble: #e3f0f9;
  --text: #0d192d;
  --text-2: #3b4d61;
  --text-3: #5f7185;
  --placeholder: #93a3b3;
  --line: #e0e8ee;
  --line-strong: #c9d5df;
  --line-soft: #0d192d10;
  --accent: #0088cf;
  --accent-hover: #0074b1;
  --accent-ink: #fff;
  --accent-text: #006ea8;
  --navy: #0a1f5c;
  --ok: #1d8a5b;
  --danger: #c4323c;
  --up: #16883f;
  --down: #d23232;
  --side-bg: linear-gradient(165deg, #0a1f5c 0%, #0c2c56 55%, #15444d 100%);
  --side-text: #eef4f9;
  --side-text-2: #b4c6d6;
  --side-text-3: #8aa2b8;
  --side-line: #ffffff1c;
  --side-hover: #ffffff12;
  --shadow-pop: 0 0 0 1px #0d192d14, 0 18px 44px #0a1f5c26, 0 2px 8px #0d192d0f;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --font-ui: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f7185' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Dark theme (theme.js sets <html data-theme>). Same roles as the light tokens above, for a navy-black desk. */
:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elevated: #121a29;
  --bg-inset: #182235;
  --bg-hover: #ffffff0f;
  --bg-accent-soft: #2ea7e81f;
  --chip: #1b263a;
  --bubble: #15314a;
  --text: #e8eef5;
  --text-2: #b9c6d4;
  --text-3: #8798ad;
  --placeholder: #5d6e83;
  --line: #233049;
  --line-strong: #31415f;
  --line-soft: #ffffff12;
  --accent: #2ea7e8;
  --accent-hover: #4cb7f0;
  --accent-ink: #04121d;
  --accent-text: #5cbef2;
  --navy: #dce7f4;
  --ok: #34c37f;
  --danger: #f0616b;
  --up: #3ccf6e;
  --down: #f2545b;
  --side-bg: linear-gradient(165deg, #060c1c 0%, #08182f 55%, #0b2629 100%);
  --shadow-pop: 0 0 0 1px #ffffff14, 0 18px 44px #00000099, 0 2px 8px #0000004d;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238798ad' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}
/* --navy is ink in dark mode, so the two surfaces that used it as a dark fill get their own. */
:root[data-theme="dark"] :is(.chart-tip, .toast) { background: #24344f; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 16px; height: 16px; flex-shrink: 0; }

.app { display: flex; height: calc(100dvh / var(--ui-scale, 1)); zoom: var(--ui-scale, 1); }
html[data-auth-locked] .app { display: none; }
.auth-gate { min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(ellipse at top, #0088cf17, transparent 65%); }
html:not([data-auth-locked]) .auth-gate { display: none; }
.noscript-intro { max-width: 640px; margin: 48px auto; padding: 0 16px; line-height: 1.55; }
/* The Worker's written summary of the page (cloud/page-meta.mjs), for readers without JavaScript. theme.js marks <html>
   with "js" before the first paint, so browsers never show it; the app shows the same information. */
html.js .ssr-page { display: none; }
.ssr-page { max-width: 760px; margin: 40px auto; padding: 0 16px; line-height: 1.6; }
.auth-gate-card { width: min(100%, 520px); text-align: center; }
.auth-gate-logo { display: block; width: 136px; height: 54px; margin: 0 auto; background: var(--navy); -webkit-mask: url(logo.svg) center / contain no-repeat; mask: url(logo.svg) center / contain no-repeat; }
.auth-gate-eyebrow { color: var(--accent-text); font: 500 12px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.auth-gate-card h1 { color: var(--navy); font-size: clamp(28px, 5vw, 40px); line-height: 1.15; letter-spacing: -.03em; }
.auth-gate-card > p:not(.auth-gate-eyebrow) { color: var(--text-3); }
.auth-gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-md); font: 500 12px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; transition: background-color .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: var(--r-md); color: var(--text-3); transition: background-color .12s, color .12s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar { width: 252px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--side-bg); color: var(--side-text); }
/* 25px inset centers the 74px logo button over the "+ New chat" row content */
.side-head { position: relative; display: flex; align-items: center; height: 60px; flex-shrink: 0; padding-left: 25px; }
.wordmark { display: grid; place-items: center; padding: 0 6px; border-radius: var(--r-md); transition: background-color .14s; }
.wordmark:hover { background: var(--side-hover); }
/* logo.svg is the luna mark (vector, so it stays sharp); used as a mask so it renders solid white on the sidebar (settings-sheet.css darkens it on the light Base/Sharks sidebars) */
.brand-logo { width: 62px; height: 44px; background: #fff; -webkit-mask: url(logo.svg) center / contain no-repeat; mask: url(logo.svg) center / contain no-repeat; }
.side-toggle { position: absolute; right: 10px; color: var(--side-text-3); }
.side-toggle:hover { background: var(--side-hover); color: #fff; }
.side-toggle svg { width: 18px; height: 18px; }

.nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 8px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 9px 0 11px; border-radius: var(--r-md); color: var(--side-text-2); font-size: 13.5px; text-align: left; white-space: nowrap; transition: background-color .12s, color .12s; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-kbd { font: 400 11px/1 var(--font-mono); color: var(--side-text-3); opacity: 0; transition: opacity .12s; }
.nav-item:hover .nav-kbd { opacity: 1; }

.recents { flex: 1; min-height: 0; padding: 2px 8px 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff2e transparent; }
.recents-label { margin: 16px 9px 5px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--side-text-3); }
.recents-label:first-child { margin-top: 8px; }
.recents-empty { margin: 0; padding: 8px 9px; font-size: 12.5px; line-height: 1.5; color: var(--side-text-3); }
.recent-item { position: relative; display: flex; align-items: center; height: 32px; border-radius: var(--r-md); color: var(--side-text-2); transition: background-color .14s, color .14s; }
.recent-item:hover { background: var(--side-hover); color: #fff; }
.recent-item.active { background: #ffffff1f; color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.recent-link { flex: 1; min-width: 0; height: 100%; padding: 0 4px 0 9px; color: inherit; font-size: 13px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-more { width: 26px; height: 26px; margin-right: 3px; display: grid; place-items: center; flex-shrink: 0; border-radius: var(--r-sm); color: var(--side-text-3); opacity: 0; transition: opacity .14s; }
.recent-item:hover .recent-more, .recent-item.active .recent-more, .recent-more:focus-visible, .recent-more.open { opacity: 1; }
.recent-more:hover, .recent-more.open { background: var(--side-hover); color: #fff; }
.recent-more svg { width: 15px; height: 15px; }

/* Portfolios and Watchlists in the sidebar (lists.js), laid out as quantcept.io's: a collapsible head with a count
   and a + on hover, then one row per item with its icon or colour dot, name and figures. */
.side-lists { margin-bottom: 4px; }
.side-section + .side-section { margin-top: 2px; }
.side-section-head { position: relative; display: flex; align-items: center; height: 30px; border-radius: var(--r-md); }
.side-section-head:hover { background: var(--side-hover); }
.side-section-toggle { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; height: 100%; padding: 0 6px; color: var(--side-text-3); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.side-section-toggle:hover { color: var(--side-text); }
.side-section-toggle .side-icon svg { width: 12px; height: 12px; transition: rotate .18s var(--ease); }
.side-section.open .side-section-toggle .side-icon svg { rotate: 90deg; }
.side-section-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #ffffff14; color: var(--side-text-2); font: 500 10.5px/16px var(--font-mono); letter-spacing: 0; text-align: center; }
.side-section-add { width: 24px; height: 24px; margin-right: 4px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--side-text-3); opacity: 0; transition: opacity .14s; }
.side-section-head:hover .side-section-add, .side-section-add:focus-visible { opacity: 1; }
.side-section-add:hover { background: var(--side-hover); color: #fff; }
.side-section-add svg { width: 14px; height: 14px; }
.side-section-body { padding-bottom: 4px; }
.side-icon { display: grid; flex-shrink: 0; }
.side-row .side-row-hit { display: flex; align-items: center; gap: 8px; }
.side-row .side-icon svg { width: 14px; height: 14px; color: var(--side-text-3); }
.side-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; }
.side-meta { display: flex; align-items: baseline; gap: 6px; flex-shrink: 0; font: 400 11px var(--font-mono); color: var(--side-text-3); }
.side-change[data-tone="up"] { color: #4ade80; }
.side-change[data-tone="down"] { color: #f87171; }
.side-count { flex-shrink: 0; color: var(--side-text-3); font: 400 11px var(--font-mono); }
.side-row:hover .side-meta, .side-row:hover .side-count, .side-row.active .side-meta, .side-row.active .side-count { display: none; }
.side-rename { flex: 1; min-width: 0; height: 26px; margin: 0 4px; padding: 0 7px; border: 1px solid var(--accent); border-radius: var(--r-sm); background: #ffffff14; color: #fff; font-size: 13px; outline: none; }
.side-empty { display: flex; align-items: center; gap: 7px; width: 100%; height: 30px; padding: 0 9px; border-radius: var(--r-md); color: var(--side-text-3); font-size: 12.5px; }
.side-empty:hover { background: var(--side-hover); color: #fff; }
.side-empty svg { width: 13px; height: 13px; }
#recentChats .recents-label:first-child { margin-top: 14px; }

/* New portfolio / New watchlist: quantcept.io's layout (two-step bar, type cards, swatches, switches) in this app's
   own blue palette, from the theme tokens, so it follows light and dark with everything else. */
.dialog.qc-dialog {
  --qc-bg: var(--bg-elevated); --qc-field: var(--bg-inset); --qc-field-line: var(--line-strong); --qc-text: var(--text); --qc-muted: var(--text-3); --qc-placeholder: var(--placeholder);
  --qc-accent: var(--accent); --qc-accent-hover: var(--accent-hover); --qc-accent-ink: var(--accent-ink); --qc-disabled: color-mix(in srgb, var(--accent) 38%, var(--bg-elevated));
  --qc-card: var(--bg-elevated); --qc-card-line: var(--line-strong); --qc-card-on: var(--bg-accent-soft); --qc-track: var(--line); --qc-ring: var(--text);
  width: min(720px, calc(100vw - 32px)); max-height: min(860px, calc(100dvh - 32px)); overflow-y: auto; border-radius: 18px; background: var(--qc-bg); color: var(--qc-text);
  box-shadow: var(--shadow-pop);
}
.dialog.qc-dialog::backdrop { background: #0a1f5c40; }
.qc-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 0; }
.qc-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.qc-head .icon-btn { color: var(--qc-text); }
.qc-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 14px 20px 0; }
.qc-steps span { height: 3px; border-radius: 2px; background: var(--qc-track); transition: background-color .2s; }
.qc-steps span.on { background: var(--qc-accent); }
.qc-form { display: grid; gap: 18px; padding: 18px 20px 20px; }
.qc-step { display: grid; gap: 18px; }
.qc-step[hidden] { display: none; }
.qc-field { display: grid; gap: 7px; min-width: 0; align-content: start; }
.qc-label { color: var(--qc-text); font-size: 13px; font-weight: 500; }
.qc-hint { color: var(--qc-muted); font-size: 12px; line-height: 1.5; }
.qc-hint:empty { display: none; }
.qc-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 600px) { .qc-row { grid-template-columns: minmax(0, 1fr); } }
.dialog.qc-dialog .qc-input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--qc-field-line); border-radius: 8px; background: var(--qc-field); color: var(--qc-text); font-size: 14px; box-shadow: none; }
.dialog.qc-dialog textarea.qc-input { height: auto; min-height: 80px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.dialog.qc-dialog select.qc-input { padding-right: 32px; appearance: none; background: var(--qc-field) var(--chevron) no-repeat right 10px center / 14px; }
.dialog.qc-dialog .qc-input::placeholder { color: var(--qc-placeholder); }
.dialog.qc-dialog .qc-input:focus { border-color: var(--qc-accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--qc-accent) 18%, transparent); }
.qc-affix { position: relative; }
.qc-affix .qc-input { padding-right: 48px; }
.qc-affix span { position: absolute; top: 50%; right: 12px; translate: 0 -50%; color: var(--qc-muted); font-size: 12px; pointer-events: none; }

/* Type and "how to fill it" cards */
.qc-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qc-fills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .qc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .qc-fills { grid-template-columns: minmax(0, 1fr); } }
.qc-card { display: grid; align-content: start; gap: 3px; min-height: 72px; padding: 11px 12px; border: 1px solid var(--qc-card-line); border-radius: 8px; background: var(--qc-card); color: var(--qc-text); text-align: left; transition: border-color .14s, background-color .14s; }
.qc-card:hover { border-color: var(--qc-muted); }
.qc-card[aria-checked="true"] { border-color: var(--qc-accent); background: var(--qc-card-on); box-shadow: inset 0 0 0 .5px var(--qc-accent); }
.qc-card b { font-size: 13.5px; font-weight: 600; }
.qc-card small { color: var(--qc-muted); font-size: 12.5px; line-height: 1.4; }

/* Watchlist colours, symbols and the default switch */
.qc-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.qc-swatch { width: 24px; height: 24px; border-radius: 6px; box-shadow: inset 0 0 0 1px #0000001a; transition: transform .12s; }
.qc-swatch:hover { transform: scale(1.08); }
.qc-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--qc-bg), 0 0 0 4px var(--qc-ring); }
.qc-search { position: relative; display: flex; align-items: center; }
.qc-search > .side-icon { position: absolute; left: 12px; color: var(--qc-muted); pointer-events: none; }
.qc-search .side-icon svg { width: 15px; height: 15px; }
.dialog.qc-dialog .qc-search .qc-input { padding-left: 34px; background: var(--qc-bg); }
.qc-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 2; margin: 0; padding: 4px; border: 1px solid var(--qc-field-line); border-radius: 10px; background: var(--qc-bg); list-style: none; box-shadow: var(--shadow-pop); }
.qc-result { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 7px 9px; border-radius: 7px; color: var(--qc-text); text-align: left; font-size: 13px; }
.qc-result:hover, .qc-result:focus-visible { background: var(--qc-field); }
.qc-result b { min-width: 64px; font-family: var(--font-mono); font-size: 12px; }
.qc-result span { overflow: hidden; color: var(--qc-muted); text-overflow: ellipsis; white-space: nowrap; }
.qc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qc-chips[hidden] { display: none; }
.qc-chip { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 2px 0 10px; border: 1px solid var(--qc-field-line); border-radius: 999px; background: var(--qc-field); font: 500 12px var(--font-mono); }
.qc-chip .icon-btn { width: 22px; height: 22px; color: var(--qc-muted); }
.qc-chip .icon-btn svg { width: 12px; height: 12px; }
.qc-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--qc-text); font-size: 13px; cursor: pointer; }
.dialog.qc-dialog input[role="switch"] { flex-shrink: 0; width: 36px; height: 20px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: var(--qc-track); accent-color: var(--qc-accent); }
.dialog.qc-dialog input[role="switch"]:checked { background: var(--qc-accent); }

/* Holdings (Choose the holdings myself) */
.qc-panel { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--qc-card-line); border-radius: 10px; background: var(--qc-card); }
.qc-panel[hidden] { display: none; }
.qc-holdings { display: grid; gap: 6px; }
.qc-holding { display: grid; grid-template-columns: minmax(0, 1fr) 120px 30px; align-items: center; gap: 8px; }
.qc-holding b { font: 600 13px var(--font-mono); }
.qc-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Footer */
.qc-error { margin: 0; color: var(--danger); font-size: 13px; }
.qc-error:empty { display: none; }
.qc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.qc-foot-end { justify-content: flex-end; }
.qc-note { color: var(--qc-muted); font-size: 12px; }
.qc-foot-buttons { display: flex; gap: 8px; margin-left: auto; }
.qc-primary { height: 36px; padding: 0 18px; border-radius: 8px; background: var(--qc-accent); color: var(--qc-accent-ink); font-size: 13.5px; font-weight: 600; transition: background-color .14s; }
.qc-primary:hover:not(:disabled) { background: var(--qc-accent-hover); }
.qc-primary:disabled { background: var(--qc-disabled); cursor: default; }
.qc-primary[hidden], .qc-ghost[hidden] { display: none; }
.qc-ghost { height: 36px; padding: 0 14px; border-radius: 8px; color: var(--qc-text); font-size: 13.5px; font-weight: 500; }
.qc-ghost:hover { background: var(--qc-field); }

/* Finance: a watchlist's head, and a self-directed portfolio's add-a-holding row */
.watchlist-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.watchlist-head h2 { display: flex; align-items: center; gap: 8px; }
.list-dot { width: 10px; height: 10px; border-radius: 50%; }
.watchlist-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.watchlist-pick { height: 34px; max-width: 220px; }
.add-holding { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.add-holding .field { width: 170px; }
.add-holding .check-row { margin: 0; }
.cash-row td { color: var(--text-2); }

.side-foot { flex-shrink: 0; padding: 8px; box-shadow: inset 0 1px 0 var(--side-line); }

.profile { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border-radius: var(--r-lg); text-align: left; transition: background-color .14s; }
.profile:hover, .profile.open { background: var(--side-hover); }
.avatar, .account-avatar { display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: color-mix(in srgb, var(--avatar-color, #5A67D8) 17%, var(--bg-elevated)); color: color-mix(in srgb, var(--avatar-color, #5A67D8) 55%, var(--text)); font-weight: 600; }
.avatar { position: relative; width: 32px; height: 32px; border: 2px solid #fff; font-size: 12px; }
.avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #25754b; }
.account-avatar { width: 44px; height: 44px; font-size: 16px; }
.profile-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-name { font-size: 13px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-email { margin-top: 1px; font-size: 11.5px; line-height: 1.35; color: var(--side-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-email[hidden] { display: none; }
.profile-plan { display: flex; align-items: center; gap: 6px; margin-top: 1px; font-size: 11.5px; color: var(--side-text-3); }
.status-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: #e0a43a; }
.status-dot[data-online="true"] { background: #3ccf8e; }
.status-dot[data-online="false"] { background: #ff6b6b; }
.profile-chevron { display: grid; color: var(--side-text-3); }
.profile-chevron svg { width: 14px; height: 14px; }
.profile .profile-plan { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (min-width: 861px) {
  .app.rail .sidebar { width: 60px; }
  .app.rail :is(.nav-label, .nav-kbd, .recents, .profile-meta, .profile-chevron) { display: none; }
  .app.rail .side-head { flex-direction: column; gap: 6px; height: auto; padding: 10px 0 6px; }
  .app.rail .brand-logo { width: 44px; }
  .app.rail .side-toggle { position: static; }
  .app.rail .nav-item, .app.rail .profile { justify-content: center; padding: 0; }
  .app.rail .profile { padding: 6px 0; }
  .app.rail .side-foot { margin-top: auto; }
}

/* ── Main ────────────────────────────────────────────── */
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main.empty { background: radial-gradient(70% 45% at 50% 0%, #0088cf17, transparent 70%), radial-gradient(40% 30% at 50% 100%, #15444d0d, transparent 70%); }
.main.empty :is(.thread, .disclaimer), .main:not(.empty) :is(.hero, .tabs, .suggestions) { display: none; }
.main .menu-btn { position: absolute; top: 10px; left: 10px; z-index: 2; display: none; background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line); }
.thread { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.messages { max-width: 780px; margin: 0 auto; padding: 40px 24px 24px; display: flex; flex-direction: column; gap: 28px; }
.dock { position: relative; width: 100%; max-width: 780px; margin: 0 auto; padding: 0 24px 14px; }
.jump-latest { position: absolute; bottom: calc(100% + 10px); left: 50%; z-index: 2; translate: -50% 0; display: inline-flex; align-items: center; gap: 6px; height: 29px; padding: 0 12px; border-radius: 999px; background: var(--bg-elevated); color: var(--text-2); font-size: 12.5px; white-space: nowrap; box-shadow: 0 0 0 1px var(--line-strong), 0 18px 44px #281e0f21, 0 2px 8px #1a17140f; animation: pop-in .15s ease-out; }
.jump-latest:hover { color: var(--text); background: var(--bg-hover); }
.jump-latest svg { width: 13px; height: 13px; }
.main.empty .dock { max-width: 744px; margin-block: auto; padding-bottom: 8vh; }

/* ── Home ────────────────────────────────────────────── */
.hero { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; text-align: center; animation: rise-in .42s var(--ease-out) both; }
.hero-eyebrow { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; margin: 0; font: 400 12px/1.4 var(--font-mono); letter-spacing: .02em; color: var(--text-3); }
.hero-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.session { display: inline-flex; align-items: center; gap: 7px; }
.session-dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.session[data-online="true"] .session-dot { background: var(--ok); box-shadow: 0 0 0 3px #1d8a5b33; }
.session[data-online="true"] .session-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: dot-pulse 2.4s var(--ease-out) infinite; }
.hero-title { margin: 0; font-size: clamp(26px, 3.6vw, 36px); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; text-wrap: balance; }
.hero-name { background: linear-gradient(100deg, var(--accent) 10%, var(--navy) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* All shortcut buttons stay on one line; on narrow screens the row scrolls sideways instead of wrapping. */
.tabs { position: relative; display: flex; flex-wrap: nowrap; justify-content: safe center; gap: 6px; max-width: 100%; margin-top: 18px; overflow-x: auto; scrollbar-width: none; animation: rise-in .46s 90ms var(--ease-out) both; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-2); font-size: 13px; transition: background-color .14s, color .14s, box-shadow .14s; }
.tab svg { width: 15px; height: 15px; }
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab[aria-selected="true"] { background: var(--bg-elevated); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 3px #0a1f5c1a; }
.tab[aria-selected="true"] svg { color: var(--accent); }

.suggestions { display: flex; flex-direction: column; min-height: 176px; margin-top: 16px; }
.suggestion { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); color: var(--text-2); font-size: 14px; line-height: 1.4; text-align: left; animation: rise-in .3s var(--ease-out) both; }
.suggestion + .suggestion { box-shadow: inset 0 1px 0 var(--line-soft); }
.suggestion:hover { background: var(--bg-hover); box-shadow: none; color: var(--text); }
.suggestion:hover + .suggestion { box-shadow: none; }
.suggestion svg { width: 14px; height: 14px; color: var(--text-3); }
.suggestion:hover svg { color: var(--accent); }
.disclaimer { margin: 10px 0 0; font-size: 11.5px; text-align: center; color: var(--text-3); }

/* ── Composer ────────────────────────────────────────── */
.composer { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px 10px 8px 12px; border-radius: var(--r-xl); background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line-strong), 0 10px 30px #0a1f5c14; transition: box-shadow .2s; }
.composer:focus-within { box-shadow: 0 0 0 1px #0088cfa6, 0 0 0 4px var(--bg-accent-soft), 0 12px 32px #0a1f5c1f; }
.composer.drag { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 6px var(--bg-accent-soft); }
.composer textarea { width: 100%; min-height: 26px; max-height: 260px; padding: 3px 6px; border: 0; outline: none; background: none; resize: none; font-size: 15.5px; line-height: 1.5; overflow-y: auto; }
.composer textarea::placeholder { color: var(--placeholder); }
.composer textarea:placeholder-shown { overflow: hidden; }
.bar { display: flex; align-items: center; gap: 4px; min-width: 0; }
.spacer { flex: 1; }

.pill { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 220px; height: 30px; padding: 0 7px 0 9px; border-radius: var(--r-md); color: var(--text-2); font: 400 12px/1 var(--font-mono); white-space: nowrap; }
.pill:hover, .pill.open { background: var(--bg-hover); color: var(--text); }
.pill .label { overflow: hidden; text-overflow: ellipsis; }
.pill > svg:last-child { width: 12px; height: 12px; color: var(--text-3); }
.model-select { field-sizing: content; min-width: 0; max-width: 200px; height: 30px; padding: 0 26px 0 9px; border: 0; border-radius: var(--r-md); appearance: none; cursor: pointer; background: transparent var(--chevron) no-repeat right 8px center / 12px; color: var(--text-2); font: 400 12px/1 var(--font-mono); text-overflow: ellipsis; }
.model-select:hover { background-color: var(--bg-hover); color: var(--text); }
.dot { display: inline-block; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--c); }

.bars { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 12px; flex-shrink: 0; }
.bars i { width: 3px; border-radius: 1px; background: var(--line-strong); }
.bars i:nth-child(1) { height: 4px; }
.bars i:nth-child(2) { height: 6.5px; }
.bars i:nth-child(3) { height: 9px; }
.bars i:nth-child(4) { height: 12px; }
.bars i[data-on] { background: var(--accent); }
.think-tag { display: inline-flex; align-items: center; height: 16px; padding: 0 5px; border-radius: 4px; background: var(--bg-accent-soft); color: var(--accent-text); font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.send { width: 34px; height: 34px; display: grid; flex-shrink: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); transition: background-color .15s, transform .1s; }
.send > span { grid-area: 1 / 1; display: grid; place-items: center; transition: opacity .18s ease, transform .18s var(--ease); }
.send:hover:not(:disabled) { background: var(--accent-hover); }
.send:active:not(:disabled) { transform: scale(.94); }
.send:disabled { background: var(--chip); color: var(--text-3); cursor: default; }
.send[data-mode="stop"], .send[data-mode="stop"]:hover { background: var(--text); }
.send[data-mode="send"] .i-stop { opacity: 0; transform: rotate(-90deg) scale(.5); }
.send[data-mode="stop"] .i-send { opacity: 0; transform: rotate(90deg) scale(.5); }

.attach-row { display: flex; gap: 8px; padding: 2px 2px 4px; overflow-x: auto; }
.attach-row:empty { display: none; }
.attach { position: relative; display: flex; align-items: center; gap: 9px; flex-shrink: 0; max-width: 230px; height: 46px; padding: 0 32px 0 7px; border-radius: var(--r-md); background: var(--bg-inset); box-shadow: inset 0 0 0 1px var(--line); animation: rise-in .2s var(--ease-out) both; }
.attach-thumb { width: 32px; height: 32px; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; border-radius: var(--r-sm); background: var(--chip); color: var(--accent-text); font: 600 9px/1 var(--font-mono); letter-spacing: .04em; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-meta { display: flex; flex-direction: column; min-width: 0; }
.attach-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-size { font-size: 11px; color: var(--text-3); }
.attach-x { position: absolute; top: 50%; right: 6px; translate: 0 -50%; width: 22px; height: 22px; border-radius: 50%; }
.attach-x svg { width: 12px; height: 12px; }

/* ── Messages ────────────────────────────────────────── */
.msg { display: flex; flex-direction: column; min-width: 0; }
.msg-enter { animation: rise-in .28s var(--ease-out) both; }
.msg-user { align-items: flex-end; }
.bubble { max-width: min(82%, 640px); padding: 10px 15px; border-radius: 18px 18px 5px 18px; background: var(--bubble); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.file-chip { padding: 3px 9px; border-radius: 999px; background: var(--chip); font: 400 11.5px/1.5 var(--font-mono); color: var(--text-2); }

.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font: 500 11px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.msg-meta .stage { color: var(--accent-text); animation: pulse 1.4s ease-in-out infinite; }
.msg-meta .checked { color: var(--ok); }

.msg-ai.busy .md:empty::before { content: ""; display: block; width: 34px; height: 8px; background: radial-gradient(circle 3px, var(--accent) 95%, transparent) 0 50% / 12px 8px repeat-x; animation: pulse 1s ease-in-out infinite; }
.msg-ai.has-activity.busy .md:empty::before { display: none; }
.chat-activity { margin: 6px 0 22px; min-width: 0; }
.activity-timeline { display: flex; flex-direction: column; gap: 12px; }
.activity-announcement { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.activity-tools { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-elevated); }
.activity-summary { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 12px; color: var(--text-2); font-size: 13px; cursor: pointer; list-style: none; }
.activity-summary::-webkit-details-marker { display: none; }
.activity-summary:hover { background: var(--bg-hover); }
.activity-label { flex-shrink: 0; font-weight: 500; color: var(--text); }
.activity-summary-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.activity-summary-detail:not(:empty)::before { content: '·'; margin-right: 8px; }
.activity-time { margin-left: auto; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-chevron { display: inline-flex; flex-shrink: 0; margin-left: 2px; color: var(--text-3); }
.activity-chevron svg { width: 14px; height: 14px; }
details[open] > .activity-summary .activity-chevron { rotate: 180deg; }
.activity-status { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; }
.activity-status svg { width: 9px; height: 9px; stroke-width: 3; }
.activity-status.is-running { border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: site-spin .7s linear infinite; }
.activity-status.is-done { background: var(--ok); color: var(--bg-elevated); font-size: 12px; }
.activity-status.is-error { background: var(--danger); color: var(--bg-elevated); }
.activity-status.is-stopped { color: var(--text-3); }
.activity-tool-list { padding: 3px 6px 7px; border-top: 1px solid var(--line); }
.activity-tool { display: flex; align-items: center; gap: 9px; min-height: 32px; padding: 5px 8px; border-radius: 6px; font-size: 13px; }
.activity-tool[data-status="running"] { background: var(--bg-hover); }
.activity-tool[data-status="running"] .activity-tool-label { color: var(--accent-text); }
.activity-tool[data-status="error"] .activity-tool-label { color: var(--danger); }
.activity-tool-icon { display: inline-flex; color: var(--text-3); }
.activity-tool-icon svg { width: 15px; height: 15px; }
.activity-tool-label { flex-shrink: 0; color: var(--text); }
.activity-tool-detail { min-width: 0; color: var(--text-3); overflow-wrap: anywhere; }
.activity-tool .activity-time { padding-left: 8px; }
.activity-phase .activity-summary { width: fit-content; min-height: 26px; padding: 0 8px 0 5px; gap: 6px; border-radius: 6px; font-size: 12.5px; }
.activity-phase .activity-label { color: var(--text-3); font-weight: 400; }
.activity-phase .activity-time { margin-left: 2px; }
.activity-phase .activity-chevron { order: -1; rotate: -90deg; }
.activity-phase[open] .activity-chevron { rotate: 0deg; }
.activity-phase .activity-status:not(.is-running):not(.is-error):not(.is-stopped) { display: none; }
.activity-phase[data-status="running"] .activity-chevron { display: none; }
.activity-phase[data-status="running"] .activity-label { color: var(--text-2); }
.activity-phase-detail { margin: 6px 0 4px 12px; padding: 6px 14px; border-left: 2px solid var(--line-strong); color: var(--text-3); font-size: 13px; line-height: 1.6; }
.activity-stop { display: inline-flex; align-items: center; align-self: flex-start; gap: 8px; margin: -8px 0 18px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text); font-size: 12.5px; font-weight: 500; }
.activity-stop:hover { background: var(--bg-hover); }
.activity-stop-icon { width: 8px; height: 8px; margin: 0 3px; border-radius: 1px; background: currentColor; }
.activity-stop kbd { padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text-3); font: 11px/1.7 var(--font-mono); }
.md.is-streaming > :last-child::after { content: ''; display: inline-block; width: 7px; height: 1em; margin-left: 4px; border-radius: 1px; vertical-align: -.1em; background: var(--accent-text); animation: pulse 1s ease-in-out infinite; }
@media (max-width: 600px) {
  .activity-summary { padding: 0 10px; gap: 8px; }
  .activity-label { flex-shrink: 1; }
  .activity-tool { flex-wrap: wrap; gap: 7px; padding: 5px 6px; font-size: 12.5px; }
  .activity-tool-detail { flex: 1 1 90px; }
  .activity-tool-label { flex-shrink: 1; }
  .activity-summary-detail { display: none; }
}

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 14px; }
.md ul, .md ol { padding-left: 22px; }
.md li + li { margin-top: 4px; }
.md h1, .md h2, .md h3, .md h4 { margin: 22px 0 10px; line-height: 1.3; letter-spacing: -.015em; }
.md h1 { font-size: 22px; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 16.5px; }
.md h4 { font-size: 15px; }
.md a { color: var(--accent-text); text-underline-offset: 2px; }
.md strong { font-weight: 600; }
.md code, .guide code { padding: 1px 5px; border-radius: 4px; background: var(--chip); font: .86em/1.5 var(--font-mono); }
.md pre { padding: 14px 16px; overflow-x: auto; border-radius: var(--r-lg); background: #0d192d; color: #e3edf5; }
.md pre code { padding: 0; background: none; color: inherit; font-size: 13px; }
.md blockquote { padding: 2px 0 2px 14px; border-left: 2px solid var(--line-strong); color: var(--text-2); }
.md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.md th { border-bottom-color: var(--line-strong); font: 500 11px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; color: var(--text-3); }
.md tbody tr:hover { background: var(--bg-hover); }
.md hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }

.msg-error { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: #c4323c12; color: var(--danger); font-size: 13.5px; }
.actions { display: flex; gap: 1px; min-height: 30px; margin-top: 6px; opacity: 0; transition: opacity .16s; }
.msg:hover .actions, .msg:focus-within .actions, .msg:last-child .actions { opacity: 1; }
.actions svg { width: 15px; height: 15px; }

/* ── Menus (native popovers) ─────────────────────────── */
.menu { position: fixed; inset: auto; margin: 0; padding: 6px; border: 0; border-radius: var(--r-lg); background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-pop); overflow-y: auto; scrollbar-width: thin; }
.menu:popover-open { animation: pop-in .16s var(--ease-out); }
.menu-label { margin: 0; padding: 8px 10px 6px; font: 500 10.5px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.menu-item { display: grid; grid-template-columns: 16px 1fr 16px; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-md); font-size: 13.5px; text-align: left; }
.menu-item:hover, .menu-item[aria-selected="true"] { background: var(--bg-hover); }
.menu-item b, .switch-row b { display: block; font-size: 13.5px; font-weight: 500; }
.menu-item small, .switch-row small { display: block; font-size: 12px; line-height: 1.4; color: var(--text-3); }
.menu-item > svg { color: var(--accent); }
.menu-item .dot { justify-self: center; }
.menu-actions .menu-item { padding-block: 7px; }
.menu-actions .menu-item > svg { color: var(--text-3); }
.menu-item.danger, .menu-actions .menu-item.danger > svg { color: var(--danger); }
.menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
.menu-note { margin: 2px 10px 8px; font-size: 11.5px; color: var(--text-3); }
.menu-user { display: flex; flex-direction: column; padding: 9px 10px 8px; }
.menu-user b { font-size: 13px; font-weight: 600; }
.menu-user small { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.slash .menu-item { grid-template-columns: 84px 1fr; }
.slash code { font: 500 12.5px/1.4 var(--font-mono); color: var(--accent-text); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; }
input[role="switch"] { position: relative; flex-shrink: 0; width: 34px; height: 20px; margin: 0; border-radius: 999px; background: var(--line-strong); appearance: none; cursor: pointer; transition: background-color .15s; }
input[role="switch"]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0d192d40; transition: translate .18s var(--ease); }
input[role="switch"]:checked { background: var(--accent); }
input[role="switch"]:checked::before { translate: 14px 0; }
input[role="switch"]:disabled { opacity: .45; cursor: not-allowed; }

/* ── Dialogs ─────────────────────────────────────────── */
.dialog { width: min(520px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 32px)); padding: 0; border: 0; border-radius: var(--r-xl); background: var(--bg-elevated); color: var(--text); box-shadow: 0 28px 90px #0a1f5c38, 0 0 0 1px #0d192d14; }
.dialog-wide { width: min(600px, calc(100vw - 32px)); }
.dialog[open] { display: flex; flex-direction: column; animation: pop-in .2s var(--ease-out); }
.dialog::backdrop { background: #0a1f5c40; backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 0 20px; }
.dialog-head h2 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.dialog-sub { margin: 6px 20px 12px; font-size: 13.5px; color: var(--text-2); }
.dialog .switch-row { margin: 0 10px; padding: 12px 10px; border-block: 1px solid var(--line); }
.dialog input:not([role]) { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); outline: none; font-size: 14px; }
.dialog input:not([role]):focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--bg-accent-soft); }

/* Quantcept's login proportions, using afa's existing light, navy, teal and blue tokens. */
/* Sign-in panel: rounded panel, pill buttons, rounded fields, labels in sentence case (Fear & Greed's sign-in). */
.auth-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px 32px 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--bg-elevated); overflow-y: auto; }
.auth-dialog[open] { display: block; animation: auth-panel-in .36s var(--ease-out) both; }
.auth-dialog::backdrop { background: #0a1f5c59; backdrop-filter: blur(5px); animation: auth-backdrop-in .2s ease-out both; }
.auth-dialog .dialog-head { display: block; padding: 0; }
.auth-dialog .dialog-head h2 { margin: 0 0 6px; color: var(--navy); font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; }
.auth-dialog .dialog-sub { margin: 0 0 20px; color: var(--text-3); font-size: 15px; font-weight: 300; line-height: 1.55; }
.auth-close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 999px; }
.auth-close svg { width: 14px; height: 14px; }
.auth-form { display: flex; flex-direction: column; }
.auth-social { display: grid; grid-template-columns: 1fr; }
.auth-provider { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; min-width: 0; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-inset); color: var(--text); font-size: 15px; font-weight: 500; transition: border-color .15s, background-color .15s, transform .15s; }
.auth-provider svg { width: 20px; height: 20px; flex: none; }
.auth-provider span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-provider:hover:not(:disabled) { border-color: var(--accent); background: var(--bg-accent-soft); }
.auth-provider:active:not(:disabled) { transform: scale(.98); }
.auth-form button:disabled { opacity: .55; cursor: not-allowed; }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--text-3); font: 400 14px/1.6 var(--font-ui); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 14px; }
.auth-field label { color: var(--text-2); font: 500 14px/1.5 var(--font-ui); }
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-forgot { color: var(--text-3); font-size: 13px; }
.auth-forgot:hover { color: var(--accent-text); }
.auth-dialog input:not([role]) { height: 46px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-elevated); color: var(--text); font-size: 15px; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.auth-dialog input:not([role]):focus { border-color: var(--accent); background: var(--bg-accent-soft); box-shadow: 0 0 0 3px var(--bg-accent-soft); }
.auth-password { position: relative; }
.auth-password input:not([role]) { padding-right: 68px; }
.auth-reveal { position: absolute; top: 50%; right: 8px; height: 30px; padding: 0 12px; border-radius: 999px; translate: 0 -50%; color: var(--text-3); font: 500 13px/1 var(--font-ui); }
.auth-reveal:hover { color: var(--accent-text); background: var(--bg-accent-soft); }
.auth-note, .auth-error { margin: 0 0 14px; font-size: 12px; line-height: 1.5; }
.auth-note { color: var(--text-3); }
.auth-error { color: var(--danger); }
.auth-form .btn-primary { width: 100%; height: 48px; margin-top: 4px; padding: 0 20px; border: 1px solid var(--accent); border-radius: 999px; font: 600 15px/1 var(--font-ui); letter-spacing: 0; text-transform: none; }
.auth-switch { margin: 16px 0 0; text-align: center; color: var(--text-3); font-size: 14px; line-height: 1.5; }
.auth-switch button { color: var(--accent-text); font-weight: 500; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .2s; }
.auth-switch button:hover { background-size: 100% 1px; }
.auth-workspace-note { margin: 14px 0 0; text-align: center; }
.portfolio-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.portfolio-dialog .auth-form { gap: 16px; }
.portfolio-dialog .wf-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.portfolio-dialog .field-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.portfolio-dialog .field { width: 100%; padding: 10px; border: 1px solid var(--line-strong); background: var(--bg-elevated); }
.portfolio-dialog .span-2 { grid-column: 1 / -1; }
.portfolio-dialog .check-row { display: flex; align-items: start; gap: 8px; font-size: 13px; }
.portfolio-report { width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.portfolio-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.portfolio-table td small { display: block; color: var(--text-3); }
.drift-alert { color: var(--danger); font-weight: 600; }
@media (max-width: 500px) { .portfolio-dialog .wf-fields { grid-template-columns: 1fr; } }
@media print {
  body:has(#reportDialog[open]) > :not(#reportDialog) { display: none !important; }
  #reportDialog[open] { position: static; width: 100%; max-height: none; overflow: visible; border: 0; box-shadow: none; }
  #reportDialog .portfolio-actions, #reportDialog .dialog-head button { display: none; }
  #reportDialog::backdrop { background: transparent; }
}
.auth-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes auth-panel-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes auth-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 480px) {
  .auth-dialog { padding: 26px 20px 22px; }
  .auth-dialog .dialog-head h2 { font-size: 28px; }
  .auth-dialog input:not([role]) { font-size: 16px; }
}
@media (max-width: 400px) {
  .auth-provider span { position: static; }
  .auth-provider svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-dialog[open], .auth-dialog::backdrop { animation: none; }
}

.guide-keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.guide-keys dt { font: 500 12.5px/1.6 var(--font-mono); color: var(--accent-text); }
.guide-keys dd { margin: 0; }

/* ── Pages: Finance, Chats, Agents, Guide ────────────── */
.main:not([data-view="chat"]) :is(.thread, .dock) { display: none; }
.page { flex: 1; min-height: 0; padding: 36px 32px 56px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.page-inner { display: flex; flex-direction: column; gap: 18px; max-width: 1040px; margin: 0 auto; }
.page-head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-right: 42px; }
.page-close { position: absolute; top: 0; right: 0; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { max-width: 640px; margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.page-actions { display: flex; flex-shrink: 0; gap: 8px; }
.nav-item.on { background: #ffffff1f; color: #fff; box-shadow: inset 2px 0 0 var(--accent); }

.card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 18px 20px; border-radius: var(--r-lg); background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line), 0 1px 2px #0a1f5c0d; }
.card .btn { align-self: flex-start; }
.card-head h2, .chart-title, .hits-head { margin: 0; font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.card-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.fin-grid, .macro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: span 2; }
.fin-tabs, .ticker { display: flex; flex-direction: column; gap: 18px; }
.fin-note { margin: 0; font-size: 12.5px; color: var(--text-3); }
.btn-ghost { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.btn-danger { height: 34px; background: var(--danger); color: #fff; }
.link-btn { align-self: flex-start; font-size: 13.5px; color: var(--accent-text); }
.link-btn:hover { text-decoration: underline; }

.seg { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--chip); }
.seg-btn { height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; color: var(--text-2); transition: background-color .12s, color .12s; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--bg-elevated); color: var(--text); box-shadow: 0 1px 2px #0a1f5c1f; }

.ticker-search input, .toolbar input, .add-symbol input, .ask-form input, .field, .agent-form input:not([type="color"]), .agent-form textarea, .agent-form select {
  width: 100%; min-width: 0; height: 42px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); outline: none; background: var(--bg-elevated); font-size: 14px;
}
.field, .agent-form textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
:is(.ticker-search input, .toolbar input, .add-symbol input, .ask-form input, .field, .agent-form input, .agent-form textarea, .agent-form select):focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--bg-accent-soft); }
.ticker-search { position: relative; }
.ticker-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 3; max-height: 360px; margin: 0; padding: 6px; overflow-y: auto; list-style: none; border-radius: var(--r-lg); background: var(--bg-elevated); box-shadow: var(--shadow-pop); }
.ticker-hit { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-md); font-size: 13.5px; text-align: left; }
.ticker-hit:hover { background: var(--bg-hover); }
.ticker-hit b { font-family: var(--font-mono); font-weight: 500; }
.ticker-hit small, .ticker-empty { font-size: 12px; color: var(--text-3); }
.ticker-empty { padding: 10px; }

.table-wrap { display: flex; flex-direction: column; gap: 8px; overflow-x: auto; }
.quotes { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.quotes th { padding: 6px 10px; border-bottom: 1px solid var(--line-strong); font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .12em; text-align: left; text-transform: uppercase; white-space: nowrap; color: var(--text-3); }
.quotes td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.quotes tbody tr { cursor: pointer; }
.quotes tbody tr:hover { background: var(--bg-hover); }
.quotes td b { margin-right: 8px; font-family: var(--font-mono); font-weight: 500; }
.quotes td small { font-size: 12px; color: var(--text-3); }
.quotes td b .stock-logo { margin-right: 10px; }

/* Stock logos (app.js stockLogo): the company's art over a lettered tile, which shows while it loads and when there is none. */
.stock-logo { position: relative; display: inline-grid; place-items: center; flex: none; width: var(--logo, 20px); height: var(--logo, 20px); margin-right: .45em; overflow: hidden; border-radius: calc(var(--logo, 20px) * .26); background: var(--bg-inset); color: var(--text-3); font: 600 calc(var(--logo, 20px) * .5)/1 var(--font-ui); vertical-align: middle; }
.stock-logo::before { content: attr(data-letter); }
.stock-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; opacity: 0; transition: opacity .15s; }
.stock-logo img[data-loaded] { opacity: 1; }
.stock-mention { border-radius: 4px; cursor: pointer; white-space: nowrap; }
/* Centered on the name's capitals: an inline grid's baseline is its hidden letter's, so a baseline offset sat it low.
   Middle, lifted 1.5px, stays within half a pixel of the caps' center from 13px to 20px text. */
.stock-mention .stock-logo { margin-right: .3em; vertical-align: middle; top: -1.5px; }
.stock-mention:hover, .stock-mention:focus-visible { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.qc-result .stock-logo { align-self: center; margin-right: 0; }
.agent-ticker .stock-logo { margin-right: .35em; }
.quotes .num { text-align: right; }
:is(.chg, .ticker-change)[data-tone="up"] { color: var(--up); }
:is(.chg, .ticker-change)[data-tone="down"] { color: var(--down); }
.range { display: inline-flex; align-items: center; gap: 8px; }
.range small { min-width: 56px; font-size: 11.5px; color: var(--text-3); }
.range small:first-child { text-align: right; }
.range-bar { position: relative; width: 80px; height: 4px; border-radius: 2px; background: var(--chip); }
.range-bar i { position: absolute; top: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); translate: 0 -50%; }
.range-bar.empty i { display: none; }
.row-action { width: 40px; }
.row-action .icon-btn { opacity: 0; }
.quotes tr:hover .row-action .icon-btn, .row-action .icon-btn:focus-visible { opacity: 1; }

.chart { --tone: var(--accent); position: relative; margin: 0; }
.chart[data-tone="up"] { --tone: var(--up); }
.chart[data-tone="down"] { --tone: var(--down); }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; cursor: crosshair; touch-action: pan-y; }
.chart-line { fill: none; stroke: var(--tone); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-area { fill: var(--tone); opacity: .09; }
.chart-cursor { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0; }
.chart.hover .chart-cursor { opacity: 1; }
.chart-tip { position: absolute; top: -4px; padding: 4px 8px; border-radius: var(--r-sm); background: var(--navy); color: #fff; font: 500 11.5px/1.3 var(--font-mono); white-space: nowrap; pointer-events: none; translate: -50% -100%; }
.chart figcaption { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font: 400 11.5px/1.3 var(--font-mono); color: var(--text-3); }
.chart-empty { margin: 0; padding: 40px 0; font-size: 13.5px; text-align: center; color: var(--text-3); }
.chart-slot { min-height: 200px; }

/* Familiar presentations; switching style never changes the underlying data. */
.price-candles, .price-vertical-grid, .price-current-line, .chart-last-price, .stock-drawing-rail, .stock-utility-rail, .stock-terminal-status, .stock-ohlc-legend, .stock-tv-details, .stock-watchlist-columns { display: none; }
.price-chart { min-width: 0; }
.chart-presentation { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
/* Drag to measure (every style): the band between two points and a readout of the move, as on Fear & Greed. */
.price-chart svg { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.price-measure-band { fill: rgba(125, 145, 185, .16); }
.price-measure-edge { stroke: var(--text-3); stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.price-measure-dot { fill: var(--up); stroke: var(--bg-elevated); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.price-measure[data-tone="down"] .price-measure-dot { fill: var(--down); }
/* The drag-to-measure readout sits on the palette's surface, like the hover label, with the move in its up/down colours. */
.chart-measure { position: absolute; top: 6px; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-elevated); color: var(--text-3); box-shadow: 0 6px 18px rgb(0 0 0 / 12%); font: 500 10.5px/1.3 var(--font-ui); transform: translateX(-50%); pointer-events: none; white-space: nowrap; }
.chart-measure[hidden] { display: none; }
.chart-measure strong { color: var(--up); font: 600 11.5px/1.3 var(--font-ui); }
.chart-measure[data-tone="down"] strong { color: var(--down); }
/* Charts take keyboard focus (arrow keys read the prices), but a click draws no outline; the keyboard still gets one. */
svg[tabindex]:focus:not(:focus-visible) { outline: none; }
.price-chart:has(.chart-measure:not([hidden])) .chart-tip { display: none; }
.chart-extreme { display: none; }
.chart-summary { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.chart-price-block { display: flex; flex-direction: column; gap: 4px; }
.chart-kicker { min-height: 15px; color: var(--text-3); font-size: 11px; }
.chart-last { color: var(--text); font-size: 30px; font-weight: 500; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.chart-return { display: flex; flex-direction: column; gap: 4px; text-align: right; }
.chart-return strong { color: var(--text-3); font: 500 13px/1.2 var(--font-mono); }
.price-chart[data-tone="up"] .chart-return strong { color: var(--up); }
.price-chart[data-tone="down"] .chart-return strong { color: var(--down); }
.chart-return span { color: var(--text-3); font-size: 10px; }
.chart-frame { position: relative; min-width: 0; }
.price-chart svg { height: 260px; overflow: visible; }
.price-grid line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.price-grid text, .price-date-axis text { fill: var(--text-3); font: 11px var(--font-mono); }
.price-baseline { stroke: var(--text-3); stroke-dasharray: 3 5; opacity: .55; vector-effect: non-scaling-stroke; }
.price-volume { fill: var(--accent); opacity: .2; }
.price-volume rect[data-tone="up"] { fill: var(--up); }
.price-volume rect[data-tone="down"] { fill: var(--down); }
.price-endpoint { fill: var(--tone); stroke: var(--bg-elevated); stroke-width: 2; }
.price-cursor-dot { fill: var(--tone); stroke: var(--bg-elevated); stroke-width: 2; opacity: 0; }
.price-chart.hover .price-cursor-dot { opacity: 1; }
.price-chart .chart-cursor { stroke: var(--text-3); stroke-dasharray: 3 3; }
/* The price hover label is the palette's own surface (white in a light palette), bold price then the moment, as on
   Fear & Greed. `:root` outranks the dark theme's navy tooltip. */
:root .price-chart .chart-tip { top: 8px; max-width: calc(100% - 16px); overflow: hidden; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-elevated); color: var(--text); box-shadow: 0 6px 18px rgb(0 0 0 / .14); font: 12px/1.4 var(--font-ui); }
.chart-tip-head { display: flex; align-items: baseline; gap: 8px; }
.chart-tip-price { font-size: 13.5px; font-weight: 700; }
.chart-tip-when { color: var(--text-3); font-size: 12.5px; }
.chart-range-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(85px, 1fr)); margin: 14px 0 0; padding: 14px 0; border-top: 1px solid var(--line); gap: 12px; }
.chart-range-stats dt { color: var(--text-3); font-size: 11px; }
.chart-range-stats dd { margin: 6px 0 0; font: 500 12px var(--font-mono); color: var(--text); }
.price-chart figcaption { margin-top: 12px; font: 400 10px/1.5 var(--font-ui); }
.price-chart figcaption > :last-child { text-align: right; }
.stock-chart-card { gap: 14px; }
.stock-chart-card .range-tabs { display: flex; }

/* Robinhood: a quote and a clean, open line, with periods beneath the plot. */
.price-chart[data-style="robinhood"] .chart-last { font-size: 38px; }
.price-chart[data-style="robinhood"] .chart-summary { justify-content: flex-start; align-items: center; gap: 24px; }
.price-chart[data-style="robinhood"] .chart-return { text-align: left; }
.price-chart[data-style="robinhood"] svg { height: 250px; }
.price-chart[data-style="robinhood"] :is(.price-grid, .price-date-axis, .price-volume, .chart-area, .chart-range-stats) { display: none; }
.stock-chart-card:has(.price-chart[data-style="robinhood"]) .range-tabs { order: 2; margin-top: 2px; }
.stock-chart-card:has(.price-chart[data-style="robinhood"]) .seg { gap: 8px; padding: 0; background: none; }
.stock-chart-card:has(.price-chart[data-style="robinhood"]) .seg-btn { height: 34px; padding: 0 10px; border-radius: 0; border-bottom: 2px solid transparent; }
.stock-chart-card:has(.price-chart[data-style="robinhood"]) .seg-btn[aria-pressed="true"] { color: var(--accent-text); border-bottom-color: var(--accent); background: none; box-shadow: none; }

/* Yahoo: a denser framed plot, right-hand scale, filled line and range statistics. */
.price-chart[data-style="yahoo"] .chart-presentation { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.price-chart[data-style="yahoo"] .chart-summary { margin-bottom: 14px; }
.price-chart[data-style="yahoo"] .chart-last { font-size: 26px; font-weight: 600; }
.price-chart[data-style="yahoo"] .chart-frame { border: 1px solid var(--line); border-radius: 4px; padding: 8px 0; }
.price-chart[data-style="yahoo"] .chart-area { fill: var(--accent); opacity: .13; }
.price-chart[data-style="yahoo"] .chart-line { stroke: var(--accent); stroke-width: 1.5; }
.price-chart[data-style="yahoo"] :is(.price-endpoint, .price-cursor-dot) { fill: var(--accent); }
.price-chart[data-style="yahoo"] .chart-range-stats { margin-top: 0; padding-bottom: 6px; }

/* Google: a soft overview surface, left scale and rounded period controls below. */
.price-chart[data-style="google"] { --tone: var(--accent); }
.price-chart[data-style="google"] .chart-frame { border-radius: 14px; padding: 14px 6px 8px; background: var(--bg-inset); }
.price-chart[data-style="google"] .chart-line { stroke-width: 2.5; }
.price-chart[data-style="google"] .chart-area { opacity: .055; }
.price-chart[data-style="google"] .price-grid line { stroke: var(--line-strong); opacity: .65; }
.price-chart[data-style="google"] .price-baseline { display: none; }
.price-chart[data-style="google"] .chart-range-stats { display: none; }
.stock-chart-card:has(.price-chart[data-style="google"]) .range-tabs { order: 2; }
.stock-chart-card:has(.price-chart[data-style="google"]) .seg { padding: 4px; border-radius: 999px; }
.stock-chart-card:has(.price-chart[data-style="google"]) .seg-btn { border-radius: 999px; }
.stock-chart-card:has(.price-chart[data-style="google"]) .seg-btn[aria-pressed="true"] { color: var(--accent-text); background: var(--bg-elevated); }

/* Perplexity: one compact research card with the facts attached to its chart. */
.price-chart[data-style="perplexity"] { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.price-chart[data-style="perplexity"] .chart-summary { order: -1; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; gap: 10px; }
.price-chart[data-style="perplexity"] .chart-price-block { flex-direction: row-reverse; align-items: baseline; gap: 10px; }
.price-chart[data-style="perplexity"] .chart-last { font-size: 23px; letter-spacing: -.02em; }
.price-chart[data-style="perplexity"] .chart-return { flex-direction: row; align-items: baseline; gap: 8px; }
.price-chart[data-style="perplexity"] .chart-return strong { font-size: 12px; }
.price-chart[data-style="perplexity"] .chart-return span { display: none; }
.price-chart[data-style="perplexity"] .chart-presentation { padding: 10px 12px 0; margin-bottom: 10px; }
.price-chart[data-style="perplexity"] .chart-frame { padding: 0 12px; }
.price-chart[data-style="perplexity"] svg { height: 220px; }
.price-chart[data-style="perplexity"] .price-grid line { stroke-dasharray: 1 5; }
.price-chart[data-style="perplexity"] .chart-area { opacity: .07; }
.price-chart[data-style="perplexity"] .chart-range-stats { margin: 0; padding: 0; gap: 0; background: var(--bg-inset); }
.price-chart[data-style="perplexity"] .chart-range-stats > div { padding: 12px 16px; border-right: 1px solid var(--line); }
.price-chart[data-style="perplexity"] .chart-range-stats > div:last-child { border-right: 0; }
.price-chart[data-style="perplexity"] figcaption { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); }

/* Fear & Greed: the feargreedflow.com stock chart. A green or red line over a soft fill, the price scale and last
   price on the right, the range's high and low called out on the line, no dates or volume. */
.price-chart[data-style="feargreed"] { padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elevated); color: var(--text); }
.price-chart[data-style="feargreed"] .chart-drawing { position: relative; }
.price-chart[data-style="feargreed"] .chart-drawing > svg { display: block; }
.price-chart[data-style="feargreed"] :is(.price-grid text, .price-date-axis, .price-volume, .chart-range-stats) { display: none; }
.price-chart[data-style="feargreed"] .price-grid line { stroke: rgba(139, 147, 163, .14); }
.price-chart[data-style="feargreed"] .price-baseline { stroke: var(--text-3); opacity: .55; }
/* The current price as a dotted rule across the chart in the price tag's colour (Luna LPL11 lib/priceMarkers.js), so the
   tag reads as this line's price; the previous-close rule stays grey. */
.price-chart[data-style="feargreed"] .price-current-line { display: block; stroke: var(--up); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .9; vector-effect: non-scaling-stroke; }
.price-chart[data-style="feargreed"][data-tone="down"] .price-current-line { stroke: var(--down); }
/* Technicals drawn over the price: moving averages, the exponential ones dashed (feargreedflow / RsiLE). */
.price-overlay { fill: none; stroke-width: 1.4; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.price-overlay.dashed { stroke-dasharray: 5 4; }
.price-chart[data-style="feargreed"] .chart-area { opacity: .2; }
.price-chart[data-style="feargreed"] :is(.chart-y-labels, .chart-last-price, .chart-extreme) { position: absolute; display: block; pointer-events: none; }
.price-chart[data-style="feargreed"] .chart-y-labels { inset: 0; }
.price-chart[data-style="feargreed"] .stock-axis-y { position: absolute; right: 2px; color: var(--text-3); font: 400 11px/1 var(--font-mono); transform: translateY(-50%); }
.price-chart[data-style="feargreed"] .chart-last-price { right: 0; padding: 2px 5px; border-radius: 4px; background: var(--up); color: #fff; font: 600 11px/1.3 var(--font-mono); transform: translateY(-50%); }
/* The tag takes the line's colour (up or down over the range), as on feargreedflow.com. */
.price-chart[data-style="feargreed"][data-tone="down"] .chart-last-price { background: var(--down); }
/* The watermark belongs to the full Finance page; under a chat card it is a stray word. */
.chat-stock .stock-chart-watermark { display: none; }
/* High and low: a dot on the close and an elbow out to the price, on whichever side has room. */
.price-chart[data-style="feargreed"] .chart-extreme { width: 0; height: 0; color: var(--text-3); font: 500 10.5px/1 var(--font-mono); white-space: nowrap; }
.chart-extreme::before { content: ""; position: absolute; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: currentColor; }
.chart-extreme::after { content: ""; position: absolute; left: 0; bottom: 0; width: 7px; height: 9px; border-top: 1px solid; border-left: 1px solid; }
.chart-extreme-low::after { top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid; }
.chart-extreme[data-side="left"]::after { left: auto; right: 0; border-left: 0; border-right: 1px solid; }
.chart-extreme b { position: absolute; left: 11px; bottom: 9px; font-weight: inherit; transform: translateY(50%); }
.chart-extreme-low b { top: 9px; bottom: auto; transform: translateY(-50%); }
.chart-extreme[data-side="left"] b { left: auto; right: 11px; }

@media (max-width: 600px) {
  .chart-presentation { align-items: flex-start; flex-direction: column; margin-bottom: 16px; }
  .chart-summary { align-items: flex-start; }
  .chart-return { text-align: left; }
  .price-chart svg { height: 220px; }
  .price-grid text { font-family: var(--font-ui); font-size: 18px; }
  .price-date-axis text { font-size: 18px; }
  .price-date-axis text:nth-child(2) { display: none; }
  .price-chart figcaption { flex-direction: column; gap: 2px; }
  .price-chart figcaption > :last-child { text-align: left; }
  .price-chart[data-style="perplexity"] .chart-price-block { align-items: flex-start; flex-direction: column-reverse; gap: 4px; }
  .price-chart[data-style="perplexity"] .chart-range-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-chart-card .seg { display: flex; flex-wrap: wrap; }
}

/* Reference palettes are scoped to the selected stock presentation and its controls. */
.ticker { color: var(--text); transition: background-color .15s; }
/* Feargreedflow's own stock page palettes: its light theme, and its dark one when this app is dark. */
.ticker[data-chart-style="feargreed"], .price-chart[data-style="feargreed"] {
  --bg: #f5f7f8; --bg-elevated: #fff; --bg-inset: #fafbfb; --bg-hover: #f0f4f5;
  --text: #29343a; --text-2: #4b5a62; --text-3: #7c8a92; --navy: #29343a;
  --accent: #18a999; --accent-hover: #12958a; --accent-text: #128a7d; --accent-ink: #fff;
  --bg-accent-soft: #18a9991a; --line: #e3e8ea; --line-strong: #cfd8dc; --chip: #fafbfb;
  --up: #16a34a; --down: #dc2626;
}
:root[data-theme="dark"] :is(.ticker[data-chart-style="feargreed"], .price-chart[data-style="feargreed"]) {
  --bg: #0a0a0a; --bg-elevated: #111214; --bg-inset: #17181b; --bg-hover: #1d1f23;
  --text: #f5f6f7; --text-2: #c9ced6; --text-3: #8b93a3; --navy: #f5f6f7;
  --accent: #30cc5a; --accent-hover: #3ddc68; --accent-text: #30cc5a; --accent-ink: #000;
  --bg-accent-soft: #30cc5a1f; --line: #24262b; --line-strong: #33363d; --chip: #1d1f23;
  --up: #30cc5a; --down: #f63538;
}
.price-chart[data-style="feargreed"][data-tone="down"] .price-baseline { stroke: var(--text-3); }
.ticker[data-chart-style="robinhood"], .price-chart[data-style="robinhood"] {
  --bg: #fff; --bg-elevated: #fff; --bg-inset: #f5f8f5; --bg-hover: #00c8050d;
  --text: #000; --text-2: #30363a; --text-3: #6f787e; --navy: #000;
  --accent: #00c805; --accent-hover: #00b405; --accent-text: #008c04; --accent-ink: #000;
  --bg-accent-soft: #00c80512; --line: #e3e9ed; --line-strong: #c6ced3; --chip: #f3f5f4;
  --up: #00c805; --down: #ff5000;
}
.ticker[data-chart-style="yahoo"], .price-chart[data-style="yahoo"] {
  --bg: #fff; --bg-elevated: #fff; --bg-inset: #f5f8fa; --bg-hover: #eef6ff;
  --text: #232a31; --text-2: #464e56; --text-3: #5b636b; --navy: #232a31;
  --accent: #1967d2; --accent-hover: #1557b0; --accent-text: #1967d2; --accent-ink: #fff;
  --bg-accent-soft: #f0f9ff; --line: #dde0e4; --line-strong: #cbd2da; --chip: #f0f7ff;
  --up: #037b66; --down: #d60a22;
}
.ticker[data-chart-style="google"], .price-chart[data-style="google"] {
  --bg: #fff; --bg-elevated: #fff; --bg-inset: #f7f8fa; --bg-hover: #e8eaed;
  --text: #0a0a0a; --text-2: #3c4043; --text-3: #5f6368; --navy: #202124;
  --accent: #0b57d0; --accent-hover: #0842a0; --accent-text: #1967d2; --accent-ink: #fff;
  --bg-accent-soft: #e5edff; --line: #dcdfe5; --line-strong: #bdc1c6; --chip: #e8eaed;
  --up: #046e00; --down: #c5221f;
}
.ticker[data-chart-style="perplexity"], .price-chart[data-style="perplexity"] {
  --bg: #fbfbfb; --bg-elevated: #fff; --bg-inset: #f7f8f7; --bg-hover: #edf0ef;
  --text: #0b2833; --text-2: #485e66; --text-3: #647b83; --navy: #0b2833;
  --accent: #016a71; --accent-hover: #015a60; --accent-text: #016a71; --accent-ink: #fff;
  --bg-accent-soft: #e5eeee; --line: #eef0f1; --line-strong: #dadee0; --chip: #edf0ef;
  --up: #016b1d; --down: #a23544;
}
.ticker[data-chart-style] { padding: 18px; background: var(--bg); border-radius: 12px; }
.ticker[data-chart-style] .card { color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.ticker[data-chart-style] .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ticker[data-chart-style] .btn-primary:hover { background: var(--accent-hover); }
.ticker[data-chart-style] .ticker-symbol { color: var(--text); }
.ticker[data-chart-style="robinhood"] .ticker-price { font-size: 34px; color: #000; }
.ticker[data-chart-style="robinhood"] .stock-chart-card { border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); padding-inline: 0; }
.stock-chart-card:has(.price-chart[data-style="robinhood"]) .seg-btn[aria-pressed="true"] { color: #000; border-bottom-color: #000; }
.price-chart[data-style="yahoo"] .chart-line { stroke: var(--tone); }
.price-chart[data-style="yahoo"] .chart-area { fill: var(--tone); opacity: .22; }
.price-chart[data-style="yahoo"] :is(.price-endpoint, .price-cursor-dot) { fill: var(--tone); }
.stock-chart-card:has(.price-chart[data-style="yahoo"]) .seg { background: none; padding: 0; }
.stock-chart-card:has(.price-chart[data-style="yahoo"]) .seg-btn[aria-pressed="true"] { background: #f0f9ff; color: #1967d2; box-shadow: none; }
.ticker[data-chart-style="yahoo"] .ticker-symbol { font-family: var(--font-ui); font-weight: 700; }
.price-chart[data-style="google"] { --tone: var(--up); }
.price-chart[data-style="google"][data-tone="down"] { --tone: var(--down); }
.price-chart[data-style="google"] .chart-area { opacity: .17; }
.stock-chart-card:has(.price-chart[data-style="google"]) .seg { background: #f7f8fa; }
.stock-chart-card:has(.price-chart[data-style="google"]) .seg-btn[aria-pressed="true"] { color: #0a0a0a; background: #e9ebf0; box-shadow: none; }
.price-chart[data-style="perplexity"] .chart-area { opacity: .13; }
.ticker[data-chart-style="perplexity"] .stock-chart-card { box-shadow: none; padding: 0; background: transparent; }
.stock-chart-card:has(.price-chart[data-style="perplexity"]) .seg { background: #f5f7f7; border: 1px solid #e5e7e6; }
.stock-chart-card:has(.price-chart[data-style="perplexity"]) .seg-btn[aria-pressed="true"] { background: #e5e6e6; color: #0b2833; box-shadow: none; }
@media (max-width: 600px) {
  .ticker[data-chart-style] { padding: 10px; }
}

.ticker-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; }
.ticker-head > div:first-child { flex: 1; min-width: 200px; }
.ticker-symbol { margin: 0; font: 600 28px/1.1 var(--font-mono); }
.ticker-name { margin: 4px 0 0; color: var(--text-2); }
.ticker-quote { text-align: right; }
.ticker-price { margin: 0; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ticker-change { margin: 2px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: max-content 1fr max-content 1fr; column-gap: 20px; margin: 0; }
.stats.single { grid-template-columns: max-content 1fr; }
.stats dt, .stats dd { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.stats dt { color: var(--text-3); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.stats a { color: var(--accent-text); }
.ask-form, .add-symbol, .draft-row { display: flex; gap: 8px; }
.ask-form .btn, .add-symbol .btn, .draft-row .btn { height: 42px; flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13px; text-align: left; color: var(--text-2); }
.chip:hover { background: var(--bg-hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.news { display: flex; flex-direction: column; }
.news-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.news-item:last-child { border-bottom: 0; }
.news-item b { font-size: 14px; font-weight: 500; line-height: 1.4; }
a.news-item:hover b { color: var(--accent-text); }
.news-item small { font-size: 12px; color: var(--text-3); }
.news-logo { width: 14px; height: 14px; margin-right: 6px; border-radius: 3px; vertical-align: -2px; }
.news-more { display: block; margin: 6px auto 0; padding: 6px 12px; border-radius: var(--r-md); color: var(--text-3); font-size: 12.5px; }
.news-more:hover { background: var(--bg-hover); color: var(--text); }
.macro-grid { margin-bottom: 12px; }
.macro-value { margin: 0; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.macro-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.macro-head h3 { margin: 0; }
.macro-pills .seg { flex-wrap: wrap; }
.macro-value small { font-size: 12.5px; font-weight: 400; color: var(--text-3); }

/* Tool steps, charts and sources inside answers */
.answer-extras { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.answer-extras:empty { display: none; }
.answer-chart { padding: 14px 16px 12px; border-radius: var(--r-lg); background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line); }
.chart-title { margin-bottom: 10px; }
.answer-stocks { display: grid; gap: 16px; margin-bottom: 16px; }
.answer-stocks:empty { display: none; }
.chat-stock { min-width: 0; }
.chat-stock-heading { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.chat-stock-symbol { display: inline-flex; align-items: center; flex-shrink: 0; gap: 8px; color: var(--accent-text); font: 700 20px/1.4 var(--font-mono); }
.chat-stock-symbol .stock-logo { margin-right: 0; }
.chat-stock-symbol:hover { text-decoration: underline; }
.chat-stock-name { margin: 4px 0; font-size: 18px; font-weight: 600; }
.chat-stock-details, .chat-stock-status { margin: 0; color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.chat-stock-pricing { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; text-align: left; }
.chat-stock-heading { flex-direction: column; gap: 4px; margin-bottom: 8px; }
.chat-stock-pricing .chat-stock-symbol { align-self: center; }
.chat-stock-pricing .chat-stock-quote { font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.chat-stock-pricing .chat-stock-change { font-size: 14px; font-weight: 700; }
.chat-stock-session { margin: -5px 0 14px; }
.chat-stock-session b { color: var(--text); font-weight: 700; }
.chat-stock-post-change[data-tone="up"] { color: var(--up); }
.chat-stock-post-change[data-tone="down"] { color: var(--down); }
.chat-stock-chart .chart-summary { display: none; }
.chat-stock-chart :is(figcaption, .stock-prev-close-badge) { display: none; }
.chat-stock-chart .price-chart { padding: 12px 4px; border: 0; }
.chat-stock-chart .chart-drawing > svg { height: 285px; }
.chat-stock-chart .chart-presentation { display: none; }
.chat-stock-chart .chart-x-labels { display: block; position: absolute; inset: 0; pointer-events: none; }
.chat-stock-chart .stock-axis-date { position: absolute; top: 100%; color: var(--text-3); font: 11px/1.3 var(--font-ui); white-space: nowrap; transform: translateX(-50%); }
.chat-stock-chart .stock-axis-date[data-align="start"] { transform: none; }
.chat-stock-chart .stock-axis-date[data-align="end"] { transform: translateX(-100%); }
.chat-stock-chart .chat-stock-volume { margin-top: 18px; }
.chat-stock-volume svg { height: 60px; display: block; width: 100%; }
.chat-stock-volume rect { fill: var(--up); opacity: .45; }
.chat-stock-volume rect[data-tone="down"] { fill: var(--down); }
.chat-stock-volume small { display: block; color: var(--text-3); font-size: 11px; padding: 5px 0; }
.chat-stock-facts dd { font-weight: 600; }
@media (max-width: 520px) {
  .chat-stock-pricing { text-align: left; }
  .chat-stock-chart .chart-drawing > svg { height: 240px; }
  .chat-stock-chart .stock-axis-date:nth-child(2) { display: none; }
  .chat-stock .chat-stock-ranges { gap: 6px; }
  .chat-stock-ranges .seg { gap: 0; }
  .chat-stock-ranges .seg-btn { padding-inline: 5px; font-size: 11px; }
  .chat-stock .chat-stock-ranges .avm-export { font-size: 10px; letter-spacing: .02em; padding: 4px 6px; }
}
.chat-stock-quote { margin: 0 0 4px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chat-stock-change { font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-stock-change[data-tone="up"] { color: var(--up); }
.chat-stock-change[data-tone="down"] { color: var(--down); }
.chat-stock-ranges { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.chat-stock-ranges > .seg, .chat-stock-ranges > .avm-export { flex-shrink: 0; }
.chat-stock-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.chat-stock-facts dt { color: var(--text-3); font-size: 11px; }
.chat-stock-facts dd { margin: 4px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.chat-stock-description { margin: 0 0 12px; font-size: 13px; line-height: 1.6; }
.chat-stock-chart .price-chart { margin-bottom: 14px; }
@media (max-width: 600px) { .chat-stock-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sources { margin: 12px 0 0; padding: 10px 0 0 20px; border-top: 1px solid var(--line); font-size: 13px; }
.sources li + li { margin-top: 4px; }
.sources a { color: var(--accent-text); overflow-wrap: anywhere; text-underline-offset: 2px; }
.sources .source-icon { width: 14px; height: 14px; margin-right: 6px; border-radius: 3px; vertical-align: -2px; }
.sources .source-site { font-weight: 600; color: var(--text); }
.sources .source-site::after { content: '·'; margin: 0 6px; font-weight: 400; color: var(--text-3); }
.context-chip { background: var(--bg-accent-soft); color: var(--accent-text); }

/* Search palette */
.palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; }
.palette-field { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.dialog .palette-field input { flex: 1; height: 54px; padding: 0; border: 0; box-shadow: none; background: none; font-size: 16px; color: var(--text); }
.dialog .palette-field input:focus-visible { outline: none; }
.palette-list { max-height: 420px; margin: 0; padding: 6px; overflow-y: auto; list-style: none; }
.palette-group { padding: 10px 10px 4px; font: 500 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.palette-item { display: grid; grid-template-columns: 16px 1fr; align-items: center; column-gap: 12px; width: 100%; padding: 8px 10px; border-radius: var(--r-md); font-size: 14px; text-align: left; }
.palette-item svg { grid-row: span 2; color: var(--text-3); }
.palette-item small { grid-column: 2; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.palette-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item[aria-selected="true"], .palette-item:hover { background: var(--bg-hover); }
.palette-empty { padding: 18px 10px; font-size: 13.5px; color: var(--text-3); }

/* Chats page */
.toolbar { display: flex; align-items: center; gap: 12px; }
.toolbar input { flex: 1; }
.bulk { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 14px; border-radius: var(--r-md); background: var(--bg-accent-soft); font-size: 13.5px; }
.bulk span { flex: 1; }
.chat-rows { margin: 0; padding: 0; list-style: none; border-radius: var(--r-lg); background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line); }
.chat-row { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 14px; border-bottom: 1px solid var(--line); }
.chat-row:last-child { border-bottom: 0; }
.chat-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.chat-row .icon-btn { opacity: 0; }
.chat-row:hover .icon-btn, .chat-row:focus-within .icon-btn { opacity: 1; }
.chat-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 4px; text-align: left; }
.chat-open b { overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.chat-open small { font-size: 12.5px; color: var(--text-3); }
.chat-open:hover b { color: var(--accent-text); }
.chat-empty { padding: 20px 16px; font-size: 13.5px; list-style: none; color: var(--text-3); }
.hits { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
.hits:empty { display: none; }
.hits-head { margin-bottom: 6px; }
.hit { padding: 10px 14px; border-radius: var(--r-md); }
.hit:hover { background: var(--bg-hover); }

/* Agents page */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.agent-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r-lg); background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line); text-align: left; }
.agent-card.active { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px var(--bg-accent-soft); }
.agent-top { display: flex; align-items: center; gap: 8px; }
.agent-top b { flex: 1; font-size: 14.5px; font-weight: 600; }
.agent-card p { flex: 1; margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.agent-card small { font-size: 12px; color: var(--text-3); }
.badge { padding: 2px 8px; border-radius: 999px; background: var(--bg-accent-soft); color: var(--accent-text); font: 600 10px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.agent-new { justify-content: center; min-height: 150px; border: 1.5px dashed var(--line-strong); background: none; box-shadow: none; }
.agent-new:hover { border-color: var(--accent); }
.agent-new b { font-size: 14.5px; color: var(--accent-text); }
.agent-form { display: flex; flex-direction: column; gap: 14px; padding: 16px 20px 20px; overflow-y: auto; }
.field-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; }
.dialog input[type="color"] { width: 64px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--bg-elevated); cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Guide page */
.guide-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--bg-accent-soft); color: var(--accent); }
.guide-icon svg { width: 18px; height: 18px; }
.guide-list { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); }
.guide-list li + li { margin-top: 6px; }
#guideKeys { scroll-margin-top: 16px; }

/* Download page */
a.btn { text-decoration: none; }
.page code { padding: 1px 5px; border-radius: 4px; background: var(--chip); font: .86em/1.5 var(--font-mono); }
.page a:not(.btn) { color: var(--accent-text); text-underline-offset: 2px; }
.download-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.download-card.mine { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px var(--bg-accent-soft); }
.download-banner { margin: 0; padding: 10px 14px; border-radius: var(--r-md); background: var(--bg-accent-soft); font-size: 13.5px; color: var(--accent-text); }
.quit-note { margin: 30vh auto 0; font-size: 15px; text-align: center; color: var(--text-2); }

.toast { position: fixed; bottom: 28px; left: 50%; z-index: 10; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--r-md); background: var(--navy); color: #fff; font-size: 13px; box-shadow: var(--shadow-pop); opacity: 0; translate: -50% 8px; pointer-events: none; transition: opacity .2s, translate .2s var(--ease-out); }
.toast.show { opacity: 1; translate: -50% 0; }

.scrim { display: none; }

@keyframes rise-in { from { opacity: 0; translate: 0 6px; } }
@keyframes pop-in { from { opacity: 0; scale: .97; } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes dot-pulse { from { opacity: .7; scale: 1; } to { opacity: 0; scale: 3; } }

@media (hover: none) { .actions, .recent-more { opacity: 1; } .nav-kbd { display: none; } }

@media (max-width: 860px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: min(300px, calc(100vw - 52px)); translate: -104% 0; transition: translate .2s var(--ease-out); }
  .app:not(.side-open) > .sidebar { position: relative; inset: auto; width: 60px; translate: none; }
  .app:not(.side-open) .sidebar :is(.nav-label, .nav-kbd, .recents, .profile-meta, .profile-chevron) { display: none; }
  .app:not(.side-open) .sidebar .side-head { flex-direction: column; height: auto; padding: 10px 0 6px; }
  .app:not(.side-open) .sidebar .brand-logo { width: 44px; }
  .app:not(.side-open) .sidebar .side-toggle { display: none; }
  .app:not(.side-open) .sidebar .nav { padding-inline: 6px; }
  .app:not(.side-open) .sidebar .nav-item { justify-content: center; padding: 0; }
  .app:not(.side-open) .sidebar .profile { justify-content: center; padding: 6px 0; }
  .app:not(.side-open) .sidebar .side-foot { margin-top: auto; padding-inline: 6px; }
  .app.side-open .sidebar { translate: 0; }
  .app.side-open .main { margin-left: 60px; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 4; background: #0a1f5c47; }
  .main .menu-btn { display: inline-grid; }
  .messages { padding: 56px 16px 24px; }
  .dock { padding: 0 16px 12px; }
  .page { padding: 60px 16px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .fin-grid, .macro-grid, .download-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .range-col { display: none; }
  .stats { grid-template-columns: max-content 1fr; }
  .ticker-quote { text-align: left; }
}
@media (max-width: 520px) {
  .pill .label, .think-tag { display: none; }
  .model-select { max-width: 140px; }
}
/* Finance-team workflows */
.wf-page { max-width: 1160px; gap: 20px; }
.wf-service { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: 12px; color: var(--text-2); }
.wf-service small { margin-left: auto; color: var(--text-3); }
.wf-service-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.wf-connections { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; }
.wf-connections summary, .wf-full-report summary { cursor: pointer; font-weight: 500; }
.wf-connections p { margin: 10px 0 0; max-width: 76ch; }
.wf-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.wf-layout.wf-no-sidebar { grid-template-columns: minmax(0, 1fr); }
.wf-workflow-list { display: flex; flex-direction: column; gap: 7px; }
.wf-workflow-item { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px; border-radius: var(--r-md); text-align: left; transition: background-color .15s; }
.wf-workflow-item:hover { background: var(--bg-hover); }
.wf-workflow-item.selected { background: var(--bg-accent-soft); box-shadow: inset 2px 0 var(--accent); }
.wf-workflow-item strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.wf-workflow-item small, .wf-workflow-item > span { color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.wf-workflow-item > span { padding-top: 6px; }
.wf-workspace { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.wf-intro { padding: 32px; background: var(--bg-elevated); border-top: 2px solid var(--accent); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.wf-eyebrow { color: var(--accent-text); font: 500 11px/1.5 var(--font-mono); }
.wf-intro h2 { max-width: 20ch; margin: 18px 0 12px; font-size: clamp(26px, 3vw, 36px); font-weight: 500; line-height: 1.15; letter-spacing: -.035em; text-wrap: balance; }
.wf-intro > p { max-width: 61ch; margin: 0 0 20px; color: var(--text-2); font-size: 14px; }
.wf-intro > .fin-note { margin: 14px 0 0; font-size: 12px; }
.wf-steps { display: flex; flex-wrap: wrap; gap: 12px 30px; padding-left: 18px; margin: 26px 0; color: var(--text-2); font-size: 13px; }
.wf-steps li { padding-right: 8px; }
.wf-editor { gap: 20px; padding: 24px; }
.wf-section-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.wf-section-head h2 { margin: 0 0 3px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.wf-section-head h3 { padding-top: 3px; }
.wf-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.wf-editor .field { width: 100%; min-width: 0; height: 40px; background: var(--bg-elevated); }
.wf-editor input[type="number"] { font-variant-numeric: tabular-nums; }
.wf-editor .field-label { font-size: 12px; }
.wf-editor h3, .wf-run h3 { margin: 0; font-size: 14px; font-weight: 600; }
.wf-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wf-page .btn { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0; text-transform: none; }
.wf-page button:disabled, .wf-page input:disabled, .wf-page select:disabled { opacity: .5; cursor: not-allowed; }
.wf-check { display: flex; gap: 9px; align-items: center; color: var(--text-2); font-size: 13px; }
.wf-check input { accent-color: var(--accent); }
.wf-delivery { display: flex; flex-direction: column; gap: 14px; }
.wf-auto-consent, .wf-review { padding: 14px; border-left: 2px solid var(--accent); background: var(--bg-accent-soft); }
.wf-review { display: flex; flex-wrap: wrap; gap: 12px; }
.wf-review > p { flex-basis: 100%; }
.wf-error { margin: 0; padding: 10px 12px; border-left: 2px solid var(--danger); color: var(--danger); background: #c4323c08; font-size: 13px; }
.wf-notice { margin: 0; padding: 12px 14px; color: var(--text-2); background: var(--bg-inset); font-size: 13px; }
.wf-definition { gap: 14px; }
.wf-definition-meta { margin: 0; color: var(--text-2); font-size: 13px; }
.wf-delete { font-size: 12px; color: var(--text-3); }
.wf-delete summary { cursor: pointer; }
.wf-delete > p { margin-top: 8px; }
.wf-delete > button { margin-top: 8px; color: var(--danger); }
.wf-history h2 { font-size: 16px; }
.wf-history { gap: 0; }
.wf-history > .wf-section-head { margin-bottom: 12px; }
.wf-history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); text-align: left; }
.wf-history-row:hover { background: var(--bg-hover); }
.wf-history-row.selected { color: var(--accent-text); }
.wf-history-row strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.wf-history-row small { display: block; margin-top: 3px; font-size: 11px; color: var(--text-3); }
.wf-status { flex-shrink: 0; font-size: 11px; color: var(--text-3); }
.wf-status.awaiting_review { color: var(--accent-text); }
.wf-status.needs_attention, .wf-status.delivery_failed { color: var(--danger); }
.wf-run { gap: 18px; }
.wf-run > .wf-section-head { flex-direction: column; }
.wf-recipients { padding: 12px 14px; background: var(--bg-inset); font-size: 12px; overflow-wrap: anywhere; }
.wf-recipients p { margin: 4px 0 0; }
.wf-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.wf-table th, .wf-table td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.wf-table th:first-child { text-align: left; font-weight: 500; }
.wf-table thead th { background: var(--bg-inset); color: var(--text-2); font-size: 11px; font-weight: 500; }
.wf-table tbody tr:last-child { color: var(--accent-text); background: var(--bg-accent-soft); font-weight: 600; }
.wf-full-report { border-top: 1px solid var(--line); padding-top: 16px; font-size: 13px; }
.wf-report { padding-top: 20px; font-size: 13px; white-space: normal; }
.wf-report:not(:has(*)) { white-space: pre-wrap; }
.wf-report td:not(:first-child) { text-align: right; }
@media (max-width: 1000px) {
  .wf-layout { grid-template-columns: minmax(0, 1fr); }
  .wf-workflow-list { flex-direction: row; overflow-x: auto; }
  .wf-workflow-item { width: 210px; flex-shrink: 0; }
}
@media (max-width: 600px) {
  .wf-fields { grid-template-columns: minmax(0, 1fr); }
  .wf-editor, .wf-intro { padding: 18px; }
  .wf-section-head { flex-wrap: wrap; }
  .wf-service small { flex-basis: 100%; margin-left: 15px; }
}
@media print {
  body:has(#main[data-view="workflows"]) { height: auto; background: #fff; }
  body:has(#main[data-view="workflows"]) .app { height: auto; display: block; }
  body:has(#main[data-view="workflows"]) .sidebar,
  #main[data-view="workflows"] > :not(#page),
  #main[data-view="workflows"] .wf-page > :not(.wf-layout),
  #main[data-view="workflows"] .wf-workflow-list,
  #main[data-view="workflows"] .wf-workspace > :not(.wf-run),
  #main[data-view="workflows"] .wf-run button,
  #main[data-view="workflows"] .wf-full-report > summary,
  #main[data-view="workflows"] .wf-review { display: none !important; }
  #main[data-view="workflows"] .page { overflow: visible; padding: 0; }
  #main[data-view="workflows"] .wf-layout { display: block; }
  #main[data-view="workflows"] .wf-run { box-shadow: none; padding: 0; }
  #main[data-view="workflows"] .wf-table { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.research-evidence { margin: 12px 0; font-size: .8rem; color: var(--muted, #5b6877); overflow-wrap: anywhere; }
.research-evidence summary { cursor: pointer; }
.research-evidence p { margin: 8px 0; }

/* ── Clients (advisor desk) ─────────────────────────────── */
.av-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.av-client-head h2 { font-size: 22px; }
.av-page .card-head h2 { margin: 0; font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.av-tabs { flex-wrap: wrap; }
.av-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.av-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--line); }
.card .av-kpi { background: var(--bg-inset); box-shadow: none; }
.av-kpi span { font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.av-kpi strong { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.av-kpi small { font-size: 12px; color: var(--text-3); }
.av-kpi.warn strong { color: var(--danger); }
.av-kpi.good strong { color: var(--ok); }
.av-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.av-table th, .av-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.av-table th { white-space: nowrap; }
.av-table th.l, .av-table td.l { text-align: left; }
.av-table thead th { background: var(--bg-inset); color: var(--text-2); font-size: 11px; font-weight: 500; }
.av-table tr.av-off td { color: var(--danger); }
.av-table tr.av-sell td:first-child { color: var(--down); font-weight: 600; }
.av-table tr.av-buy td:first-child { color: var(--up); font-weight: 600; }
.av-alloc td:nth-child(2) { width: 34%; min-width: 120px; }
.av-bar { position: relative; height: 10px; border-radius: 5px; background: var(--bg-inset); }
.av-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--accent); }
.av-bar i.off { background: var(--danger); }
.av-bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--navy); }
.av-list { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-2); }
.av-list li + li { margin-top: 6px; }
.av-sev { display: inline-block; min-width: 54px; padding: 1px 6px; border-radius: 999px; font: 600 9.5px/1.6 var(--font-mono); letter-spacing: .08em; text-align: center; text-transform: uppercase; background: var(--chip); color: var(--text-2); }
.av-sev.high { background: #c4323c1a; color: var(--danger); }
.av-sev.medium { background: #d7832f1f; color: #9a5a14; }
.av-alerts { display: flex; flex-direction: column; }
.av-alert { display: grid; grid-template-columns: max-content minmax(120px, 200px) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line); text-align: left; font-size: 13px; }
.av-alert:hover { background: var(--bg-hover); }
.av-alert strong { font-weight: 600; overflow-wrap: anywhere; }
.av-alert > span:last-child { color: var(--text-2); }
.av-alert-count { color: var(--danger) !important; }
.av-goal { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.av-target-fields { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.av-target-fields .field { width: 100%; min-width: 0; }
.av-csv, .av-compliance-input { width: 100%; font: 12px/1.5 var(--font-mono); }
.av-compliance-input { font-family: var(--font-ui); font-size: 13.5px; }
.av-details summary { cursor: pointer; font-size: 13px; font-weight: 500; }
.av-details[open] { display: flex; flex-direction: column; gap: 10px; }
.av-quiz fieldset { margin: 0; padding: 14px 0 4px; border: 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.av-quiz legend { padding: 0; font-size: 13.5px; font-weight: 600; }
.av-quiz fieldset > small { color: var(--text-3); font: 500 10px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.av-compliance { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-left: 2px solid var(--ok); background: #1d8a5b0d; }
.av-compliance.review { border-left-color: #d7832f; background: #d7832f0f; }
.av-compliance.revise { border-left-color: var(--danger); background: #c4323c0b; }
.av-compliance-head { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.av-compliance-head small { color: var(--text-2); }
.av-finding { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px; font-size: 12.5px; }
.av-finding q { display: block; margin: 3px 0; color: var(--text-2); font-style: italic; overflow-wrap: anywhere; }
.av-finding p { margin: 2px 0 0; color: var(--text-3); }
.av-finding .av-sev { align-self: start; }
.av-draft-body, .av-ips { padding: 16px 18px; border-radius: var(--r-md); background: var(--bg-inset); font-size: 14px; }
.av-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.av-fan { margin: 0; }
.av-fan svg { display: block; width: 100%; height: auto; }
.av-fan .av-grid line { stroke: var(--line); stroke-width: 1; }
.av-fan .av-grid text, .av-retire-label { fill: var(--text-3); font: 10px var(--font-mono); }
.av-band-outer { fill: #0088cf1f; }
.av-band-inner { fill: #0088cf40; }
.av-median { fill: none; stroke: var(--navy); stroke-width: 2; }
.av-retire { stroke: var(--text-3); stroke-dasharray: 4 4; }
.av-fan figcaption { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.av-key::before { content: ""; display: inline-block; width: 12px; height: 8px; margin-right: 6px; border-radius: 2px; vertical-align: 0; }
.av-key.outer::before { background: #0088cf1f; }
.av-key.inner::before { background: #0088cf40; }
.av-key.median::before { height: 2px; vertical-align: 3px; background: var(--navy); }
@media (max-width: 860px) {
  .av-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .av-target-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .av-goal { grid-template-columns: minmax(0, 1fr); }
  .av-alert { grid-template-columns: max-content minmax(0, 1fr); }
  .av-alert > span:last-child { grid-column: 1 / -1; }
}
@media print {
  body:has(#main[data-view="clients"]) { height: auto; background: #fff; }
  body:has(#main[data-view="clients"]) .app { height: auto; display: block; }
  body:has(#main[data-view="clients"]) .sidebar,
  #main[data-view="clients"] > :not(#page),
  #main[data-view="clients"] .av-page > :not(.wf-layout),
  #main[data-view="clients"] .wf-workflow-list,
  #main[data-view="clients"] .av-tabs,
  #main[data-view="clients"] .av-client-head,
  #main[data-view="clients"] .av-stack > :not(.card:has(.av-ips)),
  #main[data-view="clients"] .card:has(.av-ips) > :not(.av-ips) { display: none !important; }
  #main[data-view="clients"] .page { overflow: visible; padding: 0; }
  #main[data-view="clients"] .wf-layout { display: block; }
  #main[data-view="clients"] .av-ips { background: none; padding: 0; }
}

/* ── Clients: tools, documents, practice, packets ─────────── */
.av-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.on, .chip[aria-pressed="true"] { background: var(--bg-accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.av-recon { padding: 10px 12px; border-left: 2px solid var(--ok); background: #1d8a5b0d; font-size: 13px; }
.av-recon.warn { border-left-color: #d7832f; background: #d7832f0f; }
.av-row-actions { display: inline-flex; gap: 12px; white-space: nowrap; }
.av-ask { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.av-ask .field { flex: 1 1 240px; min-width: 0; height: 38px; }
.av-ask select.field { flex: 0 0 auto; }
.av-pre { margin: 0; padding: 14px; border-radius: var(--r-md); background: var(--bg-inset); font: 12px/1.55 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.av-table tr.av-best td { background: var(--bg-accent-soft); font-weight: 600; }
.av-chat { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; }
.av-bubble { max-width: 82%; padding: 10px 14px; border-radius: var(--r-lg); font-size: 14px; }
.av-bubble p { margin: 2px 0 0; white-space: pre-wrap; }
.av-bubble small { color: var(--text-3); font: 500 10px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.av-bubble.client { align-self: flex-start; background: var(--bg-inset); }
.av-bubble.advisor { align-self: flex-end; background: var(--bubble); }
#av-print { display: none; }
@media print {
  body.printing-packets { height: auto; background: #fff; }
  body.printing-packets > :not(#av-print) { display: none !important; }
  body.printing-packets #av-print { display: block; }
  .av-packet { break-after: page; color: #0d192d; font-size: 10.5pt; }
  .av-packet:last-child { break-after: auto; }
  .av-packet-head { padding-bottom: 10px; margin-bottom: 14px; border-bottom: 3px solid var(--brand, #0a1f5c); }
  .av-packet-head h1 { margin: 2px 0; font-size: 22pt; }
  .av-packet-head p { margin: 0; color: #3b4d61; }
  .av-packet-firm { font: 600 10pt var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--brand, #0a1f5c) !important; }
  .av-packet-section { break-inside: avoid; margin: 0 0 16px; }
  .av-packet-section h2 { margin: 0 0 8px; font-size: 13pt; color: var(--brand, #0a1f5c); }
  .av-packet .av-kpis { grid-template-columns: repeat(4, 1fr); }
  .av-packet .av-kpi { padding: 8px 10px; box-shadow: 0 0 0 1px #c9d5df; }
  .av-packet .av-kpi strong { font-size: 14pt; }
  .av-packet .av-table { font-size: 9.5pt; }
  .av-packet .av-table th, .av-packet .av-table td { padding: 5px 6px; }
  .av-packet .av-fan { max-width: 640px; }
  .av-disclosure { margin: 0 0 6px; font-size: 8.5pt; color: #3b4d61; }
}
.chat-stock-extra { margin: 4px 0 12px; }
.chat-stock-line { margin: 0 0 6px; font-size: 13px; color: var(--text-2); }
.chat-stock-holdings summary { cursor: pointer; font-size: 13px; color: var(--accent-text); margin: 4px 0; }
.chat-stock-holdings table { width: 100%; border-collapse: collapse; font-size: 12px; }
.chat-stock-holdings td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.chat-stock-holdings td.n { text-align: right; font-variant-numeric: tabular-nums; }
.chat-stock-valuation dd small { color: var(--text-3); font-size: 11px; }

/* ── Advisor desk, part two (advisor-plus.js) ─────────────────────────────── */
.av-trend { width: 100%; height: auto; margin: 10px 0 4px; }
.av-trend .grid { stroke: var(--line); stroke-width: 1; }
.av-trend .line { fill: none; stroke: var(--accent, #0088cf); stroke-width: 2; stroke-linejoin: round; }
.av-trend text { fill: var(--text-3); font-size: 11px; font-family: var(--font-mono); }
.av-tasks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.av-tasks li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-inset); }
.av-tasks li .wf-check { flex: 1 1 240px; margin: 0; }
.av-tasks li small { color: var(--text-3); font-size: 12px; }
.av-tasks li.late small { color: var(--danger); }
.av-tasks .done { text-decoration: line-through; color: var(--text-3); }
.av-timeline { display: grid; gap: 6px; margin-top: 12px; }
.av-activity { border-radius: var(--r-md); background: var(--bg-inset); padding: 8px 12px; }
.av-activity summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.av-activity summary small { color: var(--text-3); margin-left: auto; font-size: 12px; }
.av-pill { font: 500 10.5px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; padding: 0 8px; border-radius: 999px; background: var(--bg-elevated); color: var(--text-2); box-shadow: 0 0 0 1px var(--line); }
.av-pill.meeting { color: var(--accent-text); }
.av-recording { color: var(--danger); font-weight: 600; margin: 0 0 8px; animation: av-blink 1.2s ease-in-out infinite; }
@keyframes av-blink { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .av-recording { animation: none; } }
.av-record-frame { width: 100%; min-height: 480px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.av-table tr.warn td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* Phones: client tabs scroll sideways, tables become stacked cards, actions fill the width. */
@media (max-width: 640px) {
  #main[data-view="clients"] .av-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #main[data-view="clients"] .av-tabs button { flex: 0 0 auto; }
  .av-kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .av-kpi strong { font-size: 18px; }
  .av-page .table-wrap { overflow: visible; }
  .av-page .av-table thead { display: none; }
  .av-page .av-table, .av-page .av-table tbody, .av-page .av-table tr, .av-page .av-table td { display: block; width: 100%; }
  .av-page .av-table tr { margin-bottom: 10px; padding: 6px 12px; border-radius: var(--r-md); background: var(--bg-inset); }
  .av-page .av-table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); text-align: right; }
  .av-page .av-table td:last-child { border-bottom: 0; }
  .av-page .av-table td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex: 0 0 auto; max-width: 45%; }
  .av-page .av-table td.l:first-child { font-weight: 600; justify-content: flex-start; }
  .av-page .av-table td.l:first-child::before { display: none; }
  .av-page .wf-actions { flex-wrap: wrap; }
  .av-page .wf-actions > .btn { flex: 1 1 auto; }
  .av-page .av-ask { flex-wrap: wrap; }
  .av-page .av-ask > * { flex: 1 1 100%; }
  .av-toolbar { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .av-toolbar .chip { flex: 0 0 auto; }
}

/* Owner access form shown in chat when the Cloudflare site needs the owner key */
.owner-key { margin: 8px 0 4px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-inset); box-shadow: 0 0 0 1px var(--line); }
.owner-key p { margin: 0 0 10px; font-size: 13px; line-height: 1.55; color: var(--text-2); }
.owner-key code { font-family: var(--font-mono); font-size: 12px; }
.owner-key-row { display: flex; gap: 8px; flex-wrap: wrap; }
.owner-key-input { flex: 1 1 220px; min-width: 0; padding: 8px 10px; border-radius: var(--r-sm, 8px); border: 1px solid var(--line); background: var(--bg-elevated); color: inherit; font: inherit; }
.owner-key-status { display: block; margin-top: 6px; color: var(--text-3); font-size: 12px; }
.owner-key[hidden] { display: none; }

/* Bottom-left sign-in button (shown while signed out) */
.side-signin { margin-bottom: 4px; color: #fff; background: #ffffff14; box-shadow: inset 0 0 0 1px var(--side-line); }
.side-signin:hover { background: var(--side-hover); }
.side-signin[hidden] { display: none; }

/* Finance chat harness: calculation details under an answer */
.harness-note { margin: 10px 0 4px; display: grid; gap: 6px; }
.harness-note[hidden] { display: none; }
.harness-calcs summary { cursor: pointer; font-size: 12.5px; color: var(--accent-text); }
.harness-calc { margin-top: 8px; }
.harness-calc b { font-size: 12.5px; }
.harness-calc pre { margin: 4px 0 0; padding: 8px 10px; max-height: 260px; overflow: auto; border-radius: var(--r-md); background: var(--bg-inset); font: 11.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Shortcut row on phones: start at the left edge so every button can be scrolled to. */
@media (max-width: 760px) { .tabs { justify-content: flex-start; } }

/* New chat research views (lab.js), ported from Fear & Greed's research pages */
.answer-lab .lab-card { min-width: 0; }
.lab-head { margin-bottom: 12px; }
.lab-eyebrow { margin: 0 0 4px; color: var(--accent-text); font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.lab-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.lab-sub { margin: 4px 0 0; color: var(--text-3); font-size: 12.5px; }
.lab-sub:empty { display: none; }
.lab-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.lab-tools:empty { display: none; }
.lab-tools .seg { max-width: 100%; overflow-x: auto; }
.lab-tools .seg-btn { height: 26px; padding: 0 10px; font-size: 12.5px; white-space: nowrap; }
.lab-select, .lab-input { height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--bg-elevated); font-size: 13px; max-width: 100%; }
.lab-select { padding-right: 28px; appearance: none; background: var(--bg-elevated) var(--chevron) no-repeat right 8px center / 14px; }
.lab-form { display: flex; gap: 6px; }
.lab-input { width: 170px; text-transform: uppercase; }
.lab-input::placeholder { text-transform: none; color: var(--placeholder); }
.lab-form .seg-btn { height: 32px; background: var(--chip); color: var(--text); }
.lab-body { min-width: 0; }
.lab-foot { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; line-height: 1.5; }
.lab-foot:empty { display: none; }
.lab-subhead { margin: 18px 0 8px; color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.lab-muted { margin: 0; color: var(--text-3); font-size: 12.5px; }
.lab-dot { display: inline-block; flex: none; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }
.lab-ticker { color: var(--accent-text); font: 500 12px/1.3 var(--font-mono); }
.lab-ticker:hover { text-decoration: underline; }
[data-tone="up"]:is(.lab-legend b, .lab-bar-value, .lab-quote small, .lab-table span, .lab-table small) { color: var(--up); }
[data-tone="down"]:is(.lab-legend b, .lab-bar-value, .lab-quote small, .lab-table span, .lab-table small) { color: var(--down); }

/* Multi-line chart */
.lab-lines { padding-right: 44px; }
.lab-lines svg { height: 220px; }
.lab-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lab-grid.zero { stroke: var(--line-strong); }
.lab-line { fill: none; stroke-width: 1.8; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lab-tick { position: absolute; right: 0; translate: 0 -50%; color: var(--text-3); font: 400 10.5px/1 var(--font-mono); pointer-events: none; }
.lab-lines figcaption { margin-right: -44px; }
.lab-tip { display: grid; gap: 2px; padding: 6px 9px; text-align: left; }
.lab-tip b { font-weight: 500; opacity: .75; }
.lab-tip span { display: flex; align-items: center; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.lab-legend li { display: inline-flex; align-items: center; gap: 2px; }
.lab-legend b { margin-left: 6px; font: 500 12px var(--font-mono); }

/* Ranked diverging bars */
.lab-bars { display: grid; gap: 5px; margin: 0 0 14px; padding: 0; list-style: none; }
.lab-bars li { display: grid; grid-template-columns: minmax(120px, 1.1fr) 2fr 72px; align-items: center; gap: 10px; font-size: 12.5px; }
.lab-bar-label { display: flex; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lab-bar-track { position: relative; height: 12px; border-radius: 3px; background: linear-gradient(var(--line-strong), var(--line-strong)) center / 1px 100% no-repeat, var(--bg-inset); }
.lab-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; background: var(--up); }
.lab-bar[data-tone="down"] { background: var(--down); }
.lab-bar-value { font: 500 12px var(--font-mono); text-align: right; }
.lab-bar-note { grid-column: 1 / -1; color: var(--text-3); }

/* Tables */
.lab-table-wrap { min-width: 0; overflow-x: auto; }
.lab-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lab-table caption { padding-bottom: 6px; color: var(--text-2); font-size: 12px; font-weight: 600; text-align: left; }
.lab-table th { padding: 6px 8px; border-bottom: 1px solid var(--line-strong); color: var(--text-3); font-size: 11px; font-weight: 500; text-align: left; white-space: nowrap; }
.lab-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lab-table tbody tr:hover { background: var(--bg-hover); }
.lab-table .n { text-align: right; white-space: nowrap; }
.lab-table-wrap + .lab-table-wrap { margin-top: 18px; }

/* Stock map */
/* Stock maps, after feargreedflow's (app/globals.css .maps-*): a grey ground showing between sectors and industries,
   a band naming each sector, a label per industry, white tickers with a soft shadow, and logos on a white chip. */
.lab-map { position: relative; aspect-ratio: 1000 / 620; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--bg-elevated) 88%, var(--text)); }
.lab-map-sector { position: absolute; display: flex; align-items: center; padding: 0 6px; overflow: hidden; background: color-mix(in srgb, var(--bg-elevated) 88%, var(--text)); color: var(--text); font: 700 10.9px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }
.lab-map-industry { position: absolute; padding: 0 5px; overflow: hidden; background: color-mix(in srgb, var(--bg-elevated) 82%, transparent); color: var(--text-3); font: 600 9.3px/13px var(--font-ui); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }
.lab-map-tile { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; overflow: hidden; border: 0; border-radius: 0; box-shadow: inset 0 0 0 1px rgba(15, 17, 22, .55); color: #fff; line-height: 1.05; text-align: center; cursor: pointer; }
.lab-map-tile:is(:hover, :focus-visible) { z-index: 2; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75); outline: none; }
.lab-map-tile b { display: flex; align-items: center; gap: 6px; color: #fff; font-family: var(--font-ui); font-weight: 700; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.lab-map-tile small { margin-top: 1px; color: rgba(255, 255, 255, .92); font-family: var(--font-ui); line-height: 1.1; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.lab-map-logo { flex-shrink: 0; border-radius: 5px; background: rgba(255, 255, 255, .9); object-fit: contain; }
.lab-map-logo.stacked { margin-bottom: 4px; }
.lab-map-scale { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 10px; }
.lab-map-scale span { min-width: 52px; padding: 4px 8px; border-radius: 5px; color: #fff; font: 600 11.8px/1.2 var(--font-ui); text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }

/* Supply chain */
.lab-chain { display: grid; grid-template-columns: 1fr minmax(150px, .8fr) 1fr; gap: 12px; align-items: start; }
.lab-chain-col h4, .lab-chain-peers h4 { margin: 0 0 8px; color: var(--text-3); font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.lab-chain-col ul, .lab-chain-peers ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.lab-chain-col details { margin-top: 6px; font-size: 12px; }
.lab-chain-col summary { color: var(--accent-text); cursor: pointer; }
.lab-chain-col details ul { margin-top: 6px; }
.lab-chain-item { display: grid; grid-template-columns: auto 1fr; padding: 7px 9px; border-radius: var(--r-md); background: var(--bg-inset); font-size: 12.5px; }
.lab-chain-item .lab-dot { margin-top: 5px; }
.lab-chain-item small { grid-column: 2; color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.lab-chain-name { color: var(--text-2); }
.lab-chain-company { display: grid; grid-template-columns: auto 1fr; padding: 12px; border-radius: var(--r-md); background: var(--bg-accent-soft); box-shadow: inset 0 0 0 1px #0088cf33; }
.lab-chain-company .lab-dot { margin-top: 7px; }
.lab-chain-company b { font-size: 15px; }
.lab-chain-company small { grid-column: 2; margin-top: 2px; color: var(--text-2); font-size: 11.5px; }
.lab-chain-peers { margin-top: 16px; }
.lab-chain-peers ul { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* Historical metrics */
.lab-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lab-metric { min-width: 0; padding: 10px 12px 8px; border-radius: var(--r-md); background: var(--bg-inset); }
.lab-metric-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.lab-metric-head b { color: var(--text); font: 600 14px var(--font-mono); }
.lab-metric > small { display: block; margin: 2px 0 6px; color: var(--text-3); font-size: 11px; }
.lab-metric .chart svg { height: 84px; }
.lab-metric .chart figcaption { font-size: 10px; }

/* Global quotes */
.lab-quotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 16px; }
.lab-quote { display: grid; padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-inset); font-size: 11.5px; }
.lab-quote span { overflow: hidden; color: var(--text-3); white-space: nowrap; text-overflow: ellipsis; }
.lab-quote b { margin-top: 2px; font: 600 13.5px var(--font-mono); }
.lab-quote small { font: 500 11px var(--font-mono); }

/* Currency matrix */
.lab-matrix th:first-child, .lab-matrix tbody th { position: sticky; left: 0; background: var(--bg-elevated); }
.lab-matrix tbody th { padding: 6px 8px; border-bottom: 1px solid var(--line); color: var(--text-2); font: 600 11.5px var(--font-mono); }
.lab-matrix td { font-family: var(--font-mono); font-size: 11.5px; }

/* The 13F section: sentiment-lab's .hf-* styles (app/globals.css) on this app's theme tokens. The card takes the page
   colour so its panels read as panels, as they do on feargreedflow.com/hedge-funds. */
.lab-card.hf { container-type: inline-size; background: var(--bg); }
.lab-card.hf[aria-busy="true"] .lab-body { opacity: .55; transition: opacity .2s; }
.hf-views:empty { display: none; }
.hf-views { margin: 0 0 14px; }
.hf-views-track { display: flex; gap: 2px; width: max-content; max-width: 100%; padding: 3px; overflow-x: auto; scrollbar-width: none; border-radius: 999px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.hf-view { padding: 6px 13px; border-radius: 999px; color: var(--text-3); font: 500 12.5px var(--font-ui); white-space: nowrap; transition: background-color .2s, color .2s; }
.hf-view:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.hf-view[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--text) 12%, transparent); font-weight: 600; }
.hf .lab-body { display: grid; gap: 14px; }
.hf-panel { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elevated); }
.hf-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.hf-panel-head h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.hf-note { color: var(--text-3); font-size: 11.5px; }
.hf-sub { margin: 4px 0 10px; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.hf-empty { padding: 14px 0; color: var(--text-3); font-size: 12.5px; text-align: center; }
.hf-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.hf-pair-wide { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.hf-stack { display: grid; gap: 14px; align-content: start; min-width: 0; }
@container (max-width: 900px) { .hf-pair, .hf-pair-wide { grid-template-columns: minmax(0, 1fr); } }
/* The managers list beside the top 20 card runs the card's height and scrolls inside, so the two end level.
   `contain: size` keeps the list's own length out of the row's height. */
@container (min-width: 901px) {
  .hf-pair-even { align-items: stretch; }
  .hf-pair-even > .hf-panel:first-child { contain: size; display: flex; flex-direction: column; min-height: 440px; }
  .hf-pair-even > .hf-panel:first-child > div:last-child, .hf-pair-even > .hf-panel:first-child .hf-sort-wrap { display: flex; flex: 1; flex-direction: column; min-height: 0; }
  .hf-pair-even > .hf-panel:first-child .hf-scroll { flex: 1; min-height: 0; max-height: none; }
}

/* Toggles and the quarter row */
.hf-toggle { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.hf-toggle button { padding: 4px 12px; border-radius: 999px; color: var(--text-3); font-size: 12px; font-weight: 700; white-space: nowrap; }
.hf-toggle button:hover:not(:disabled):not(.on) { color: var(--text); }
.hf-toggle button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); }
.hf-toggle button:disabled { opacity: .4; cursor: default; }
.hf-quarters { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.hf-roster { border: 0; padding: 0; }
.hf-roster button { font-size: 14px; color: var(--text-3); }
.hf-roster button.on { background: var(--bg-inset); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.hf-search { flex: 1; min-width: 150px; max-width: 280px; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-inset); font-size: 12.5px; }
.hf-search:focus { border-color: var(--accent); outline: none; }
.hf-back { justify-self: start; color: var(--text-3); font-size: 12.5px; }
.hf-back:hover { color: var(--text); }

/* Facts strip */
.hf-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elevated); }
.hf-fact { padding: 11px 14px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.hf-fact dt { margin-bottom: 4px; color: var(--text-3); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hf-fact dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hf-fact-plain { font-size: 14px !important; font-weight: 600 !important; }
.hf-fact-wide { grid-column: span 2; }
.hf-fact-aside { display: inline-block; margin-left: 6px; color: var(--text-3); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.hf [data-tone="up"] { color: var(--up); }
.hf [data-tone="down"] { color: var(--down); }
.hf-bar { display: flex; height: 24px; margin-bottom: 6px; overflow: hidden; border-radius: 5px; }
.hf-bar-seg { display: grid; place-items: center; min-width: 2px; overflow: hidden; color: #fff; font-size: 11px; font-weight: 700; }
.hf-bar-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; color: var(--text-3); font-size: 11px; font-weight: 600; }
.hf-bar-key li { display: flex; align-items: center; gap: 6px; }
.hf-swatch { flex-shrink: 0; width: 10px; height: 10px; border-radius: 3px; }
.hf-explain { margin: 0; padding-left: 10px; border-left: 2px solid var(--line); color: var(--text-3); font-size: 12px; line-height: 1.5; }

/* Tables. The banding itself is in the long-lists rule at the end of this block. */
.hf-table-scroll { min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.hf-scroll { max-height: 520px; overflow-y: auto; }
.hf-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-elevated); }
.hf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hf-table th, .hf-table td { padding: 8px 10px; text-align: left; white-space: nowrap; vertical-align: middle; }
.hf-table th { border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hf-table .num { text-align: right; }
/* Numbers read a size up from the labels around them. */
.hf-table td.num { font-size: 13.5px; }
.hf-table .hf-rank { width: 2.4em; color: var(--text-3); text-align: right; }
/* Sortable headers: the label is the button, the arrow says which way. */
.hf-table th .hf-sort { display: inline-flex; align-items: center; gap: 3px; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.hf-table th .hf-sort:hover, .hf-table th .hf-sort.on { color: var(--text); }
.hf-table th.num .hf-sort { flex-direction: row-reverse; }
.hf-sort-mark { font-size: 8px; min-width: 8px; }
/* A manager's page while its filings load. */
.hf-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 340px; padding: 40px 16px; text-align: center; animation: rise-in .2s; }
.hf-loading b { font-size: 17px; font-weight: 700; }
.hf-loading-logo { border-radius: 10px; }
.hf-spinner { width: 32px; height: 32px; border: 3px solid color-mix(in srgb, var(--accent) 20%, transparent); border-top-color: var(--accent); border-right-color: var(--accent); border-radius: 50%; animation: site-spin .7s linear infinite; }
.hf-loading .is-loading::before { display: none; }
/* Charts & Visualizations. */
.hf-charts-tab .hf-panel-head { margin-bottom: 0; }
.hf-chart-panel .lab-lines svg { height: 240px; }
.hf-chart-figures { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; color: var(--text-2); font-size: 12.5px; }
.hf-chart-figure { display: inline-flex; align-items: center; gap: 6px; }
.hf-chart-figure b { font-size: 15px; }
.hf-chart-note { margin: 10px 0 0; color: var(--text-3); font-size: 12px; line-height: 1.55; }
.hf-chart-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px 12px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 11.5px; }
.hf-chart-key li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hf-legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hf-legend-pct { color: var(--text-3); font-variant-numeric: tabular-nums; }
.hf-fund-map > .seg { margin-bottom: 8px; }
/* The map tooltip (feargreedflow .maps-tooltip). */
.lab-map-tip { position: fixed; z-index: 90; width: 230px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--text) 9%, transparent); border-radius: 12px; background: var(--bg-elevated); color: var(--text); box-shadow: 0 10px 28px rgba(0, 0, 0, .22); pointer-events: none; font-family: var(--font-ui); }
.lab-map-tip-title { margin-bottom: 3px; font-size: 13.5px; font-weight: 700; }
.lab-map-tip-row { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.lab-map-tip-perfs { display: flex; flex-direction: column; gap: 1px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.lab-map-tip-perf { color: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lab-map-tip-perf.on { font-weight: 800; }
.hf-table td.hf-empty { white-space: normal; }
.hf-row { cursor: pointer; }
.hf-row:hover .hf-fund { color: var(--accent-text); }
.hf-est { margin-left: 4px; padding: 0 4px; border-radius: 4px; background: var(--bg-inset); font-size: 9px; font-style: normal; }
.hf-pnl-pct { display: block; font-size: 10.5px; font-style: normal; opacity: .8; }
/* Historic: four bars of shares held over the last four filings. */
.hf-hist { display: inline-flex; vertical-align: middle; }
.hf-table .hf-hist svg { display: block; width: 60px; height: 26px; }
.hf-hist-flat { fill: color-mix(in srgb, var(--text-3) 70%, transparent); }
.hf-hist-up { fill: #30cc5a; }
.hf-hist-down { fill: #f63538; }
.hf-holdings th.hf-hist-head { text-transform: none; letter-spacing: normal; }
.hf-company { display: inline-block; max-width: 230px; overflow: hidden; color: var(--text-3); text-overflow: ellipsis; vertical-align: middle; }
.hf-side { display: inline-block; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 700; }
.hf-side-call { color: #1baf7a; }
.hf-side-put { color: #e34948; }
.hf-logo { flex-shrink: 0; border-radius: 5px; object-fit: contain; }
.hf-ticker, .hf-fund { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-align: left; }
.hf-ticker b { font: 600 12.5px var(--font-mono); }
.hf-ticker:hover b, .hf-fund:hover { color: var(--accent-text); }
.hf-ticker-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.hf-ticker-text small { max-width: 150px; overflow: hidden; color: var(--text-3); font-size: 11px; text-overflow: ellipsis; }
.hf-ticker-none { padding-left: 30px; color: var(--text-3); }
.hf-fund { font-weight: 600; }
.hf-fund > span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hf-funds td:first-child { max-width: 0; width: 46%; }
.hf-funds .hf-fund { max-width: 100%; }
.hf-breadth { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 120px; }
.hf-breadth-n { min-width: 1.6em; font-size: 12px; }
.hf-breadth-n:first-child { text-align: right; }
.hf-breadth-bar { display: flex; flex: 1; gap: 2px; min-width: 48px; height: 8px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.hf-breadth-up { background: #22c55e; }
.hf-breadth-down { background: #ef4444; }
.hf-meter { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.hf-meter-bar { display: block; width: 64px; height: 6px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.hf-meter-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.hf-meter b { min-width: 2.2em; font-weight: 600; }
.hf-meter-weight b { min-width: 3.9em; }
.hf-meter-weight .hf-meter-bar { width: 44px; }
.hf-move { color: var(--text-3); font-size: 12px; }
.hf-move-new { padding: 1px 7px; border: 1px solid currentColor; border-radius: 999px; color: var(--accent-text); font-size: 11px; font-weight: 700; }
.hf-link-btn { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.hf-link-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.hf-pager { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.hf-page-btn { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 999px; }
.hf-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
.hf-page-btn:disabled { opacity: .35; cursor: default; }

/* A manager's page */
.hf-detail-head { display: grid; gap: 6px; }
.hf-detail-name { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.hf-detail-logo { flex-shrink: 0; border-radius: 6px; object-fit: contain; }
.hf-rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px 24px; }
.hf-rings > .hf-ring + .hf-ring { padding-left: 24px; border-left: 1px solid var(--line); }
@container (max-width: 820px) { .hf-rings > .hf-ring + .hf-ring { padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); } }
.hf-ring { min-width: 0; }
.hf-ring-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.hf-ring-total { color: var(--text-3); font-size: 12.5px; letter-spacing: 0; text-transform: none; }
.hf-ring-empty { display: grid; place-items: center; min-height: 180px; color: var(--text-3); font-size: 13px; text-align: center; }
.hf-similar, .hf-avg-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.hf-similar li, .hf-avg-list li { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; font-size: 12.5px; }
.hf-similar li:nth-child(odd), .hf-avg-list li:nth-child(odd) { background: color-mix(in srgb, var(--text) 4%, transparent); }
.hf-similar .hf-fund, .hf-avg-list .hf-fund { flex: 1; }
.hf-similar .hf-note { min-width: 9em; text-align: right; }
.hf-avg-value { color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }

/* fiscal.ai's wheel (fiscalWheel in market.js): an ETF's holdings and the 13F rings. Hovering a slice or its label
   dims the rest; the tip follows the pointer. */
.fiscal-wheel { position: relative; width: 100%; min-width: 0; }
.fiscal-wheel svg { display: block; overflow: visible; }
.fiscal-slice, .fiscal-label { transition: opacity .18s ease; }
.fiscal-slice.dim, .fiscal-label.dim { opacity: .2; }
.fiscal-slice.on { filter: brightness(1.08); }
.fiscal-slice.clickable, .fiscal-label.clickable { cursor: pointer; }
.fiscal-label-name { fill: var(--text); font: 700 11px var(--font-ui); }
.fiscal-label-pct { fill: var(--text-3); font: 600 10.5px var(--font-ui); }
.fiscal-label.on .fiscal-label-name { fill: var(--accent-text); }
.fiscal-center-top { fill: var(--text); font: 800 17px var(--font-ui); }
.fiscal-center-sub { fill: var(--text-3); font: 600 11px var(--font-ui); }
.wheel-tip { position: absolute; top: 0; left: 0; z-index: 3; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elevated); box-shadow: var(--shadow-pop); font-size: 12px; white-space: nowrap; pointer-events: none; }
.wheel-tip[hidden] { display: none; }
.wheel-tip i { width: 9px; height: 9px; border-radius: 50%; }
.wheel-tip span { font-weight: 700; }
.wheel-tip b { font: 500 12px var(--font-mono); }

/* Who owns it, sector rotation, fund overlap */
.hf-owner-head { display: flex; align-items: center; gap: 12px; }
.hf-owner-head > div { flex: 1; }
.hf-owner-name { margin: 0; font-size: 20px; font-weight: 800; }
.hf-owner-head .hf-note { margin: 2px 0 0; }
.hf-flows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.hf-flows li { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) 84px minmax(140px, auto); align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; }
.hf-flows li:nth-child(odd) { background: color-mix(in srgb, var(--text) 4%, transparent); }
.hf-flow-name { font-weight: 600; }
.hf-flow-track { position: relative; height: 12px; border-radius: 3px; background: linear-gradient(var(--line-strong), var(--line-strong)) center / 1px 100% no-repeat; }
.hf-flow-bar { position: absolute; top: 1px; bottom: 1px; border-radius: 3px; }
.hf-flow-bar.in { background: #22c55e; }
.hf-flow-bar.out { background: #ef4444; }
.hf-flow-value { font-weight: 600; text-align: right; }
.hf-flow-funds { display: flex; gap: 12px; font-size: 11.5px; }
@container (max-width: 640px) { .hf-flows li { grid-template-columns: minmax(0, 1fr) 84px; } .hf-flow-track { display: none; } .hf-flow-funds { grid-column: 1 / -1; } }
.hf-heat td, .hf-heat th { padding: 7px 8px; }
.hf-heat tbody td { border-bottom: 1px solid var(--line); }
.hf-heat .hf-heat-on { box-shadow: inset 1px 0 0 var(--accent), inset -1px 0 0 var(--accent); font-weight: 700; }
.hf-heat-pick { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.hf-heat-pick[aria-pressed="true"] { color: var(--accent-text); }
.hf-compare-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.hf-compare-pick .lab-select { min-width: 0; flex: 1 1 200px; }
.hf-compare-score { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.hf-compare-figure { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.hf-compare-score .hf-note { margin: 0; }
.hf-venn svg { width: 132px; height: 92px; }
.hf-venn circle { stroke-width: 1.5; }
.hf-venn .a { fill: color-mix(in srgb, #3987e5 22%, transparent); stroke: #3987e5; }
.hf-venn .b { fill: color-mix(in srgb, #e0457b 18%, transparent); stroke: #e0457b; }
.hf-pair-funds { display: grid; gap: 4px; }

/* Long lists anywhere in the app get banded rows instead of a rule under each, the tint mixed from the theme's own
   text colour (sentiment-lab's .hf-page tables): Finance's market lists, a portfolio, the chat's research tables, an
   ETF's holdings and the 13F tables. */
:is(.quotes, .portfolio-table, .lab-table, .fgf-table, .hf-table:not(.hf-nozebra)) tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--text) 4%, transparent); }
:is(.quotes, .portfolio-table, .lab-table, .fgf-table, .hf-table:not(.hf-nozebra)) tbody td { border-bottom-color: transparent; }
:is(.quotes, .portfolio-table, .lab-table, .hf-table) tbody tr:hover { background: var(--bg-hover); }

@media (max-width: 680px) {
  .lab-chain { grid-template-columns: minmax(0, 1fr); }
  .lab-bars li { grid-template-columns: minmax(96px, 1fr) 1.4fr 60px; }
  .lab-map { aspect-ratio: 1000 / 820; }
}

/* Agent tasks: the box on the right of chat. Inline on wide screens, a drawer over the chat on narrower ones. */
.agent-panel { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg-elevated); scrollbar-width: thin; }
.agent-panel[hidden] { display: none; }
.agent-panel-head { display: flex; align-items: center; justify-content: space-between; }
.agent-panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.agent-panel-note { margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.agent-task-form { display: flex; flex-direction: column; gap: 8px; }
.agent-task-input { width: 100%; resize: vertical; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--bg); color: var(--text); font: 13px/1.45 var(--font-ui); }
.agent-task-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.agent-task-add { align-self: flex-end; }
.agent-panel-status { margin: 0; padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-inset); color: var(--text-2); font-size: 12.5px; }
.agent-task-list { display: flex; flex-direction: column; gap: 10px; }
.agent-task { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.agent-task.idle { opacity: .75; }
.agent-task-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; }
.agent-task-head b { flex: 1 1 150px; font-size: 13.5px; font-weight: 600; }
.agent-task-kind { flex-shrink: 0; color: var(--accent-text); font: 500 11px var(--font-mono); }
.agent-task-meta, .agent-task-empty { margin: 0; color: var(--text-3); font-size: 12px; line-height: 1.45; }
.agent-findings { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 0; padding: 0; list-style: none; }
.agent-findings li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding-top: 8px; border-top: 1px solid var(--line-soft, var(--line)); font-size: 12.5px; line-height: 1.45; }
.agent-findings time { color: var(--text-3); font: 11px var(--font-mono); }
.agent-findings a, .agent-findings span:not(.agent-tickers) { flex-basis: 100%; color: var(--text); }
.agent-findings a:hover { color: var(--accent-text); }
.agent-findings small { color: var(--text-3); }
.agent-tickers { display: flex; flex-wrap: wrap; gap: 4px; }
.agent-ticker { padding: 1px 7px; border-radius: 999px; background: var(--bg-accent-soft); color: var(--accent-text); font: 600 11px/1.6 var(--font-mono); }
.agent-ticker:hover { background: var(--accent); color: var(--accent-ink); }
.agent-task-actions { display: flex; gap: 6px; margin-top: 2px; }
.agent-task-btn { padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-2); font-size: 12px; }
.agent-task-btn:hover { background: var(--bg-hover); color: var(--text); }
@media (max-width: 1100px) {
  .agent-panel { position: fixed; inset: 0 0 0 auto; z-index: 30; width: min(360px, 100vw); box-shadow: -8px 0 24px #0a1f5c1f; }
}

/* Performance tab (advisor-performance-ui.js) */
.av-perf-chart { margin: 8px 0 0; }
.av-perf-chart svg { display: block; width: 100%; height: auto; }
.av-perf-chart .grid { stroke: var(--line); stroke-width: 1; }
.av-perf-chart text { fill: var(--text-3); font: 10px var(--font-mono); }
.av-perf-chart .growth { fill: none; stroke: var(--accent, #0088cf); stroke-width: 2.2; stroke-linejoin: round; }
.av-perf-chart .bench { fill: none; stroke: var(--navy); stroke-width: 1.6; stroke-dasharray: 5 4; }
.av-perf-chart .value { fill: none; stroke: var(--text-3); stroke-width: 1; opacity: .6; }
.av-perf-chart figcaption { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.av-key.growth::before { height: 3px; background: var(--accent, #0088cf); vertical-align: 2px; }
.av-key.bench::before { height: 0; border-top: 2px dashed var(--navy); vertical-align: 3px; }
.av-key.value::before { height: 1px; background: var(--text-3); vertical-align: 3px; }
.av-perf-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; margin-top: 10px; }
.av-perf-change { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
@media print { .av-packet .av-perf-chart { max-width: 640px; } }
/* Account menu and settings, using gr8r-studio's profile layout. */
.profile-menu { padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.profile-menu .menu-user { flex-direction: row; align-items: center; gap: 12px; padding: 8px 4px 12px; }
.suggestion-headline { align-items: center; }
.suggestion-source { flex-shrink: 0; margin-inline-start: auto; color: var(--text-3); font-size: 11px; text-align: end; }
@media (max-width: 700px) { .suggestion-headline { flex-wrap: wrap; } .suggestion-source { margin-inline-start: 28px; width: calc(100% - 28px); text-align: start; } }
.profile-menu .menu-user > div { min-width: 0; }
.profile-menu .menu-user b { display: block; font-size: 15px; }
.profile-menu .menu-user small { display: block; color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu hr { margin: 6px -8px; border-color: var(--line); }
.profile-menu .menu-item { grid-template-columns: 18px 1fr auto; gap: 10px; min-height: 36px; padding: 7px 5px; font-size: 14px; }
.profile-menu .menu-item > svg { width: 18px; height: 18px; color: var(--text-2); }
.profile-menu kbd { min-width: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text-3); text-align: center; font: inherit; font-size: 12px; }
.profile-theme { padding: 3px 2px 6px; }
.profile-theme .menu-label { padding: 7px 2px 9px; font: 600 11px/1.4 var(--font-ui); letter-spacing: .06em; }
.theme-pills { display: flex; gap: 2px; width: 100%; padding: 3px; border-radius: 8px; background: var(--bg-inset); }
.theme-pills button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 30px; padding: 3px 5px; border-radius: 6px; color: var(--text-2); font-size: 13px; }
.theme-pills button:hover { background: var(--bg-hover); }
.theme-pills button[aria-checked="true"] { background: var(--bg-elevated); color: var(--text); box-shadow: 0 1px 3px #00000020, 0 0 0 1px var(--line); }
.theme-pills svg { width: 14px; height: 14px; }
.account-profile { max-width: 900px; }
.account-profile-hero { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding-block: 20px; border-bottom: 1px solid var(--line); }
.account-profile-hero .account-avatar, .account-avatar-editor .account-avatar { width: 64px; height: 64px; font-size: 23px; }
.account-identity { flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.account-identity h2 { margin: 0; font-size: 24px; line-height: 1.3; letter-spacing: -.02em; }
.account-identity p { margin: 3px 0 0; color: var(--text-2); }
.account-identity .account-email { font-size: 13px; color: var(--text-3); }
.account-details { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; margin: 4px 0; font-size: 14px; }
.account-details dt { color: var(--text-3); }
.account-details dd { margin: 0; overflow-wrap: anywhere; }
.account-settings { max-width: 1100px; gap: 24px; }
.account-settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 500px; border-top: 1px solid var(--line); }
.account-settings-nav { border-right: 1px solid var(--line); padding: 20px 14px 20px 0; }
.account-nav-label { margin: 0; padding: 14px 10px 6px; color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.account-nav-label:first-child { padding-top: 0; }
.account-settings-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 6px; font-size: 13px; text-align: left; }
.account-settings-link svg { width: 15px; height: 15px; color: var(--text-3); }
.account-settings-link:hover { background: var(--bg-hover); }
.account-settings-link[aria-current="page"] { background: var(--bg-accent-soft); color: var(--accent-text); font-weight: 500; }
.account-sync { padding: 12px 10px; color: var(--text-3); font-size: 11px; overflow-wrap: anywhere; }
.account-settings-content { max-width: 740px; padding: 26px 0 50px 36px; }
.account-settings-content > h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.account-lead { margin: 0 0 26px; color: var(--text-2); font-size: 14px; }
.account-profile-form { display: flex; flex-direction: column; gap: 20px; max-width: 440px; }
.account-avatar-editor { display: flex; align-items: center; gap: 16px; margin-bottom: 2px; }
.account-avatar-editor p { margin: 0 0 8px; font-size: 13px; font-weight: 500; }
.account-photo { margin-bottom: 14px; }
.account-photo-actions { display: flex; align-items: center; gap: 12px; }
.account-photo-remove { color: var(--text-3); font-size: 13px; }
.account-photo-remove:hover { color: var(--down, #c0392b); text-decoration: underline; }
.account-photo-note { display: block; margin-top: 6px; color: var(--text-3); font-size: 12px; }
/* A profile picture fills its avatar circle (the status dot on the sidebar avatar stays on top). */
.avatar.has-photo, .account-avatar.has-photo, .aw-avatar.has-photo { overflow: visible; background: var(--bg-inset); }
.avatar.has-photo img, .account-avatar.has-photo img, .aw-avatar.has-photo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.account-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.account-swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--avatar-color); border: 2px solid var(--bg-elevated); }
.account-swatch[aria-checked="true"] { outline: 2px solid var(--avatar-color); outline-offset: 1px; }
.account-field { display: flex; flex-direction: column; gap: 6px; }
.account-field label { font-size: 13px; font-weight: 500; }
.account-field input { width: 100%; min-width: 0; height: 38px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-elevated); font-size: 14px; }
.account-field input:disabled { color: var(--text-3); background: var(--bg-inset); }
.account-field small, .account-hint { color: var(--text-3); font-size: 12px; line-height: 1.6; }
.account-form-error { margin: 0; color: var(--danger); font-size: 13px; }
.account-profile-form button:disabled { opacity: .6; cursor: wait; }
.account-appearance h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.account-theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.account-theme-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 8px; border: 1px solid var(--line-strong); border-radius: 10px; text-align: left; background: var(--bg-elevated); }
.account-theme-card:hover { border-color: var(--accent); }
.account-theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--bg-accent-soft); }
.account-theme-caption { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.account-theme-caption svg { width: 14px; height: 14px; }
.account-theme-preview { display: flex; height: 84px; width: 100%; border: 1px solid #80808033; border-radius: 5px; overflow: hidden; }
.preview-main { display: flex; flex-direction: column; gap: 5px; padding: 10px 6px; background: var(--preview-side); }
.preview-main { padding: 14px 8px; background: var(--preview-bg); }
.preview-main i:last-child { background: var(--preview-accent); width: 65%; }
.preview-main i:first-child { width: 55%; background: var(--preview-ink); margin-bottom: 4px; }
.account-hint { margin: 16px 0 0; }
.account-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.account-setting-row b { font-size: 14px; font-weight: 500; }
.account-setting-row p { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }
.account-setting-row .btn { flex-shrink: 0; }
.account-danger { color: var(--danger); border: 1px solid var(--line-strong); }
@media (max-width: 1050px) {
  .account-settings-layout { grid-template-columns: 170px minmax(0, 1fr); }
  .account-settings-content { padding-left: 24px; }
}
@media (max-width: 700px) {
  .account-settings-layout { grid-template-columns: minmax(0, 1fr); }
  .account-settings-nav { display: flex; gap: 4px; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 0; }
  .account-settings-nav .account-nav-label { display: none; }
  .account-settings-link { width: auto; padding: 8px; }
  .account-sync { width: 100%; margin: 0; padding: 6px 8px 0; }
  .account-settings-content { padding: 24px 0; }
  .account-details { grid-template-columns: 90px minmax(0, 1fr); }
  .account-theme-cards { gap: 8px; }
  .account-theme-card { padding: 5px; }
  .account-theme-caption { gap: 4px; font-size: 12px; }
  .account-setting-row { align-items: flex-start; flex-direction: column; gap: 12px; }
}

.account-select { max-width: 240px; min-width: 150px; padding: 7px 28px 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background-color: var(--bg-elevated); font-size: 13px; }
.account-device { overflow-wrap: anywhere; max-width: 480px; }
.account-section-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.account-security-state { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-accent-soft); font-weight: 500; }
.account-two-factor { margin-top: 20px; font-size: 14px; }
.account-qr { display: block; width: 180px; height: 180px; margin: 12px 0; background: #fff; border-radius: 8px; }
.account-secret { display: block; overflow-wrap: anywhere; margin: 14px 0; user-select: all; font-size: 13px; }
.account-recovery-codes { overflow-x: auto; padding: 16px; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 2; user-select: all; }
.account-settings-nav { max-height: calc(100dvh - 170px); overflow-y: auto; }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) *, :root:not([data-motion="full"]) *::before, :root:not([data-motion="full"]) *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (max-width: 700px) { .account-settings-nav { max-height: none; } .account-select { max-width: 100%; width: 100%; } }
:root[data-accent="indigo"] { --account-accent: #4b5bd6; --account-accent-dark: #96a2ff; }
:root[data-accent="violet"] { --account-accent: #7348cc; --account-accent-dark: #bc9cf5; }
:root[data-accent="teal"] { --account-accent: #117d76; --account-accent-dark: #58cfc2; }
:root[data-accent="rose"] { --account-accent: #b93d68; --account-accent-dark: #ff94b8; }
:root[data-accent="graphite"] { --account-accent: #475569; --account-accent-dark: #b8c6d6; }
:root[data-accent]:not([data-accent="blue"]) { --accent: var(--account-accent); --accent-hover: color-mix(in srgb, var(--accent) 85%, #000); --accent-text: var(--accent); --bg-accent-soft: color-mix(in srgb, var(--accent) 10%, transparent); }
:root[data-theme="dark"][data-accent]:not([data-accent="blue"]) { --accent: var(--account-accent-dark); --accent-hover: color-mix(in srgb, var(--accent) 85%, #fff); }
:root[data-density="compact"] .nav-item { min-height: 30px; padding-block: 5px; }
:root[data-density="compact"] .recent-link { padding-block: 5px; }

/* ── Loading circle ── one for the whole site: beside any "Loading…" text (app.js h() marks it .is-loading), on busy
   buttons, beside a research card's title while it reloads, and large on a 13F manager's loading page (.hf-spinner).
   It keeps turning when the system asks for reduced motion: the rule above stops every other animation, but a frozen
   circle reads as a hang. html:root out-ranks that rule's :root:not(...) selectors, and this comes after it. */
.is-loading::before, .lab-card[aria-busy="true"] > .lab-head > .lab-title::after {
  content: ""; display: inline-block; flex-shrink: 0; width: .95em; height: .95em; margin-right: .5em; vertical-align: -.15em;
  border: 2px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: var(--accent); border-right-color: var(--accent); border-radius: 50%;
  animation: site-spin .7s linear infinite;
}
.lab-card[aria-busy="true"] > .lab-head > .lab-title::after { margin: 0 0 0 .55em; width: .7em; height: .7em; }
@keyframes site-spin { to { transform: rotate(360deg); } }
html:root .hf-spinner, html:root .is-loading::before, html:root .lab-card[aria-busy="true"] > .lab-head > .lab-title::after { animation: site-spin .7s linear infinite !important; animation-duration: .7s !important; }
