/* tradio — "instrument panel". The trading mode drives --accent across the UI. */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --ink: #0e1626;
  --ink-2: #141f33;
  --ink-3: #1b2740;
  --line: #25324a;
  --bone: #e8e6dd;
  --muted: #8a97ad;
  --accent: #7c8aa6;          /* default = signals */
  --accent-soft: rgba(124, 138, 166, 0.14);
  --pos: #4ade80;
  --neg: #ff4d5e;
  --on-accent: #0e1626;   /* dark text that stays readable on the accent in both themes */
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* Light theme: recolor the surfaces/text; the mode accent system is unchanged. */
body[data-theme="light"] {
  --ink: #f3f4f7;
  --ink-2: #ffffff;
  --ink-3: #eef0f4;
  --line: #d7dbe4;
  --bone: #1a2233;
  --muted: #5c6678;
  --pos: #1f9d57;
  --neg: #d63347;
}

/* Mode-driven accent — the signature: switching mode re-skins everything. */
body[data-mode="signals_only"] { --accent: #7c8aa6; --accent-soft: rgba(124,138,166,.14); }
body[data-mode="paper"]        { --accent: #38bdf8; --accent-soft: rgba(56,189,248,.14); }
body[data-mode="live"]         { --accent: #ff4d5e; --accent-soft: rgba(255,77,94,.16); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top status bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-actions { display: contents; }
.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand .mark { color: var(--accent); }
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  color: var(--bone);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
/* tactile press feedback */
.nav-toggle:active { transform: scale(0.9); }
/* open state: tint in the mode accent so the control reads as "on" */
.nav-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
/* icon: cross-fade the hamburger bars into a down chevron on open */
.nav-toggle-svg { display: block; overflow: visible; }
.ico-bars,
.ico-chev {
  transform-box: view-box;
  transform-origin: 9px 9px; /* center of the 18x18 viewBox; portable across browsers */
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.ico-chev { opacity: 0; transform: scale(0.6); }
.nav-toggle[aria-expanded="true"] .ico-bars { opacity: 0; transform: scale(0.6); }
.nav-toggle[aria-expanded="true"] .ico-chev { opacity: 1; transform: scale(1); }

@media (prefers-reduced-motion: reduce) {
  .nav-toggle, .nav-toggle:active, .ico-bars, .ico-chev { transition: none; }
}

/* ---- the mode beacon (signature element) ---- */
.beacon {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding: 8px 18px 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--bone);
}
.beacon .led {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 2px var(--accent);
}
body[data-mode="live"] .beacon .led { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--accent); }
  50% { opacity: 0.35; box-shadow: 0 0 3px var(--accent); }
}
.beacon .label-sub { color: var(--muted); letter-spacing: 0.12em; }

/* inline help: circled "?" with a hover/focus popover */
.beacon .help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 9px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
  cursor: help;
}
.beacon .help:hover,
.beacon .help:focus-visible {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  outline: none;
}
.help-pop {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: -6px;
  width: 232px;
  padding: 11px 13px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: var(--bone);
  /* reset the beacon's mono/uppercase/tracking so the tip reads as prose */
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  z-index: 20;
}
.beacon .help:hover .help-pop,
.beacon .help:focus .help-pop { display: block; }

/* ---- mode switcher + logout ---- */
.switcher { display: inline-flex; gap: 6px; }
.switcher button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 11px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.switcher button.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.switcher button:hover:not(.on) { color: var(--bone); border-color: var(--accent); }
.linkbtn { background: none; border: none; color: var(--muted); cursor: pointer; font-family: var(--sans); }
.linkbtn:hover { color: var(--bone); }

/* ---- section nav ---- */
.nav {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.nav a {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--bone); text-decoration: none; }
.nav a.active { color: var(--bone); border-bottom-color: var(--accent); }

/* ---- layout ---- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
h1.title { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: 0.01em; }
.subtitle { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.panel {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }

/* stat tiles */
.stat .num { font-family: var(--mono); font-size: 30px; font-weight: 600; }
.stat .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }

/* ---- tables ---- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
.tbl th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: var(--accent-soft); }
.tbl .num { text-align: right; }
.empty { color: var(--muted); padding: 24px 12px; font-family: var(--sans); }

/* tags */
.tag { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.buy { color: var(--pos); border-color: var(--pos); }
.tag.sell { color: var(--neg); border-color: var(--neg); }
.tag.entry { color: var(--accent); border-color: var(--accent); }
/* divider before the admin-only section on the Settings page */
.section-admin { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }

.lvl-INFO { color: var(--muted); }
.lvl-WARN { color: #f5c451; }
.lvl-ERROR { color: var(--neg); }
/* per-symbol detail chips on poll events */
.event-detail { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.evt-sym { font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; }
.evt-sym b { color: var(--bone); font-weight: 600; margin-left: 5px; }
.pos-val { color: var(--pos); }
.neg-val { color: var(--neg); }

/* ---- forms ---- */
.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
/* One clean row: give every control the same height so the labels above them and
   the controls themselves all line up, regardless of type (text / textarea /
   file / button). Without this, the taller native file input and the
   line-height:1.5 textarea sit at different heights and drag their labels out of
   alignment. */
.row-form input,
.row-form select,
.row-form textarea,
.row-form > .btn { height: 38px; box-sizing: border-box; }
.row-form textarea { padding-top: 8px; padding-bottom: 8px; resize: vertical; }
.row-form input[type="file"] { padding: 6px 10px; font-family: var(--sans); line-height: 1.4; }
.row-form > .btn { display: inline-flex; align-items: center; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
input, select, textarea {
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--bone);
  padding: 9px 11px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
  min-width: 130px;
}
textarea { font-family: var(--sans); line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { filter: none; color: var(--muted); border-color: var(--line); }
a.btn { display: inline-block; text-decoration: none; line-height: 1.1; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--neg); border-color: var(--neg); filter: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- login ---- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: 100%; max-width: 420px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  padding: 40px 36px;
}
.login .brand { display: block; margin-bottom: 6px; }
.login p.hint { color: var(--muted); font-size: 13px; margin: 0 0 26px; }
.login input { width: 100%; margin-bottom: 14px; }
.login .btn { width: 100%; }
.login .err { color: var(--neg); font-size: 13px; margin: 0 0 14px; font-family: var(--mono); }
.login .hint.claim { color: var(--bone); border-left: 2px solid var(--accent); padding-left: 12px; }
.login code { font-family: var(--mono); color: var(--accent); background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 720px) {
  /* top bar: line 1 = brand + beacon + hamburger, line 2 = actions */
  .topbar { flex-wrap: wrap; gap: 12px 10px; padding: 12px 16px; }
  .brand { order: 1; }
  .beacon { order: 2; margin-left: 0; }
  .nav-toggle { order: 3; display: inline-flex; margin-left: auto; }
  .topbar-actions {
    order: 4;
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .switcher { flex: 1; }
  .switcher button { flex: 1; padding: 9px 8px; }

  /* section nav: collapse into a vertical drawer toggled by .open. When open it
     is pinned just below the sticky header (top + max-height set by nav.js) so it
     appears above the fold no matter how far the page is scrolled. */
  .nav { display: none; flex-direction: column; gap: 0; padding: 0; }
  .nav.open {
    display: flex;
    position: fixed;
    left: 0; right: 0;
    z-index: 9;                 /* below the sticky topbar (z-index: 10) */
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav a { padding: 13px 16px; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; }
  .nav a.active { border-bottom-color: transparent; border-left-color: var(--accent); }

  .wrap { padding: 18px 14px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-mode="live"] .beacon .led { animation: none; }
}

/* ---- theme toggle ---- */
.theme-toggle { font-size: 16px; line-height: 1; padding: 2px 4px; }

/* ---- credential / settings rows ---- */
/* Aligned grid: provider | api key | api secret | Save | Clear. The inner forms
   are display:contents so their fields/buttons sit directly in these columns, so
   every row's inputs line up regardless of how many fields a provider has. */
.cred-row { display: grid; align-items: end; gap: 8px 14px;
  grid-template-columns: 190px minmax(0, 1fr) minmax(0, 1fr) auto;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.cred-row:last-child { border-bottom: none; }
.cred-row > .cred-save { display: contents; }
.cred-name-cell { align-self: center; display: flex; align-items: center; gap: 8px; }
/* Fixed-size leading badge so provider names all start at the same x. The circle
   stays 22px; the inner glyph is enlarged and bolded so it fills more of it. */
.cred-name-cell .badge { flex: none; width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1; }
.cred-row .field input { width: 100%; min-width: 0; }
/* Save + Clear stacked vertically in a single actions column. */
.cred-actions { display: flex; flex-direction: column; gap: 6px; align-self: end; }
.cred-actions form { margin: 0; }
.cred-actions .btn { width: 100%; }
@media (max-width: 720px) {
  .cred-row { grid-template-columns: 1fr; }
}
.cred-name { font-family: var(--mono); font-size: 14px; }
.badge { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); }
.badge.set { color: var(--pos); border-color: var(--pos); }
.badge.warn { color: #f5c451; border-color: #f5c451; }
.badge.unset { color: var(--neg); border-color: var(--neg); }

/* ---- admin System Notifications callout (roadmap page) ---- */
.callout { border: 1px solid var(--accent); border-left: 3px solid var(--accent);
  border-radius: 8px; background: var(--ink-2); padding: 14px 16px; margin-bottom: 16px; }
.callout-notify { border-color: #f5c451; border-left-color: #f5c451; }
.callout-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.callout-head h2 { margin: 0; font-size: 14px; text-transform: uppercase;
  letter-spacing: 0.08em; color: #f5c451; }
.callout-flink { font-size: 12px; color: var(--accent); white-space: nowrap; margin-left: auto; }
.notify-empty { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.notify-item { padding: 8px 0; border-top: 1px solid var(--line); }
.notify-item:first-of-type { border-top: none; padding-top: 2px; }
.notify-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.notify-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.notify-ts { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.notify-link { font-size: 12px; color: var(--accent); }
.notify-acked { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.notify-acked > summary { cursor: pointer; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; }
.notify-acked[open] > summary { margin-bottom: 6px; }
.done-flink { margin: 0 0 12px; font-size: 12px; color: var(--muted); }

/* ---- roadmap attachments ---- */
.attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.att { position: relative; display: inline-flex; align-items: center; }
.att img { height: 56px; width: auto; max-width: 140px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 6px; display: block; }
.att-file { font-size: 12px; color: var(--accent); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 9px; text-decoration: none; }
.att-file:hover { border-color: var(--accent); }
.att-del { position: absolute; top: -6px; right: -6px; }
.att-del button { width: 18px; height: 18px; padding: 0; line-height: 1; font-size: 11px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--ink-2);
  color: var(--muted); cursor: pointer; }
.att-del button:hover { color: var(--neg); border-color: var(--neg); }
.att-add label { font-size: 12px; color: var(--muted); cursor: pointer; border: 1px dashed var(--line);
  border-radius: 6px; padding: 5px 10px; }
.att-add label:hover { color: var(--bone); border-color: var(--muted); }
.att-add input { display: none; }

/* selected / pasted files preview on the suggest form */
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chips[hidden] { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--ink-2);
  font-family: var(--mono); font-size: 12px; color: var(--muted); }
.file-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; display: block; }
.file-chip-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip-x { background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0 3px; }
.file-chip-x:hover { color: var(--neg); }

/* ---- roadmap ---- */
.roadmap-list { list-style: none; margin: 0; padding: 0; }
.roadmap-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 12px;
  border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: 6px;
  margin-bottom: 10px; background: var(--ink-2); }
.roadmap-item .grip { cursor: grab; color: var(--muted); font-size: 18px; line-height: 1.2;
  user-select: none; }
.roadmap-item .body { flex: 1; }
.roadmap-item .body h3 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
/* Referenceable item number (e.g. #63) shown before the title. */
.roadmap-item .body h3 .rm-id { font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--muted); margin-right: 6px; }
.roadmap-item .body p { margin: 0; color: var(--muted); font-size: 13px; }
.roadmap-item .controls { display: flex; align-items: center; gap: 8px; }
/* Backlog items: a 2x2 grid (edit / cancel on top, to-top / to-bottom below). */
.roadmap-item .controls.controls-grid { display: grid; grid-template-columns: repeat(2, auto);
  gap: 6px; align-content: start; justify-items: center; }
.roadmap-item .controls.controls-grid form { display: contents; }
.roadmap-item.editing .controls { display: none; }

/* icon buttons (edit pencil / delete x) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; background: transparent;
  border: 1px solid var(--line); border-radius: 6px; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--bone); border-color: var(--muted); }
.icon-btn.danger { color: var(--neg); }
.icon-btn.danger:hover { border-color: var(--neg); filter: brightness(1.1); }

/* live markdown preview under the suggest form */
.md-preview-wrap { margin-top: 14px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--ink-3); }
.md-preview-wrap .label-sub { display: block; margin-bottom: 4px; }

/* rendered markdown body of a roadmap entry */
.rm-md { font-size: 13px; color: var(--muted); }
.rm-md > :first-child { margin-top: 0; }
.rm-md > :last-child { margin-bottom: 0; }
.rm-md p { margin: 0 0 6px; }
.rm-md ul, .rm-md ol { margin: 4px 0; padding-left: 20px; }
.rm-md a { color: var(--accent); }
.rm-md code { font-family: var(--mono); font-size: 12px; background: var(--ink-3);
  padding: 1px 4px; border-radius: 4px; }
.rm-md pre { background: var(--ink-3); padding: 8px 10px; border-radius: 6px; overflow-x: auto; }
.rm-md pre code { background: none; padding: 0; }
.rm-md blockquote { margin: 4px 0; padding-left: 10px; border-left: 2px solid var(--line); }
.rm-md h1, .rm-md h2, .rm-md h3 { font-size: 14px; margin: 6px 0 3px; color: var(--bone); }

/* collapse a long entry; .expanded (set by JS) reveals the rest */
.md-clamp { max-height: 4.6em; overflow: hidden; }
.md-clamp.expanded { max-height: none; }
.md-more { margin-top: 4px; padding: 0; border: none; background: none; cursor: pointer;
  color: var(--accent); font-size: 12px; font-family: var(--sans); }
.md-more:hover { text-decoration: underline; }

/* admin inline edit form (swaps in over the rendered view) */
.rm-edit { display: flex; flex-direction: column; gap: 8px; }
/* the `display:flex` above would otherwise override the `hidden` attribute, so the
   edit form (input boxes) must be explicitly hidden until the pencil opens it */
.rm-edit[hidden] { display: none; }
.rm-edit input, .rm-edit textarea { width: 100%; }
.rm-edit textarea { resize: vertical; }
.edit-actions { display: flex; gap: 8px; margin-top: 2px; }

/* clearable inputs (suggest form): x button to wipe contents. The button sits
   OUTSIDE the field (a flex sibling, not an overlay) so it never collides with a
   textarea's resize handle and keeps a fixed position as the box is resized. */
.clearable { display: flex; align-items: flex-start; gap: 6px; }
.clearable input, .clearable textarea { flex: 1; min-width: 0; }
.clear-btn { display: none; flex: 0 0 auto; align-self: stretch;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.clearable textarea + .clear-btn { align-self: flex-start; height: 38px; }
.clear-btn:hover { color: var(--neg); border-color: var(--neg); }
.clearable input:not(:placeholder-shown) + .clear-btn,
.clearable textarea:not(:placeholder-shown) + .clear-btn { display: block; }
.status-tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line);
  color: var(--muted); }
.status-tag.planned { color: var(--accent); border-color: var(--accent); }
.status-tag.in_progress { color: #f5c451; border-color: #f5c451; }
.status-tag.done { color: var(--pos); border-color: var(--pos); }
.status-tag.cancelled { color: var(--neg); border-color: var(--neg); }
.status-tag.live { color: var(--pos); border-color: var(--pos); }
.status-tag.fallback { color: var(--muted); border-color: var(--line); }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { border-left-color: var(--accent); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }

/* collapsible sections (Backlog / Suggest / Notifications / Done): a ▸ triangle
   that rotates open. The summary may wrap a plain label or an <h2> heading. */
.rm-collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0;
}
.rm-collapse > summary::-webkit-details-marker { display: none; }
.rm-collapse > summary::before {
  content: "\25B8"; /* ▸ */
  font-size: 33px;
  line-height: 1;
  position: relative;
  top: -4px; /* glyph sits low in its em box; nudge it up to center the label */
  transition: transform 0.15s ease;
}
/* A heading used as the toggle label keeps its own colour but drops its margin. */
.rm-collapse > summary h2 { margin: 0; }
.rm-collapse[open] > summary { margin-bottom: 14px; }
.rm-collapse[open] > summary::before { transform: rotate(90deg); }
.roadmap-done .done-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: normal;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.roadmap-item.is-done { opacity: 0.72; border-left-color: var(--pos); }
.roadmap-item.is-cancelled { opacity: 0.6; border-left-color: var(--neg); }
.roadmap-item.is-cancelled .rm-view h3 { text-decoration: line-through; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px;
  border: 1px solid var(--accent); border-left: 3px solid var(--accent); background: var(--accent-soft); }
.flash.error { border-color: var(--neg); border-left-color: var(--neg); color: var(--neg); }
.flash.warn { border-color: #f5c451; border-left-color: #f5c451; color: #f5c451; }
.link-list { margin: 0; padding-left: 18px; }
.link-list li { margin: 4px 0; }
.link-list a { color: var(--accent); }
/* show typed symbols uppercase (front-end only; backend normalizes anyway) */
input.upper { text-transform: uppercase; }
.flash code { font-family: var(--mono); }

/* ---- latest-price cards (dashboard) ---- */
.price-card .num { font-size: 24px; }
.price-card .price-when { color: var(--muted); font-size: 11px; font-family: var(--mono); margin-top: 4px; }

/* latest price in the Sources watchlist: value with a small timestamp beneath */
.tbl .price-when { display: block; color: var(--muted); font-size: 11px; font-family: var(--mono); }
.tbl .muted { color: var(--muted); }

/* ---- charts (Chart.js manages the canvas; we only size the wrapper) ---- */
/* sparkline: small inline trend on dashboard cards / positions rows */
.spark { position: relative; height: 34px; margin: 6px 0 2px; }
.spark-cell { width: 110px; height: 28px; margin: 0 0 0 auto; }
/* full price chart in the history overlay */
.overlay-chart { position: relative; height: 200px; padding: 14px 18px 4px; }

/* per-source key indicator (globe = shared/global key, user = own key) */
.key-badge { display: inline-flex; vertical-align: middle; margin-left: 5px;
  color: var(--muted); }
.key-badge:hover { color: var(--bone); }

/* circled-i info icon with a hover tooltip (rule explanations) */
.info-badge { display: inline-flex; vertical-align: middle; margin-left: 6px;
  color: var(--muted); }
.info-badge:hover, .info-badge:focus { color: var(--accent); outline: none; }

/* synthetic (mock) data indicator next to a price */
.mock-badge { display: inline-flex; vertical-align: middle; margin-right: 4px;
  color: #f5c451; cursor: help; }

/* ---- clickable symbol ---- */
.symlink { font-family: var(--mono); font-size: 13px; color: var(--accent); cursor: pointer; padding: 0; }
.symlink:hover { text-decoration: underline; }

/* ---- price-history overlay (modal) ---- */
.overlay-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.overlay-card {
  width: 100%; max-width: 640px; max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.overlay-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.overlay-head h2 { margin: 0; font-size: 18px; }
.overlay-latest { font-family: var(--mono); font-size: 15px; color: var(--bone); }
.overlay-close { font-size: 22px; line-height: 1; padding: 0 4px; }
.overlay-body { overflow-y: auto; padding: 0 20px 16px; }
