/*
  style.css — the DESIGN (skin and clothing).
  Zen / Steve-Jobs feel: lots of empty space, one thing in focus,
  a soft paper background, calm ink-coloured text, one quiet accent.

  The :root block below is our "palette". Change a value here and it
  updates everywhere — try it once you're comfortable.
*/
:root {
  --paper:     #f6f5f1;  /* warm off-white, like good paper */
  --ink:       #2a2a28;  /* soft near-black, like brush ink  */
  --ink-soft:  #7a7a73;  /* muted grey for secondary text    */
  --line:      #e4e2db;  /* hairline borders                 */
  --accent:    #6f7d6a;  /* a single, restrained sage green  */
  --neg:       #b5806f;  /* a muted clay, only for losses     */
  --white:     #ffffff;

  --radius: 14px;        /* gentle rounded corners */
}

/* Reset a few browser defaults so spacing is predictable */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  /* The clean system font — on your Mac this is Apple's San Francisco */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* One narrow, centred column with generous breathing room */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 96px 24px 64px;
}
/* The Top Analysts table has five columns, so it gets a touch more room — the
   masthead and key field stay centred, the lanes get to breathe on one line. */
.page--wide { max-width: 760px; }

/* ---------- Header ---------- */
.masthead {
  text-align: center;
  margin-bottom: 64px;
}

.enso {
  width: 56px;
  height: 56px;
  color: var(--ink);
  opacity: 0.85;
  margin-bottom: 24px;
}

.title {
  font-size: 40px;
  font-weight: 300;          /* light and airy */
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--ink-soft);
  font-size: 17px;
}

/* ---------- Input area ---------- */
.inputzone {
  margin-bottom: 48px;
}

.inputzone__label {
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.inputzone__box {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; /* monospace suits raw data */
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.inputzone__box::placeholder { color: #b7b6ae; }

/* A gentle ring when the box is active, instead of a harsh outline */
.inputzone__box:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 125, 106, 0.15);
}

.inputzone {
  text-align: center;
}

/* A small, quiet status line under the button */
.status {
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* A text button that looks like a link (used for "Forget") */
.linkbtn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

/* A minimalist text button */
.btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;       /* fully rounded pill */
  color: var(--ink-soft);
  font-size: 14px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* The primary call-to-action: a calm filled sage pill (used on the welcome page).
   It's an <a> styled as a button, so a few resets keep it looking like one. */
.btn--primary {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  padding: 12px 28px;
  font-size: 15px;
}
.btn--primary:hover {
  background: #5f6c5b;          /* a touch darker on hover */
  border-color: #5f6c5b;
  color: var(--white);
}

/* ---------- Welcome page ---------- */
/* The landing column can breathe a little wider than the tracker. */
.landing { max-width: 680px; }

/* Hero: enso, promise, the way in */
.hero {
  text-align: center;
  margin-bottom: 96px;
}
/* The brand name over the promise — quiet, spaced, sage. */
.hero__eyebrow {
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero__title {
  font-size: 44px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 8px 0 24px;
}
.hero__lede {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 36px;
}
.hero__trust {
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

/* The possibilities: a calm vertical list */
.features {
  display: flex;
  flex-direction: column;
  gap: 48px;
  margin-bottom: 96px;
}
.feature {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  text-align: left;
}
.feature__icon {
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--accent);
  opacity: 0.9;
  margin-top: 4px;
}
.feature__title {
  font-size: 19px;
  font-weight: 400;
  margin-bottom: 6px;
}
.feature__desc {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
}

/* The closing invitation */
.closing {
  text-align: center;
  margin-bottom: 24px;
}
.closing__line {
  font-size: 20px;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 24px;
}

/* ---------- Top navigation ---------- */
/* A clear, Apple-like bar pinned to the top: a near-solid strip of paper with a
   hairline divider and the faintest shadow, so it reads plainly as a bar. The
   enso (home) and the "Portfolio" link sit together on the left; the Log in /
   Sign up buttons sit on the right. It stays put as you scroll. */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 245, 241, 0.92);    /* the paper colour, near-solid */
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
.navbar__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Left: enso + the "Portfolio" link, kept close together. */
.navbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.navbar__brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}
.navbar__enso {
  width: 30px;
  height: 30px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}
.navbar__brand:hover .navbar__enso { opacity: 1; }
/* The wordmark beside the enso — quiet, light, the brand name in ink. */
.navbar__wordmark {
  margin-left: 9px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.navbar__link {
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}
.navbar__link:hover { color: var(--ink); }
/* The link for the page you're on sits a touch firmer in ink. */
.navbar__link[aria-current="page"] { color: var(--ink); }

/* A tiny "Premium" tag beside the Target link — sage, quiet, just enough to feel
   special without shouting. */
.navbar__badge {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 2px;
  vertical-align: 1px;
}

/* Right: the two account buttons. Log in is a quiet outline; Sign up is filled. */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar__btn {
  font: inherit;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.navbar__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.navbar__btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}
.navbar__btn--primary:hover {
  background: #5f6c5b;
  border-color: #5f6c5b;
  color: var(--white);
}
/* When signed in, the navbar shows the account email in quiet grey. */
.navbar__user {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Accounts: login / signup ---------- */
/* A single narrow card, centred, in the same calm language as the tracker. */
.auth {
  max-width: 380px;
  margin: 0 auto;
}
.auth__head {
  text-align: center;
  margin-bottom: 36px;
}
.auth__title {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: 0.03em;
  margin: 8px 0 8px;
}
.auth__subtitle {
  color: var(--ink-soft);
  font-size: 15px;
}
.auth__card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
}

/* A labelled input. Reused by both auth pages. */
.field {
  margin-bottom: 18px;
  text-align: left;
}
.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.2s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
}
.field__hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* Full-width buttons for the auth forms. */
.btn--block {
  display: block;
  width: 100%;
  text-align: center;
}
.btn--google {
  margin-top: 0;
  color: var(--ink);
}

/* A gentle "or" divider between email and Google sign-in. */
.auth__or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.auth__or::before,
.auth__or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Feedback lines. */
.auth__error {
  color: var(--neg);
  font-size: 14px;
  margin-bottom: 14px;
  text-align: left;
}
.auth__ok {
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 14px;
  text-align: left;
}
.auth__foot {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 22px;
}
.auth__foot a {
  color: var(--accent);
  text-decoration: none;
}
.auth__foot a:hover { text-decoration: underline; }

/* ---------- Account page ---------- */
.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 16px;
}
.acct-label { color: var(--ink-soft); font-size: 14px; }
.acct-plan {
  font-size: 14px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.acct-plan.is-premium {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}
.acct-note { color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; }
.acct-hr { border: none; border-top: 1px solid var(--line); margin: 28px 0 20px; }
.acct-h2 { font-size: 16px; font-weight: 500; margin-bottom: 14px; }
/* Space the stacked full-width buttons on the account page. */
.acct-row + #upgradeBtn, .btn--block + .btn--block { margin-top: 10px; }
.acct-danger { color: var(--neg); border-color: var(--neg); }
.acct-danger:hover { color: var(--white); background: var(--neg); border-color: var(--neg); }

/* ---------- Premium prompt bar (Stock Research / Target) ---------- */
.premium-bar {
  max-width: 640px;
  margin: 0 auto 24px;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(111, 125, 106, 0.08);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
}
.premium-bar a { color: var(--accent); font-weight: 500; text-decoration: none; }
.premium-bar a:hover { text-decoration: underline; }

/* ---------- Legal pages (privacy / terms) ---------- */
.legal { max-width: 640px; margin: 0 auto; }
.legal h1 { font-size: 32px; font-weight: 300; letter-spacing: 0.03em; margin-bottom: 8px; }
.legal h2 { font-size: 17px; font-weight: 500; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--ink); font-size: 15px; }
.legal ul { margin: 8px 0 8px 20px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--accent); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal__meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 12px; }
.legal__foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- Results: summary + chart ---------- */
.results:empty { display: none; }
.results { margin-top: 8px; }

/* The Savings / Total-value switch */
.tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 40px;
}
.tab {
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab:hover { color: var(--ink); }
.tab--active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* The "coming next" placeholder for the Total-value view */
.placeholder {
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
  padding: 24px 8px 8px;
}
.placeholder p { margin-bottom: 14px; }
.placeholder__title {
  color: var(--ink);
  font-size: 20px;
  font-weight: 300;
  margin-bottom: 18px;
}

/* A whisper of colour for gain (sage) / loss (clay) */
.gain-pos { color: var(--accent); }
.gain-neg { color: var(--neg); }

/* Clickable Historic column headers (sort the table) */
.hist-sort { cursor: pointer; user-select: none; transition: color 0.15s ease; }
.hist-sort:hover { color: var(--ink); }
.hist-sort--on { color: var(--accent); }

/* The optional "Show dates" toggle above the Historic table */
.hist-dates {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  margin-bottom: 10px;
  user-select: none;
}
.hist-dates input { accent-color: var(--accent); cursor: pointer; }

/* The quiet "Mar 2019 → Jun 2022 · held 3y 2m" line under a closed company */
.hist-when {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* The holdings block sits under the Total-value graph */
.holdings-block { margin-top: 56px; }
.holdings-title {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

/* Header row: the title on the left, the Portfolio / Historic toggle on the right */
.holdings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.holdings-head .holdings-title { margin-bottom: 0; text-align: left; }

/* A small segmented toggle (matches the calm pill of the tabs) */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg__btn,
.tx-seg__btn,
.pt-seg__btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.seg__btn:hover,
.tx-seg__btn:hover,
.pt-seg__btn:hover { color: var(--ink); }
.seg__btn--active,
.tx-seg__btn--active,
.pt-seg__btn--active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* The Performance table's controls (Price/Value toggle + currency picker) sit together
   on the right of the block header. */
.perf-head__side {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Quiet messages / footnote inside the holdings block */
.holdings-empty {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 16px 0;
}
.holdings-foot {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 18px;
}

/* Holdings table */
.holdings {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.holdings th {
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}
.holdings td {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
/* Right-align the numeric columns — header AND cells (the `.holdings` qualifier
   gives this enough weight to beat the `.holdings th` left-align above). Tabular
   figures keep every digit the same width, so the numbers line up cleanly. */
.holdings .hd-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* Keep the data lanes on a single line so the overview reads cleanly: the price
   never splits from its currency, headers don't wrap, and the fund consensus
   ("Buy · ETF · from its holdings") stays one tidy line. Company names — the one
   column that can be long — are still free to wrap. Only on screens wide enough
   to hold five lanes; narrow phones keep wrapping so nothing runs off the edge. */
@media (min-width: 680px) {
  .analysts .hd-num,
  .analysts th,
  .analysts .a-consensus { white-space: nowrap; }

  /* Give each money column a clear left gutter so Price · Avg. target · Upside
     read as separate lanes instead of running together. */
  .analysts th.hd-num,
  .analysts td.hd-num { padding-left: 34px; }

  /* Cap the company name to one tidy line (full name on hover) so a long fund
     title can't crowd the numbers next to it. */
  .analysts .hd-name {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
.hd-name { color: var(--ink); }
.hd-pct { color: var(--ink-soft); }

/* On a narrow screen the extra columns can't all fit; let the table scroll
   sideways rather than run off the edge (it's roomy on a normal desktop). */
.holdings-scroll { overflow-x: auto; }

/* The Performance holdings table carries an extra number column (Return with the
   amount under it), so its lanes need a clear gutter and mustn't wrap, or the figures
   run together.
   The one long column — the company name — is capped to a tidy line (full name on
   hover) so it can't crowd the numbers. */
.holdings--perf th.hd-num,
.holdings--perf td.hd-num {
  padding-left: 22px;
  white-space: nowrap;
}
.holdings--perf .hd-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Top Analysts page ---------- */
/* The API-key setting: a quiet, centred field. */
.keyzone {
  max-width: 460px;
  margin: 0 auto 8px;
  text-align: center;
}
.keyzone__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.keyzone__row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.keyfield {
  flex: 1;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  outline: none;
  transition: border-color 0.2s ease;
}
.keyfield:focus { border-color: var(--accent); }
.keyzone__hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.keyzone__hint a { color: var(--accent); }

/* The friendly "open Portfolio first" message. */
.analysts-empty {
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  padding: 32px 0;
}
.analysts-empty a { color: var(--accent); }

/* The analyst table reuses .holdings; these are the extras it needs. */
.analysts .a-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}
.analysts .a-muted { color: var(--ink-soft); font-size: 13px; }

/* The clickable ticker (also the way to fix a wrong one). */
.a-ticker {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--accent);
  cursor: pointer;
}
.a-ticker:hover { text-decoration: underline; }

/* The consensus chip — one calm pill, tinted by how bullish analysts are. */
.rating {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.rating--buy2  { color: var(--white);  background: var(--accent); border-color: var(--accent); }
.rating--buy   { color: var(--accent); background: rgba(111, 125, 106, 0.12); border-color: transparent; }
.rating--hold  { color: var(--ink-soft); background: transparent; }
.rating--sell  { color: var(--neg); background: rgba(181, 128, 111, 0.12); border-color: transparent; }
.rating--sell2 { color: var(--white); background: var(--neg); border-color: var(--neg); }

/* Upside / downside to the average target. */
.a-up   { color: var(--accent); }
.a-down { color: var(--neg); }

/* A clickable holding row (expands to recent bank ratings). */
.analysts tr.a-expandable { cursor: pointer; }
.analysts tr.a-expandable:hover td { background: rgba(111, 125, 106, 0.05); }
.a-caret {
  display: none;   /* only expandable rows (stocks with ratings) show the caret */
  margin-right: 8px;
  color: var(--ink-soft);
  transition: transform 0.2s ease;
}
.analysts tr.a-expandable .a-caret { display: inline-block; }
.analysts tr.a-open .a-caret { transform: rotate(90deg); color: var(--accent); }

/* a small neutral tag for ETFs / funds in the consensus column */
.a-fund-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 4px;
}

/* The expanded panel: a calm list of recent analyst ratings. */
.a-detail > td { padding: 4px 0 22px; border-bottom: 1px solid var(--line); }
.a-detail__head {
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 4px 0 14px;
}
/* the analyst rating spread: a thin proportional Buy/Hold/Sell bar + legend */
.a-spread { margin: 4px 0 18px; }
.a-bar {
  display: flex;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
}
.a-bar__seg { height: 100%; }
.a-bar__seg--buy  { background: var(--accent); }
.a-bar__seg--hold { background: #cdcbc2; }
.a-bar__seg--sell { background: var(--neg); }
.a-spread__counts {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}
.a-spread__item { display: inline-flex; align-items: center; gap: 6px; }
.a-spread__item b { color: var(--ink); font-weight: 600; }
.a-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.a-dot--buy  { background: var(--accent); }
.a-dot--hold { background: #cdcbc2; }
.a-dot--sell { background: var(--neg); }
.a-rate {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.a-rate:first-of-type { border-top: none; }
.a-rate__firm { flex: 1; color: var(--ink); font-size: 14px; }
.a-rate__act { color: var(--ink-soft); font-size: 12px; }   /* "upgraded" / "initiated" next to the bank */
.a-rate__grade { flex-shrink: 0; }
.a-rate__date {
  flex-shrink: 0;
  min-width: 84px;
  text-align: right;
  white-space: nowrap;   /* keep "9 buy · 21 hold · 1 sell" on one line */
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
/* ETF breakdown rows: the fund's top holdings, shown as real table rows so their
   price / target / upside line up under the same columns as the fund row above.
   Lighter and tighter than a normal row, and gently inset to read as nested. */
.a-fundrow > td {
  padding: 10px 0;
  border-bottom: none;
  font-size: 14px;
  color: var(--ink-soft);
}
.a-fundrow:first-child > td { padding-top: 14px; }
.a-fundrow .a-fund-name { color: var(--ink); }
.a-fundrow > td:first-child { padding-left: 16px; }
.a-fund-lbl { font-size: 12px; color: var(--ink-soft); }
/* the Buy/Hold/Sell bar that leads the fund's expansion (no divider under it,
   so it reads as part of the same block as the holdings below) */
.a-fund-spread {
  padding: 6px 0 16px 16px !important;
  border-bottom: none !important;
}
.a-fund-spread .a-detail__head { margin-top: 0; }
.a-fund-note {
  padding: 8px 0 22px 16px !important;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  border-bottom: 1px solid var(--line) !important;
}
/* "Recent news": a separate, deliberately eye-catching card panel below the analyst
   detail — Yahoo-Finance style. A two-column grid of cards, each with a thumbnail,
   a bold headline, a short description and "source · 3h ago". Built to invite a daily
   return, while staying in the app's calm palette. */
.news-panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.news-panel__head {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 32px;
}
@media (max-width: 640px) {
  .news-grid { grid-template-columns: 1fr; gap: 0; }
}
.news-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: opacity 0.15s ease;
}
/* the first card in each column has no top rule (mirrors Yahoo's clean top edge) */
.news-grid > .news-card:nth-child(1),
.news-grid > .news-card:nth-child(2) { border-top: none; }
@media (max-width: 640px) {
  .news-grid > .news-card:nth-child(2) { border-top: 1px solid var(--line); }
}
.news-card:hover { opacity: 0.72; }
.news-card__body {
  flex: 1;
  min-width: 0;   /* let the clamps shrink instead of overflowing the grid cell */
  display: flex;
  flex-direction: column;
}
.news-card__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card:hover .news-card__title { color: var(--accent); }
.news-card__desc {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card__meta {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.news-card__thumb {
  flex: 0 0 116px;
  width: 116px;
  height: 82px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eceae3, #e0e4dc);   /* soft placeholder if no image */
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
@media (max-width: 640px) {
  .news-card__thumb { flex-basis: 92px; width: 92px; height: 68px; }
}
.a-detail__note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 14px;
  line-height: 1.5;
}
.a-detail__note code {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 5px;
  border-radius: 4px;
}
/* A brief "what this company does" line, sat where the provenance note used to be.
   A touch larger/darker than a footnote since it's real content, not fine print. */
.a-detail__about {
  font-size: 13px;
  color: var(--ink-soft2, var(--ink-soft));
}

/* The small tag marking a target as an estimate (not a published one). */
.a-est {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Stock Research page ---------- */
/* The research page holds five lists side by side, so it gets a wider column. */
.page--research { max-width: 1000px; }

/* The AI search box: one calm ChatGPT-style line — a rounded field with the send
   button tucked inside on the right. Nothing else around it. */
.ask {
  max-width: 640px;
  margin: 8px auto 8px;
}
.ask__box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 7px 7px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ask__box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 125, 106, 0.12);
}
.ask__field {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: 6px 0;
}
.ask__field::placeholder { color: var(--ink-soft); }
.ask__send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--accent);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.ask__send:hover { opacity: 0.9; }
.ask__send svg { width: 19px; height: 19px; }

/* The sector chips / example-search chips: calm pill buttons, sage when on. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 40px;
  max-width: 620px;
}
.chip {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 15px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { color: var(--ink); border-color: var(--ink-soft); }
.chip.is-on {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}
.chips__hint {
  flex-basis: 100%;
  text-align: center;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* AI search results: one heading + a self-wrapping grid of picks. */
.ask-list { margin-top: 30px; }
.ask-list__head {
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 8px;
}
.ask-list__sub { font-size: 13px; color: var(--ink-soft); }
.ask-list__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 24px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

/* The five curated lists, laid out horizontally as compact cards. */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 44px;
}
.theme-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 14px 12px;
}
.theme-card__title {
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-align: center;
  margin-bottom: 8px;
}
.theme-card__empty {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  padding: 8px 0;
}
.theme-card__picks { display: flex; flex-direction: column; }

/* One pick — a clickable row: company on the left, upside on the right. */
.pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  padding: 9px 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.pick:first-child { border-top: none; }
.pick:hover { background: rgba(111, 125, 106, 0.06); }
.pick--active { background: rgba(111, 125, 106, 0.12); }
.pick__co { flex: 1; min-width: 0; }
.pick__name {
  display: block;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick__tk { font-size: 10px; letter-spacing: 0.04em; color: var(--accent); }
.pick__own {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
}
.pick__up {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* The detail panel below the lists — the selected stock, in full. */
.detail-panel:empty { display: none; }
.detail-panel { margin-top: 40px; }
.detail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 22px 24px;
}
.detail__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.detail__name { font-size: 20px; color: var(--ink); }
.detail__tk { font-size: 13px; letter-spacing: 0.04em; color: var(--accent); margin-left: 8px; }
.detail__sector { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.detail__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat__lbl {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat__val { font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* The price chart inside the detail card — a calm area sparkline with a range toggle. */
.dchart { margin: 22px 0 6px; }
.dchart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.dchart__perf { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dchart__perf.a-up   { color: var(--accent); }
.dchart__perf.a-down { color: var(--neg); }
.dchart__perf-range { color: var(--ink-soft); font-weight: 400; font-size: 12px; }
.dchart__ranges { display: inline-flex; gap: 2px; }
.dchart__range {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.dchart__range:hover { color: var(--ink); }
.dchart__range.is-on { color: var(--ink); background: var(--paper); }
.dchart__plot { position: relative; width: 100%; height: 180px; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.dchart__svg { display: block; width: 100%; height: 100%; }
.dchart__line { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dchart--down .dchart__line { stroke: var(--neg); }
.dchart__fill-a { stop-color: var(--accent); stop-opacity: 0.16; }
.dchart__fill-b { stop-color: var(--accent); stop-opacity: 0; }
.dchart--down .dchart__fill-a { stop-color: var(--neg); }
.dchart__dot {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--white);
  pointer-events: none;
}
.dchart__plot.is-down .dchart__dot { background: var(--neg); }
.dchart__tip {
  position: absolute;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  z-index: 2;
}
.dchart__tip b   { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.dchart__tip span { font-size: 11px; color: var(--ink-soft); }

/* Drag-to-measure: the shaded band, its two endpoint dots, and the % / period label. */
.dchart__band {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  background: rgba(111, 125, 106, 0.12);          /* sage tint (a gain) */
  border-left: 1px solid rgba(111, 125, 106, 0.45);
  border-right: 1px solid rgba(111, 125, 106, 0.45);
}
.dchart__plot.sel-neg .dchart__band {
  background: rgba(181, 128, 111, 0.12);          /* clay tint (a loss) */
  border-left-color: rgba(181, 128, 111, 0.45);
  border-right-color: rgba(181, 128, 111, 0.45);
}
.dchart__edge {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 2px var(--accent);
  pointer-events: none;
}
.dchart__plot.sel-neg .dchart__edge { box-shadow: 0 0 0 2px var(--neg); }
.dchart__sel {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 11px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.dchart__sel b { font-size: 15px; font-variant-numeric: tabular-nums; }
.dchart__sel.a-up   b { color: var(--accent); }
.dchart__sel.a-down b { color: var(--neg); }
.dchart__sel span { font-size: 11px; color: var(--ink-soft); }
.dchart__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.dchart__tick { white-space: nowrap; }

/* The key-metrics grid + 52-week range bar, below the chart. */
.detail__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 16px 22px;
  padding: 18px 0 2px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric__lbl {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.metric__val { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.range52 { margin: 18px 0 2px; }
.range52__lbl {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 9px;
}
.range52__track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}
.range52__mark {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--white);
}
.range52__ends {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* On narrow screens the five cards become a horizontal swipe. */
@media (max-width: 900px) {
  .themes-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 74%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .theme-card { scroll-snap-align: start; }
}

/* The static ticker under a pick's name (not editable, unlike the Analysts page). */
.a-ticker-static { font-size: 12px; letter-spacing: 0.03em; color: var(--accent); }

/* A quiet tag marking a pick you already hold. */
.owned-tag {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(111, 125, 106, 0.4);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

/* The "Surprise me" chip — a slightly warmer, sage-tinted starter. */
.chip--spark { color: var(--accent); border-color: rgba(111, 125, 106, 0.35); }
.chip--spark:hover { color: var(--white); background: var(--accent); border-color: var(--accent); }

/* ---------- Today's standout: the single hero pick, fresh each visit ---------- */
.standout-wrap:empty { display: none; }
.standout-wrap { margin: 28px auto 8px; max-width: 560px; }
.standout {
  display: block;
  width: 100%;
  text-align: center;
  font: inherit;
  cursor: pointer;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(111, 125, 106, 0.10), rgba(111, 125, 106, 0) 62%),
    var(--white);
  border: 1px solid rgba(111, 125, 106, 0.28);
  border-radius: var(--radius);
  padding: 20px 24px 18px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.standout:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(111, 125, 106, 0.14);
  border-color: rgba(111, 125, 106, 0.45);
}
.standout__eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.standout__name { display: block; font-size: 24px; font-weight: 300; color: var(--ink); letter-spacing: 0.01em; }
.standout__tk { font-size: 13px; letter-spacing: 0.04em; color: var(--accent); margin-left: 10px; vertical-align: middle; }
.standout__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.standout__rating { font-size: 12px; }
.standout__up { font-size: 17px; font-variant-numeric: tabular-nums; }
.standout__go {
  font-size: 13px;
  color: var(--ink-soft);
  transition: color 0.15s ease, transform 0.15s ease;
}
.standout:hover .standout__go { color: var(--accent); transform: translateX(2px); }

/* A little life in the five theme cards — a gentle lift on hover. */
.theme-card { transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(42, 42, 40, 0.06);
  border-color: rgba(111, 125, 106, 0.30);
}

/* The one-line note shown when we fall back to the built-in starter list. */
.research-note {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  text-align: center;
  margin: 0 auto 8px;
  max-width: 560px;
}
.research-note code {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ========== ETF Research page ==========
   Six big index blocks + five theme baskets, each a one-line explainer over a
   top-5 table (reuses the Portfolio's .holdings table). The one genuinely new
   pieces are the per-block explainer/fee lines and the little risk-meter. */

/* One index / theme block: a title, a plain-English explainer, then its table. */
.index-block { margin-top: 44px; }
.index-block:first-child { margin-top: 32px; }
.index-block__title {
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.01em;
  margin-bottom: 2px;
}
.index-block__note {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
/* The honest reminder under an INDEX block: within one index, fee/size is what differs. */
.index-block__fee {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 10px;
  line-height: 1.6;
}
.index-block__fee b { color: var(--ink); font-weight: 600; }

/* The ETF table: the .holdings look, with a two-line Fund cell (name + ticker/fee). */
/* Tighter rows than the default .holdings (16px) — the name cell is 2–3 lines tall, so
   the extra padding made the rows feel far apart — and TOP-align every column so the
   numbers line up with the index/fund name instead of floating in the vertical middle. */
.etf-table td {
  padding-top: 10px;
  padding-bottom: 10px;
  vertical-align: top;
}
.etf-table .hd-name { padding-right: 16px; }
/* Column headers carry a `title` explaining each column — hint it's hoverable. */
.etf-table th[title] { cursor: help; }
.etf-name { display: block; font-size: 15px; color: var(--ink); }
.etf-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.etf-tk { font-size: 11px; letter-spacing: 0.04em; color: var(--accent); }
.pick__fee { font-size: 11px; color: var(--ink-soft); }
/* The index row's plain-English explainer ("The 500 biggest US companies."), and the
   theme fund's one-line "angle" — both quiet sub-lines under the name. */
.index-row__note,
.etf-angle {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.35;
}
.etf-angle { margin-top: 4px; }
.ret-span { font-size: 11px; color: var(--ink-soft); }   /* the "(3y)" tag when 5y is missing */
/* The generic `.pick` rule (Stock Research) is display:flex for its button-rows. Here
   the picks are REAL table rows, so force them back to table-row / table-cell — otherwise
   each row lays out as its own flex line and the number columns don't align. */
.etf-table tr.pick { display: table-row; cursor: pointer; transition: background 0.12s ease; }
.etf-table tr.pick > td { display: table-cell; }
.etf-table tbody tr.pick:hover { background: rgba(111, 125, 106, 0.06); }
.etf-table tbody tr.pick--active { background: rgba(111, 125, 106, 0.12); }
/* Give the risk column room so the dot meter + word sit on one tidy line. */
.etf-risk { white-space: nowrap; }

/* Popular-ETFs table: give each number lane a left gutter so Avg./year · Volatility ·
   Risk · Since read as separate columns. */
@media (min-width: 680px) {
  .etf-table--index th.hd-num,
  .etf-table--index td.hd-num { padding-left: 30px; }
}

/* The risk meter — five dots (level of them filled) + a plain word. Coloured
   sage (calm) → clay (wild) so the S&P 500 vs Emerging Markets gap is obvious. */
.risk { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.risk__word { font-size: 12px; color: var(--ink-soft); }
.risk--none { color: var(--ink-soft); }
.risk-meter { display: inline-flex; gap: 3px; align-items: center; }
.risk-meter__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);   /* an empty dot */
}
/* Filled dots take the level's colour; the higher the level, the warmer (toward clay). */
.risk--lv1 .risk-meter__dot.is-on { background: var(--accent); }
.risk--lv2 .risk-meter__dot.is-on { background: var(--accent); }
.risk--lv3 .risk-meter__dot.is-on { background: #b0a35f; }   /* a muted amber, the middle of sage→clay */
.risk--lv4 .risk-meter__dot.is-on { background: #bd9068; }
.risk--lv5 .risk-meter__dot.is-on { background: var(--neg); }

/* The big, calm headline number */
.summary {
  text-align: center;
  margin-bottom: 24px;
  position: relative;   /* anchor the "hide amounts" toggle */
}

/* A quiet eye button in the summary's corner: tap to blur all money for privacy. */
.hide-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.hide-toggle:hover { color: var(--ink); background-color: rgba(0, 0, 0, 0.04); }
.hide-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* When hiding, softly obscure every money figure. Layout stays put and the chart
   line shape is still visible — only the numbers become unreadable (and unselectable). */
.values-hidden .summary__value,
.values-hidden .summary__sub,
.values-hidden .hd-money,
.values-hidden .chart-ylabel,
.values-hidden .tip-amt,
.values-hidden .tip-hold-val {
  filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
}
.summary__label {
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.summary__value {
  font-size: 48px;
  font-weight: 300;
  letter-spacing: 0.01em;
  margin: 6px 0 8px;
  color: var(--accent);
}
.summary__sub {
  font-size: 13px;
  color: var(--ink-soft);
}

/* The chart header: account picker (left) + time range (right) */
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.range-select,
.account-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;   /* same as the page */
  border: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 5px 22px 5px 6px;
  cursor: pointer;
  transition: color 0.2s ease;
  /* a small chevron on the right */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237a7a73' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}
.range-select:hover,
.account-select:hover { color: var(--ink); }
.range-select:focus,
.account-select:focus { outline: none; }

/* the custom from → to date pickers: a quiet right-aligned row below the chart head,
   shown only when "Custom…" is chosen in the range dropdown. */
.date-range {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}
.date-range.hidden { display: none; }   /* explicit: the row hides unless custom is picked
                                           (its display:flex is declared after generic .hidden) */
.date-range__sep { color: var(--ink-soft); font-size: 13px; }
.date-input {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.date-input:hover { color: var(--ink); border-color: var(--ink-soft); }
.date-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the account picker aligns its chevron after the (possibly longer) name, but a
   long account name is capped to one line with an ellipsis rather than wrapping */
.account-select { padding-left: 0; max-width: 220px; }
.account-select__label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* the account picker is a button + a checkbox popover (tick which accounts to
   include in the analysis). The wrapper anchors the floating menu below it. */
.acct-picker { position: relative; }
.acct-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 200px;
  max-width: 280px;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
}
.acct-menu.hidden { display: none; }   /* explicit: the panel hides when closed */
.acct-menu__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.acct-menu__row:hover { background: rgba(42, 42, 40, 0.05); }
.acct-menu__row input { accent-color: var(--accent); cursor: pointer; flex: none; }
/* a long account name stays on one line, trailing off with an ellipsis */
.acct-menu__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-menu__sep { height: 1px; background: var(--line); margin: 6px 4px; }
.acct-menu__add {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.acct-menu__add:hover { color: var(--ink); background: rgba(42, 42, 40, 0.05); }

/* each side of the chart head lays its controls out in a quiet row */
.chart-head__side {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* the "Compare" button sits by the currency/range pickers on the right */
.compare-btn {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.compare-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.compare-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.compare-btn--active,
.compare-btn--active:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* a small, quiet "+ Add" button beside the account picker */
.add-acct {
  background: none;
  border: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  margin-left: 2px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.add-acct:hover { color: var(--accent); }

/* The timeline chart */
.chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}
.chart-area {
  fill: var(--accent);
  opacity: 0.05;
  stroke: none;
}
/* The savings line on the Compare chart: a quiet, dashed grey behind the value line */
.chart-line--savings {
  stroke: var(--ink-soft);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}
.chart-dot--savings {
  fill: var(--ink-soft);
  stroke: var(--white);
  stroke-width: 2;
}

/* The little key under the Compare chart */
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
}
.legend-swatch--value   { border-top-color: var(--ink); }
.legend-swatch--savings { border-top-color: var(--ink-soft); border-top-style: dashed; }

/* The two coloured value lines inside the Compare hover card */
.tip-amt--value   { fill: var(--ink); }
.tip-amt--savings { fill: var(--ink-soft); }
.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.55;
}
.chart-zero {
  stroke: var(--ink-soft);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.5;
}
.chart-ylabel {
  fill: var(--ink-soft);
  font-size: 11px;
  text-anchor: end;
  font-family: -apple-system, sans-serif;
}
.chart-xlabel {
  fill: var(--ink-soft);
  font-size: 11px;
  text-anchor: middle;
  font-family: -apple-system, sans-serif;
}

/* Hover readout */
.chart-capture { cursor: crosshair; }
.hover { pointer-events: none; }
.chart-cursor {
  stroke: var(--ink-soft);
  stroke-width: 1;
  opacity: 0.35;
}
.chart-dot {
  fill: var(--accent);
  stroke: var(--white);
  stroke-width: 2;
}
.tip { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12)); }
.tip-bg {
  fill: var(--white);
  stroke: var(--line);
  stroke-width: 1;
}
.tip-amt {
  fill: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
}
.tip-date {
  fill: var(--ink-soft);
  font-size: 11px;
  font-family: -apple-system, sans-serif;
}
/* A hairline between the value/date header and the holdings list */
.tip-div {
  stroke: var(--line);
  stroke-width: 1;
}
/* "What you held then": name on the left, its value flush-right, quiet and even */
.tip-hold-name {
  fill: var(--ink);
  font-size: 11.5px;
  font-family: -apple-system, sans-serif;
}
.tip-hold-val {
  fill: var(--ink-soft);
  font-size: 11.5px;
  text-anchor: end;
  font-family: -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* Drag-to-measure: a shaded band between two chosen points + a change readout.
   Sage when the value rose over the span, clay when it fell. */
.measure { pointer-events: none; }
.measure-band { fill: var(--ink); opacity: 0.08; }
.measure--neg .measure-band { fill: var(--neg); }
.measure-edge {
  fill: var(--ink);
  stroke: var(--white);
  stroke-width: 2;
}
.measure--neg .measure-edge { fill: var(--neg); }
.measure-sel { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12)); }
.measure-sel-bg {
  fill: var(--white);
  stroke: var(--line);
  stroke-width: 1;
}
.measure-sel-amt {
  fill: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
}
.measure--neg .measure-sel-amt { fill: var(--neg); }
.measure-sel-range {
  fill: var(--ink-soft);
  font-size: 11px;
  font-family: -apple-system, sans-serif;
}
.tip-hold-more {
  fill: var(--ink-soft);
  font-style: italic;
}

.chart__caption {
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 16px;
}
.note {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ---------- Live prices control ---------- */
.live-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}
.live-bar__text { color: var(--ink); }
/* the soft pulsing dot that signals "live" */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 1.8s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.8); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- Footer ---------- */
.reassurance {
  margin-top: 72px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}
/* Cloud-sync status (Premium): a quiet " · Synced" appended by sync.js via a
   data attribute, so the base privacy copy is untouched for signed-out users. */
.reassurance[data-sync]:not([data-sync=""])::after {
  content: " · " attr(data-sync);
  color: var(--accent);
}

/* A small helper: hides an element completely */
.hidden { display: none; }

/* ---------- Drop overlay: drag a folder of exports to add accounts ---------- */
/* A soft, dimmed sheet over the page, with one calm card in the middle. */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(42, 42, 40, 0.28);        /* a quiet ink wash */
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease both;
}
/* Keep the generic .hidden working here: .drop-overlay's display:flex is declared
   later in the file, so without this more-specific rule it would win and the
   overlay would never actually hide. */
.drop-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drop-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  padding: 28px;
}

/* The quiet close (×) in the corner */
.drop-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s ease;
}
.drop-close:hover { color: var(--ink); }

/* The dashed target you drop the folder onto */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 48px 24px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.drop-zone:hover,
.drop-zone:focus-visible { outline: none; border-color: var(--accent); }

/* Lit up while a folder is hovering over it */
.drop-zone--over {
  border-color: var(--accent);
  background: rgba(111, 125, 106, 0.08);
  transform: scale(1.01);
}

.drop-zone__icon { width: 40px; height: 40px; color: var(--accent); opacity: 0.9; }
.drop-zone__title { font-size: 18px; font-weight: 300; color: var(--ink); }
.drop-zone__hint  { font-size: 13px; color: var(--ink-soft); line-height: 1.7; max-width: 320px; }
.drop-zone__hint code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
}

/* ---------- Target page (the planner) ---------- */
/* The inputs sit in a calm row of cards: one accent border on focus, the currency
   or % quietly tucked to the right of the field. */
.planner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 48px;
}
.planner__field {
  flex: 1 1 150px;
  min-width: 150px;
  max-width: 220px;
}
.planner__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.planner__opt { text-transform: none; letter-spacing: 0; opacity: 0.7; }
.planner__inputwrap {
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 0.2s ease;
}
.planner__inputwrap:focus-within { border-color: var(--accent); }
.planner__input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 18px;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 0;
  font-variant-numeric: tabular-nums;
}
.planner__suffix { color: var(--ink-soft); font-size: 15px; padding-left: 8px; }
.planner__hint { font-size: 12px; color: var(--ink-soft); margin-top: 7px; }

/* A quiet, link-like action under an input (e.g. "Current", "Plan with 1.000/mo"). */
.planner__action {
  margin-top: 7px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  transition: color 0.2s ease;
}
.planner__action:hover { color: #5f6c5b; text-decoration: underline; }
.planner__action[hidden] { display: none; }

/* The one-line result of the goal auto-plan (hidden until there's something to say). */
.planner__note {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin: -16px auto 36px;
  max-width: 460px;
}
.planner__note:empty { display: none; }

/* The quiet title beside the chart's time-range dropdown. */
.chart-head__title {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* The headline figure — the one number the eye should land on. */
.target-headline { text-align: center; margin-bottom: 36px; }
.target-headline__label { font-size: 14px; color: var(--ink-soft); }
.target-headline__value {
  font-size: 48px;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 6px 0 12px;
  font-variant-numeric: tabular-nums;
}
.target-headline__split {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}
.target-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 7px;
  vertical-align: middle;
}
.target-dot--saved  { background: var(--ink-soft); }
.target-dot--growth { background: var(--accent); }

/* The milestone dots on the value line, and the goal line. */
.target-mark { fill: var(--accent); stroke: var(--white); stroke-width: 1.5; }
.target-goalline {
  stroke: var(--neg);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.7;
}
.target-goallabel {
  fill: var(--neg);
  font-size: 11px;
  text-anchor: end;
  font-family: -apple-system, sans-serif;
}

/* The "you'd reach your goal in…" line. */
.target-goal {
  text-align: center;
  font-size: 15px;
  color: var(--ink);
  margin: 24px auto 0;
  max-width: 460px;
}
.target-goal strong { font-weight: 500; }

/* The milestone cards: 1 / 5 / 10 / 20 / 30 years — a tidy row of equal cards, each
   just the horizon and the value. Wraps to two-up on narrow screens. */
/* No boxes. Steve-Jobs zen: take the chrome away and let the figures themselves be
   the design — five columns floating on the paper under one quiet hairline. The value
   is the hero (light weight, like the headline above it); the year is a small caption,
   the growth a sage whisper. Whitespace does the separating, not borders. */
.milestones {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 60px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}
/* Each card is a button — click a year to focus the chart on it. It's still chromeless:
   reset the native button look and let it read as plain figures on the paper. */
.milestone {
  position: relative;
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 16px 14px;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}
/* A faint hairline between columns so the numbers never read as one run. Short and
   vertically centred — a quiet divider, not a table grid. `+` skips the first card. */
.milestone + .milestone::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 40px;
  background: var(--line);
}
/* Hover/focus: a faint sage wash invites the click. */
.milestone:hover { background-color: rgba(111, 125, 106, 0.06); }
.milestone:focus-visible {
  outline: none;
  background-color: rgba(111, 125, 106, 0.06);
  box-shadow: 0 0 0 2px rgba(111, 125, 106, 0.35);
}
/* Active year: the year label turns sage and a small sage underline sits beneath it,
   so it's clear which year the headline and chart are showing. */
.milestone--active .milestone__year { color: var(--accent); }
.milestone--active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--accent);
}
.milestone__year {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.milestone__value {
  display: block;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The currency stays, but small and quiet, so the digits are what the eye reads. */
.milestone__ccy {
  font-size: 0.6em;
  font-weight: 400;
  color: var(--ink-soft);
  margin-left: 3px;
}
@media (max-width: 600px) {
  .milestones {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 0;
  }
  /* on two-up, DOM order ≠ visual rows, so the dividers would land wrong — drop them */
  .milestone + .milestone::before { display: none; }
}

/* ---------- Gentle motion ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.masthead,
.hero { animation: fadeUp 0.7s ease both; }
.fade-in  { animation: fadeUp 0.35s ease both; }

/* Respect people who prefer less movement */
@media (prefers-reduced-motion: reduce) {
  .masthead, .hero, .fade-in { animation: none; }
}
