/* styles/pages.css — Target planner + gentle motion + Macro page + price studio
   Part of the former single style.css, split by source order so the cascade is
   unchanged (loaded in sequence: tokens→base→landing→auth→portfolio→research→pages). */
/* ---------- 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: var(--accent-strong); 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(78, 97, 87, 0.06); }
.milestone:focus-visible {
  outline: none;
  background-color: rgba(78, 97, 87, 0.06);
  box-shadow: 0 0 0 2px rgba(78, 97, 87, 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; }

/* "Fusion" when switching views. Because the header skeleton is now identical across
   views, nothing jumps — so we simply dissolve the two things that actually change: the
   headline text (a soft opacity crossfade, held in place) and the graph (fade + a whisper
   of scale so it feels like it materialises). Same duration/easing → they read as ONE
   coordinated morph, calm and satisfying rather than a flicker. */
@keyframes chartFuse {
  from { opacity: 0; transform: scale(0.99); }
  to   { opacity: 1; transform: scale(1); }
}
.chart-fuse { animation: chartFuse 0.34s ease both; transform-origin: 50% 55%; }
@keyframes summaryFuse {
  from { opacity: 0.15; }
  to   { opacity: 1; }
}
.summary-fuse { animation: summaryFuse 0.34s ease both; }

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

/* ---------- Macro page ---------- */
/* A wide, calm workspace: search on top, then two tab bars (categories + metrics),
   then the chart and its data table. Reuses the research page's .ask + .dchart. */
.page--macro { max-width: 1000px; }

/* Company search: starter chips + the name→ticker match list. */
.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 14px auto 4px;
  max-width: 620px;
}
.macro-matches { max-width: 620px; margin: 8px auto 0; }
.macro-matches__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  padding: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.macro-match {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: transparent;
  border: none;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.12s ease;
}
.macro-match:hover { background: var(--paper); }
.macro-match__sym { font-weight: 600; min-width: 62px; font-variant-numeric: tabular-nums; }
.macro-match__name { flex: 1; color: var(--ink-soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.macro-match__exch { color: var(--ink-soft); font-size: 12px; }

/* The loaded company's header. */
.macro-company { text-align: center; margin: 26px auto 4px; }
.macro-company__name { font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.macro-company__tk { font-size: 15px; font-weight: 500; color: var(--ink-soft); margin-left: 10px; }
.macro-company__sub { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }

/* Top-level category tabs: a centered, wrapping row, underline for the active one. */
.macro-cats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  margin: 20px auto 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.macro-cat {
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.macro-cat:hover { color: var(--ink); background: var(--paper); }
.macro-cat.is-on { color: var(--on-accent); background: var(--accent); }

/* The metrics within a category: a lighter, quieter pill row. */
.macro-subs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 16px auto 0;
}
.macro-subs:empty { margin: 0; }
.macro-sub {
  font: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.macro-sub:hover { color: var(--ink); border-color: var(--ink-soft); }
.macro-sub.is-on { color: var(--ink); border-color: var(--accent); background: var(--paper); }

/* The panel: heading + period/range control, then chart + table. */
.macro-panel { margin: 26px 0 40px; min-height: 260px; }
.macro-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.macro-panel__title { font-size: 18px; font-weight: 600; color: var(--ink); margin: 0; }
.macro-panel__tk { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-left: 6px; }

/* Annual / Quarterly toggle (mirrors the app's .seg segmented control). */
.macro-seg {
  display: inline-flex;
  gap: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.macro-seg__btn {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.macro-seg__btn:hover { color: var(--ink); }
.macro-seg__btn.is-on { color: var(--ink); background: var(--white); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }

/* Headline figure above a periodic chart. */
.macro-headline { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 8px 0 2px; }
.macro-headline__val { font-size: 30px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.macro-headline__lbl { font-size: 13px; color: var(--ink-soft); }
.macro-headline__chg { font-size: 14px; font-variant-numeric: tabular-nums; }

.macro-chart { margin: 10px 0 6px; }
.macro-dchart { margin: 10px 0 6px; }
.macro-dchart--line .dchart__plot { cursor: crosshair; }

/* ---- Stock-Price chart studio (Yahoo-Finance-style, Zen skin) ---- */
.mchart { margin: 8px 0 6px; }
.mchart__bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.mchart__ranges { flex-wrap: wrap; }
/* Chart-type segmented control (skinned like .macro-seg__btn). */
.mchart__type {
  font: inherit; font-size: 12.5px; color: var(--ink-soft);
  background: transparent; border: none; border-radius: 999px;
  padding: 5px 13px; cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.mchart__type:hover { color: var(--ink); }
.mchart__type.is-on { color: var(--ink); background: var(--white); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.mchart__perf { margin-left: auto; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mchart__perf.a-up   { color: var(--accent); }
.mchart__perf.a-down { color: var(--neg); }
.mchart__perf-range { color: var(--ink-soft); font-weight: 400; font-size: 12px; }
/* The plot is the hero — noticeably taller than the mini sparklines elsewhere. */
.mchart__plot { height: 340px; }

/* Candlesticks + OHLC bars. Sage = up (close ≥ open), clay = down. */
.mchart-wick { stroke-width: 1; }
.mchart-wick.mchart-up   { stroke: var(--accent); }
/* Down candles use a true Yahoo-Finance red (not the app's calm clay --neg), so red really
   reads as red on the chart. Up stays the sage accent (a green). --mchart-dn is chart-only. */
.mchart-wick.mchart-down { stroke: var(--mchart-dn); }
.mchart-body { fill: none; stroke-linecap: butt; }
.mchart-body.mchart-up   { stroke: var(--accent); }
.mchart-body.mchart-down { stroke: var(--mchart-dn); }
.mchart-obar line { stroke-width: 1.4; }
.mchart-obar.mchart-up   line { stroke: var(--accent); }
.mchart-obar.mchart-down line { stroke: var(--mchart-dn); }

/* Baseline chart: sage above the start price, clay below (hard-stop gradients). */
.mchart-fill-up   { stop-color: var(--accent); stop-opacity: 0.18; }
.mchart-fill-dn   { stop-color: var(--neg);    stop-opacity: 0.18; }
.mchart-stroke-up { stop-color: var(--accent); }
.mchart-stroke-dn { stop-color: var(--neg); }
.mchart-baseref   { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.5; }

/* OHLC readout in the crosshair tooltip. */
.dchart__ohlc { display: block; margin-top: 3px; font-size: 10.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---- Studio: grid lanes, right price axis, current-price line, zoom/pan (Yahoo-style) ---- */
.mchart-grid { stroke: var(--line); opacity: 0.55; }
.mchart-nowline { stroke: var(--accent); stroke-dasharray: 5 4; opacity: 0.85; }
.mchart-nowline--dn { stroke: var(--mchart-dn); }
/* Plot + right axis sit side by side; the plot takes the slack, the axis a fixed lane. */
.mchart__plotrow { display: flex; align-items: stretch; }
.mchart__plotrow .mchart__plot { flex: 1 1 auto; min-width: 0; touch-action: none; }
.mchart__plotrow .mchart__plot:active { cursor: grabbing; }
.mchart__yaxis { position: relative; flex: 0 0 60px; width: 60px; align-self: stretch; }
/* Time axis: month labels + a dotted tick & bold year at each January, positioned by time. The
   inner layer spans exactly the plot (the 60px right padding reserves the price-axis lane). */
.mchart__axis {
  display: block; position: relative; height: 42px; padding: 0 60px 0 0;
  margin-top: 6px; border-top: 1px solid var(--line);
}
.mchart__axis-inner { position: relative; height: 100%; }
.mchart__dtick {
  position: absolute; top: 8px; transform: translateX(-50%);
  font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.mchart__dtick--year { top: 23px; color: var(--ink); font-weight: 600; }
.mchart__dtick--year::before {
  content: ""; position: absolute; left: 50%; top: -23px; height: 16px;
  border-left: 1px dotted var(--ink-soft); opacity: 0.6;
}
.mchart__ytick {
  position: absolute; right: 8px; transform: translateY(-50%);
  font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none;
}
.mchart__ynow {
  position: absolute; right: 4px; transform: translateY(-50%); z-index: 2;
  font-size: 11px; font-weight: 600; color: #fff; background: var(--accent);
  border-radius: 4px; padding: 1px 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.mchart__ynow.is-down { background: var(--mchart-dn); }
/* Crosshair rules: vertical tracks the hovered candle, horizontal tracks the MOUSE height. */
.dchart__cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-soft); opacity: 0.35; pointer-events: none; }
.dchart__crossh { position: absolute; left: 0; right: 0; height: 1px; background: var(--ink-soft); opacity: 0.35; pointer-events: none; }
/* The price tag that rides on the right axis at the mouse's height (Yahoo's grey cursor tag). */
.dchart__ycursor {
  position: absolute; right: 0; transform: translate(100%, -50%); z-index: 3;
  font-size: 11px; font-weight: 600; color: #fff; background: var(--headline);
  border-radius: 4px; padding: 1px 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
  pointer-events: none; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* Bar chart (values per fiscal period). */
.macro-barplot { height: 200px; }
.macro-bar-svg { width: 100%; height: 100%; display: block; }
.macro-bar { fill: var(--accent); opacity: 0.85; }
.macro-bar--neg { fill: var(--neg); opacity: 0.8; }
.macro-barplot:hover .macro-bar { opacity: 0.7; }
.macro-bar-zero { stroke: var(--ink-soft); stroke-width: 1; opacity: 0.4; }

/* ============================================================================
   Studio toolbar + advanced tools (indicators · compare · events · draw ·
   settings · fullscreen). Calm, labelled controls — never a dense icon strip.
   ============================================================================ */
/* The whole price studio sits in a soft floating card — same language as the Portfolio's
   framed chart (var(--card) surface, hairline, brushed sheen, soft shadow) — so the graph
   reads as one calm, beautiful panel. Fullscreen overrides this below. */
.mstudio {
  position: relative; margin: 14px 0 8px;
  background: var(--card); background-image: var(--card-grad);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 20px 44px -26px rgba(24, 34, 32, 0.34), var(--sheen-hi);
  padding: 18px 22px 16px;
}
html[data-theme="dark"] .mstudio { box-shadow: 0 20px 44px -26px rgba(0, 0, 0, 0.5), var(--sheen-hi); }
@media (max-width: 540px) { .mstudio { padding: 14px 14px 12px; border-radius: 16px; } }
.mstudio__tools { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 8px; }
.mstudio__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* A studio "tool" reads like a quiet text control; it lifts to the accent when active. */
.mstudio__tool {
  font: inherit; font-size: 12.5px; color: var(--ink-soft);
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 5px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.mstudio__tool:hover { color: var(--ink); }
.mstudio__tool.is-on { color: var(--accent); border-color: var(--line); background: var(--white); }
.mstudio__tool--icon { font-size: 15px; padding: 4px 9px; line-height: 1; }
.mstudio__count { font-style: normal; font-size: 10.5px; font-weight: 600; background: var(--accent); color: #fff;
  border-radius: 999px; min-width: 15px; height: 15px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; }

/* Inline popover panel — expands calmly under the toolbar (accordion, not overlay). */
.mstudio__pop {
  border: 1px solid var(--line); border-radius: 14px; background: var(--white);
  padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  animation: mstudioPop 0.14s ease;
}
@keyframes mstudioPop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.mstudio__pop[hidden] { display: none; }
.mpop__head { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.mpop__hint { font-size: 12px; color: var(--ink-soft); margin: 6px 2px 0; line-height: 1.5; }
.mpop__cols { display: flex; gap: 26px; flex-wrap: wrap; }
.mpop__col { min-width: 190px; }
.mpop__clear {
  font: inherit; font-size: 12px; color: var(--neg); background: transparent; border: none;
  padding: 8px 2px 2px; margin-top: 6px; cursor: pointer;
}
.mpop__clear:hover { text-decoration: underline; }

/* Checkable rows (indicators + settings). */
.mind-opt, .mset-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 12.5px; color: var(--ink); text-align: left;
  background: transparent; border: none; border-radius: 8px; padding: 6px 8px; cursor: pointer;
}
.mind-opt:hover, .mset-opt:hover { background: var(--paper); }
.mind-opt.is-on, .mset-opt.is-on { color: var(--accent); }
.mind-check { width: 14px; flex: 0 0 14px; text-align: center; color: var(--accent); font-size: 12px; }

/* Frequency (interval) menu — a compact checked list, and the toolbar button's caret. */
.mstudio__pop--interval { min-width: 168px; }
.mint-list { display: flex; flex-direction: column; }
.mint-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 13px; color: var(--ink); text-align: left;
  background: transparent; border: none; border-radius: 8px; padding: 7px 8px; cursor: pointer;
}
.mint-opt:hover { background: var(--paper); }
.mint-opt.is-on { color: var(--accent); font-weight: 600; }
.mstudio__tool--interval { font-variant-numeric: tabular-nums; }
.mstudio__caret { font-size: 9px; opacity: 0.6; margin-left: 1px; }

/* Draw popover: the tool chips + a done/erase row. */
.mdraw-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mdraw-opt, .mdraw-done {
  font: inherit; font-size: 12.5px; color: var(--ink-soft);
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.mdraw-opt:hover, .mdraw-done:hover { color: var(--ink); }
.mdraw-opt.is-on { color: #fff; background: var(--accent); border-color: var(--accent); }
.mdraw-done { display: block; margin-top: 4px; }
.mdraw-done.is-on { color: var(--ink); }

/* Compare popover: the add form + type-ahead menu + the ticker chips. */
.mcmp-search { position: relative; }
.mcmp-acmenu { max-height: 264px; overflow-y: auto; }
.mcmp-form { display: flex; gap: 6px; margin-bottom: 8px; }
.mcmp-input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px;
}
.mcmp-input:focus { outline: none; border-color: var(--accent); }
.mcmp-add {
  font: inherit; font-size: 12.5px; color: #fff; background: var(--accent); border: none;
  border-radius: 10px; padding: 7px 14px; cursor: pointer;
}
.mcmp-add:hover { background: var(--accent-strong); }
.mcmp-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mcmp-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 5px 3px 9px;
}
.mcmp-x, .mleg-x, .mdraw-del, .mchart__panel-x {
  font: inherit; line-height: 1; color: var(--ink-soft); background: transparent; border: none; cursor: pointer;
}
.mcmp-x { font-size: 15px; padding: 0 2px; }
.mcmp-x:hover, .mleg-x:hover { color: var(--neg); }

/* Legend under the toolbar (active overlays, or the compare lines). */
.mstudio__legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 2px 6px; min-height: 0; }
.mstudio__legend:empty { display: none; }
.mleg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mleg b { font-weight: 600; }
.mleg-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--c, var(--accent)); }
.mleg-x { font-size: 14px; padding: 0 1px; }
.mleg--load { font-style: italic; opacity: 0.7; }

/* Multi-line palette (indicators + comparisons): sage first, then three calm companions —
   dusty blue, amber, muted violet, teal. Set once as --c, read by dots/lines/paths. */
.mcmp-main, .mind-a { --c: var(--accent); }
.mcmp-a, .mind-b { --c: #5b8aa6; }
.mcmp-b, .mind-c { --c: #c08552; }
.mcmp-c, .mind-d { --c: #8a76ad; }
.mcmp-d { --c: #4f9e8f; }
.mind-line { fill: none; stroke: var(--c, var(--accent)); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.mind-dash { stroke-dasharray: 4 3; }
.mband { fill: var(--accent); opacity: 0.07; stroke: none; }       /* Bollinger fill */
.mcloud { fill: var(--accent); opacity: 0.1; stroke: none; }        /* Ichimoku cloud */
.msar { fill: var(--accent); }                                      /* Parabolic SAR dots */
.mcmp-path { fill: none; stroke: var(--c, var(--accent)); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.mcmp-path.mcmp-main { stroke-width: 2.2; }

/* Oscillator sub-panels (Volume, RSI, MACD, …), stacked under the price plot. */
.mchart__panels { margin-top: 4px; }
.mchart__panel { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.mchart__panel-label { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-soft); margin-bottom: 2px; }
.mchart__panel-label b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mchart__panel-x { font-size: 14px; margin-left: auto; padding: 0 3px; }
.mchart__panel-x:hover { color: var(--neg); }
.mchart__panel-plot { position: relative; height: 92px; cursor: crosshair; }
.mpanel-svg { width: 100%; height: 100%; display: block; }
.mpanel-guide { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.35; }
.mpanel-bar.mchart-up { fill: var(--accent); opacity: 0.75; }
.mpanel-bar.mchart-down { fill: var(--neg); opacity: 0.7; }
/* Shared vertical hairline (oscillator panels + compare hover). */
.mchart__hair { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-soft); opacity: 0.4; pointer-events: none; }

/* Dividend / split event pins along the plot bottom. */
.mevent {
  position: absolute; bottom: 4px; transform: translateX(-50%);
  width: 16px; height: 16px; border-radius: 50%; font-size: 9px; font-weight: 700; line-height: 16px; text-align: center;
  color: #fff; cursor: help; pointer-events: auto; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.mevent--div { background: var(--accent); }
.mevent--split { background: #c08552; }

/* Your drawings (trendlines, rays, rectangles, horizontal lines) — the one warm note. */
.mdraw-line { stroke: var(--neg); stroke-width: 1.6; }
.mdraw-rect { fill: var(--neg); fill-opacity: 0.08; stroke: var(--neg); stroke-width: 1.4; }
.mdraw-live { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mdraw-del {
  position: absolute; transform: translate(-50%, -50%);
  width: 18px; height: 18px; border-radius: 50%; background: var(--white); border: 1px solid var(--neg) !important;
  color: var(--neg); font-size: 13px; line-height: 1; z-index: 3;
}
.mdraw-del:hover { background: var(--neg); color: #fff; }
.mchart__plot.is-drawing { cursor: crosshair; }
.mchart__loading { padding: 40px 0; text-align: center; }

/* Fullscreen: the chart takes over the viewport; the rest of the page is locked. */
body.mstudio-lock { overflow: hidden; }
.mstudio--full {
  position: fixed; inset: 0; z-index: 1000; margin: 0;
  background: var(--paper); background-image: var(--paper-grad);
  padding: 20px clamp(16px, 5vw, 60px); overflow: auto; display: flex; flex-direction: column;
}
.mstudio--full .mchart__body, .mstudio--full .mchart__plot { flex: 1 1 auto; }
.mstudio--full .mchart__plot { height: min(62vh, 640px); }
.mstudio__close {
  position: fixed; top: 18px; right: 22px; z-index: 1001;
  font: inherit; font-size: 13px; color: var(--ink-soft);
  background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer;
}
.mstudio__close:hover { color: var(--ink); border-color: var(--accent); }

/* Price-Ratio decomposition: three x-aligned panels (price · per-share · ratio),
   macrotrends-style, in the app's calm skin. Dots on each period are logo yellow. */
.macro-pr { position: relative; margin: 18px 0 4px; }
.macro-pr__charts {
  display: grid;
  grid-template-columns: 16px 40px 1fr;   /* rotated label · numeric legend · plot */
  column-gap: 8px;
  row-gap: 18px;
  align-items: stretch;
}
.macro-pr__ylabel {
  grid-column: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  align-self: center;
  justify-self: center;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  white-space: nowrap;
}
/* Left numeric legend: labels absolutely placed at each gridline's height. */
.macro-pr__numcol { grid-column: 2; position: relative; }
.macro-pr__num {
  position: absolute; right: 4px;
  transform: translateY(-50%);
  font-size: 0.6rem; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.macro-pr__plot {
  grid-column: 3;
  position: relative;
  height: 150px;
  cursor: crosshair;
}
.macro-pr__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Bars must sit ABOVE the dashed gridlines (the grid spans are absolutely positioned,
   so give the bar svg its own stacking layer, else the dashes paint over each bar). */
.macro-pr__plot--bars .macro-bar-svg { position: absolute; inset: 0; z-index: 1; }
.macro-pr__line { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* Dashed gridlines — the quiet scaffold behind the data (Jobs-calm, Gaudí-precise). */
.macro-pr__grid {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 1px dashed var(--line);
  transform: translateY(-0.5px);
  pointer-events: none;
}
.macro-pr__vgrid {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 1px dashed var(--line);
  opacity: 0.7;
  pointer-events: none;
}
/* Period dots: a soft yellow bead ringed by the paper + a hair of sage, so they read
   clearly against the line without shouting. */
.macro-pr__dot {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fcdd09;                        /* senyera yellow, from the logo */
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.macro-pr__cross {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--ink-soft); opacity: 0.4;
  transform: translateX(-50%);
  pointer-events: none;
}
.macro-pr__axis { grid-column: 3; position: relative; height: 15px; margin-top: 4px; }
.macro-pr__axcell {
  position: absolute; transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.62rem; color: var(--ink-soft);
}
/* Per-panel value box that floats beside the hovered point (flips side near the edge). */
.macro-pr__vbox {
  position: absolute; z-index: 6;
  transform: translate(10px, -50%);
  background: var(--white);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.74rem; color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
  pointer-events: none;
}
.macro-pr__vbox--left { transform: translate(calc(-100% - 10px), -50%); }
/* Dark date chip on the axis, under the crosshair. */
.macro-pr__datebox {
  position: absolute; top: 0;
  transform: translateX(-50%);
  z-index: 6;
  background: var(--ink); color: var(--paper);
  font-size: 0.64rem; padding: 2px 8px;
  border-radius: 5px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Data tables (per-metric and full statement). */
.macro-tbl-wrap { margin-top: 16px; }
.macro-tbl-wrap--wide { overflow-x: auto; }
.macro-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.macro-tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.macro-tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}
/* Number lanes: header AND cells right-aligned (the th needs the extra specificity to
   beat `.macro-tbl th`'s left default), plus an equal width per period column so the
   figures line up in tidy vertical lanes — tabular-nums keeps the digits themselves aligned. */
.macro-tbl__num,
.macro-tbl th.macro-tbl__num { text-align: right; }
.macro-tbl--stmt th.macro-tbl__num,
.macro-tbl--stmt td.macro-tbl__num { width: 116px; }
.macro-tbl__item { color: var(--ink-soft); position: sticky; left: 0; background: var(--paper); }
.macro-tbl--stmt th:first-child, .macro-tbl--stmt td:first-child { position: sticky; left: 0; background: var(--paper); }
.macro-tbl tbody tr:hover td { background: var(--paper); }

/* Calm hints / empty & not-configured states. */
.macro-hint { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 32px 16px; line-height: 1.6; }
.macro-hint--small { font-size: 12px; padding: 10px 0 0; text-align: left; }
.macro-hint code { font-size: 12px; background: var(--paper); padding: 1px 6px; border-radius: 5px; }

@media (max-width: 620px) {
  .macro-cat, .macro-sub { font-size: 12.5px; padding: 6px 11px; }
  .macro-company__name { font-size: 22px; }
  .macro-headline__val { font-size: 24px; }
}

/* ══════════════ News page ══════════════
   A calm, image-rich grid of market headlines. Cards are quiet surfaces that lift
   a touch on hover; imageless items fall back to a soft platinum gradient. */
.news-scope {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 2px;
}
.news-scope__btn {
  font: inherit;
  font-size: 14px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.news-scope__btn:hover { color: var(--ink); border-color: var(--accent); }
.news-scope__btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.news-status {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin: 12px 0 24px;
  min-height: 1em;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.news-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -14px rgba(24, 34, 32, 0.35);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.news-card__img {
  height: 150px;
  background-size: cover;
  background-position: center;
  background-color: var(--paper);
}
.news-card__img--none { background: linear-gradient(135deg, var(--paper), var(--line)); }
.news-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.news-card__meta { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.01em; }
.news-card__title { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--ink); }
@media (max-width: 560px) { .news-grid { grid-template-columns: 1fr; } }
