/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --border: #e5e1d8;
  --border-strong: #d7d2c6;
  --text: #1a1916;
  --text-muted: #6b6860;
  --up: #2a6b44;
  --up-bg: #eaf4ee;
  --up-fill: rgba(42,107,68,.09);
  --down: #8b2a2a;
  --down-bg: #f9eaea;
  --down-fill: rgba(139,42,42,.07);
  --accent: #3d5a99;
  --accent-hover: #314a82;
  --accent-bg: #edf0f9;
  --nav-bg: rgba(248,247,243,.80);
  /* radius scale */
  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 16px;
  /* layered elevation — soft, warm-tinted shadows for clean depth */
  --shadow-sm: 0 1px 2px rgba(28,25,20,.05);
  --shadow: 0 1px 2px rgba(28,25,20,.04), 0 4px 14px rgba(28,25,20,.05);
  --shadow-lg: 0 12px 32px rgba(28,25,20,.12);
  /* focus ring + motion */
  --ring: 0 0 0 3px rgba(61,90,153,.20);
  --t-fast: .12s ease;
  --t: .18s ease;
}

/* Dark mode */
:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #181b21;
  --surface-2: #21252d;
  --border: #2a2e37;
  --border-strong: #3a3f4a;
  --text: #e8e6e0;
  --text-muted: #9a958c;
  --up: #4ade80;
  --up-bg: #1a2e22;
  --up-fill: rgba(74,222,128,.12);
  --down: #f87171;
  --down-bg: #2e1c1c;
  --down-fill: rgba(248,113,113,.10);
  --accent: #7ea0d8;
  --accent-hover: #97b3e2;
  --accent-bg: #1e2638;
  --nav-bg: rgba(18,20,25,.72);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 3px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  --ring: 0 0 0 3px rgba(126,160,216,.28);
}

/* Colorblind-safe palette (blue = up, orange = down) */
:root[data-colors="colorblind"] {
  --up: #1f77b4;
  --up-bg: #e6eef5;
  --up-fill: rgba(31,119,180,.10);
  --down: #d27622;
  --down-bg: #faeede;
  --down-fill: rgba(210,118,34,.10);
}
:root[data-theme="dark"][data-colors="colorblind"] {
  --up: #6b9fd0;
  --up-bg: #1a2738;
  --up-fill: rgba(107,159,208,.14);
  --down: #e09060;
  --down-bg: #2e2417;
  --down-fill: rgba(224,144,96,.12);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }

/* Consistent keyboard-focus ring across the app — visible only for keyboard
   users (mouse clicks stay clean). Form fields also get the ring on plain focus. */
a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
input:focus, select:focus, textarea:focus { box-shadow: var(--ring); }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: .85rem 2rem;
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }

/* ── Search bar ──────────────────────────────────────────────────────────── */
.nav-search {
  margin-left: auto;
  position: relative;
}
.nav-search input {
  width: 220px;
  padding: .45rem .85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: border-color .15s, width .2s;
}
.nav-search input:focus { border-color: var(--accent); width: 280px; }
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: none;
  z-index: 200;
  overflow: hidden;
}
.search-dropdown.open { display: block; }
.search-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  cursor: pointer;
  transition: background .1s;
  font-size: .875rem;
}
.search-item:hover { background: var(--surface-2); }
.search-item .ticker-badge {
  font-family: 'Geist Mono', monospace;
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: .1rem .4rem;
  border-radius: 4px;
  min-width: 52px;
  text-align: center;
}
.search-item .company-name {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-item.selected { background: var(--surface-2); }
.search-exch {
  margin-left: auto;
  font-size: .7rem;
  color: var(--text-muted);
  font-family: 'Geist Mono', monospace;
  flex-shrink: 0;
}

/* ── Page layout ─────────────────────────────────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-wide { max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--text);
}
.mono { font-family: 'Geist Mono', 'Courier New', monospace; font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); font-size: .875rem; }
.tag {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .5rem;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
}

/* ── Price display ───────────────────────────────────────────────────────── */
.price-large {
  font-family: 'Geist Mono', monospace;
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1;
}
.change-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-family: 'Geist Mono', monospace;
  font-size: .9rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 6px;
}
.change-pill.up   { color: var(--up);   background: var(--up-bg);   }
.change-pill.down { color: var(--down); background: var(--down-bg); }
.change-pill.flat { color: var(--text-muted); background: var(--surface-2); }

/* ── Stat grid ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-cell {
  background: var(--surface);
  padding: 1rem 1.1rem;
}
.stat-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .25rem;
}
.stat-value {
  font-family: 'Geist Mono', monospace;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Period buttons ──────────────────────────────────────────────────────── */
.period-bar {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.period-btn {
  font-family: 'Geist Mono', monospace;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: all .12s;
}
.period-btn:hover { color: var(--text); border-color: var(--border); }
.period-btn.active {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* ── Chart canvas ────────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-wrap canvas {
  display: block;
  width: 100%;
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .78rem;
  font-family: 'Geist Mono', monospace;
  box-shadow: var(--shadow);
  display: none;
  white-space: nowrap;
}
/* ── Economic calendar ───────────────────────────────────────────────────── */
.cal-day {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}
.cal-day:last-child { border-bottom: none; }
.cal-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: .95rem;
  padding-bottom: .5rem;
  margin-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.cal-day-until {
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: .15rem .55rem;
  border-radius: 12px;
}
.cal-event {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .55rem .25rem;
  font-size: .88rem;
}
.cal-event-time {
  font-family: 'Geist Mono', monospace;
  font-size: .82rem;
  color: var(--text-muted);
  min-width: 50px;
}
.cal-imp-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-event-name {
  flex: 1;
  font-weight: 500;
}
.cal-event-cat {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  padding: .2rem .55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* ── Options chain table ─────────────────────────────────────────────────── */
.options-table { font-size: .82rem; min-width: 760px; }
.options-table td, .options-table th { padding: .35rem .55rem; }
.options-table .opt-strike-cell {
  text-align: center;
  font-weight: 700;
  background: var(--surface-2);
  font-family: 'Geist Mono', monospace;
}
.options-table .opt-call-itm  { background: rgba(34, 197, 94, .08); }
.options-table .opt-put-itm   { background: rgba(239, 68, 68, .08); }
.options-table tr.opt-atm     { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
.options-table tr.opt-atm .opt-strike-cell {
  background: var(--accent-bg);
  color: var(--accent);
}
.options-table .opt-sep-l { border-left: 2px solid var(--accent); }
.options-table .opt-sep-r { border-right: 2px solid var(--accent); }

/* Vertical + horizontal cursor crosshair shared by every chart on the site. Each
   chart's hover handler injects these into .chart-wrap: the vertical line's `left`
   snaps to the nearest data point's pixel x (so it doesn't jitter), while the
   horizontal line's `top` follows the raw cursor y. */
.chart-crosshair,
.chart-crosshair-h {
  position: absolute;
  background: var(--text-muted);
  opacity: .45;
  pointer-events: none;
  display: none;
}
.chart-crosshair {
  top: 0;
  bottom: 0;
  width: 1px;
}
.chart-crosshair-h {
  left: 0;
  right: 0;
  height: 1px;
}
/* Y-axis value tag that rides the horizontal crosshair, showing the exact
   value under the cursor. Right-aligned so its edge meets the axis (its `left`
   is set to the chart's left padding in JS). */
.chart-crosshair-label {
  position: absolute;
  transform: translate(-100%, -50%);
  background: var(--text);
  color: var(--bg);
  font: 600 11px 'Geist Mono', monospace;
  line-height: 1;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 6;
  display: none;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  text-align: left;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: .65rem 1rem;
  background: var(--surface-2);
  border-bottom: 1.5px solid var(--border-strong);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table thead th:first-child { border-top-left-radius: var(--radius-sm); }
.data-table thead th:last-child  { border-top-right-radius: var(--radius-sm); }
.data-table th:hover { color: var(--text); }
/* Every sortable header (any th with data-col) shows a faint ↕ hint by default;
   the active sort column overrides it with a bold ↑ or ↓ in the accent color. */
.data-table th[data-col]::after {
  content: " ↕";
  color: var(--text-muted);
  opacity: .35;
  font-size: .85em;
}
.data-table th.sort-asc::after  { content: " ↑"; color: var(--accent); opacity: 1; }
.data-table th.sort-desc::after { content: " ↓"; color: var(--accent); opacity: 1; }
.data-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }
.data-table td.mono { font-family: 'Geist Mono', monospace; }

/* Right-align numeric columns so decimals line up for easy scanning (the
   standard for financial tables). Scoped per table by column position, so the
   leading text columns (ticker/company) and trailing action column stay left. */
#screener-table th:nth-child(n+3):nth-child(-n+10),
#screener-table td:nth-child(n+3):nth-child(-n+10),
#portfolio-table th:nth-child(n+3):nth-child(-n+10),
#portfolio-table td:nth-child(n+3):nth-child(-n+10) { text-align: right; }

/* Positions table packs 11 columns (incl. an after-hours sub-line and a Sell
   button); tighten its horizontal cell padding so everything fits in one view
   without a horizontal scrollbar. Scoped to this table — the screener keeps the
   roomier default .data-table padding. */
#portfolio-table th,
#portfolio-table td { padding-left: .5rem; padding-right: .5rem; }

/* ── Filter form ─────────────────────────────────────────────────────────── */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: .3rem; min-width: 120px; }
.filter-group label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.filter-group select,
.filter-group input {
  padding: .4rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: .875rem;
  outline: none;
  color: var(--text);
}
.filter-group select:focus,
.filter-group input:focus { border-color: var(--accent); }
.filter-range { display: flex; gap: .4rem; align-items: center; }
.filter-range input { min-width: 70px; }
.filter-range span { color: var(--text-muted); font-size: .8rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 600;
  transition: all .12s;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(.5px); }
.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.btn-outline.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2);
}
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ── Watchlist rows ──────────────────────────────────────────────────────── */
.wl-name {
  flex: 1;
  font-size: .875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 4px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── 52w range bar ───────────────────────────────────────────────────────── */
.range-bar-track {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  position: relative;
}
.range-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.range-bar-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ── Description / about ─────────────────────────────────────────────────── */
.about-text {
  font-size: .875rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-height: 5.5em;
  overflow: hidden;
  position: relative;
  transition: max-height .3s;
}
.about-text.expanded { max-height: 999px; }
.about-toggle {
  font-size: .8rem;
  color: var(--accent);
  cursor: pointer;
  margin-top: .35rem;
  display: inline-block;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Section header ──────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--border);
}
.section-header h2 { font-size: 1.15rem; letter-spacing: -.01em; }

/* ── Info "i" button + tooltip ───────────────────────────────────────────── */
.info-wrap { position: relative; display: inline-flex; align-items: center; text-transform: none; letter-spacing: normal; }
/* In the portfolio summary the info button sits inside an overflow:hidden grid
   (rounded corners), which would clip a normal absolute tooltip — position this
   one fixed (JS sets its coords) so it escapes the clip. The compound selector
   keeps it more specific than the base .info-tooltip (which is defined later). */
.info-tooltip.portfolio-ah-tip { position: fixed; transform: none; }
.info-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.info-btn:hover { color: var(--text); border-color: var(--accent); }
.info-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  max-width: 78vw;
  padding: .7rem .8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: .78rem;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
  z-index: 200;
}
.info-wrap:hover .info-tooltip,
.info-btn:focus-visible + .info-tooltip,
.info-tooltip.open { opacity: 1; visibility: visible; }
.info-tooltip strong { display: block; margin-bottom: .3rem; }
.info-tooltip-updated {
  display: block;
  margin-top: .45rem;
  color: var(--text-muted);
  font-size: .72rem;
}
/* Keeps a field label and its info button on one line above the control. */
.label-with-info { display: flex; align-items: center; gap: .35rem; }

/* ── Collapsible section cards ───────────────────────────────────────────── */
/* Each data card's header gets a chevron toggle so sections can be hidden to
   cut clutter. Collapsing hides everything in the card except its header. */
.card.collapsible > .section-header h2,
.card.collapsible > .card-collapse-head .card-collapse-title { cursor: pointer; }
/* The price-chart card has no .section-header — this is its header row, treated
   the same way (kept visible when collapsed, gets the chevron). */
.card-collapse-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-collapse-head > .period-bar { margin-left: auto; }
.card-collapse-btn {
  align-self: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.card-collapse-btn:hover { color: var(--text); border-color: var(--accent); }
.card-collapse-btn svg { transition: transform .18s ease; }
.card.collapsed > .section-header .card-collapse-btn svg,
.card.collapsed > .card-collapse-head .card-collapse-btn svg { transform: rotate(-90deg); }
.card.collapsed > .section-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.card.collapsed > .card-collapse-head { margin-bottom: 0; }
.card.collapsed > *:not(.section-header):not(.card-collapse-head) { display: none; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: .5rem;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
}
.page-info { font-size: .875rem; color: var(--text-muted); }

/* ── Alert banner ────────────────────────────────────────────────────────── */
.alert {
  padding: .6rem 1rem;
  border-radius: 6px;
  font-size: .825rem;
  margin-bottom: 1rem;
}
.alert-warn { background: #fef9e7; color: #7a5a00; border: 1px solid #f0e0a0; }

/* ── Fund table (statistics page) ───────────────────────────────────────── */
.fund-sub-hdr {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  font-weight: 700;
  font-family: 'Geist', system-ui, sans-serif;
  padding: .7rem 0 .3rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: .1rem;
  margin-top: .6rem;
}
.fund-sub-hdr:first-child { margin-top: 0; padding-top: 0; }
.fund-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .38rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .855rem;
  gap: 1rem;
}
.fund-row:last-child { border-bottom: none; }
.fund-lbl { color: var(--text-muted); flex-shrink: 0; }
.fund-val {
  font-family: 'Geist Mono', 'Courier New', monospace;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.fund-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
/* 3-column grid for valuation measures */
.fund-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.fund-cell-3 {
  background: var(--surface);
  padding: .9rem 1.1rem;
}
.fund-cell-3 .fund-lbl {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .3rem;
  display: block;
}
.fund-cell-3 .fund-val {
  font-family: 'Geist Mono', monospace;
  font-weight: 600;
  font-size: .95rem;
  text-align: left;
}

/* ── Analyst recommendations ─────────────────────────────────────────────── */
.analyst-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}
.analyst-consensus {
  text-align: center;
  min-width: 120px;
}
.analyst-consensus-badge {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  padding: .45rem 1rem;
  border-radius: 8px;
  letter-spacing: .01em;
}
.analyst-score-wrap {
  flex: 1;
  min-width: 180px;
}
.analyst-score-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #8b2a2a, #c8a020, #2a6b44);
  position: relative;
}
.analyst-score-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: var(--surface);
  border: 2.5px solid var(--text);
  border-radius: 50%;
}
.analyst-target-wrap {
  flex: 1;
  min-width: 200px;
}
.analyst-target-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  text-align: center;
}

/* ── Portfolio ────────────────────────────────────────────────────────────── */
/* Even tile grid with hairline dividers — matches the Key Statistics .stat-grid
   on the quote page. The 1px gap over a --border background draws the gridlines;
   overflow:hidden keeps the corners rounded. */
.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  margin-bottom: 1.25rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.portfolio-summary-cell {
  background: var(--surface);
  padding: .85rem 1rem;
}
.portfolio-summary-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: .3rem;
}
.portfolio-summary-value {
  font-family: 'Geist Mono', 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
}
.portfolio-summary-value.up   { color: var(--up); }
.portfolio-summary-value.down { color: var(--down); }
/* Merged tiles (Total P&L, Day Gain, After Hours): dollar value + smaller % beside it. */
.portfolio-summary-valrow {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  flex-wrap: wrap;
}
.portfolio-summary-sub {
  font-family: 'Geist Mono', 'Courier New', monospace;
  font-size: .8rem;
  font-weight: 600;
}
.portfolio-summary-sub.up   { color: var(--up); }
.portfolio-summary-sub.down { color: var(--down); }
.add-position-form {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
}
.add-position-form input {
  flex: 1;
  min-width: 110px;
  height: 36px;
  padding: 0 .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: .875rem;
  font-family: 'Geist', system-ui, sans-serif;
  color: var(--text);
}
.add-position-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.portfolio-delete {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .8rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.portfolio-delete:hover {
  border-color: var(--down);
  color: var(--down);
}

/* ── AI Portfolio Analyst panel ──────────────────────────────────────────── */
.analyst-pref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.analyst-pref-label {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.analyst-pref-select {
  width: 100%;
  height: 36px;
  padding: 0 .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: .82rem;
  color: var(--text);
  cursor: pointer;
}
.analyst-pref-select:focus { outline: none; border-color: var(--accent); }
/* Markdown output */
.analyst-result-body { font-size: .875rem; line-height: 1.65; color: var(--text); }
.analyst-md-h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.25rem 0 .4rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: .3rem;
}
.analyst-md-h4 { font-size: .9rem; font-weight: 700; margin: .9rem 0 .3rem; }
.analyst-md-p  { margin: .5rem 0; }
.analyst-md-li {
  position: relative;
  padding-left: 1.1rem;
  margin: .25rem 0;
  display: block;
}
.analyst-md-li::before { content: '•'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.analyst-md-li-num { padding-left: 1.6rem; margin: .3rem 0; display: block; position: relative; }
.analyst-li-num    { position: absolute; left: 0; font-weight: 700; color: var(--accent); min-width: 1.4rem; }

/* ── View toggle (Cards / Table) ─────────────────────────────────────────── */
.view-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.view-toggle-btn {
  padding: .25rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  transition: background .15s, color .15s;
}
.view-toggle-btn + .view-toggle-btn {
  border-left: 1.5px solid var(--border);
}
.view-toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Selected chips/toggles get a touch of depth so the active choice stands out. */
.preset-chip.active,
.indicator-chip.active,
.period-btn.active { box-shadow: var(--shadow-sm); }

/* ── Position card grid ──────────────────────────────────────────────────── */
.position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.position-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .15s;
  background: var(--bg);
}
.position-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.position-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .75rem;
}
.position-ticker {
  font-weight: 700;
  color: var(--accent);
  font-size: .95rem;
  display: block;
}
.position-company {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.position-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.position-stat-label {
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .2rem;
}
.position-stat-value {
  font-size: .875rem;
  font-weight: 600;
}
.position-pnl {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.position-pnl-value {
  font-weight: 700;
  font-size: 1rem;
}
.position-pnl-value.up   { color: var(--up); }
.position-pnl-value.down { color: var(--down); }
.position-alloc {
  margin-left: auto;
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Home mini-cards (markets overview + popular tickers) ─────────────────── */
.mini-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.mini-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
/* Market-mover list rows */
.mover-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .65rem .5rem;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}
.mover-row:last-child { border-bottom: none; }
.mover-row:hover { background: var(--surface-2); }

/* ── Home / dashboard (greeting + launcher) ──────────────────────────────── */
.home-hero { text-align: center; padding: 3.5rem 0 2.5rem; }
.home-greeting { font-size: 2.4rem; margin-bottom: .5rem; letter-spacing: -.02em; }
.home-sub { font-size: 1.05rem; color: var(--text-muted); }
.launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  max-width: 880px;
  margin: 0 auto;
}
.launch-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.launch-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.launch-card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .3rem;
}
.launch-card-title .arrow { margin-left: auto; color: var(--accent); transition: transform var(--t-fast); }
.launch-card:hover .arrow { transform: translateX(3px); }
.launch-card-desc { font-size: .85rem; color: var(--text-muted); line-height: 1.45; }

/* Greeting sub-line: date + market open/closed pill */
.home-status { margin-top: .85rem; display: inline-flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--text-muted); }
.home-status-pill { font-size: .72rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.home-status-pill.open { background: var(--up-bg); color: var(--up); }

/* Dashboard widget layout */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: start;   /* don't stretch the short Portfolio card to the tall watchlist */
}
.dash-spark-wrap { margin-top: 1rem; }
.dash-spark-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  font-size: .72rem; color: var(--text-muted); margin-bottom: .4rem; flex-wrap: wrap;
}
.dash-spark-head .dash-spark-net { font-weight: 600; }
.dash-spark-head .dash-spark-net.up   { color: var(--up); }
.dash-spark-head .dash-spark-net.down { color: var(--down); }
.dash-spark-wrap canvas { width: 100%; height: 150px; display: block; }
.dash-hold-pl-lbl { color: var(--text-muted); font-size: .66rem; font-weight: 600; margin-right: .1rem; }
.dash-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem 1.25rem;
}
/* Eye toggle that hides/shows the portfolio $ values (percentages stay). */
.dash-eye-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.dash-eye-btn:hover { color: var(--text); border-color: var(--accent); }
.dash-hidden { letter-spacing: .12em; color: var(--text-muted); }
.dash-wl-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .35rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast);
}
.dash-wl-row:last-child { border-bottom: none; }
.dash-wl-row:hover { background: var(--surface-2); }
.dash-subhead {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin: 1.5rem 0 .75rem;
}

@media (max-width: 768px) {
  .home-greeting { font-size: 1.9rem; }
  .home-hero { padding: 2.25rem 0 1.75rem; }
}
/* Sort toolbar */
.portfolio-sort-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.portfolio-sort-bar select {
  height: 32px;
  padding: 0 .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: .825rem;
  font-family: 'Geist', system-ui, sans-serif;
  color: var(--text);
  cursor: pointer;
}
.portfolio-sort-bar select:focus { outline: none; border-color: var(--accent); }

/* ── Screener preset chips ───────────────────────────────────────────────── */
.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.preset-chip {
  padding: .35rem .9rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 600;
  font-family: 'Geist', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.preset-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.preset-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* Saved (custom) presets: outline by default to visually separate from built-ins;
   share the same .active style for consistency. */
.preset-chip-saved {
  border-style: dashed;
}
.preset-chip-x {
  display: inline-block;
  margin-left: .4rem;
  padding: 0 .35rem;
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1;
  opacity: .55;
}
.preset-chip-x:hover {
  opacity: 1;
  background: var(--surface-2);
  color: var(--down);
}
/* Make the saved-presets-slot a passthrough so its children join the preset-bar flex. */
#saved-presets-slot {
  display: contents;
}

/* Technical-indicator toggle chips on the quote chart card. */
.indicator-chip {
  padding: .25rem .7rem;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  font-family: 'Geist', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.indicator-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.indicator-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* News sentiment dots (bullish/bearish/neutral) — inline before each headline. */
.sentiment-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: .45rem;
  vertical-align: middle;
  background: var(--border);
  flex-shrink: 0;
}
.sentiment-bullish { background: var(--up); }
.sentiment-bearish { background: var(--down); }
.sentiment-neutral { background: var(--text-muted); opacity: .55; }
.sentiment-pending { background: var(--border); opacity: .6; }

/* ── Watchlist toggle button (screener rows) ─────────────────────────────── */
.wl-toggle-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.wl-toggle-btn:hover {
  border-color: var(--up);
  color: var(--up);
}
.wl-toggle-btn.wl-toggle-added {
  background: var(--up);
  border-color: var(--up);
  color: #fff;
}

/* ── Dividend suggestion rows ────────────────────────────────────────────── */
.div-suggest-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.div-suggest-row:last-child { border-bottom: none; }

/* ── Position tabs (Open / Closed) ───────────────────────────────────────── */
.position-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.position-tab {
  padding: .65rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.position-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.position-tab:hover:not(.active) { color: var(--text); }
.position-tab span { color: var(--text-muted); font-weight: 400; margin-left: .25rem; font-size: .82rem; }

/* ── Earnings page ───────────────────────────────────────────────────────── */
.earnings-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(160px, 1fr) minmax(180px, 1fr);
  gap: 1rem;
  align-items: center;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background .1s;
}
.earnings-row:last-child { border-bottom: none; }
.earnings-row:hover { background: var(--surface-2); }
.earnings-row-left { min-width: 0; }
.earnings-ticker {
  font-weight: 700;
  color: var(--accent);
  font-size: .95rem;
}
.earnings-name {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.earnings-row-mid { display: flex; flex-direction: column; gap: .2rem; }
.earnings-date {
  font-size: .85rem;
  font-weight: 500;
}
.earnings-when {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: inline-block;
  padding: .15rem .5rem;
  background: var(--surface-2);
  border-radius: 999px;
  width: max-content;
}
.earnings-when.today { background: var(--accent-bg); color: var(--accent); }
.earnings-when.soon  { background: var(--up-bg);     color: var(--up); }
.earnings-row-right {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.earnings-stat-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .15rem;
}
.earnings-stat-value {
  font-size: .9rem;
  font-weight: 600;
}
.earnings-stat-value.up   { color: var(--up); }
.earnings-stat-value.down { color: var(--down); }

/* ── Alerts page ─────────────────────────────────────────────────────────── */
.alert-group {
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.alert-group:last-child { border-bottom: none; margin-bottom: 0; }
.alert-group-head {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .5rem;
}
.alert-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .55rem .75rem;
  border-radius: 6px;
  margin-bottom: .35rem;
  background: var(--surface-2);
}
.alert-row-info { flex: 1; min-width: 0; }
.alert-row-status { flex-shrink: 0; }
.alert-row-actions { display: flex; gap: .35rem; flex-shrink: 0; flex-wrap: wrap; }
.badge-on,
.badge-off,
.badge-triggered {
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-on { background: var(--up-bg); color: var(--up); }
.badge-off { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }
.badge-triggered { background: var(--accent-bg); color: var(--accent); }

/* ── Alert modal on quote page ───────────────────────────────────────────── */
.alert-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.alert-modal-backdrop.open { display: flex; }
.alert-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.alert-modal h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.alert-modal .alert-field { margin-bottom: .9rem; }
.alert-modal label { display: block; font-size: .78rem; font-weight: 600; margin-bottom: .35rem; color: var(--text-muted); }
.alert-modal input[type="number"],
.alert-modal input[type="text"] {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: 'Geist Mono', monospace;
  font-size: .95rem;
  outline: none;
}
.alert-modal input[type="number"]:focus,
.alert-modal input[type="text"]:focus { border-color: var(--accent); }
.alert-modal-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.alert-existing {
  margin-bottom: 1rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.alert-existing-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface-2);
  padding: .2rem .55rem;
  border-radius: 999px;
  margin-right: .35rem;
  margin-top: .25rem;
  font-family: 'Geist Mono', monospace;
}

/* ── Compare page ────────────────────────────────────────────────────────── */
.cmp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .75rem;
}
.cmp-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .65rem .35rem .55rem;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  font-size: .82rem;
  background: var(--surface);
}
.cmp-chip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.cmp-chip-ticker {
  font-family: 'Geist Mono', monospace;
  font-weight: 700;
}
.cmp-chip-name {
  font-size: .72rem;
  color: var(--text-muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-chip-x {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  margin-left: .2rem;
}
.cmp-chip-x:hover { color: var(--down); }
.cmp-add-wrap {
  position: relative;
  max-width: 360px;
}
.cmp-add-wrap input {
  width: 100%;
  padding: .55rem .9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.cmp-add-wrap input:focus { border-color: var(--accent); }
.cmp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.cmp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: 'Geist Mono', monospace;
  font-size: .82rem;
}
.cmp-table th,
.cmp-table td {
  text-align: right;
}
.cmp-table th:first-child,
.cmp-table td:first-child {
  text-align: left;
}
.cmp-table td.up   { color: var(--up); }
.cmp-table td.down { color: var(--down); }
.cmp-table .cmp-section-row td {
  text-align: left;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  padding-top: .55rem;
  padding-bottom: .35rem;
  border-top: 1px solid var(--border);
}
.cmp-table .cmp-section-row:hover td { background: var(--surface-2); }

/* ── ETF comparison ──────────────────────────────────────────────────────── */
.cmp-chip.etf-chip-warn { opacity: .55; }

/* Overlap summary banner */
.etf-overlap {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .6rem .85rem;
  margin-bottom: 1.25rem;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .82rem;
}
.etf-overlap-count { font-weight: 700; color: var(--accent); white-space: nowrap; }
.etf-overlap-hint { color: var(--text-muted); }

/* Shared-holdings matrix */
.etf-shared-name .etf-h-sym { font-size: .82rem; }
.etf-shared-coname { color: var(--text-muted); font-size: .8rem; margin-left: .4rem; }
.etf-count-badge {
  display: inline-block;
  padding: .08rem .45rem;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
}
.etf-cell-empty { opacity: .45; }

/* Per-ETF columns */
.etf-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}
.etf-col { padding: 1.1rem 1.15rem 1.25rem; }
.etf-col-head { margin-bottom: .5rem; }
.etf-col-title { display: flex; align-items: center; gap: .5rem; }
.etf-col-name {
  font-weight: 600;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.etf-col-meta { font-size: .74rem; color: var(--text-muted); margin-top: .3rem; }
.etf-col-desc {
  font-size: .74rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-top: .45rem;
}
.etf-col-desc.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.etf-desc-toggle {
  margin-top: .35rem;
  padding: 0;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}
.etf-desc-toggle:hover { text-decoration: underline; }
.etf-col-note { font-size: .8rem; color: var(--text-muted); padding: .75rem 0; }
.etf-holdings-head {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: var(--text-muted);
  margin: .75rem 0 .35rem;
  padding-top: .6rem;
  border-top: 1px solid var(--border);
}
.etf-holding-list { list-style: none; margin: 0; padding: 0; }
.etf-holding {
  display: grid;
  grid-template-columns: 1.3rem auto 1fr auto;
  align-items: center;
  gap: .15rem .5rem;
  padding: .4rem;
  border-bottom: 1px solid var(--border);
}
.etf-holding:last-child { border-bottom: none; }
.etf-h-rank { font-family: 'Geist Mono', monospace; font-size: .72rem; color: var(--text-muted); text-align: center; }
.etf-h-sym  { font-family: 'Geist Mono', monospace; font-weight: 700; font-size: .8rem; }
.etf-h-name {
  min-width: 0;
  font-size: .76rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.etf-h-wt { font-family: 'Geist Mono', monospace; font-weight: 600; font-size: .82rem; }
.etf-h-bar {
  grid-column: 1 / -1;
  height: 4px;
  margin-top: .25rem;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.etf-h-bar > span { display: block; height: 100%; border-radius: 2px; }
.etf-holding.etf-shared { background: var(--accent-bg); border-radius: 6px; }
.etf-holding.etf-shared .etf-h-sym { color: var(--accent); }

/* Sector-weightings table cells: value + mini bar */
.etf-sec-val { display: block; }
.etf-sec-bar {
  display: block;
  height: 4px;
  margin-top: .25rem;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.etf-sec-bar > span { display: block; height: 100%; border-radius: 2px; }

/* ── Politicians (congressional trades) ──────────────────────────────────── */
.pol-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}
.pol-input {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .88rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.pol-input:focus { border-color: var(--accent); }
#pol-search { flex: 1 1 240px; min-width: 200px; }
.pol-wl-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.pol-name {
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-size: inherit;
}
.pol-name:hover { text-decoration: underline; }
.pol-meta { display: block; color: var(--text-muted); font-size: .76rem; margin-top: .1rem; }
.pol-side {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--surface-2);
}
.pol-side.up   { color: var(--up);   background: var(--up-bg); }
.pol-side.down { color: var(--down); background: var(--down-bg); }
.pol-lag { color: var(--text-muted); font-size: .72rem; }
.pol-active-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
  padding: .4rem .75rem;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .82rem;
}
.pol-chip-x { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.pol-chip-x:hover { color: var(--down); }

/* ── News list ───────────────────────────────────────────────────────────── */
.news-item {
  display: flex;
  gap: .85rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background .1s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--surface-2); }
.news-thumb {
  width: 96px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--surface-2);
}
.news-body { flex: 1; min-width: 0; }
.news-title {
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: .35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-meta {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .35rem;
}
.news-publisher { font-weight: 500; }
.news-dot { opacity: .6; }

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row:first-child { padding-top: 0; }
.settings-info { flex: 1; min-width: 0; }
.settings-label {
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: .2rem;
  color: var(--text);
}
.settings-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.settings-control { flex-shrink: 0; }
.settings-segment {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.settings-segment button {
  padding: .4rem .85rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  transition: background .12s, color .12s;
}
.settings-segment button:last-child { border-right: none; }
.settings-segment button.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
.settings-segment button:hover:not(.active) {
  background: var(--surface-2);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  border: 1px solid var(--down);
  color: var(--down);
}
.btn-danger:hover {
  background: var(--down-bg);
}
.settings-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .65rem 1rem;
  font-size: .85rem;
  box-shadow: var(--shadow);
  z-index: 1000;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.settings-toast.show { opacity: 1; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: .75rem 1rem; gap: 1rem; flex-wrap: wrap; }
  .nav-links { gap: 1rem; flex-wrap: wrap; }
  .nav-search { flex: 1 1 100%; order: 99; margin-top: .25rem; }
  .nav-search input,
  .nav-search input:focus { width: 100%; }
  .page, .page-wide { padding: 1.25rem 1rem 3rem; }
  .card { padding: 1.15rem; }
  .section-header h2 { font-size: 1.08rem; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .settings-segment { flex-wrap: wrap; }
  .price-large { font-size: 1.8rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-form { flex-direction: column; }
  .data-table { font-size: .8rem; }
  .data-table th, .data-table td { padding: .5rem .6rem; }
  .fund-cols { grid-template-columns: 1fr; gap: 0; }
  .fund-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .preset-chip { font-size: .78rem; padding: .3rem .75rem; }
  .analyst-wrap { gap: 1rem; }
  .analyst-target-grid { grid-template-columns: repeat(2, 1fr); }
  /* Force the portfolio summary to a 2-column grid so the labels and values stay
     readable instead of squeezing tiles onto one phone-wide row. Keep the 1px gap
     so the hairline-divider look is preserved on mobile. */
  .portfolio-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
  }
  .portfolio-summary-cell { min-width: 0; }
  .add-position-form input { min-width: 90px; }
  .position-grid { grid-template-columns: 1fr; }
  .position-stats { grid-template-columns: repeat(2, 1fr); }
  /* Chart cards: shorter price chart + responsive indicator panel. */
  #chart-wrap { height: 220px !important; }
  #indicator-wrap { height: 80px !important; }
}

@media (max-width: 480px) {
  .nav-brand { font-size: 1rem; }
  .nav-links a { font-size: .85rem; }
  .price-large { font-size: 1.5rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .fund-cols-3 { grid-template-columns: 1fr; }
  .position-stats { grid-template-columns: 1fr 1fr; }
  /* News card: shrink thumbnails so the headline keeps room to breathe. */
  .news-thumb { width: 56px; height: 56px; }
  /* Section headers tighter so cards don't waste vertical space. */
  .section-header h2 { font-size: 1rem; }
}

/* ── Auth pages (login + signup) ─────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Soft accent glows bleed out from behind the card so the near-black page
     isn't flat — the "spills onto the black background" part of the aurora look.
     Renders as a faint wash on the light theme (--bg is cream there). */
  background:
    radial-gradient(60% 55% at 28% 18%, rgba(47,110,230,.20), transparent 60%),
    radial-gradient(55% 55% at 78% 82%, rgba(23,196,196,.15), transparent 60%),
    var(--bg);
  padding: 2rem 1rem;
}
/* Two-column shell: gradient brand panel + themed form panel share one
   rounded, elevated card (overflow:hidden clips the gradient to the corners). */
.auth-shell {
  position: relative;
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Accent-tinted glow makes the card look lit from within on the dark page. */
  box-shadow: 0 0 90px rgba(45,120,230,.28), var(--shadow-lg);
  overflow: hidden;
}

/* Left: brand panel. Fixed brand-blue gradient (not themed --accent) so the
   white text stays high-contrast in both light and dark modes. */
.auth-brandpanel {
  position: relative;
  overflow: hidden;
  isolation: isolate;                /* contain the aurora blend to this panel */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 2.5rem 2.25rem;
  color: #fff;
  /* Vibrant blue→indigo→cyan base; a very faint grid keeps a subtle "data"
     texture. The animated aurora blobs live in ::before, blended on top. */
  background:
    linear-gradient(0deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 100% 36px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 36px 100%,
    linear-gradient(150deg, #3320a8 0%, #2a53d6 40%, #1f8fe6 72%, #17c4c4 100%);
}
/* Lift the logo + tagline/features above the aurora layer. */
.auth-brandpanel > * { position: relative; z-index: 1; }
/* Animated aurora: soft colored blobs screen-blended over the base gradient. */
.auth-brandpanel::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: 0;
  background:
    radial-gradient(38% 46% at 22% 26%, rgba(124,77,255,.60), transparent 70%),
    radial-gradient(42% 52% at 80% 18%, rgba(0,204,255,.55), transparent 70%),
    radial-gradient(48% 58% at 62% 88%, rgba(74,120,255,.60), transparent 70%),
    radial-gradient(34% 44% at 12% 84%, rgba(0,230,200,.45), transparent 70%);
  mix-blend-mode: screen;
  filter: saturate(1.1);
}
@media (prefers-reduced-motion: no-preference) {
  .auth-brandpanel::before {
    animation: aurora-drift 22s ease-in-out infinite alternate;
  }
}
@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0)      scale(1);    }
  50%  { transform: translate3d(3%, -3%, 0)   scale(1.12); }
  100% { transform: translate3d(-3%, 2%, 0)   scale(1.06); }
}
.auth-brandpanel-main { margin-top: auto; }
.auth-tagline {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 1.5rem;
}
.auth-features { list-style: none; padding: 0; margin: 0; }
.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: .9rem;
  color: rgba(255,255,255,.85);
  margin-bottom: .85rem;
}
.auth-features li:last-child { margin-bottom: 0; }
.auth-features li::before {
  content: "✓";
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .05rem;
}

/* Right: form panel — inner column, no own border/shadow (shell provides it). */
.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 2.5rem 2rem;
}
.auth-brand {
  display: inline-flex;
  align-items: center;
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.auth-brand span { color: #cdd9f2; }
.auth-logo-mark {
  width: 1.5em;
  height: 1.5em;
  margin-right: .5rem;
  border-radius: 7px;
  /* The favicon tile is the same blue family as the panel — a faint ring +
     shadow separates it so it reads as a distinct logo badge. */
  box-shadow: 0 0 0 1px rgba(255,255,255,.28), 0 2px 6px rgba(0,0,0,.28);
}
.auth-heading {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 1.7rem;
  margin: 0 0 .35rem;
}
.auth-sub {
  font-size: .88rem;
  color: var(--text-muted);
  margin: 0 0 1.4rem;
}
.auth-sub a { color: var(--accent); text-decoration: none; }
.auth-sub a:hover { text-decoration: underline; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.auth-field > span {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.auth-field > input {
  padding: .7rem .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.auth-field > input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.auth-submit {
  width: 100%;
  padding: .75rem;
  font-size: .95rem;
  margin-top: .5rem;
  border: none;
  /* Gradient fill + accent glow so the primary action pops like the panel. */
  background: linear-gradient(135deg, #2a63e0 0%, #1f8fe6 55%, #17c4c4 100%);
  box-shadow: 0 6px 18px rgba(42,99,224,.35);
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}
/* Repeat the gradient on :hover so the base .btn-primary:hover rule (a flat
   color) can't override it; use brightness + a stronger glow for the hover pop. */
.auth-submit:hover {
  background: linear-gradient(135deg, #2a63e0 0%, #1f8fe6 55%, #17c4c4 100%);
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 28px rgba(42,99,224,.5);
}
.auth-alt {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
}
.auth-alt a { color: var(--accent); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.auth-error {
  background: var(--down-bg);
  color: var(--down);
  border: 1px solid var(--down);
  border-radius: var(--radius-sm);
  padding: .6rem .85rem;
  font-size: .85rem;
  margin-bottom: 1rem;
}
/* Signup legal-agreement checkbox */
.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin-top: 1rem;
  font-size: .82rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.auth-checkbox input { margin-top: .15rem; flex-shrink: 0; }
.auth-checkbox a { color: var(--accent); text-decoration: none; }
.auth-checkbox a:hover { text-decoration: underline; }
.auth-legal-footer {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: .8rem;
}
.auth-legal-footer a { color: var(--text-muted); text-decoration: none; }
.auth-legal-footer a:hover { color: var(--accent); text-decoration: underline; }

/* Stack to a single card on narrow screens: brand panel becomes a compact top
   band (logo + tagline; feature bullets hidden). */
@media (max-width: 760px) {
  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 440px;
    box-shadow: 0 0 55px rgba(45,120,230,.24), var(--shadow-lg);
  }
  .auth-brandpanel { gap: 1.25rem; padding: 1.75rem 1.75rem 1.5rem; }
  .auth-tagline { font-size: 1.4rem; margin-bottom: 0; }
  .auth-features { display: none; }
  .auth-card { padding: 1.75rem; }
}

/* ── Legal page ──────────────────────────────────────────────────────────── */
.legal-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.5rem;
}
.legal-jump-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.legal-jump a { color: var(--accent); text-decoration: none; font-size: .9rem; }
.legal-jump a:hover { text-decoration: underline; }
/* Keep anchored sections clear of the sticky nav when jumped to. */
.legal-section { scroll-margin-top: 5rem; }
.legal-body { max-width: 70ch; color: var(--text); line-height: 1.65; }
.legal-body p { margin: 0 0 1rem; }
.legal-body h3 {
  font-size: 1rem;
  margin: 1.4rem 0 .5rem;
}
.legal-body ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.legal-body li { margin-bottom: .5rem; }
.legal-body code {
  font-family: 'Geist Mono', monospace;
  font-size: .85em;
  background: var(--surface-2);
  padding: .1rem .35rem;
  border-radius: 4px;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.nav-user a { color: var(--text-muted); text-decoration: none; }
.nav-user a:hover { color: var(--text); }
/* Sign-out is a POST form button styled to read as the plain nav link it replaced. */
.nav-logout-btn {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; cursor: pointer;
  color: var(--text-muted); text-decoration: none;
}
.nav-logout-btn:hover { color: var(--text); }

/* One-time migration banner — fixed strip across the bottom on first login when
   localStorage still has legacy data and the server account is empty. */
.migration-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 720px;
  width: calc(100% - 2.5rem);
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 1000;
  font-size: .88rem;
}
.migration-banner-body { flex: 1; }
.migration-banner-detail {
  display: block;
  margin-top: .35rem;
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.migration-banner-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .migration-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .migration-banner-actions { justify-content: stretch; }
  .migration-banner-actions .btn { flex: 1; }
}
