/* ============================================================
   Kyra - personal workstation (Session 029; dark institutional theme Session 044)
   A calm, quiet workspace: slate surfaces, one accent, colour only for
   meaning (LONG / SHORT, ok / warning / blocked). A left sidebar on desktop,
   a menu on phones.
   ============================================================ */

/* Session 044: KYRA DESIGN TOKENS - a calm, institutional dark theme.
   Graphite/navy background, slate surfaces, one calm blue accent with a
   cyan-teal companion, colour only for meaning. Every colour on every page
   comes from here; components never hard-code a colour. */
:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0b1018;
  --bg-elevated: #0f151f;
  --surface: #131a26;
  --surface-2: #18212f;
  --surface-3: #1e2838;
  --line: #243044;
  --line-strong: #34425a;
  /* text */
  --text: #e4e9f1;           /* soft off-white: 14.6:1 on --surface */
  --text-strong: #f4f7fb;
  --muted: #95a2b6;          /* cool gray: 6.7:1 on --surface */
  --faint: #6b788d;
  /* accent */
  --accent: #5b9cf5;         /* calm blue */
  --accent-strong: #7cb1ff;
  --accent-soft: rgba(91, 156, 245, 0.14);
  --accent-line: rgba(91, 156, 245, 0.38);
  --accent-2: #3fbfb4;       /* cyan-teal */
  --accent-2-soft: rgba(63, 191, 180, 0.14);
  --on-accent: #08111f;      /* text on accent fills: 7.4:1 */
  /* meaning */
  --long: #43c39a;           /* restrained green/teal */
  --long-soft: rgba(67, 195, 154, 0.13);
  --short: #e46f6f;          /* restrained red */
  --short-soft: rgba(228, 111, 111, 0.13);
  --entry: #d6a75c;
  --ok: #43c39a;
  --ok-soft: rgba(67, 195, 154, 0.13);
  --warn: #d6a75c;           /* muted amber */
  --warn-soft: rgba(214, 167, 92, 0.14);
  --warn-line: rgba(214, 167, 92, 0.4);
  --bad: #e46f6f;
  --bad-soft: rgba(228, 111, 111, 0.13);
  --off: #8592a6;
  --off-soft: rgba(133, 146, 166, 0.12);
  --saved: #a995f0;
  --saved-soft: rgba(169, 149, 240, 0.14);
  --saved-line: rgba(169, 149, 240, 0.4);
  /* source identity (Kyra vs cBot never share a colour) */
  --src-kyra: #5b9cf5;
  --src-kyra-soft: rgba(91, 156, 245, 0.14);
  --src-cbot: #3fbfb4;
  --src-cbot-soft: rgba(63, 191, 180, 0.14);
  --src-cbot-line: rgba(63, 191, 180, 0.38);
  --src-ext: #d6a75c;
  --src-ext-soft: rgba(214, 167, 92, 0.13);
  --src-ext-line: rgba(214, 167, 92, 0.4);
  --src-manual: #b0a3d9;
  --src-manual-soft: rgba(176, 163, 217, 0.14);
  --src-manual-line: rgba(176, 163, 217, 0.38);
  /* chart palette */
  --chart-grid: #222c3d;
  --chart-axis: #6b788d;
  --chart-line: #5b9cf5;
  --chart-fill: rgba(91, 156, 245, 0.16);
  --chart-pos: #43c39a;
  --chart-neg: #e46f6f;
  --chart-neutral: #8592a6;
  /* names the shared chart renderer (backtestShared.js) reads */
  --bull: #43c39a;
  --bear: #e46f6f;
  --gold: #d6a75c;
  --ema20: #d6b35c; --ema50: #5b9cf5; --ema100: #a995f0; --ema200: #e48aa6; --vwap: #3fbfb4;
  --scrim: rgba(3, 6, 12, 0.6);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --sidebar: 240px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); }
.skip-link:focus { top: 8px; }

/* ---- shell: sidebar + mobile bar ---------------------------------------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.sidebar-brand { padding: 18px 18px 14px; }
.sidebar-brand a { text-decoration: none; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.sidebar-brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.side-nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 14px 10px 6px; }
.side-nav a { display: flex; margin: 0; /* legacy pages style bare `nav a` (S29-D1) */ align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.side-nav a:hover { background: var(--surface-2); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.sidebar-foot { margin-top: auto; padding: 14px 18px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot b { color: var(--text); font-weight: 600; }
.mobilebar { display: none; }
.shell-scrim { display: none; }
body.has-shell { padding-left: var(--sidebar); }

@media (max-width: 900px) {
  body.has-shell { padding-left: 0; padding-top: 56px; }
  .mobilebar { display: flex; position: fixed; inset: 0 0 auto 0; height: 56px; z-index: 45; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .mobilebar-brand { font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
  .sidebar { transform: translateX(-100%); transition: transform 0.18s ease; width: min(84vw, 300px); box-shadow: none; visibility: hidden; }
  body.menu-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  body.menu-open .shell-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 35; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---- page layout ---------------------------------------------------------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 28px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
.page-lede { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .page { padding: 16px 16px 32px; } .page-title { font-size: 20px; } }

footer.page-foot { max-width: 1240px; margin: 0 auto; padding: 0 28px 32px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
@media (max-width: 600px) { footer.page-foot { padding: 0 16px 24px; } }

/* ---- panels --------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; min-width: 0; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title { font-size: 15px; font-weight: 600; margin: 0; }
.panel-sub { font-size: 12.5px; color: var(--muted); }
.panel-body { padding: 16px; }
.panel-link { font-size: 13px; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

.notice { font-size: 13px; color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--warn); background: var(--surface); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px; line-height: 1.5; }
.notice.bad { border-left-color: var(--bad); background: var(--bad-soft); }

/* ---- buttons, badges, chips ---------------------------------------------- */
.btn { font: inherit; font-size: 13.5px; font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-quiet { background: transparent; font-size: 12.5px; min-height: 36px; padding: 6px 10px; }
.btn-icon { min-width: 44px; min-height: 44px; padding: 0; }
.btn-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.badge-neutral { color: var(--text); background: var(--off-soft); }
.badge-off { color: var(--off); background: var(--off-soft); }
.chip { font-size: 11.5px; font-family: var(--mono); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; display: inline-block; }
.chip-tier { color: var(--entry); background: var(--warn-soft); border-color: var(--warn-line); }
.chip-selected { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* ---- status tiles --------------------------------------------------------- */
.status-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; box-shadow: var(--shadow); }
.tile-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.tile-value { margin-bottom: 8px; }
.tile-value .badge { white-space: normal; }
.tile-detail { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.tile-detail b { color: var(--text); font-weight: 600; }
.tile-link { display: inline-block; margin-top: 8px; font-size: 12.5px; text-decoration: none; }

/* ---- setup cards ---------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.setup-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.setup-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.setup-instrument { font-size: 16px; font-weight: 700; color: var(--text); }
.dir { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.dir-long { color: var(--long); background: var(--long-soft); }
.dir-short { color: var(--short); background: var(--short-soft); }
.dir-unknown { color: var(--muted); border: 1px solid var(--line); }
.setup-sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.levels div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.levels dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.levels dd { margin: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.lv-entry { color: var(--entry); }
.lv-sl { color: var(--short); }
.lv-tp { color: var(--long); }
.setup-why { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 12.5px; }
.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-family: var(--mono); flex-wrap: wrap; }
.setup-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.setup-chart:not(:empty) { margin-top: 10px; overflow-x: auto; }
.setup-chart svg { max-width: 100%; height: auto; }
.setup-rr { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.setup-rr b { color: var(--text); font-family: var(--mono); }
.setup-warn { font-size: 12.5px; color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 7px 10px; margin-bottom: 10px; }
a.setup-instrument, a.activity-inst { text-decoration: none; color: var(--text); }
/* standalone links: at least a 24px target (WCAG 2.2 target size) */
a.setup-instrument, a.activity-inst, .panel-link, .tile-link { display: inline-flex; align-items: center; min-height: 28px; }
a.setup-instrument:hover, a.activity-inst:hover { text-decoration: underline; }

/* ---- lists ------------------------------------------------------------------ */
.empty { text-align: center; padding: 28px 14px; }
.empty-title { font-weight: 600; margin-bottom: 6px; }
.empty-body { font-size: 13px; color: var(--muted); line-height: 1.55; max-width: 540px; margin: 0 auto; }
.activity, .inst-list, .strat-list, .decisions, .cfg-list, .catalog-list { list-style: none; margin: 0; padding: 0; }
.activity-row { display: grid; grid-template-columns: 150px 90px 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.activity-row:first-child { border-top: none; }
.activity-row-3 { grid-template-columns: 150px 90px minmax(0, 1fr); }
.activity-time, .activity-lv { font-family: var(--mono); color: var(--muted); font-size: 12.5px; }
.activity-inst { font-weight: 600; }
.activity-strat { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-head { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.mon-head-gap { margin-top: 16px; }
.inst-row, .strat-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; flex-wrap: wrap; }
.inst-row:first-child, .strat-row:first-child { border-top: none; }
.inst-name, .strat-name { font-weight: 600; flex: 1; min-width: 0; }
.inst-count { font-family: var(--mono); color: var(--muted); font-size: 12.5px; }
.strat-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.strat-row { flex-direction: column; align-items: flex-start; }
.strat-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---- filters ---------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px 0; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.filters select { font: inherit; font-size: 13.5px; font-weight: 400; text-transform: none; letter-spacing: 0; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; min-height: 40px; min-width: 130px; }
.filter-count { font-size: 12.5px; color: var(--muted); font-family: var(--mono); margin-left: auto; padding-bottom: 10px; }

/* ---- setup detail -------------------------------------------------------------- */
.back-link { display: inline-flex; align-items: center; min-height: 36px; font-size: 13.5px; color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.back-link:hover { color: var(--text); }
.detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.levels-lg dd { font-size: 17px; }
.detail-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.detail-section .btn { margin-top: 12px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 10px 0 0; }
.kv dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.kv dd { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }

/* ---- decisions ------------------------------------------------------------------ */
.decision-row { display: grid; grid-template-columns: 150px 80px 64px 110px minmax(0, 1fr); grid-template-areas: 'time inst dir outcome strat' 'reason reason reason reason lv' 'tags tags tags tags tags'; gap: 5px 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; }
.decision-row:first-child { border-top: none; }
.decision-row .activity-time { grid-area: time; }
.decision-row .activity-inst { grid-area: inst; }
.decision-row .dir, .decision-row > span:nth-child(3) { grid-area: dir; }
.decision-row .badge { grid-area: outcome; justify-self: start; }
.decision-strategy { grid-area: strat; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-reason { grid-area: reason; }
.decision-reason code { margin-left: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.decision-row .activity-lv { grid-area: lv; justify-self: end; }
.decision-tags { grid-area: tags; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- scanner configuration --------------------------------------------------- */
.cfg-summary { font-size: 13px; margin: 8px 0 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cfg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cfg-row:first-child { border-top: none; }
.cfg-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.cfg-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cfg-reason { grid-column: 1 / -1; padding-left: 30px; }
.cfg-toggle input, .cfg-inst input { width: 18px; height: 18px; accent-color: var(--accent); }
.cfg-instruments { margin: 12px 0; font-size: 13.5px; }
.cfg-instruments summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 600; }
.cfg-inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 6px; }
.cfg-inst { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; min-height: 36px; }
.cfg-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---- strategy catalog ----------------------------------------------------------- */
.catalog-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.catalog-row:first-child { border-top: none; }
.catalog-name { font-weight: 600; }
.catalog-meta { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.catalog-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- notification alerts (Session 030) ------------------------------------------------ */
.alert-stack { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 10px; width: min(340px, calc(100vw - 32px)); }
.alert-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-lg); }
.alert-card-bad { border-left-color: var(--bad); }
.alert-head { display: flex; align-items: center; gap: 8px; }
.alert-instrument { font-size: 15px; font-weight: 700; flex: 1; min-width: 0; }
.alert-close { margin-left: auto; min-width: 32px; min-height: 32px; border: none; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 6px; }
.alert-close:hover { background: var(--surface-2); color: var(--text); }
.alert-sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; }
.alert-why { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.alert-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.alert-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.alert-toggle, .alert-volume { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; min-height: 40px; }
.alert-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.alert-volume input { accent-color: var(--accent); height: 24px; }
@media (max-width: 480px) { .alert-stack { right: 8px; left: 8px; bottom: 8px; width: auto; } }

/* ---- shared chart controls (backtestShared.js): at least a 32 px target --------------- */
.chart-nav button { min-height: 32px; min-width: 32px; }

/* ---- per-strategy ledger summary (Session 030) --------------------------------------- */
.sum-list { list-style: none; margin: 0; padding: 0; }
.sum-row { padding: 14px 0; border-top: 1px solid var(--line); }
.sum-row:first-child { border-top: none; padding-top: 4px; }
.sum-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sum-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 0 0 12px; }
.sum-count { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.sum-count dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sum-count dd { margin: 2px 0 0; font-family: var(--mono); font-size: 16px; font-weight: 600; }
.sum-ok dd { color: var(--ok); }
.sum-warn dd { color: var(--warn); }
.sum-block { margin-top: 10px; }
.sum-reasons { margin: 0; padding-left: 20px; font-size: 13px; }
.sum-reasons li { padding: 3px 0; }
.sum-reasons code { margin-left: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.sum-n { margin-left: 8px; font-family: var(--mono); font-weight: 600; }
.sum-inst { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- health ------------------------------------------------------------------------ */
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; margin: 0; }
.facts dt, .facts dd { padding: 10px 0; border-top: 1px solid var(--line); margin: 0; font-size: 13.5px; }
.facts dt:first-of-type, .facts dd:first-of-type { border-top: none; }
.facts dd { text-align: right; }

/* ---- responsive ---------------------------------------------------------------------- */
@media (max-width: 768px) {
  .activity-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'inst dir' 'time time' 'strat strat' 'lv lv'; gap: 4px 8px; }
  .activity-row > * { min-width: 0; overflow-wrap: break-word; }
  /* Session 043h: the 3-column variant has no named children - stack it
     instead of auto-flowing into the 'auto' column. */
  .activity-row-3 { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .activity-row.activity-row-3 > * { grid-area: auto; }
  .activity-inst { grid-area: inst; }
  .activity-row .dir { grid-area: dir; justify-self: end; }
  .activity-time { grid-area: time; }
  .activity-strat { grid-area: strat; white-space: normal; }
  .activity-lv { grid-area: lv; }
  .decision-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'inst outcome' 'time dir' 'strat strat' 'reason reason' 'lv lv' 'tags tags'; }
  .decision-row .activity-lv { justify-self: start; }
  .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .filter-count { flex-basis: 100%; margin-left: 0; padding-bottom: 0; }
}
@media (max-width: 480px) {
  /* Phones: compact status so the setups are reachable without a full screen of
     tiles. Every badge still states its truth; the scanner tile keeps its detail,
     and the explanations are on the Data & health page. */
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile-value { margin-bottom: 0; }
  .tile:first-child { grid-column: 1 / -1; }
  .tile:first-child .tile-value { margin-bottom: 6px; }
  .tile:not(:first-child) .tile-detail { display: none; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .levels dd { font-size: 12.5px; }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-title { font-size: 21px; }
  .cfg-reason { padding-left: 0; }
}

/* --- operational tables (Session 035) ---------------------------------------
   Wide status tables that must stay readable on a phone. Above 768px they are
   ordinary tables; below it each row becomes its own card and the column name
   travels with the value, so nothing needs horizontal scrolling. */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.data-table thead th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.data-table tbody th { font-weight: 600; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 768px) {
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table th, .stack-table td { display: block; width: auto; }
  .stack-table tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
  .stack-table th, .stack-table td { border: 0; padding: 4px 0; }
  .stack-table td[data-label]::before {
    content: attr(data-label) " ";
    display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .02em;
  }
}

/* ---- per-strategy operational status (Session 035) --------------------------
   The catalog row is a two-column grid, which squeezes the name to nothing
   inside a narrow sidebar and breaks it mid-word. This list stacks instead, so
   it reads the same in a 300px aside and on a full-width page. */
.ops-list { list-style: none; margin: 0; padding: 0; }
.ops-row { padding: 12px 0; border-top: 1px solid var(--line); }
.ops-row:first-child { border-top: none; }
.ops-name { display: block; font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.ops-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ops-meta { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }

/* ---- Live scanner (Session 036) -------------------------------------------
   The status and the switch sit side by side on a wide screen and stack on a
   phone. The switch column has a minimum width so the button never wraps
   mid-word, which is what broke the strategy names in Session 035. */
.panel-live .panel-body { display: block; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 20px; align-items: start; }
.live-headline { display: block; }
.live-status { margin-bottom: 8px; }
.live-blurb { font-size: 13px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.scanner-switch { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.scanner-switch .switch-state { margin-bottom: 10px; }
.scanner-switch .btn { width: 100%; }
.scanner-switch .switch-note { margin-top: 10px; line-height: 1.5; }
.live-activity { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.subhead { font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
/* Session 043h: recent scanner activity - its own card layout (never the
   setup list's fixed .activity-row columns). Desktop: time | instrument +
   status | strategy | reason; phones: stacked. Text wraps at word
   boundaries; nothing is squeezed into a fixed narrow column. */
.scan-activity-row { display: grid; grid-template-columns: minmax(9.5rem, 11rem) minmax(0, 1fr) minmax(0, 1.3fr); grid-template-areas: 'when head detail' 'when strat detail'; gap: 2px 14px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.scan-activity-row:first-child { border-top: none; }
.scan-activity-row > * { min-width: 0; overflow-wrap: break-word; word-break: normal; }
.sa-when { grid-area: when; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sa-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.sa-inst { font-weight: 600; }
.sa-strat { grid-area: strat; color: var(--muted); font-size: 12.5px; }
.sa-detail { grid-area: detail; line-height: 1.45; }
@media (max-width: 640px) {
  .scan-activity-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'when' 'head' 'strat' 'detail'; gap: 3px; }
}
.activity-totals { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); line-height: 1.6; }
.activity-since { opacity: 0.75; }

@media (max-width: 720px) {
  .live-grid { grid-template-columns: 1fr; }
}

/* ---- Local time + live operations (Session 037) ---------------------------
   The clock is presentation only. It sits in the page head, reads the device
   clock, and is deliberately quiet: tabular numerals so the seconds do not
   make the layout jitter once per second. */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.clock-slot { flex: 0 0 auto; }
.clock { text-align: right; line-height: 1.25; }
.clock-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.clock-time { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 13px; color: var(--text); }
.clock-zone { font-variant-numeric: tabular-nums; }

/* A timestamp shown in local time, with the UTC instant kept under it. */
.t-local { font-variant-numeric: tabular-nums; }
.t-utc { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* The accepted setup. Prominent when there is one, calm when there is not -
   an empty state here means the scanner is working, not that it is broken. */
.panel-setup .panel-body { padding-top: 6px; }
.setup-empty { padding: 18px 0; }
.setup-empty-title { font-weight: 600; margin-bottom: 4px; }
.setup-hit { border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: 10px; padding: 16px; background: var(--surface-2); }
.setup-hit-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.setup-hit-inst { font-size: 19px; font-weight: 700; }
.setup-hit-when { margin-bottom: 10px; }
.setup-hit-local { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.setup-hit-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.setup-hit-meta span:not(:last-child)::after { content: ' ·'; }
.setup-hit-levels { display: flex; gap: 18px; flex-wrap: wrap; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.setup-hit-levels em { display: block; font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.setup-hit-levels span { font-size: 16px; font-weight: 600; }
.setup-hit-reason { margin-bottom: 10px; }

/* The retiring path, visually quieter than the operational cards. */
.panel-legacy { opacity: 0.92; }
.panel-legacy .panel-title { font-weight: 600; }

.activity-marks { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); line-height: 1.6; }
.ops-counts { font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .page-head { flex-direction: column; }
  .clock { text-align: left; }
  .clock-time { font-size: 30px; }
  .setup-hit-levels { gap: 12px; }
  .setup-hit-levels span { font-size: 15px; }
}

/* ---- Forming setups (Session 038, Phase 6) --------------------------------
   Restrained on purpose. A forming candidate is an observation, not a signal,
   so it gets a calm accent rather than the accepted setup's prominence - and
   nothing here animates, flashes or pulses. */
.panel-forming .panel-body { padding-top: 6px; }
.fs-empty { padding: 16px 0; }
.fs-empty-title { font-weight: 600; margin-bottom: 4px; }
.fs-list { list-style: none; margin: 0; padding: 0; }
.fs-card { border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.fs-card-stale { opacity: 0.78; border-left-style: dashed; }
.fs-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.fs-inst { font-size: 17px; font-weight: 700; }
.fs-progress { font-variant-numeric: tabular-nums; font-size: 15px; }
.fs-progress b { font-size: 17px; }
.fs-strategy { font-size: 13px; color: var(--muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.fs-waiting { font-size: 14px; margin-bottom: 4px; overflow-wrap: anywhere; }
.fs-waiting em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 6px; }
.fs-when { font-variant-numeric: tabular-nums; }
.fs-detail { margin-top: 8px; }
.fs-detail summary { cursor: pointer; font-size: 13px; }
.fs-stages { list-style: none; margin: 8px 0 6px; padding: 0; }
.fs-stage { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; overflow-wrap: anywhere; }
.fs-mark { width: 1em; flex: 0 0 auto; font-weight: 700; }
.fs-stage-label { flex: 1 1 auto; }
/* Confirmed reads positive, waiting reads neutral-warm, and NOT EVALUATED is
   deliberately muted - it is not a failure and must never look like one. */
.fs-ok .fs-mark { color: var(--ok); }
.fs-warn .fs-mark { color: var(--warn); }
.fs-off { color: var(--muted); }
.fs-off .fs-mark { color: var(--muted); }
.fs-foot { margin-top: 8px; }

@media (max-width: 600px) {
  .fs-head { gap: 6px; }
  .fs-inst { font-size: 16px; }
  .fs-card { padding: 11px 12px; }
}

/* ---- Canonical Setups page (Session 038, Phase 7) -------------------------- */
.panel-filters .panel-body { padding-bottom: 10px; }
.su-filters { display: flex; gap: 12px; flex-wrap: wrap; }
.su-filters label { display: flex; flex-direction: column; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); gap: 4px; }
.su-filters select { font: inherit; font-size: 13.5px; text-transform: none; letter-spacing: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; min-height: 38px; }
.su-empty { padding: 16px 0; }
.su-empty-title { font-weight: 600; margin-bottom: 4px; }
.su-list { list-style: none; margin: 0; padding: 0; }
.su-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; margin-bottom: 10px; background: var(--surface); }
.su-accepted { border-left: 3px solid var(--accent); }
.su-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.su-inst { font-size: 17px; font-weight: 700; }
.su-strategy { font-size: 13px; margin-bottom: 4px; overflow-wrap: anywhere; }
.su-when { font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.su-levels { display: flex; gap: 16px; flex-wrap: wrap; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.su-levels em { display: block; font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.su-levels span { font-size: 15px; font-weight: 600; }
.su-nolevels { margin-bottom: 8px; }
.su-reason { margin-bottom: 8px; overflow-wrap: anywhere; }
.su-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.su-open { font-size: 13px; font-weight: 500; }
/* Recent: stacked rows, so nothing needs horizontal scrolling on a phone. */
.su-recent { list-style: none; margin: 0; padding: 0; }
.su-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--line); }
.su-row:first-child { border-top: none; }
.su-row-when { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }
.su-row-inst { font-weight: 600; }
.su-prog { font-variant-numeric: tabular-nums; font-size: 13px; }
.su-row-strategy { font-size: 13px; }
.su-row-reason { flex: 1 1 100%; }

@media (max-width: 600px) {
  .su-filters { gap: 8px; }
  .su-filters label { flex: 1 1 45%; }
  .su-levels { gap: 12px; }
  .su-row-when { flex: 1 1 100%; }
}

/* ---- Canonical setup board (Session 039) ---------------------------------- */
.badge-saved { color: var(--saved); background: var(--saved-soft); }
.state-badge { display: inline-flex; }
.sb-list { list-style: none; margin: 0; padding: 0; }
.sb-card { border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 10px; padding: 13px 14px; margin-bottom: 10px; background: var(--surface); }
.sb-accepted { border-left-color: var(--ok); }
.sb-accepted.sb-expired { border-left-color: var(--off); }
.sb-saved { box-shadow: inset 0 0 0 1px var(--saved-line); }
.sb-forming { border-left-color: var(--accent); }
.sb-stale { opacity: 0.78; border-left-style: dashed; }
.sb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sb-inst { font-size: 17px; font-weight: 700; color: var(--text); text-decoration: none; }
.sb-inst:hover { text-decoration: underline; }
.sb-strategy { font-size: 13px; margin-bottom: 6px; overflow-wrap: anywhere; }
.sb-times { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; font-size: 12.5px; }
.sb-times-lg { font-size: 13.5px; margin: 10px 0 14px; }
.sb-times .when em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 4px; }
.sb-times .t-utc { display: none; }
.sb-reason { margin-bottom: 8px; overflow-wrap: anywhere; }
.sb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sb-actions .btn-primary { min-width: 120px; }
.saved-mark { display: inline-flex; align-items: center; gap: 6px; }
.sb-error { margin: 10px 0 0; }
.sb-shadow { margin-top: 8px; }
.sb-policy { margin-top: 12px; }
.sb-note textarea { width: 100%; font: inherit; font-size: 14px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; margin: 4px 0 8px; background: var(--surface); color: var(--text); }
.alert-open { font-size: 12.5px; font-weight: 500; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .sb-card { padding: 11px 12px; }
  .sb-actions .btn { flex: 1 1 auto; }
}

/* ---- Settings (Session 039) ------------------------------------------------ */
.settings-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 16px; font-size: 13px; }
.settings-toc a { color: var(--accent); text-decoration: none; }
.settings-toc a:hover { text-decoration: underline; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.set-row:first-child { border-top: none; }
.set-label p { margin: 4px 0 0; }
.set-control { display: flex; flex-direction: column; gap: 6px; }
.set-control select, .legacy-settings select, .legacy-settings input[type="number"] { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.switch-row input { width: 18px; height: 18px; }
.set-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.set-list { margin: 6px 0 0; padding-left: 18px; }
.set-howto { margin-top: 8px; font-size: 13px; }
.set-howto summary, .legacy-settings summary { cursor: pointer; font-weight: 600; }
.set-howto code, .set-list code, .facts code { font-size: 12px; overflow-wrap: anywhere; }
.save-ok { color: var(--ok); }
.save-bad { color: var(--bad); }
.legacy-settings { margin-top: 16px; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px 14px; }
.legacy-settings[open] summary { margin-bottom: 10px; }
.legacy-h { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.asset-columns { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .asset-columns { grid-template-columns: 1fr 1fr 1fr; } }
.asset-column-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.pair-grid { display: flex; flex-direction: column; gap: 6px; }
.pair-option, .session-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface); cursor: pointer; font-size: 13.5px; margin-bottom: 6px; }
.pair-option { justify-content: flex-start; font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.pair-option.selected, .session-option.selected { border-color: var(--accent); }
.session-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tf-grid, .style-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-option, .style-btn { border: 1px solid var(--line); border-radius: 8px; padding: 8px 13px; background: var(--surface); cursor: pointer; font-size: 13px; }
.tf-option.selected, .style-btn.selected { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tf-option.disabled { opacity: 0.35; cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 560px) { .set-row { grid-template-columns: 1fr; gap: 8px; } }
body[data-page="settings"] .facts { grid-template-columns: minmax(110px, 190px) minmax(0, 1fr); }
body[data-page="settings"] .facts dd { text-align: left; overflow-wrap: anywhere; }
body[data-page="settings"] .subhead { margin-top: 18px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 560px) { body[data-page="settings"] .facts { grid-template-columns: 1fr; } body[data-page="settings"] .facts dd { border-top: none; padding-top: 0; } }

/* ---- Trade decision, journal, statistics, live strategies (Session 042) --- */
.tv-decision { margin-bottom: 12px; }
.tv-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tv-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
@media (min-width: 640px) { .tv-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tv-choices-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tv-choice { min-height: 48px; font-weight: 600; }
.tv-choice.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tv-trade { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.tv-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .tv-grid { grid-template-columns: 1fr 1fr; } }
.tv-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tv-field input, .tv-field textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px; min-height: 44px; }
.tv-value { font-size: 16px; color: var(--text); padding: 10px 0; }
.tv-sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 12px; }
.tv-notes { margin-top: 10px; }
.tv-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.tv-actions .btn-primary { min-height: 48px; min-width: 160px; }
.tv-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.tv-compare div { background: var(--surface-2); border-radius: 8px; padding: 10px; }
.tv-compare dt { font-size: 12px; color: var(--muted); }
.tv-compare dd { margin: 4px 0 0; font-weight: 600; font-size: 15px; }
@media (max-width: 520px) { .tv-compare { grid-template-columns: 1fr; } }
.tv-list { list-style: none; margin: 0; padding: 0; }
.tv-item a { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 4px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; min-height: 48px; }
.tv-item:first-child a { border-top: none; }
.tv-inst { font-weight: 700; }
.tv-r { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-meta { flex-basis: 100%; }
.tv-filters { margin-bottom: 12px; }
.tv-filters input { font: inherit; font-size: 14px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; min-height: 38px; background: var(--surface); color: var(--text); }
.tv-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 760px) { .tv-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tv-tile { background: var(--surface-2); border-radius: 10px; padding: 12px; }
.tv-tile-label { font-size: 12px; color: var(--muted); }
.tv-tile-value { font-size: 20px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tv-curve { margin: 14px 0 0; }
.tv-curve svg { width: 100%; height: 90px; background: var(--surface-2); border-radius: 8px; }
.tv-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tv-zero { stroke: var(--line-strong); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.tv-breakdown { margin-top: 10px; }
.tv-breakdown summary { cursor: pointer; font-weight: 600; min-height: 36px; }
.tv-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tv-table th, .tv-table td { text-align: left; padding: 7px 6px; border-top: 1px solid var(--line); }
.tv-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tv-audit { padding-left: 18px; }
.tv-live { list-style: none; margin: 0; padding: 0; }
.tv-live-row { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 3px; }
.tv-live-row:first-child { border-top: none; }
.tv-live-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tv-live-groups { display: flex; flex-direction: column; gap: 14px; }
.tv-live-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tv-live-ghead { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tv-axis { display: inline-flex; align-items: center; gap: 4px; }
.tv-axis em { font-style: normal; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.catalog-legacy { margin-top: 12px; }
.catalog-legacy > summary { cursor: pointer; padding: 6px 0; color: var(--muted); }
.tv-warn { color: var(--bad); }
.set-cats { display: flex; flex-direction: column; gap: 8px; }
.set-cat { align-items: flex-start; min-height: 44px; }
/* Session 043f: NEW setups must be obvious; handled/expired are quiet. */
.sb-card.sb-new { border: 2px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.badge-new { background: var(--accent); color: var(--on-accent); font-weight: 700; letter-spacing: .04em; }
.sb-current-head { margin-bottom: 8px; }
.sb-newcount { display: inline-block; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 13px; }
.sb-none .su-empty-title { font-size: 1.05rem; font-weight: 700; }
.sb-recent-wrap { border-top: 1px solid var(--line); margin-top: 8px; opacity: .92; }
.sb-recent-row { font-size: 13px; }

/* Session 043k: strategy registry axes + lifecycle table */
.reg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.reg-row { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.reg-axes { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0; }
.reg-axis { display: inline-flex; align-items: center; gap: 4px; }
.reg-axis em { font-style: normal; font-size: 0.75rem; opacity: 0.75; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.mini-table th, .mini-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) { .mini-table { display: block; overflow-x: auto; } }

/* ==== Session 044: product UI components ==================================== */
/* brand */
.sidebar-brand a { display: inline-block; line-height: 0; }
.sidebar-brand img { display: block; height: 34px; width: auto; }
.sidebar-brand small { margin-top: 6px; letter-spacing: 0.02em; }
.mobilebar-brand { line-height: 0; }
.mobilebar-brand img { display: block; height: 28px; width: auto; }
.side-nav-gap { height: 8px; }
.sidebar, .mobilebar { background: var(--bg-elevated); }

/* form controls */
.input, .select, .textarea, .page input:not([type=checkbox]):not([type=radio]), .page select, .page textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 9px 11px; min-height: 40px; max-width: 100%;
}
.input:focus, .page input:focus, .page select:focus, .page textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field { display: flex; flex-direction: column; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 14px; align-items: end; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.btn-block { width: 100%; }
.btn-danger { color: var(--bad); border-color: var(--bad-soft); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-teal { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); font-weight: 600; }
.btn-teal:hover { filter: brightness(1.08); }

/* login */
body.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--accent-2-soft), transparent 55%), var(--bg); }
.login-wrap { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px 26px 24px; box-shadow: var(--shadow-lg); }
.login-logo { display: block; height: 44px; width: auto; margin-bottom: 22px; }
.login-title { font-size: 18px; font-weight: 600; margin: 0 0 6px; color: var(--text-strong); letter-spacing: -0.01em; }
.login-lede { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.login-form .input { width: 100%; margin-bottom: 14px; }
.login-error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-foot { text-align: center; font-size: 12px; color: var(--faint); margin: 0; }

/* source identity: KYRA vs CBOT vs MANUAL are never the same colour */
.src-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap; font-family: var(--mono); }
.src-kyra { color: var(--src-kyra); background: var(--src-kyra-soft); border-color: var(--accent-line); }
.src-cbot { color: var(--src-cbot); background: var(--src-cbot-soft); border-color: var(--src-cbot-line); }
.src-manual { color: var(--src-manual); background: var(--src-manual-soft); border-color: var(--src-manual-line); }
.panel-src-kyra { border-top: 2px solid var(--src-kyra); }
.panel-src-cbot { border-top: 2px solid var(--src-cbot); }

/* dashboard dual panels */
.dual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dual { grid-template-columns: minmax(0, 1fr); } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 13px; min-width: 0; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--text-strong); overflow-wrap: anywhere; }
.kpi-value.t-pos { color: var(--long); } .kpi-value.t-neg { color: var(--short); }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* generic data table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:hover td { background: var(--surface-2); }
.t-num { text-align: right; font-family: var(--mono); }
.t-pos { color: var(--long); } .t-neg { color: var(--short); }

/* signal / entry cards */
.sig-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sig-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sig-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sig-inst { font-weight: 700; font-size: 15px; color: var(--text-strong); }
.sig-meta { font-size: 12.5px; color: var(--muted); }
.sig-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; font-family: var(--mono); font-size: 12.5px; }
.sig-levels span { display: block; color: var(--muted); font-family: var(--sans); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.sig-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.sig-observed { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }

/* token reveal (shown once) */
.token-box { font-family: var(--mono); font-size: 12.5px; background: var(--bg); border: 1px dashed var(--warn-line); color: var(--text-strong); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }

/* filters */
.k-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.k-filters .field { min-width: 140px; flex: 1 1 140px; max-width: 220px; }

/* charts (public/js/charts.js) */
.chart-grid-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .chart-grid-wrap { grid-template-columns: minmax(0, 1fr); } }
.chart-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 8px; min-width: 0; }
.chart-title { font-size: 12.5px; font-weight: 600; margin: 0 0 8px; color: var(--text); }
.chart-note { font-size: 12px; color: var(--muted); margin: 6px 0 2px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .c-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .c-zero { stroke: var(--line-strong); stroke-width: 1; }
.chart .c-axis { fill: var(--chart-axis); font-size: 10px; font-family: var(--mono); }
.chart .c-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .c-line-neg { fill: none; stroke: var(--chart-neg); stroke-width: 2; stroke-linejoin: round; }
.chart .c-area { fill: var(--chart-fill); stroke: none; }
.chart .c-area-neg { fill: var(--short-soft); stroke: none; }
.chart .c-pos { fill: var(--chart-pos); }
.chart .c-neg { fill: var(--chart-neg); }
.chart .c-neutral { fill: var(--chart-neutral); }
.chart-empty { font-size: 13px; color: var(--muted); padding: 26px 8px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; }

/* misc */
.empty-state { color: var(--muted); font-size: 13.5px; padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.callout { font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 10px 13px; color: var(--text); line-height: 1.5; }
.callout b { color: var(--text-strong); }
.callout-teal { border-left: 3px solid var(--accent-2); }
.callout-blue { border-left: 3px solid var(--accent); }
.callout-amber { border-left: 3px solid var(--warn); }
.split { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mono { font-family: var(--mono); }
.pager { display: flex; justify-content: center; margin-top: 14px; }
.k-tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--off-soft); color: var(--text); border: 1px solid var(--line); margin: 0 4px 4px 0; }
dialog.sheet { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.sheet-body { padding: 16px 18px; max-height: 70vh; overflow-y: auto; }

/* cBot library (cTrader Store discovery) */
.src-ext { color: var(--src-ext); background: var(--src-ext-soft); border-color: var(--src-ext-line); }
.lib-rank { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 6px; padding: 1px 7px; }
.lib-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
@media (max-width: 420px) { .lib-list { grid-template-columns: minmax(0, 1fr); } }
.lib-card .kpis { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.lib-card .kpi-value { font-size: 16px; }
