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

:root {
  --sidebar: #0E0E0E;
  --sidebar-hover: #1A1A1A;
  --sidebar-text: #7A7672;
  --sidebar-active: #F2F0EC;
  --accent: #C0392B;
  --ground: #F5F4F1;
  --surface: #FFFFFF;
  --border: #E8E6E1;
  --text: #1A1918;
  --text-2: #65615C;
  --pos: #16A34A;
  --neg: #DC2626;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--ground); color: var(--text); font-size: 14px; line-height: 1.6; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* ── AUTH / PASSWORD SCREENS ── */
#auth-screen, #pw-screen {
  display: none; align-items: center; justify-content: center;
  height: 100vh; background: var(--ground);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 40px 44px; width: 420px;
  max-width: calc(100vw - 48px);
}
.brand-mark {
  font-family: Georgia, serif; font-size: 1.5rem; font-weight: normal;
  letter-spacing: -0.02em; margin-bottom: 6px;
}
.brand-mark em { color: var(--accent); font-style: normal; }
.auth-tag { font-size: 0.875rem; color: var(--text-2); margin-bottom: 24px; }
.auth-steps {
  font-size: 0.875rem; color: var(--text-2); line-height: 2.1;
  margin-bottom: 20px; padding-left: 18px;
}
.auth-steps a { color: var(--accent); }
.auth-row { display: flex; gap: 8px; }
.auth-input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.875rem; outline: none;
  transition: border-color .15s;
}
.auth-input:focus { border-color: var(--accent); }
.btn-primary {
  padding: 9px 18px; background: var(--accent); color: #fff;
  border-radius: 6px; font-size: 0.875rem; font-weight: 500;
  transition: background .15s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary svg { flex-shrink: 0; }
.btn-primary:hover:not(:disabled) { background: #a93226; }
.btn-primary:disabled { background: #d4a5a0; cursor: not-allowed; }

/* ── TURNSTILE ── */
.turnstile-wrap { margin: 10px 0 4px; display: flex; justify-content: center; min-height: 65px; }

/* ── APP SHELL ── */
#app { display: none; height: 100vh; flex-shrink: 0; }

/* ── SIDEBAR ── */
.sidebar {
  width: 15rem; height: 100vh; flex-shrink: 0;
  background: var(--sidebar); display: flex; flex-direction: column;
  overflow: hidden; transition: width .22s cubic-bezier(.4,0,.2,1);
  z-index: 999;
}
.sb-brand {
  padding: 1rem 12px 1rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  font-family: Georgia, serif; font-size: 1.2rem; font-weight: normal;
  letter-spacing: -0.01em; color: #F2F0EC;
  border-bottom: 1px solid #1C1C1C; flex-shrink: 0; min-height: 56px;
}
.sb-brand em { color: var(--accent); font-style: normal; }
.sb-logo { white-space: nowrap; overflow: hidden; transition: opacity .15s; cursor: pointer; }
.sb-logo:hover { opacity: .75; }
.sb-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0;
  color: var(--sidebar-text); transition: color .12s, background .12s;
}
.sb-toggle:hover { color: var(--sidebar-active); background: var(--sidebar-hover); }
.sb-toggle svg { transition: transform .22s cubic-bezier(.4,0,.2,1); }

/* collapsed state */
.sidebar.collapsed { width: 52px; }
.sidebar.collapsed .sb-logo { opacity: 0; width: 0; pointer-events: none; }
.sidebar.collapsed .sb-brand { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sb-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed .sb-label { display: none; }
.sidebar.collapsed .nav-soon { display: none; }
.sidebar.collapsed .nav-btn { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar.collapsed .session-row { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .sess-label { display: none; }

.sb-nav {
  flex: 1; padding: 6px 0; display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto;
}
.nav-btn {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1.5rem; width: 100%; text-align: left;
  color: var(--sidebar-text); font-size: 0.8rem;
  transition: color .12s, background .12s;
  position: relative;
}
.nav-btn:hover { color: var(--sidebar-active); background: var(--sidebar-hover); }
.nav-btn.active {
  color: var(--sidebar-active); background: var(--sidebar-hover);
}
.nav-btn.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 2px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-btn.disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.nav-btn svg { flex-shrink: 0; }
.sb-label { white-space: nowrap; overflow: hidden; }
.nav-soon {
  margin-left: auto; font-size: 0.65rem; background: #1E1E1E;
  color: #555; padding: 1px 6px; border-radius: 3px; letter-spacing: .04em;
}
.nav-badge {
  margin-left: auto; flex-shrink: 0;
  background: var(--accent); color: #fff;
  font-size: .6rem; font-weight: 700; letter-spacing: .01em;
  min-width: 15px; height: 15px; border-radius: 999px; padding: 0 4px;
  display: none; align-items: center; justify-content: center; line-height: 1;
}
.nav-badge.visible { display: inline-flex; }
.sidebar.collapsed .nav-badge {
  position: absolute; top: 5px; right: 5px; margin: 0;
  min-width: 13px; height: 13px; font-size: .55rem; padding: 0 3px;
}
.sb-divider { height: 1px; background: #1C1C1C; margin: 3px 8px; }
.new-chat-btn { color: var(--sidebar-text); }
.new-chat-btn:hover { color: var(--sidebar-active); }
.sb-footer {
  border-top: 1px solid #1C1C1C; padding: 6px 0 8px; flex-shrink: 0;
}
.user-group {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  margin: 2px;
  overflow: hidden;
}
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 6px; cursor: pointer;
  border-radius: 6px; transition: background .12s;
}
.user-row:hover { background: var(--sidebar-hover); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.user-info { min-width: 0; }
.user-name {
  font-size: .78rem; font-weight: 600; color: var(--sidebar-active);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-cid { font-size: .67rem; color: var(--sidebar-text); margin-top: 1px; }
.sidebar.collapsed .user-row { justify-content: center; padding: 8px 0 6px; }
.sidebar.collapsed .user-info { display: none; }
.session-row {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; font-size: 0.75rem; color: #4A4744;
  position: relative;
}
/* Tooltip CSS*/
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 12px;
  background: #1A1918; color: #F2F0EC;
  font-size: .72rem; white-space: nowrap;
  padding: 4px 8px; border-radius: 5px;
  pointer-events: none; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.sess-dot { width: 6px; height: 6px; border-radius: 50%; background: #2A2A2A; flex-shrink: 0; transition: background .3s; }
.sess-dot.on  { background: var(--pos); }
.sess-dot.err { background: var(--neg); }

/* ── MAIN ── */
.app-main {
  flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── VIEW HEADER ── */
.view-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.view-title { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--ground); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px 4px 12px; font-size: 0.75rem;
  color: var(--text-2); font-variant-numeric: tabular-nums;
}
.pf-chip .cv { font-weight: 600; }
.pf-chip .cv.p { color: var(--pos); }
.pf-chip .cv.n { color: var(--neg); }
.eye-btn {
  display: flex; align-items: center; padding: 2px 3px;
  color: var(--text-2); opacity: .55; transition: opacity .15s;
}
.eye-btn:hover { opacity: 1; }

/* ── VIEWS ── */
.view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.view.active { display: flex; }

/* ── CHAT ── */
.chat-scroll {
  flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column;
}
.chat-inner {
  width: 100%;
  display: flex; flex-direction: column; gap: 0; flex: 1;
}
/* Welcome */
.chat-welcome {
  margin: auto; text-align: center; padding: 40px 24px; max-width: 460px;
}
.wlc-icon {
  width: 42px; height: 42px; background: var(--accent); border-radius: 10px;
  margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
}
.chat-welcome h2 {
  font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 8px;
}
.chat-welcome p { font-size: 0.875rem; color: var(--text-2); margin-bottom: 24px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sug-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 13px; font-size: 0.8rem; color: var(--text-2);
  transition: border-color .12s, color .12s;
}
.sug-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Messages */
.msg-row {
  display: flex; gap: 11px; margin-bottom: 22px; align-self: flex-start;
  width: 100%;
}
.msg-row.u { align-self: flex-end; flex-direction: row-reverse; max-width: 88%; }
.msg-avatar {
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; margin-top: 2px;
}
.msg-avatar.ai { background: var(--accent); color: #fff; }
.msg-avatar.me { background: #1A1918; color: #F2F0EC; }
.msg-body { flex: 1; min-width: 0; }
.msg-who { display: none; }
.msg-text { font-size: 0.875rem; line-height: 1.5; color: var(--text); }
/* ai bubble */
.msg-row:not(.u) .msg-body {
  background: var(--surface); border: 1px solid var(--border);
  padding: 12px 16px; border-radius: 2px 1rem 1rem 1rem;
}
/* user bubble */
.msg-row.u .msg-body {
  background: #1A1918; color: #F2F0EC;
  padding: 10px 14px; border-radius: 1rem 2px 1rem 1rem;
}
.msg-row.u .msg-text { color: #F2F0EC; }
/* markdown in ai */
.msg-text h3, .msg-text h4 { font-size: .875rem; font-weight: 700; margin: 12px 0 4px; }
.msg-text p { margin-bottom: 7px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text ul, .msg-text ol { padding-left: 20px; margin: 4px 0 7px; }
.msg-text li { margin-bottom: 1px; }
.msg-text strong { font-weight: 600; }
.msg-text em { font-style: italic; }
.msg-text code {
  font-family: 'Courier New', monospace; font-size: .82em;
  background: #F0EFEB; padding: 1px 5px; border-radius: 3px;
}
.cursor::after { content: '▋'; animation: blink 1s step-end infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
/* Thinking / reasoning block */
.thinking-block { margin-bottom: 8px; border: 1px solid rgba(0,0,0,.07); border-radius: 8px; overflow: hidden; }
.thinking-block summary { font-size: .7rem; color: var(--text-2); padding: 0.2rem; cursor: pointer; user-select: none; list-style: none; display: flex; align-items: center; gap: 5px; }
.thinking-block summary::-webkit-details-marker { display: none; }
.thinking-block summary::before { content: '▸ '; font-size: .7rem; transition: transform .15s; }
details[open].thinking-block summary::before { content: '▾ '; }
.thinking-body { font-size: .76rem; color: var(--text-2); padding: 8px 10px 10px; white-space: pre-wrap; line-height: 1.5; max-height: 200px; overflow-y: auto; border-top: 1px solid rgba(0,0,0,.06); }
.think-hidden { display: none !important; }
html.dark .thinking-block { border-color: rgba(255,255,255,.07); }
html.dark .thinking-body { border-top-color: rgba(255,255,255,.05); }

/* Chat footer */
.chat-footer {
  padding: 14px 24px; background: var(--surface);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-wrap { display: flex; gap: 8px; width: 100%; }
.chat-input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: .875rem; outline: none;
  transition: border-color .15s;
}
.chat-input:focus { border-color: #C0C0C0; }
.chat-input::placeholder { color: #B8B5B0; }
.chat-input:disabled { background: #FAF9F7; color: #B8B5B0; }
.btn-send {
  width: 40px; height: 40px; background: var(--accent); color: #fff;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s;
}
.btn-send:hover:not(:disabled) { background: #a93226; }
.btn-send:disabled { background: #d4a5a0; cursor: not-allowed; }

/* Attachment bar */
.attach-bar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 20px; font-size: .75rem;
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: all .15s; user-select: none; white-space: nowrap;
}
.attach-chip:hover { border-color: var(--accent); color: var(--accent); }
.attach-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.attach-chip-input {
  border: none; outline: none; font-size: .75rem; background: transparent;
  color: inherit; width: 90px; display: none; padding: 0;
}
.attach-tag {
  display: inline-flex; align-items: center; gap: 3px; font-size: .72rem;
  padding: 2px 8px; border-radius: 10px; background: #e8d5d3; color: #7a2e28;
  margin-bottom: 3px; margin-right: 3px;
}

/* ── HOLDINGS ── */
.holdings-body { flex: 1; overflow: auto; padding: 1rem; }
.summary-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.sum-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 18px; flex: 1; min-width: 140px;
}
.sum-label {
  font-size: 0.7rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px;
}
.sum-val {
  font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.sum-val.p { color: var(--pos); }
.sum-val.n { color: var(--neg); }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
thead th {
  text-align: left; padding: 8px 12px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-2);
  border-bottom: 1px solid var(--border); background: var(--surface);
  white-space: nowrap;
}
thead th:not(:first-child) { text-align: right; }
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th.sortable::after { content: ' ⇅'; font-size: .55rem; opacity: .3; }
thead th.sort-asc::after { content: ' ▲'; font-size: .6rem; opacity: .7; }
thead th.sort-desc::after { content: ' ▼'; font-size: .6rem; opacity: .7; }
tbody tr { border-bottom: 1px solid #F0EFEB; }
tbody tr:hover { background: #FAFAF8; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 0.5rem; vertical-align: middle; white-space: nowrap; }
tbody td:not(:first-child) { text-align: right; }
.stk-name { font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.price-history-btn { color: var(--text-2); padding: 2px; border-radius: 4px; display: inline-flex; transition: color .12s, background .12s; }
.price-history-btn:hover { color: var(--accent); background: rgba(192,57,43,.08); }
.stk-ex { font-size: .72rem; color: #9A9795; margin-top: 1px; }
.p-pos { color: var(--pos); font-weight: 600; }
.p-neg { color: var(--neg); font-weight: 600; }

/* ── TAX ── */
.tax-body { flex: 1; overflow: auto; padding: 24px; }
.tax-intro {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 56px 24px; text-align: center;
}
.tax-intro p {
  font-size: .875rem; color: var(--text-2); max-width: 340px;
  line-height: 1.65; margin-bottom: 20px;
}
.tax-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.tax-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px;
}
.tax-card.hl { border-color: var(--accent); background: #FEF8F7; }
.tc-label {
  font-size: .7rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.tc-val {
  font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.tax-card.hl .tc-val { color: var(--accent); }
.tc-sub { font-size: .75rem; color: var(--text-2); margin-top: 3px; }
.type-ltcg {
  display: inline-block; font-size: .7rem; font-weight: 600;
  background: #EFF8F0; color: var(--pos); padding: 2px 7px; border-radius: 4px;
}
.type-stcg {
  display: inline-block; font-size: .7rem; font-weight: 600;
  background: #FEF3F2; color: #B91C1C; padding: 2px 7px; border-radius: 4px;
}
.tax-section-hdr {
  font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-2); margin: 24px 0 12px;
}
.tax-section-hdr span { font-size: .7rem; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; background: #1A1918;
  color: #F2F0EC; padding: 10px 16px; border-radius: 8px; font-size: .84rem;
  max-width: 320px; z-index: 999; display: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
#toast.err { background: #7F1D1D; }

.acct-nav-btn { display: none; }
.acct-conn-row-wrap { display: none; }

/* ── MOBILE ── */
@media (max-width: 680px) {
  .sidebar {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; height: 56px; flex-direction: row;
    border-top: 1px solid #1C1C1C;
  }
  .sb-brand, .sb-footer { display: none; }
  .sb-nav { flex-direction: row; padding: 0; gap: 0; justify-content: space-around; width: 100%; }
  .nav-btn { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .62rem; justify-content: center; align-items: center; flex: 1; }
  .nav-btn.active::before { top: 0; left: 4px; right: 4px; bottom: auto; width: auto; height: 2px; }
  .nav-soon { display: none; }
  .nav-badge { position: absolute; top: 3px; left: 50%; transform: translateX(4px); margin: 0; min-width: 13px; height: 13px; font-size: .55rem; padding: 0 3px; }
  .acct-nav-btn { display: flex; }
  .acct-conn-row-wrap { display: block; }
  .app-main { flex: 1; height: 100vh; padding-bottom: 56px; }
  .chat-footer, .view-hdr { padding-left: 1rem; padding-right: 1rem; }
  .chat-inner, .holdings-body, .tax-body, .acct-body { padding: 1rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .auth-row { flex-direction: column; }
  .auth-row .btn-primary { width: 100%; }
  #toast {
    left: 50%; right: auto; top: auto; bottom: 72px;
    transform: translateX(-50%);
    max-width: calc(100% - 48px); text-align: center;
  }
}

/* ── SCROLLBARS ── */
:root { color-scheme: light; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D0CEC9; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #B8B5B0; }

/* ── DARK MODE ── */
html.dark {
  --ground: #111110;
  --surface: #1A1918;
  --border: #2C2A27;
  --text: #F2F0EC;
  --text-2: #9A9690;
  color-scheme: dark;
}
html.dark ::-webkit-scrollbar-thumb { background: #3A3835; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #4A4744; }
html.dark .msg-text code { background: #252320; }
html.dark tbody tr { border-bottom-color: #252320; }
html.dark tbody tr:hover { background: #1E1D1B; }
html.dark .chat-input { background: var(--surface); color: var(--text); }
html.dark .chat-input::placeholder { color: #5A5654; }
html.dark .chat-input:disabled { background: #141312; color: #5A5654; }
html.dark .chat-input:focus { border-color: #555; }
html.dark .attach-chip { background: var(--surface); }
html.dark .attach-chip:hover { color: var(--accent); border-color: var(--accent); }
html.dark .attach-tag { background: #3a2020; color: #f0a09a; }
html.dark .msg-row.u .msg-body { background: #272523; }
html.dark .sug-btn { background: var(--surface); }
html.dark .auth-input { background: var(--surface); color: var(--text); }
html.dark .auth-input::placeholder { color: #5A5654; }

/* ── SETTINGS VIEW ── */
.settings-body { flex: 1; overflow: auto; padding: 32px 24px; }
.settings-section { max-width: 400px; }
.settings-section h3 { font-size: .875rem; font-weight: 600; margin-bottom: 16px; letter-spacing: -.01em; }
.field-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.form-msg { font-size: .8rem; margin-top: 8px; display: none; }
.form-msg.err { color: var(--neg); }
.form-msg.ok  { color: var(--pos); }

/* ── ACCOUNT VIEW ── */
.acct-body { flex: 1; min-height: 0; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.acct-user-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; display: flex; align-items: center; gap: 12px;
}
.acct-section { background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; }
.acct-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px;
  text-align: left; font-size: .875rem; color: var(--text);
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.acct-row:last-child { border-bottom: none; }
.acct-row:hover { background: var(--ground); }
.acct-row-icon { color: var(--text-2); display: flex; flex-shrink: 0; }
.acct-row-label { flex: 1; }
.acct-row.danger { color: var(--neg); }
.acct-row.danger .acct-row-icon { color: var(--neg); opacity: .7; }
.acct-chevron { color: var(--text-2); opacity: .35; flex-shrink: 0; }

/* ── TICKER MAPPING ── */
.acct-ticker-section { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.acct-ticker-hdr { display: flex; align-items: center; gap: 10px; font-size: .875rem; font-weight: 500; }
.acct-ticker-hint { font-size: .78rem; color: var(--text-2); line-height: 1.5; }
.acct-ticker-hint a { color: var(--accent); }
.acct-ticker-inputs { display: flex; flex-direction: column; gap: 8px; }
.acct-file-label { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; color: var(--text-2); }
.acct-file-label input[type=file] { font-size: .78rem; color: var(--text); }
.acct-ticker-result { font-size: .78rem; color: var(--text-2); line-height: 1.5; }
.acct-ticker-result .unresolved { color: var(--neg); }

/* ── PRICE HISTORY MODAL ── */
.ph-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 99; }
.ph-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; width: 32.5rem; max-width: 94vw; height: 30rem; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; }
.ph-modal-hdr { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .9rem; flex-shrink: 0; }
.ph-modal-hdr button { color: var(--text-2); padding: 4px; border-radius: 0.5rem; display: flex; }
.ph-modal-hdr button:hover { background: var(--ground); color: var(--text); }
.ph-period-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ph-period-btn { font-size: .7rem; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; transition: color .12s, border-color .12s, background .12s; }
.ph-period-btn:hover { color: var(--text); border-color: var(--text-2); }
.ph-period-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(192,57,43,.08); font-weight: 600; }
.ph-modal-body { padding: 1rem; font-size: .7rem; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ph-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.7rem; margin-bottom: 1rem; flex-shrink: 0; }
.ph-stat-label { font-size: .68rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.ph-stat-val { font-size: .92rem; font-weight: 600; margin-top: 2px; }
.ph-chart-wrap { flex: 1; min-height: 0; position: relative; }
.ph-error { color: var(--neg); }

/* ── PRIVACY MODE ── */
.privacy-chat .msg-row:not(.u) .msg-text { filter: blur(7px); user-select: none; }

/* ── CONVERSATIONS VIEW ── */
.conversations-body { padding: 1rem; overflow-y: auto; flex: 1; }
.conv-loading, .conv-empty { padding: 2rem; text-align: center; color: var(--text-2); font-size: .875rem; }
.conv-list { display: flex; flex-direction: column; }
.conv-item { display: flex; align-items: center; gap: 0.2rem; padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 0.5rem; cursor: pointer; margin: 0.2rem; transition: background .12s; background: var(--surface); }
.conv-item:hover { background: var(--ground); }
.conv-info { flex: 1; min-width: 0; }
.conv-title { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: .7rem; color: var(--text-2); position: relative; }
.conv-del, .conv-share { flex-shrink: 0; color: var(--text-2); padding: 6px; border-radius: 6px; transition: color .12s, background .12s; }
.conv-del:hover { color: var(--neg); background: rgba(235,87,87,.1); }
.conv-share:hover { color: var(--text); background: rgba(0,0,0,.05); }

/* ── DAILY DIGEST VIEW ── */
.digests-body { padding: 1rem; overflow-y: auto; flex: 1; }
.digest-item { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 0.5rem; margin: 0.2rem; background: var(--surface); overflow:hidden; transition: background .12s, border-color .12s; }
.digest-loading, .digest-empty { padding: 2rem; text-align: center; color: var(--text-2); font-size: .875rem; }
.digest-list { display: flex; flex-direction: column; }
.digest-item.unread { border-left-color: var(--accent); background-color: var(--border);}
.digest-head { display: flex; align-items: center; gap: 0.5rem; padding: 1rem; cursor: pointer; transition: background .12s; }
.digest-head:hover { background: var(--ground); }
.digest-item:has(.digest-body.open) .digest-head { background: var(--ground); border-bottom: 1px solid var(--border); }
.digest-info { flex: 1; min-width: 0; }
.digest-title { font-size: .875rem; font-weight: 500; }
.digest-item.unread .digest-title { font-weight: 700; }
.digest-preview { font-size: .78rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.digest-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.digest-source { font-size: .68rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.digest-time { font-size: .72rem; color: var(--text-2); position: relative; }
.digest-del { flex-shrink: 0; color: var(--text-2); padding: 6px; border-radius: 6px; transition: color .12s, background .12s; }
.digest-del:hover { color: var(--neg); background: rgba(235,87,87,.1); }
.digest-body { display: none; padding: 1rem; margin: 1rem; font-size: .84rem; line-height: 1.55; border-top: 1px solid var(--border); }
.digest-body.open { display: block; padding-top: 0.8rem; }
.digest-holding-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.digest-holding-chip { font-size: .72rem; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; transition: color .12s, border-color .12s; }
.digest-holding-chip:hover { color: var(--accent); border-color: var(--accent); }

/* ── STRATEGY VIEW ── */
.strategy-body { padding: 1rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 0.75rem; max-width: 640px; }
.strategy-hint { font-size: .8rem; color: var(--text-2); line-height: 1.5; }
.strategy-textarea {
  flex: 1; min-height: 320px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.875rem; font-family: inherit; line-height: 1.6;
  outline: none; resize: vertical; background: var(--surface); color: var(--text);
  transition: border-color .15s;
}
.strategy-textarea:focus { border-color: var(--accent); }
.strategy-meta { font-size: .72rem; color: var(--text-2); }
