/* ==========================================================================
   Navasan — design system
   Mobile-first. Persian RTL is the primary and only reading direction.
   Light and dark are both designed; the dark palette is not an inversion.
   ========================================================================== */

/* --- Persian webfont, self-hosted (no CDN at runtime: the app runs offline) --- */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/vazirmatn-400.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/vazirmatn-500.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/vazirmatn-700.woff2") format("woff2");
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/vazirmatn-800.woff2") format("woff2");
}

/* --- Tokens: light ------------------------------------------------------- */
:root {
  color-scheme: light dark;

  --bg: #f4f4f1;
  --bg-elev: #ffffff;
  --bg-subtle: #eeeeea;
  --fg: #15161a;
  --fg-soft: #3c3d44;
  --muted: #6a6b74;
  --line: #e4e4de;
  --line-strong: #d3d3cc;

  --accent: #0b7a54;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 122, 84, 0.10);

  --good: #0f7a4e;
  --good-soft: rgba(15, 122, 78, 0.12);
  --warn: #96650a;
  --warn-soft: rgba(150, 101, 10, 0.14);
  --danger: #b3261e;
  --danger-soft: rgba(179, 38, 30, 0.12);

  --shadow-sm: 0 1px 2px rgba(18, 19, 23, 0.04), 0 1px 3px rgba(18, 19, 23, 0.05);
  --shadow-md: 0 6px 22px -12px rgba(18, 19, 23, 0.30);
  --shadow-accent: 0 10px 24px -12px rgba(11, 122, 84, 0.55);

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Type scale — real contrast between the key number, headings and body. */
  --text-xs: 0.78rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.7rem;
  /* The symbol page's own name, the subject of the page. A step above every
     label and a step under the verdict, which stays the loudest word. */
  --text-symbol: clamp(1.7rem, 7.5vw, 2.35rem);
  --text-metric: clamp(1.7rem, 6.5vw, 2.5rem);
  --text-hero: clamp(2.2rem, 9vw, 3.5rem);
  /* The plan tiles. Sized to hold `۳٬۳۵۰ ریال` on one line in a half-width tile
     at 360px, and to stay under the hero's own step at desktop width. */
  --text-tile: clamp(1.2rem, 5vw, 1.75rem);

  --lh: 1.85;      /* Persian needs vertical room */
  --lh-tight: 1.3;

  --font: "Vazirmatn", system-ui, "Segoe UI", Tahoma, "Noto Naskh Arabic", sans-serif;

  --tap: 44px;     /* minimum touch target */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --speed: 180ms;
  --page: 68rem;
}

/* --- Tokens: dark -------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --bg-elev: #191a20;
    --bg-subtle: #212329;
    --fg: #edeef2;
    --fg-soft: #c9ccd3;
    --muted: #9a9ca6;
    --line: #2a2c33;
    --line-strong: #3b3e47;

    --accent: #31d29c;
    --accent-ink: #052a1e;
    --accent-soft: rgba(49, 210, 156, 0.14);

    --good: #3ad79f;
    --good-soft: rgba(58, 215, 159, 0.15);
    --warn: #f2c14e;
    --warn-soft: rgba(242, 193, 78, 0.15);
    --danger: #f87b74;
    --danger-soft: rgba(248, 123, 116, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 30px -14px rgba(0, 0, 0, 0.8);
    --shadow-accent: 0 12px 28px -14px rgba(49, 210, 156, 0.45);
  }
}

/* --- Reset / base -------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  direction: rtl;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--lh);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: var(--lh-tight); margin: 0 0 0.6rem; font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }
p { margin: 0 0 0.6rem; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: none; transition: color var(--speed) var(--ease); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
ul { margin: 0; padding-inline-start: 1.1rem; }
li { margin-bottom: 0.35rem; }
/* Columns of numbers must line up. */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.muted { color: var(--muted); font-size: var(--text-sm); }
/* A caveat that qualifies a decision (G4's no-fill warning on a locked session):
   muted body weight, but marked so it reads as a qualifier and not as another
   line of the plan it sits under. */
.caveat {
  border-inline-start: 3px solid var(--warn);
  background: var(--warn-soft);
  border-radius: var(--r-xs);
  color: var(--fg-soft);
  font-size: var(--text-sm);
  line-height: 1.7;
  margin: 0;
  padding: 0.5rem 0.75rem;
}
/* --- Un-tradeable symbol (C13 item 5) ------------------------------------ */
/* `no_liquidity` is not a market judgment like the other seven vetoes — it says
   the reader cannot get their money out at all. It gets the hero, a bordered
   block and the one saturated colour on the page, so it can never be read as
   just another unattractive name. */
.illiquid {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--r-sm);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
}
.illiquid-head {
  color: var(--danger);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: var(--lh-tight);
  margin: 0 0 0.3rem;
}
.illiquid-detail {
  color: var(--fg-soft);
  font-size: var(--text-sm);
  line-height: 1.75;
  margin: 0 0 0.35rem;
}

/* The actionable price behind the middle action (`صبر کن`), distinct from the
   muted plan note above it because it is the one thing the reader can act on. */
.wait-note {
  border-inline-start: 3px solid var(--warn);
  background: var(--warn-soft);
  border-radius: var(--r-xs);
  color: var(--fg-soft);
  font-size: var(--text-sm);
  line-height: 1.75;
  margin: 0.7rem 0 0;
  padding: 0.5rem 0.75rem;
}
.wait-note .num { font-weight: 700; color: var(--fg); }
/* The vetoes inside the decision block. The card that used to hold them sat
   below the chart repeating the same strings; here they sit under the verdict
   they explain, so the block needs its own separation from the tiles below. */
.hero .veto-list { margin: 0 0 1rem; }
/* `کم کن`'s fraction, beside the word it qualifies. */
.size-hint {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}
/* The eyebrow and the badges share one flex row; wrapping keeps 360px honest
   when the regime badge joins the risk badge. */
.head-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }

.error { color: var(--danger); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--fg);
  letter-spacing: -0.02em;
  padding: 0.35rem 0.2rem;
}
.brand:hover { text-decoration: none; }
.brand svg { display: block; color: var(--accent); }
.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.7rem;
  border-radius: var(--r-xs);
  color: var(--fg-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.topbar nav a:hover { background: var(--bg-subtle); color: var(--fg); text-decoration: none; }
.topbar nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.logout { margin-inline-start: auto; }
.logout button {
  min-height: var(--tap);
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-xs);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.logout button:hover { color: var(--danger); border-color: var(--danger); }

/* --- Layout -------------------------------------------------------------- */
.container {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1rem 0.9rem 3.5rem;
  /* Machine tokens (evidence, URLs in data notes) are long and unbreakable by
     default; `anywhere` lets them wrap instead of forcing the page wide. */
  overflow-wrap: anywhere;
}
.stack { display: grid; gap: 1rem; }
.stack > * { min-width: 0; }
.page-head { margin: 0.4rem 0 0.2rem; }
.page-head h1 { font-size: var(--text-2xl); }
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: none;
}

/* --- Card ---------------------------------------------------------------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.05rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.card-head h2 { margin: 0; }
.section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 0.55rem;
}
/* The positives sit under the penalties inside one card, so their heading needs
   its own separation from the list above it. */
.positive-title { margin-top: 1.1rem; }

/* --- Buttons ------------------------------------------------------------- */
.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--tap);
  padding: 0 1.1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--speed) var(--ease), background var(--speed) var(--ease),
              border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              color var(--speed) var(--ease);
}
.btn:hover { border-color: var(--line-strong); background: var(--bg-subtle); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-wide { width: 100%; }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: transparent; }

/* --- Forms --------------------------------------------------------------- */
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field > label, .field > span {
  font-size: var(--text-sm);
  color: var(--fg-soft);
  font-weight: 500;
}
input, select, textarea {
  font: inherit;
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  min-height: var(--tap);
  width: 100%;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
input::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
.form-row { display: grid; gap: 0.7rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.inline-form > * { flex: 1 1 11rem; min-width: 0; }
.inline-form > .btn { flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* --- Badges -------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--fg-soft);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}
.badge.low, .badge.good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.badge.medium, .badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.high, .badge.critical, .badge.bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

/* tone text helpers */
.tone-good { color: var(--good); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--danger); }
.tone-flat { color: var(--muted); }

/* --- Decision hero (the one loud element) -------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  padding: clamp(1.2rem, 5vw, 2rem);
  background: var(--bg-elev);
  box-shadow: var(--shadow-md);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 100% 0%, var(--tone-soft, transparent), transparent 62%);
}
.hero > * { position: relative; z-index: 1; }
.hero-good { --tone-soft: var(--good-soft); }
.hero-warn { --tone-soft: var(--warn-soft); }
.hero-bad  { --tone-soft: var(--danger-soft); }

/* Who and when, above the verdict: the symbol and its sector, then the session
   and the score on its own line, with the risk and regime badges opposite. */
.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.8rem;
}
.hero-id { min-width: 0; }
/* The symbol's own name — the page's subject, and until now the smallest line
   on it. Weight and size carry it; the verdict below keeps `--text-hero`, so
   the order of reading is still name, verdict, plan. */
.hero-symbol {
  font-size: var(--text-symbol);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0 0 0.1rem;
  overflow-wrap: anywhere;
}
.meta-line {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 0;
  font-variant-numeric: tabular-nums;
}
/* The session is still trading (D3): the numbers on this page are partly a
   running value and may move by the close. Its own class, and *not* the boxed
   `.quiet-caveat` — this qualifies the session date it sits under rather than
   standing as a caveat of its own, and one box per hero is enough. A step above
   the muted meta line, because the reader has to notice it. */
.session-open-note {
  color: var(--fg-soft);
  font-weight: 600;
  margin-top: 0.3rem;
}
/* The day's own band, under the plan: the ceiling the risk reasons refer to. */
.band-line { margin-top: 0.55rem; }
/* The price the whole page is read against — a step above the meta line and a
   step below the plan tiles, so the order of reading is decision, plan, price. */
.price-line {
  color: var(--fg-soft);
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 0.8rem;
}
.price-line .num { font-weight: 700; color: var(--fg); }
.hero .price-line { margin-top: 0; }

.decision {
  font-size: var(--text-hero);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0.15rem 0 0.2rem;
  animation: rise 220ms var(--ease) both;
}
.decision.good { color: var(--good); }
.decision.warn { color: var(--warn); }
.decision.bad  { color: var(--danger); }
.hero-sub { color: var(--muted); font-size: var(--text-sm); margin-bottom: 1rem; }

/* The plan: the four numbers the reader acts on, and the page's second-loudest
   element. Two-up on a phone so all four stay above the fold, four-up from
   40rem — one column of four tiles would push the plan off the first screen. */
.plan-metrics { margin-bottom: 0.4rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-metrics .metric-value { font-size: var(--text-tile); }
.entry-note { margin-top: 0.6rem; }
.plan-note { margin-top: 0.7rem; }
.buy-form { margin-top: 1rem; }

/* The standing qualifiers the buy-quality audit added (2026-09-25): what the
   verdict is and is not, and the money comparison the risk score never weighed.
   A note, not an alert — the plain line and the muted register put them a rank
   below whatever they qualify, so the verdict stays the hero's one loud
   element. Deliberately NOT `.caveat`: that one is the per-symbol
   locked-session warning and wears the warn tone, and the verdict caveat is
   true of every symbol — a warn block on every page would spend the tone the
   real warning needs. */
.quiet-caveat {
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  border-radius: var(--r-xs);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.8;
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.8rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* --- Key numbers --------------------------------------------------------- */
.metrics { display: grid; gap: 0.6rem; grid-template-columns: 1fr; }
.metric {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem;
  min-width: 0;
}
.metric-label { font-size: var(--text-xs); color: var(--muted); margin-bottom: 0.1rem; }
.metric-value {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.metric-value.good { color: var(--good); }
.metric-value.bad { color: var(--danger); }

/* --- Data table (stacked cards on narrow screens) ------------------------ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: start;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--speed) var(--ease); }
.data-table tbody tr:hover { background: var(--bg-subtle); }
.data-table td.num { font-variant-numeric: tabular-nums; }
.data-table .empty { color: var(--muted); }

@media (max-width: 40rem) {
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg-subtle);
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.65rem;
  }
  .data-table tbody tr:hover { background: var(--bg-subtle); }
  .data-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: 0.32rem 0;
    text-align: end;
  }
  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 500;
    text-align: start;
  }
  .data-table td[data-label=""]::before { content: none; }
  /* Inline row links (symbol, analyze) fall below the 44px touch minimum once
     the table stacks; give them a full tap target on narrow screens. The *width*
     matters as much as the height for a link whose own text is two characters. */
  .data-table td a { display: inline-flex; align-items: center; min-height: var(--tap);
                     min-width: var(--tap); }
}

/* --- Checklist (question / answer, plain language) ------------------------ */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.check-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.check-item:last-child { border-bottom: 0; }
.check-q { font-size: var(--text-sm); color: var(--muted); }
.check-q::before {
  content: "";
  display: inline-block;
  width: 0.9rem; height: 0.9rem;
  margin-inline-end: 0.4rem;
  border-radius: 50%;
  vertical-align: -0.1rem;
  background: var(--tone, var(--muted));
}
.check-item.yes { --tone: var(--good); }
.check-item.no  { --tone: var(--danger); }
/* The third state: the item makes no claim, so it wears neither tone. The dot
   is a **hollow** ring rather than a filled one, and the answer is set back to
   the muted colour at a lighter weight — so the state is readable without
   colour, which a state sitting beside two coloured ones has to be. `--tone`
   is cleared rather than overridden so the ring's own colour is the only mark
   this row carries. */
.check-item.unknown { --tone: transparent; }
.check-item.unknown .check-q::before { box-shadow: inset 0 0 0 1.5px var(--muted); }
.check-item.unknown .check-a { color: var(--muted); font-weight: 500; }
.check-a { font-weight: 600; font-size: var(--text-base); }

/* --- Reason list --------------------------------------------------------- */
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.reasons li {
  display: grid;
  gap: 0.15rem;
  padding-inline-start: 0.85rem;
  border-inline-start: 3px solid var(--tone, var(--line-strong));
  margin: 0;
}
.reasons li.penalty { --tone: var(--danger); }
.reasons li.positive { --tone: var(--good); }
/* `buy.reasons` and `position.reasons` carry the tones above since T9: the buy
   verdict is a *combination*, so one list holds the criteria that carried it and
   the ones that opposed it, and a support rendered without its tone reads as
   another reason against. The line's class comes from `web.reader.reason_tone`;
   a contribution that scored nothing gets none. The position card's lines are
   all advisories and score nothing, so they stay untinted — unchanged. */
.decision-reasons { margin-top: 0.9rem; }
.reason-text { font-size: var(--text-sm); }
/* The two share a register — small, muted, tabular — and differ in exactly one
   thing: direction. */
.evidence,
.datum {
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: start;
  font-variant-numeric: tabular-nums;
}
/* A *datum* is a machine string — the database path — and is LTR on its own
   account: it is not Persian prose, and a path inside an RTL paragraph reverses.

   **`.evidence` is NOT that, and forcing it LTR was a defect** (found 2026-10-02
   from the owner's report on `/backtest`). What the class holds is the engine's own
   Persian sentence — `[بازده ۲۰ روزه: ۳۵٫۶٪ (آستانه ۰٫۰٪)]` — and a Persian sentence
   in an LTR embedding lays its segments out left-to-right, so the reader saw
   `[بازده ۰٫۰٪)] (آستانه ۳۵٫۶٪ روزه: ۲۰`. Measured on the symbol page (24 spans) and
   on `/backtest` (3), by reading each word's own client rect. */
.datum {
  direction: ltr;
  unicode-bidi: embed;
}

/* --- Timeline (trade events) --------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

/* --- Empty state --------------------------------------------------------- */
.empty {
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 0.9rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  margin: 0;
}

/* --- Search hero (symbol index) ------------------------------------------ */
.search-hero {
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--bg-elev);
}
.search-form { display: grid; gap: 0.7rem; }
.search-form input { font-size: var(--text-lg); min-height: 3.1rem; }
@media (min-width: 40rem) {
  .search-form { grid-template-columns: 1fr auto; align-items: center; }
  .search-form .btn { padding-inline: 1.6rem; }
}
/* The index table's own filter, in the card head: a step under the hero's search,
   because it narrows a list rather than starting a job. It wraps under the
   heading on a phone instead of squeezing the input. */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}
.filter-form input {
  font-size: var(--text-sm);
  min-height: 2.5rem;
  padding: 0.3rem 0.7rem;
  width: clamp(8rem, 32vw, 13rem);
}
.filter-form .btn { min-height: 2.5rem; padding: 0 0.85rem; font-size: var(--text-sm); }
/* On a phone the filter takes the row under the heading: a heading wrapped to two
   lines beside a squeezed input reads as neither. Scoped to this card's head, so
   no other card's layout moves. */
@media (max-width: 40rem) {
  .filter-head { flex-wrap: wrap; }
  .filter-head .filter-form { flex: 1 1 100%; justify-content: flex-start; }
  .filter-head .filter-form input { flex: 1 1 auto; width: auto; }
}

/* --- Chart --------------------------------------------------------------- */
.chart-card { padding: 0.9rem 0.9rem 0.5rem; }
.chart-frame { position: relative; height: clamp(200px, 42vw, 300px); }
.chart-frame canvas { width: 100% !important; height: 100% !important; }
/* The near levels, as text under the chart: the lines on the canvas are not a
   list a reader can check a price against, and these are the legacy's own form. */
.level-list {
  list-style: none;
  margin: 0.5rem 0 0.35rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: var(--text-sm);
  color: var(--fg-soft);
}
.level-list li {
  margin: 0;
  padding-inline-start: 0.75rem;
  border-inline-start: 3px solid var(--line-strong);
}

/* --- The holder's card ---------------------------------------------------- */
/* The action word is the card's own focal point, one step below the hero's. */
.position-head {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: 0.6rem;
}
/* The instruction that names the act and the price it happens at. */
.instruction {
  background: var(--bg-subtle);
  border-radius: var(--r-xs);
  font-size: var(--text-sm);
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.7rem;
}
.instruction .num { font-weight: 700; }
/* The stop is built from a session that has closed, so it applies from the next
   one — the qualifier the legacy printed beside it. */
.next-session { margin-top: 0.6rem; }

/* --- Data notes ----------------------------------------------------------- */
.note-list { margin: 0; }

/* --- Failure page --------------------------------------------------------- */
/* Every failure a reader can reach is this page: a Persian sentence and the way
   back, never a developer string as a whole document. */
.message-card { max-width: 34rem; }
.message-card h1 { font-size: var(--text-2xl); margin-bottom: 0.5rem; }
.message-card .actions { margin-top: 1rem; }

/* --- Login --------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(90% 70% at 100% 0%, var(--accent-soft), transparent 60%),
    radial-gradient(80% 60% at 0% 100%, var(--accent-soft), transparent 55%),
    var(--bg);
}
.login-card {
  width: min(23rem, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.6rem 1.4rem 1.5rem;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 1rem;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
}
.login-brand svg { color: var(--accent); }
.login-card h1 { font-size: var(--text-2xl); margin: 0; }
.login-sub { color: var(--muted); font-size: var(--text-sm); margin: -0.4rem 0 0; }

/* --- Backtest page -------------------------------------------------------- */
.warn-note {
  background: var(--warn-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg-soft);
  font-size: var(--text-sm);
  padding: 0.6rem 0.8rem;
}
.flash-note {
  background: var(--warn-soft);
  border-radius: var(--r-sm);
  color: var(--warn);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.6rem 0.9rem;
}
.running-note {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
/* `.running-log` carried `direction: ltr` and no longer does (2026-10-02, the
   owner's report): the run's own heartbeat is a Persian sentence —
   `84 از 890 نماد — 794 سیگنال ثبت شد` — and the LTR embedding put its segments in
   reverse, so the count landed at the far end and the line read backwards. The
   class is kept as the hook for the run line; `.num` beside it already gives the
   tabular figures the counts want. */
.anchor-form { border-top: 1px dashed var(--line-strong); margin-top: 0.9rem; padding-top: 0.9rem; }
.anchor-name { margin-top: 1.1rem; }
.errors-list { list-style: none; padding: 0; }
.errors-list li { margin: 0.2rem 0; }

/* --- Responsive widening ------------------------------------------------- */
@media (min-width: 40rem) {
  .container { padding: 1.4rem 1.25rem 4rem; }
  .card { padding: 1.25rem 1.35rem; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics.cols-4 { grid-template-columns: repeat(4, 1fr); }
  /* One signal per card, and a steady record is dozens of them: at a wide width
     a single column leaves half the page empty beside a five-line row. Two
     columns are the smallest number that uses the width without making a card
     narrower than the plan line it has to hold. */
  .paper-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topbar { padding: 0.55rem 1.4rem; }
  .topbar nav a { padding: 0 0.85rem; font-size: var(--text-base); }
}
@media (min-width: 64rem) {
  .container { padding-inline: 1.5rem; }
  .metrics.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* --- Settings page -------------------------------------------------------- */
.hero-focus {
  background:
    radial-gradient(120% 130% at 100% 0%, var(--accent-soft), transparent 58%),
    var(--bg-elev);
}
/* The regime rows are the page's focal point: the bull_strong bar is the one
   the owner calibrates, so it is the one cell that carries the accent. */
.focus-grid { display: grid; gap: 0.6rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) {
  .focus-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .focus-grid > .is-primary { grid-column: 1 / -1; }
}
/* The critical card's four remaining regimes fill one row exactly at desktop
   width, so the grid never leaves a dangling empty cell beside them. */
@media (min-width: 64rem) {
  .focus-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.focus-cell {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}
.focus-cell.is-primary {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.setting { display: grid; gap: 0.1rem; min-width: 0; }
.setting-row { display: grid; gap: 0.35rem; min-width: 0; margin: 0; }
.setting-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-soft);
}
.setting-control { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.setting-control input { min-width: 0; font-size: var(--text-base); }
.setting-control .unit {
  font-size: var(--text-sm);
  color: var(--muted);
  flex: 0 0 auto;
}
.setting-control .btn { flex: 0 0 auto; }
/* The primary cell spans the whole row, so an unconstrained field would stretch
   a two-digit number across a metre. Scoped to it alone: the four regime cells
   sit in one track each and their controls must stay on one line. */
.focus-cell.is-primary .setting-control input { max-width: 18rem; }
.setting-reset { margin: 0; }
/* `button.btn` outranks a bare `.btn-quiet`, so the quiet form has to name both
   classes or the reset renders as a second, equally loud button. */
.btn.btn-quiet {
  min-height: var(--tap);
  padding: 0 0.5rem;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
  font-weight: 500;
  font-size: var(--text-xs);
}
.btn.btn-quiet:hover {
  color: var(--fg);
  background: var(--bg-subtle);
  border-color: transparent;
}

/* The deep end: closed by default, so the ~100 remaining numbers are not
   reachable by a scroll — only by a deliberate open. */
.fold {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: var(--tap);
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  list-style: none;
  border-radius: var(--r);
  transition: background var(--speed) var(--ease);
}
.fold-summary::-webkit-details-marker { display: none; }
.fold-summary:hover { background: var(--bg-subtle); }
.fold-title { font-weight: 700; font-size: var(--text-lg); }
.fold[open] .fold-summary { border-bottom: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; }
.fold > .muted { padding: 0.8rem 1.1rem 0; margin: 0; }
.fold-group { padding: 0.4rem 1.1rem 1rem; }
.fold-group + .fold-group { border-top: 1px solid var(--line); }
.fold-row { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.fold-row:last-child { border-bottom: 0; }
.fold-row .setting-control input { min-width: 0; }
/* On a phone a folded row stacks exactly like a card row — label, then field.
   Only from 40rem is there room for the one-line label/field/reset table the
   deep end is meant to be; forcing that split earlier collapses the label to a
   single character. */
@media (min-width: 40rem) {
  .fold-row .setting { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
  .fold-row .setting-row {
    grid-template-columns: minmax(13rem, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
  }
  .fold-row .setting-control input { max-width: 11rem; }
}

/* --- The AI card (the second opinion) ------------------------------------ */
/* Deliberately the quietest card on the page. The engine's verdict is the
   focal point, and a second opinion carrying the same visual weight would leave
   the reader with two loud answers and no way to tell which one the app stands
   behind. Its accent is the neutral line, not the action colour. */
.ai-card { border-style: dashed; }
.ai-note { margin: 0 0 0.85rem; }
.ai-answers { display: grid; gap: 0.6rem; }
.ai-answer {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem;
}
.ai-question { margin: 0; font-size: var(--text-xs); color: var(--muted); }
/* The one emphasized word in the card: the answer, at heading size, so the
   reader can compare it with the engine's verdict at a glance. */
.ai-lean {
  margin: 0.1rem 0 0.25rem;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.3;
}
.ai-summary { margin: 0; color: var(--fg-soft); line-height: 1.75; }
.ai-points {
  margin: 0.8rem 0 0;
  padding-inline-start: 1.1rem;
  color: var(--fg-soft);
  display: grid;
  gap: 0.3rem;
}
.ai-stamp { margin: 0.7rem 0 0; }
.ai-card .actions { margin-top: 0.85rem; }
.ai-cost { margin: 0.5rem 0 0; }
/* **The card folds, and it starts folded** — the engine's verdict is the page's
   answer, so the second opinion waits to be asked for instead of pushing the chart
   and the reasons below the fold on a phone. Native `<details>`, so the keyboard and
   the screen reader keep working and no script is needed. `.ai-fold` and not
   `.ai-summary`, which is the answer's own summary line above. */
.ai-card > .ai-fold {
  cursor: pointer;
  margin-bottom: 0;
  list-style: none;               /* Firefox's marker */
  gap: 0.5rem;
}
.ai-card > .ai-fold::-webkit-details-marker { display: none; }
.ai-card[open] > .ai-fold { margin-bottom: 0.75rem; }
.ai-fold-state { display: inline-flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; }
/* The affordance, drawn rather than fetched: a chevron pointing down while folded
   and up once open. The global reduced-motion rule already flattens the turn. */
.ai-chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-0.08rem, -0.08rem);
  transition: transform var(--speed) var(--ease);
}
.ai-card[open] .ai-chevron { transform: rotate(-135deg) translate(-0.08rem, -0.08rem); }

/* The hero's own action, under the badges it sits beside: the reader presses it
   from the first screen instead of scrolling past the analysis it replaces. */
.refresh-form { margin-top: 0.15rem; }

/* --- History -------------------------------------------------------------- */
.change { display: grid; gap: 0.1rem; min-width: 0; }
.change-what { font-weight: 600; font-size: var(--text-sm); }
.change-when { display: grid; gap: 0.3rem; justify-items: end; }
.timeline .change-when form { margin: 0; }

/* --- The home page (the day in one screen) ------------------------------- */
/* The day's list is the page's one loud element: the hero carries the count at
   hero scale, and every block below it is a card at a step down. The accent tint
   is `--accent-soft` rather than a semantic tone — the list's *size* is a fact,
   not a verdict, and a good/warn/bad hero would be the page judging the market. */
.hero-home { --tone-soft: var(--accent-soft); }
/* The market's badges, on their own line under the date. `.head-badges`' own
   end-alignment is for the symbol page, where the badges sit opposite the
   symbol; here they belong with the day they qualify. */
.market-line { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.5rem; }
.home-count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.1rem 0 0.25rem;
}
.home-count-n {
  font-size: var(--text-hero);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.home-count-unit { font-size: var(--text-lg); color: var(--fg-soft); font-weight: 700; }
/* The three states where there is no number to show — a failed scan, no scan, an
   empty list. Same size as a count's line so the hero does not jump between
   days, and worded rather than a zero: a `۰` would read as "measured, and none". */
.home-state { font-size: var(--text-2xl); margin: 0.1rem 0 0.3rem; }

/* --- The day's list: one tappable row per name --------------------------- */
/* Not a table. A name and two words are the whole row, and on a phone a stacked
   table spends three lines on it; the whole row is the link, so the tap target is
   the full width rather than two characters of ticker. */
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.pick-list li { margin: 0; }
.pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: var(--tap);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: inherit;
  text-decoration: none;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.pick:hover { background: var(--bg-elev); border-color: var(--line-strong); text-decoration: none; }
.pick-symbol { font-weight: 700; font-size: var(--text-lg); min-width: 0; overflow-wrap: anywhere; }
.pick-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.3rem; }

/* --- Open positions ------------------------------------------------------ */
.book-list { list-style: none; margin: 0; padding: 0; }
.book { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.book:first-child { padding-top: 0.2rem; }
.book:last-child { border-bottom: 0; padding-bottom: 0; }
.book-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.book-symbol { font-size: var(--text-lg); }
/* The money, one step below the hero — and sized so `+۶۵۴٬۲۷۸ ریال` stays on one
   line in a phone's card. */
.book-pnl { font-size: var(--text-tile); font-weight: 800; line-height: 1.25; margin: 0.15rem 0 0.2rem; }
.book-pct { font-size: var(--text-sm); font-weight: 600; }

/* --- Latest alerts ------------------------------------------------------- */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.alert:first-child { padding-top: 0.2rem; }
.alert:last-child { border-bottom: 0; padding-bottom: 0; }
/* Both in-row links take the full tap minimum on their own, the way the stacked
   tables' links do — a two-character ticker is a target a thumb misses. */
.alert-symbol, .book-symbol { font-weight: 700; display: inline-flex; align-items: center; min-height: var(--tap); }
/* The stamp is the row's right edge and wraps to its own line before the badge
   does, so a long kind word never pushes a date off the card. */
.alert-when { margin-inline-start: auto; color: var(--muted); font-size: var(--text-xs); }
.alert-delivery { flex-basis: 100%; color: var(--warn); font-size: var(--text-sm); }

/* --- The scheduler's line (the page's last, quietest row) ---------------- */
/* --- The paper view: one block per signal, outcome or its absence -------- */
/* Cards rather than a table, and the reason is the same as the day's list's: a
   signal carries a symbol, a session, up to three levels and an outcome, which on
   a 360px screen is five stacked lines — a table would scroll sideways, and the
   UI rules forbid that. The pending rows are visibly a different state, not a
   missing value: a dashed edge and a muted figure. */
.paper-pending-line { margin: 0 0 0.5rem; font-size: var(--text-sm); color: var(--fg-soft); }
.paper-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.paper-list li { margin: 0; }
.paper {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
}
.paper.is-pending { border-style: dashed; background: transparent; }
/* A signal that never became a trade is a settled state, not a waiting one: it
   keeps the solid edge the scored rows have, and is told apart by its badge and by
   the muted figure beside it. The dashed edge is reserved for "not yet". */
.paper.is-no-trade { background: transparent; }
.paper.is-no-trade .paper-symbol { color: var(--fg-soft); }
.paper-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
/* The row's own link, and a key rather than prose — the ticker keeps TSETMC's
   spelling. `min-height: var(--tap)` for the same reason the home page's links
   carry it: a link the reader taps has to be tappable. */
.paper-symbol {
  font-weight: 700;
  font-size: var(--text-lg);
  min-width: 0;
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}
.paper-outcome {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.15rem 0 0;
}
.paper-outcome .paper-return { font-size: var(--text-tile); font-weight: 800; }
.paper-outcome .paper-exit { font-size: var(--text-sm); color: var(--muted); }
.paper-outcome.is-pending .paper-wait,
.paper-outcome.is-no-trade .paper-wait { font-size: var(--text-sm); color: var(--muted); }
.paper-outcome .badge { white-space: normal; }

/* Machinery, not content: it answers "is the app actually running the day",
   which the reader checks when something looks missing above it. */
.status-line {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.9;
  margin: 0;
  padding: 0 0.25rem;
  text-align: center;
}

/* --- The alert stream (T18) ---------------------------------------------- */

/* The card's head carries three small things: how many rows, whether the channel is
   live, and the one button that turns on sound. They wrap as a cluster rather than
   pushing the heading off the line at 360px. */
.alert-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.6rem;
  min-width: 0;
}
.stream-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.stream-chip::before {
  content: "";
  width: 0.45rem; height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}
.stream-chip.is-on { color: var(--good); }
.stream-chip.is-warn { color: var(--warn); }
.stream-chip.is-warn::before { animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* A quiet button: the same tap target as `.btn`, without the chrome of a primary
   action. Turning on notifications is a one-time setup step on a card the reader
   otherwise only reads, so it must not compete with the page's own focal point. */
.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 0.8rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--fg-soft);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.btn-quiet:hover { border-color: var(--line-strong); background: var(--bg-subtle); }

/* Where a live alert lands. Fixed above the bottom edge on a phone — under the
   thumb, and clear of the top bar — and pinned to the reading edge on a wider
   screen, where the page's own column has room beside it. */
.toasts {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  inset-inline: 0.75rem;
  bottom: 0.75rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  box-shadow: var(--shadow-md);
  color: var(--fg);
  font-size: var(--text-sm);
  text-decoration: none;
  pointer-events: auto;
  animation: toast-in 220ms var(--ease);
}
.toast:hover { border-color: var(--line-strong); text-decoration: none; }
/* The loud ones are the events that carry money: one accent edge, and nothing else
   about the card changes — the emphasis is the point, not the decoration. */
.toast-loud { border-inline-start: 3px solid var(--accent); }
.toast-symbol { font-weight: 700; }
.toast-when { margin-inline-start: auto; color: var(--muted); font-size: var(--text-xs); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.6rem); }
  to { opacity: 1; transform: none; }
}
@media (min-width: 48rem) {
  .toasts {
    /* The reading edge, which in this document is the right: `inset-inline-start`
       follows the page's own direction, so a Persian reader gets the corner his eye
       reaches first rather than the mirrored one. */
    inset-inline: 1.25rem auto;
    bottom: auto;
    top: 4.5rem;
    width: 22rem;
  }
}

/* --- Motion preferences -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
