/* Alie2 dashboard — futuristic, calm, high-contrast.
   Built for Marvin's assistant: large readable type, plain language.

   Palette is intentionally three-tier on both surfaces (bg / card / raised)
   and text (text / text-2 / muted) so the eye has somewhere to rest and
   hover states feel tactile. Accent is used sparingly — the teal carries
   the meaning of "active / interactive". */

:root {
  /* surfaces */
  --bg:          #0a0f1e;
  --bg-2:        #0e1426;
  --surface-0:   #131a30;
  --surface-1:   #1a2240;
  --surface-2:   #232c50;
  /* borders + dividers — translucent so they stack cleanly on gradients */
  --line:        rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  /* text */
  --text:        #f1f4fb;
  --text-2:      #c8d1e6;
  --muted:       #8d97b3;
  /* accent + semantic */
  --accent:      #5eead4;
  --accent-2:    #2dd4bf;
  --accent-soft: rgba(94, 234, 212, 0.14);
  --accent-edge: rgba(94, 234, 212, 0.45);
  --good:        #4ade80;
  --warn:        #fbbf24;
  --bad:         #f87171;
  /* shape + motion */
  --radius:      14px;
  --radius-sm:   10px;
  --radius-pill: 999px;
  --shadow-1:    0 1px 0 rgba(255, 255, 255, 0.04) inset,
                 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-2:    0 1px 0 rgba(255, 255, 255, 0.06) inset,
                 0 18px 50px rgba(0, 0, 0, 0.55);
  --t-fast:      .12s ease;
  --t:           .18s ease;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 50% -200px, #122242 0%, var(--bg) 60%),
              var(--bg);
  color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 600; letter-spacing: .01em; color: var(--text); }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbars — discreet, so they don't compete with content. */
* { scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* ── Sign-in ─────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% -10%, #19264a, var(--bg)); }
.login-card {
  width: 340px; padding: 2.2rem 2rem; background: var(--surface-1);
  border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: .6rem;
  box-shadow: var(--shadow-2);
}
.brand-big { font-size: 1.95rem; font-weight: 700; letter-spacing: .06em; }
.brand-big .logo, .brand .logo { color: var(--accent); }
.login-card label { font-size: .85rem; color: var(--muted); margin-top: .6rem; }
.login-card input, #chat-input {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: .75rem .9rem; font-size: 1rem;
  outline: none; transition: border-color var(--t), box-shadow var(--t);
}
.login-card input:focus, #chat-input:focus {
  border-color: var(--accent-edge);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-card button, .primary {
  margin-top: .9rem;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #052625; border: 0; border-radius: var(--radius-sm);
  padding: .75rem; font-size: 1rem; font-weight: 600;
  transition: transform var(--t-fast), box-shadow var(--t);
  box-shadow: 0 6px 16px rgba(45, 212, 191, 0.25);
}
.login-card button:hover, .primary:hover { transform: translateY(-1px); }
.login-card button:active { transform: translateY(0); }
/* Shared button look — used on the Grid Controller Pad page by the download
   link (<a class="btn">) and the Save button (<button class="btn">) so they
   match. Works for both <a> and <button>. */
.btn {
  display: inline-block; text-align: center; text-decoration: none;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #052625; border: 0; border-radius: var(--radius-sm);
  padding: .6rem .95rem; font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t);
  box-shadow: 0 6px 16px rgba(45, 212, 191, 0.25);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.error { color: var(--bad); font-size: .9rem; margin: .4rem 0 0; }

/* ── App shell ───────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--line);
  padding: 1.3rem .75rem;
  display: flex; flex-direction: column; gap: .2rem;
}
.brand { font-size: 1.35rem; font-weight: 700; letter-spacing: .06em;
  padding: .2rem .7rem 1.2rem; }
.nav-btn {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  background: transparent; color: var(--text-2); border: 0; text-align: left;
  padding: .7rem .8rem; border-radius: var(--radius-sm); font-size: .98rem;
  border-left: 3px solid transparent;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-btn:hover { background: var(--surface-0); color: var(--text); }
.nav-btn[aria-current="true"] {
  background: var(--surface-1); color: var(--text);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.nav-ico { color: var(--accent); width: 1.15rem; text-align: center; }
.nav-spacer { flex: 1; }
.logout { color: var(--muted); font-size: .9rem; }
.logout:hover { color: var(--bad); background: transparent; }

.main { padding: 1.6rem 2.2rem 3rem; overflow: auto; }
.topbar { margin-bottom: 1.4rem; }
.topbar h1 { margin: 0 0 .25rem; font-size: 1.55rem; letter-spacing: -0.01em; }
.topbar .muted { margin: 0; font-size: .95rem; color: var(--text-2); }

/* ── Cards / panels ──────────────────────────────────────────────────── */
.group { margin-bottom: 1.6rem; }
.group-head { display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .6rem; }
.group-head h2 { margin: 0; font-size: 1.1rem; }
.count { color: var(--muted); font-size: .9rem; font-weight: 500; }
.group-hint { color: var(--muted); font-size: .9rem; margin: -.2rem 0 .7rem; }

.list { display: flex; flex-direction: column; gap: .55rem; }
.row {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .85rem 1.05rem;
  display: flex; align-items: center; gap: .9rem;
  text-align: left; width: 100%; color: var(--text);
  transition: transform var(--t-fast), border-color var(--t),
              background var(--t), box-shadow var(--t);
}
.row:hover {
  border-color: var(--accent-edge);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.row .title { flex: 1; font-size: .98rem; color: var(--text); }
.row .meta {
  color: var(--muted); font-size: .82rem; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.badge {
  font-size: .72rem; padding: .2rem .55rem; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-edge);
  white-space: nowrap; letter-spacing: .02em; font-weight: 500;
}
.badge.perm {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.35);
}

/* hint pill — explains a technical word in plain language */
.hint {
  display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem;
  border-radius: 50%; border: 1px solid var(--line-strong); color: var(--muted);
  font-size: .72rem; cursor: help;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.hint:hover { color: var(--accent); border-color: var(--accent-edge); }

/* chips (filters / folders) */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip {
  background: var(--surface-0); border: 1px solid var(--line); color: var(--text-2);
  border-radius: var(--radius-pill); padding: .4rem .85rem; font-size: .85rem;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { background: var(--surface-1); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-edge);
}

/* ── Tabs (KB sources) ───────────────────────────────────────────────── */
/* Segmented chip rail — wraps to next line instead of horizontal-scrolling.
   Discovered dynamically from the API response in app.js. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .35rem;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 1.1rem;
  box-shadow: var(--shadow-1);
}
.tab {
  background: transparent;
  color: var(--text-2);
  border: 0;
  padding: .55rem 1rem;
  font-size: .92rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: .35rem;
  transition: background var(--t-fast), color var(--t-fast);
}
.tab:hover { background: var(--surface-1); color: var(--text); }
.tab[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #052625;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(45, 212, 191, 0.25);
}
.tab .count {
  color: inherit; opacity: .65; font-size: .82rem; font-weight: 500;
  margin: 0;
}
.tab[aria-pressed="true"] .count { opacity: .75; }
.tab-hint { color: var(--muted); font-size: .92rem; margin: 0 0 .9rem; }
.tab-content { animation: tab-fade-in .18s ease; }
@keyframes tab-fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ── KB multi-select / bulk delete ──────────────────────────────────── */
/* Sticky action bar that appears below the tabs when at least one KB row
   is checked. Reads "N items selected" + Cancel + Delete-selected. */
.kb-actions {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .85rem;
  margin: 0 0 .9rem;
  background: var(--surface-1);
  border: 1px solid var(--accent-edge);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  animation: kb-actions-in .18s ease;
}
@keyframes kb-actions-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.kb-actions-count {
  color: var(--text); font-weight: 600; font-size: .92rem;
}
.kb-actions-spacer { flex: 1; }
.kb-actions-clear, .kb-actions-delete {
  border: 0; border-radius: var(--radius-sm);
  padding: .5rem .95rem; font-size: .9rem; font-weight: 600;
  font-family: inherit;
  transition: transform var(--t-fast), background var(--t-fast),
              filter var(--t-fast);
}
.kb-actions-clear {
  background: var(--surface-2); color: var(--text-2);
}
.kb-actions-clear:hover { background: var(--line-strong); color: var(--text); }
.kb-actions-delete {
  background: linear-gradient(180deg, #fb7185, #ef4444);
  color: #fff;
  box-shadow: 0 6px 14px rgba(239, 68, 68, 0.30);
}
.kb-actions-delete:hover { transform: translateY(-1px); filter: brightness(1.05); }
.kb-actions-delete:disabled, .kb-actions-clear:disabled {
  opacity: .55; cursor: not-allowed; transform: none;
}

/* "Select all in this tab" header above the list. */
.kb-select-all {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .35rem .6rem; margin: 0 0 .55rem;
  font-size: .87rem; color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.kb-select-all:hover { color: var(--text); background: var(--surface-0); }

/* KB rows are <div>s now (so a checkbox can live inside cleanly) instead
   of <button>s. Match the button-row look + cursor. */
.kb-row { cursor: pointer; }
.kb-row input[type="checkbox"] { flex: 0 0 auto; }

/* Native checkboxes restyled to fit the palette. */
input[type="checkbox"] {
  appearance: none;
  width: 1.05rem; height: 1.05rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-0);
  cursor: pointer;
  position: relative;
  transition: border-color var(--t-fast), background var(--t-fast);
}
input[type="checkbox"]:hover { border-color: var(--accent-edge); }
input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 9px;
  border-right: 2px solid #052625;
  border-bottom: 2px solid #052625;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Confirm-delete modal — list of names + paired Cancel / Delete buttons. */
.kb-confirm-list {
  max-height: 240px; overflow: auto;
  margin: .6rem 0 .8rem;
  padding-left: 1.2rem;
  color: var(--text-2);
}
.kb-confirm-list li { padding: .15rem 0; }
.kb-confirm-actions {
  display: flex; justify-content: flex-end; gap: .55rem;
  margin-top: .8rem;
}

.empty, .loading { color: var(--muted); padding: 1.5rem .2rem; }
.loading::before {
  content: ""; display: inline-block;
  width: .85rem; height: .85rem; margin-right: .55rem; vertical-align: -2px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── GitHub feed ─────────────────────────────────────────────────────── */
.commit-detail {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-top: 0; margin-top: -.5rem;
  padding: .95rem 1.05rem; font-size: .9rem;
}
.commit-detail pre { white-space: pre-wrap; color: var(--text); margin: 0 0 .6rem; }
.file { display: flex; gap: .6rem; font-size: .85rem; color: var(--muted); }
.file .add { color: var(--good); } .file .del { color: var(--bad); }

/* ── Chat ────────────────────────────────────────────────────────────── */
/* ── Chat page: roster (top, collapsible) + chat | live activity ───────── */
.chat-page { display: flex; flex-direction: column; gap: .8rem; height: calc(100vh - 8rem); }

.chat-roster { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .85rem .2rem; flex: 0 0 auto; }
.chat-roster > .chat-roster-sum { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .55rem; padding: .35rem .1rem; font-weight: 600; color: var(--text); }
.chat-roster > .chat-roster-sum::-webkit-details-marker { display: none; }
.chat-roster-sum::before { content: "▸"; color: var(--muted); transition: transform var(--t); }
.chat-roster[open] > .chat-roster-sum::before { transform: rotate(90deg); }
.crs-count { color: var(--muted); font-size: .82rem; font-weight: 400; }
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .55rem; padding: .55rem .1rem .35rem; max-height: 38vh; overflow: auto; }

.agent-card { background: linear-gradient(180deg, var(--surface-1, #131a30), var(--surface-0, #0e1426)); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .65rem; transition: border-color var(--t); }
.agent-card:hover { border-color: var(--accent-edge); }
.agent-card > .ac-sum { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .45rem; }
.agent-card > .ac-sum::-webkit-details-marker { display: none; }
.ac-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--good); box-shadow: 0 0 7px var(--good); flex: 0 0 auto; }
.ac-name { font-weight: 600; color: var(--text); text-transform: capitalize; }
.ac-id { color: var(--muted); font-size: .74rem; font-family: ui-monospace, monospace; margin-left: auto; }
.ac-body { margin-top: .5rem; display: flex; flex-direction: column; gap: .45rem; }
.ac-desc { margin: 0; color: var(--text-2); font-size: .84rem; line-height: 1.45; }
.ac-skills { display: flex; flex-wrap: wrap; gap: .3rem; }
.ac-chip { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-edge); border-radius: var(--radius-pill); padding: .08rem .5rem; font-size: .71rem; }
.ac-skilllist { display: flex; flex-direction: column; gap: .35rem; border-top: 1px solid var(--line); padding-top: .45rem; }
.ac-skillrow { display: flex; flex-direction: column; gap: .1rem; }
.ac-skillname { font-size: .77rem; font-weight: 600; color: var(--text-2); }
.ac-skilldesc { font-size: .73rem; color: var(--muted); line-height: 1.4; }
.ac-meta { font-size: .74rem; }
.ac-link { color: var(--accent); text-decoration: none; }
.ac-link:hover { text-decoration: underline; }

.chat-main { display: flex; gap: .8rem; flex: 1 1 0; min-height: 0; }
.chat-wrap { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }

.chat-activity { flex: 0 0 38%; max-width: 460px; display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.act-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
.act-title { font-weight: 600; font-size: .9rem; }
.act-status { font-size: .76rem; color: var(--accent); white-space: nowrap; }
.act-log { flex: 1 1 0; overflow: auto; padding: .4rem .6rem; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .76rem; line-height: 1.5; }
.act-line { display: grid; grid-template-columns: auto auto 1fr; gap: .5rem; padding: .14rem 0; border-bottom: 1px solid rgba(255,255,255,.035); white-space: pre-wrap; word-break: break-word; }
.act-ts { color: var(--muted); }
.act-who { color: var(--accent-2); font-weight: 600; }
.act-msg { color: var(--text-2); }
.act-warning .act-msg { color: var(--warn); }
.act-error .act-msg, .act-critical .act-msg { color: var(--bad); }
.msg.bot.thinking { color: var(--muted); font-style: italic; }

@media (max-width: 860px) {
  .chat-page { height: auto; }
  .chat-main { flex-direction: column; }
  .chat-activity { flex: 0 0 auto; max-width: none; height: 32vh; }
}
.chat-log {
  flex: 1; overflow: auto;
  display: flex; flex-direction: column; gap: .7rem;
  padding: .8rem .3rem;
}
.msg {
  max-width: 78%; padding: .7rem 1rem; border-radius: 14px;
  font-size: .97rem; line-height: 1.5;
  animation: msg-in .2s ease;
  white-space: pre-wrap; /* preserve line breaks in agent replies */
  word-break: break-word;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--accent-soft), rgba(94, 234, 212, 0.06));
  color: var(--text);
  border: 1px solid var(--accent-edge);
}
.msg.bot {
  align-self: flex-start;
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  border: 1px solid var(--line);
}
.msg.bot.intermediate {
  /* Intermediate "thinking out loud" emissions are visibly de-emphasized
     so the eye lands on the final answer first. */
  background: var(--surface-0);
  border-style: dashed;
  opacity: .85;
  font-size: .92rem;
}
.msg.note {
  align-self: center; background: transparent; color: var(--text-2);
  font-size: .92rem; text-align: center; opacity: .9;
  max-width: 90%; padding: .5rem 1rem;
}

/* Speaker-labelled bot bubble — small "Vera ✦" header sits above the
   message body so every reply is unambiguously attributed. */
.msg-row { display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.msg-row.bot-row { max-width: 82%; }
.msg-speaker {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 0 .3rem;
  font-size: .78rem; color: var(--muted);
  font-weight: 500; letter-spacing: .02em;
}
.msg-speaker-glyph { color: var(--accent); font-size: .9rem; }
.msg-speaker-name { color: var(--text-2); }

/* ── Tool-call widget (collapsed by default) ─────────────────────────── */
/* Native <details>/<summary>. Discrete chip when collapsed; expands into
   a card with a Request / Response section. Lives in the same chat flow
   so the user sees the orchestration mid-stream. */
.tool-call {
  align-self: flex-start;
  max-width: 82%;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  animation: msg-in .2s ease;
}
.tool-call[open] {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}
.tool-call-summary {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .75rem;
  cursor: pointer;
  list-style: none;
  color: var(--text-2);
  transition: color var(--t-fast), background var(--t-fast);
  border-radius: var(--radius-sm);
}
.tool-call-summary::-webkit-details-marker { display: none; }
.tool-call-summary::before {
  content: "▸"; color: var(--muted); margin-right: .15rem;
  transition: transform var(--t-fast);
  display: inline-block;
}
.tool-call[open] > .tool-call-summary::before { transform: rotate(90deg); }
.tool-call-summary:hover { color: var(--text); background: var(--surface-1); }
.tool-call-icon { color: var(--accent); font-size: .9rem; }
.tool-call-from, .tool-call-to { color: var(--text-2); font-weight: 500; }
.tool-call-arrow { color: var(--muted); margin: 0 .15rem; }
.tool-call-dur {
  margin-left: auto;
  color: var(--muted); font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.tool-call-body {
  padding: .25rem .85rem .8rem;
  display: flex; flex-direction: column; gap: .4rem;
  border-top: 1px solid var(--line);
  animation: msg-in .15s ease;
}
.tool-call-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
  margin-top: .35rem;
}
.tool-call-label.muted { text-transform: none; letter-spacing: 0; font-weight: 400; font-style: italic; }
.tool-call-message {
  white-space: pre-wrap; word-break: break-word;
  color: var(--text);
  font-size: .92rem; line-height: 1.5;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .55rem .75rem;
}
.tool-call-json {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .82rem;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .55rem .75rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

/* Sub-agent handoff (cassandra/ada). Slimmer than a tool call —
   pure annotation, no expand. */
.agent-transfer {
  align-self: center;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .7rem;
  color: var(--muted);
  font-size: .82rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
}

/* ── Markdown bubble ─────────────────────────────────────────────────── */
/* When the agent's reply is rendered through marked + DOMPurify the
   bubble drops `white-space: pre-wrap` (HTML structure now carries the
   line breaks) and styles the rendered tags for the chat palette. */
.msg.bot.markdown {
  white-space: normal;
}
.msg.bot.markdown > :first-child { margin-top: 0; }
.msg.bot.markdown > :last-child { margin-bottom: 0; }
.msg.bot.markdown p { margin: .35rem 0; }
.msg.bot.markdown h1, .msg.bot.markdown h2, .msg.bot.markdown h3,
.msg.bot.markdown h4 { margin: .9rem 0 .4rem; font-weight: 600; }
.msg.bot.markdown h1 { font-size: 1.15rem; }
.msg.bot.markdown h2 { font-size: 1.05rem; }
.msg.bot.markdown h3 { font-size: 1rem; color: var(--text-2); }
.msg.bot.markdown ul, .msg.bot.markdown ol {
  margin: .35rem 0; padding-left: 1.4rem;
}
.msg.bot.markdown li { margin: .15rem 0; }
.msg.bot.markdown a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-edge); }
.msg.bot.markdown a:hover { text-decoration-color: var(--accent); }
.msg.bot.markdown blockquote {
  margin: .55rem 0; padding: .1rem .85rem;
  border-left: 3px solid var(--accent-edge);
  color: var(--text-2); background: var(--surface-0);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.msg.bot.markdown code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .88em;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .05rem .35rem;
}
.msg.bot.markdown pre {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  overflow-x: auto;
  margin: .55rem 0;
}
.msg.bot.markdown pre code {
  background: transparent; border: 0; padding: 0;
  font-size: .85rem; line-height: 1.5;
  color: var(--text);
}
.msg.bot.markdown table {
  border-collapse: collapse; width: 100%;
  margin: .55rem 0;
  font-size: .9rem;
}
.msg.bot.markdown th, .msg.bot.markdown td {
  text-align: left;
  padding: .4rem .65rem;
  border-bottom: 1px solid var(--line);
}
.msg.bot.markdown th {
  background: var(--surface-0);
  color: var(--text-2);
  font-weight: 600;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
}
.msg.bot.markdown tr:last-child td { border-bottom: 0; }
.msg.bot.markdown hr {
  border: 0; height: 1px;
  background: var(--line-strong);
  margin: .85rem 0;
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0;
  background: rgba(4, 6, 12, 0.78);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 2rem; z-index: 50;
  animation: modal-in .15s ease;
}
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(760px, 100%);
  max-height: 84vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-2);
}
.modal-head { display: flex; align-items: center; gap: 1rem;
  padding: 1.05rem 1.2rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.modal-body { padding: 1.15rem 1.2rem; overflow: auto; }
.modal-body pre { white-space: pre-wrap; word-break: break-word;
  font-family: var(--font); font-size: .95rem; margin: 0; color: var(--text-2); }
.icon-btn { background: transparent; border: 0; color: var(--muted);
  font-size: 1rem; padding: .35rem .55rem; border-radius: 7px;
  transition: color var(--t-fast), background var(--t-fast); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* ── Responsive — sidebar collapses to a top rail on small screens ──── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: .8rem .6rem;
  }
  .brand { padding: .2rem .6rem; }
  .nav-btn {
    width: auto; flex: 1 1 auto; min-width: 0;
    padding: .55rem .7rem; font-size: .9rem;
    border-left: 0; border-bottom: 3px solid transparent;
  }
  .nav-btn[aria-current="true"] {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  .nav-spacer { display: none; }
  .logout { flex: 0 0 auto; }
  .main { padding: 1.2rem 1.2rem 2.5rem; }
}

/* ── Pythia panel — 1h candle high/low predictions ────────────────────
   Scoped to #panel-pythia. Reuses the dashboard's existing palette,
   chip/tab idiom, and gradient cards so the panel blends in with the
   rest of the dashboard. */
.nav-btn .nav-sub {
  font-size: .72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: .04em;
  margin-left: .35rem;
}
.nav-btn[aria-current="true"] .nav-sub { color: var(--accent); }

#panel-pythia .py-watchlist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  padding: .4rem;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin: 0 0 1.2rem;
}
#panel-pythia .py-watchlist-label {
  color: var(--muted); font-size: .82rem;
  padding: 0 .55rem 0 .65rem; letter-spacing: .02em;
}
#panel-pythia .py-chips { display: contents; }
#panel-pythia .py-sym-chip {
  background: transparent; color: var(--text-2);
  border: 0; padding: .5rem .85rem .5rem .75rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .9rem; font-weight: 600; letter-spacing: .04em;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
}
#panel-pythia .py-sym-chip:hover { background: var(--surface-1); color: var(--text); }
#panel-pythia .py-sym-chip[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #052625;
  box-shadow: 0 4px 12px rgba(45, 212, 191, 0.25);
}
#panel-pythia .py-sym-chip[aria-pressed="true"] .py-sym-x { color: rgba(5, 38, 37, 0.55); }
#panel-pythia .py-sym-x { color: var(--muted); font-weight: 400; font-size: .85em; padding-left: .15rem; }
#panel-pythia .py-sym-x:hover { color: var(--bad); }
#panel-pythia .py-sym-add {
  background: transparent; color: var(--muted);
  border: 1px dashed var(--line-strong);
  padding: .45rem .8rem; font-size: .85rem; font-family: inherit;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
#panel-pythia .py-sym-add:hover { color: var(--accent); border-color: var(--accent-edge); }

#panel-pythia .py-refresh-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #052625;
  border: 0;
  padding: .5rem .95rem;
  font-size: .88rem; font-weight: 600;
  font-family: inherit; letter-spacing: .02em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(45, 212, 191, 0.25);
  transition: transform var(--t-fast), box-shadow var(--t), filter var(--t-fast);
}
#panel-pythia .py-refresh-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
#panel-pythia .py-refresh-btn:disabled,
#panel-pythia .py-refresh-btn.working {
  background: linear-gradient(180deg, #4b5563, #374151);
  color: #9ca3af;
  box-shadow: none;
  filter: none;
  cursor: progress;
  opacity: .7;
  transform: none;
}
#panel-pythia .py-refresh-ico {
  display: inline-block;
  font-size: 1rem;
  transition: transform .2s ease;
}
#panel-pythia .py-refresh-btn.working .py-refresh-ico {
  animation: py-spin 1.1s linear infinite;
}
@keyframes py-spin { to { transform: rotate(360deg); } }
#panel-pythia .py-watchlist-spacer { flex: 1; }
#panel-pythia .py-watchlist-meta {
  color: var(--muted); font-size: .78rem;
  padding-right: .55rem; font-variant-numeric: tabular-nums;
}

/* ── Entry monitor heat-map ─────────────────────────────────────────── */
#panel-pythia .py-monitor {
  margin: 0 0 1rem; padding: .8rem .9rem .7rem;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
}
#panel-pythia .py-monitor-head {
  display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap;
}
#panel-pythia .py-monitor-title { font-weight: 700; color: var(--ink); }
#panel-pythia .py-monitor-sub { color: var(--muted); font-size: .8rem; }
#panel-pythia .py-monitor-spacer { flex: 1; }
#panel-pythia .py-monitor-status { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
#panel-pythia .py-mon-voice { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .82rem; cursor: pointer; }
#panel-pythia .py-monitor-grid {
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
}
#panel-pythia .py-mon-tile {
  position: relative; padding: .5rem .55rem .45rem; border-radius: 8px;
  border: 1px solid var(--line); cursor: pointer; transition: transform .08s ease;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  align-items: baseline; column-gap: .3rem;
}
#panel-pythia .py-mon-tile:hover { transform: translateY(-1px); border-color: var(--accent, #ff8a00); }
#panel-pythia .py-mon-sym { grid-column: 1; font-weight: 700; color: #1a1205; font-size: .95rem; }
#panel-pythia .py-mon-arrow { grid-column: 2; grid-row: 1; font-size: .9rem; color: #5a3d00; }
#panel-pythia .py-mon-price { grid-column: 1 / span 2; grid-row: 2; color: #2a1d05; font-size: .82rem; font-variant-numeric: tabular-nums; }
#panel-pythia .py-mon-near { grid-column: 1 / span 2; grid-row: 3; color: #3a2800; font-size: .72rem; font-weight: 600; }
/* Open P&L now lives in the hover tooltip (title), not on the card. */
#panel-pythia .py-mon-rev { box-shadow: inset 0 0 0 2px rgba(34,197,94,.85); }   /* turning-up accent */
#panel-pythia .py-mon-rev .py-mon-arrow { color: #15803d; }
/* Full-card "Predicting" overlay while a prediction runs, and a red-X overlay
   when the last prediction FAILED (so stale numbers are never trusted). */
#panel-pythia .py-mon-refreshing, #panel-pythia .py-mon-failed { position: relative; }
#panel-pythia .py-mon-predicting, #panel-pythia .py-mon-failbox {
  position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
#panel-pythia .py-mon-predicting { background: rgba(12,16,28,.84); color: #dce8ff; }
#panel-pythia .py-pred-spin {
  width: 20px; height: 20px; border-radius: 50%; margin-bottom: 5px;
  border: 2.5px solid rgba(160,190,255,.28); border-top-color: #9fc0ff;
  animation: py-pred-spin .8s linear infinite;
}
@keyframes py-pred-spin { to { transform: rotate(360deg); } }
#panel-pythia .py-pred-label { font-weight: 800; font-size: .9rem; letter-spacing: .04em; }
#panel-pythia .py-pred-reason { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: #9fc0ff; }
#panel-pythia .py-mon-failbox { background: rgba(58,8,8,.92); color: #ffd9d9; cursor: help; }
#panel-pythia .py-fail-x { font-size: 1.8rem; font-weight: 900; color: #ff5252; line-height: 1; }
#panel-pythia .py-fail-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; color: #ffb3b3; margin-top: 3px; }
#panel-pythia .py-mon-blink { animation: py-mon-blink 0.85s steps(2, start) infinite; }

/* Grid Controller Pad — one-time setup guide for the (non-technical) assistant. */
#panel-keymap .gcp-setup {
  margin: .9rem 0; padding: .9rem 1.1rem; border: 1px solid var(--border, #2a3350);
  border-radius: 10px; background: rgba(120,150,255,.06); line-height: 1.6;
}
#panel-keymap .gcp-setup h3 { margin: 0 0 .4rem; font-size: 1rem; }
#panel-keymap .gcp-setup ol { margin: .4rem 0 .4rem 1.25rem; padding: 0; }
#panel-keymap .gcp-setup li { margin: .35rem 0; }
#panel-keymap .gcp-setup ol[type="a"] { margin-top: .3rem; }
#panel-keymap .gcp-setup .gcp-note { color: var(--muted, #8d97b3); font-size: .85rem; margin: .35rem 0; }
@keyframes py-mon-blink { 50% { background: rgba(255,90,0,0.98) !important; } }
#panel-pythia .py-mon-empty { color: var(--muted); font-size: .85rem; padding: .4rem .2rem; grid-column: 1 / -1; }
#panel-pythia .py-monitor-legend { margin: .55rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
#panel-pythia .py-mon-key-rev { color: #22c55e; font-weight: 700; }
#panel-pythia .py-mon-key-fall { color: #ff8a00; font-weight: 700; }

/* Exit monitor — cool (teal) palette so it never reads as the entry strip. */
#panel-pythia .py-exit-tile .py-mon-sym { color: #042f2a; }
#panel-pythia .py-exit-tile .py-mon-arrow { color: #0b3d35; }
#panel-pythia .py-exit-tile .py-mon-price { color: #062c27; }
#panel-pythia .py-exit-tile .py-mon-near { color: #0b4a40; }
#panel-pythia .py-exit-tile:hover { border-color: #0d9488; }
#panel-pythia .py-exit-roll { box-shadow: inset 0 0 0 2px rgba(168,85,247,.9); }   /* rolling-over = exit signal */
#panel-pythia .py-exit-roll .py-mon-arrow { color: #7c3aed; }

/* Jun-17 monitor controls: section expanders + Top-N input. */
#panel-pythia .py-mon-collapse {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .9rem; line-height: 1; padding: 0 .15rem; width: 1.1rem; flex: 0 0 auto;
}
#panel-pythia .py-mon-collapse:hover { color: var(--ink); }
#panel-pythia .py-monitor.py-collapsed .py-mon-rect,
#panel-pythia .py-monitor.py-collapsed .py-monitor-grid,
#panel-pythia .py-monitor.py-collapsed .py-monitor-legend { display: none; }
#panel-pythia .py-mon-topn-label {
  display: inline-flex; align-items: center; gap: .3rem; color: var(--muted);
  font-size: .82rem; font-variant-numeric: tabular-nums;
}
#panel-pythia .py-mon-topn-label input {
  width: 3rem; padding: .15rem .3rem; text-align: center; font: inherit;
  background: var(--surface-0, #0b0f1d); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
}

/* F: the buy-zone box — symbols within 5% of the predicted low (top N). */
#panel-pythia .py-mon-rect {
  margin: 0 0 .6rem; padding: .5rem; border-radius: 9px; min-height: 2.2rem;
  border: 2px dashed var(--accent, #ff8a00); background: rgba(255,138,0,.06);
  display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
}
#panel-pythia .py-mon-rect-empty {
  grid-column: 1 / -1; color: var(--muted); font-size: .82rem;
  padding: .35rem .25rem; align-self: center;
}

/* J: "Room below the high" — distinct indigo palette (not entry, not exit). */
#panel-pythia .py-bh-tile .py-mon-sym { color: #1a1340; }
#panel-pythia .py-bh-tile .py-mon-arrow { color: #312170; }
#panel-pythia .py-bh-tile .py-mon-price { color: #221a52; }
#panel-pythia .py-bh-tile .py-mon-near { color: #2c2168; }
#panel-pythia .py-bh-tile:hover { border-color: #6d5ae0; }
#panel-pythia .py-exit-blink { animation: py-exit-blink 0.85s steps(2, start) infinite; }
@keyframes py-exit-blink { 50% { background: rgba(6,182,212,0.98) !important; } }
#panel-pythia .py-exit-key-roll { color: #a855f7; font-weight: 700; }
#panel-pythia .py-exit-key-rise { color: #0d9488; font-weight: 700; }

/* ── Schwab token expiry: discreet → big (<4h) → full banner (expired) ── */
#panel-pythia .py-token { margin: 0 0 .8rem; }
#panel-pythia .py-token-ok {
  font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .5rem;
}
#panel-pythia .py-token-reauth-sm { color: var(--muted); text-decoration: underline; }
#panel-pythia .py-token-warn {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: .7rem .9rem; border-radius: 10px;
  background: rgba(255,138,0,.14); border: 1px solid rgba(255,138,0,.55);
}
#panel-pythia .py-token-big { font-size: 1.15rem; font-weight: 800; color: #ff8a00; }
#panel-pythia .py-token-reauth {
  font-weight: 700; color: #fff; background: #ff8a00; padding: .35rem .7rem;
  border-radius: 7px; text-decoration: none;
}
#panel-pythia .py-token-expired {
  padding: 1.4rem 1.2rem; border-radius: 12px; text-align: center;
  background: repeating-linear-gradient(45deg, #b91c1c, #b91c1c 14px, #a01010 14px, #a01010 28px);
  border: 3px solid #fde047; box-shadow: 0 0 0 3px rgba(185,28,28,.35);
  animation: py-token-pulse 1.1s ease-in-out infinite;
}
@keyframes py-token-pulse { 50% { box-shadow: 0 0 24px 4px rgba(253,224,71,.55); } }
#panel-pythia .py-token-banner-title { font-size: 1.6rem; font-weight: 900; color: #fff; letter-spacing: .3px; }
#panel-pythia .py-token-banner-sub { margin-top: .5rem; font-size: 1rem; color: #fff; }
#panel-pythia .py-token-expired .py-token-reauth { display: inline-block; margin-top: .2rem; background: #fde047; color: #7a1010; }

/* ── Improvements page: open-issues section ── */
#panel-github .gh-section-head {
  font-weight: 700; color: var(--ink); margin: 1.1rem 0 .5rem; font-size: .95rem;
}
#panel-github .gh-section-head:first-child { margin-top: 0; }
#panel-github .gh-issue-row { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; }
#panel-github .gh-issue-num { color: var(--accent, #ff8a00); font-weight: 700; font-variant-numeric: tabular-nums; }

#panel-pythia .py-focus {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--shadow-1);
  margin: 0 0 1.4rem;
}
#panel-pythia .py-focus-head {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: .55rem 1rem; margin: 0 0 .65rem;
}
#panel-pythia .py-focus-sym {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.45rem; font-weight: 700; letter-spacing: .04em;
  margin: 0;
}
#panel-pythia .py-focus-meta { color: var(--muted); font-size: .82rem; margin-left: auto; }
/* Feature 9a: rolling "trust" badge in the focus meta line. */
#panel-pythia .py-trust-badge { font-weight: 700; }
#panel-pythia .py-trust-badge .py-trust-sub { font-weight: 400; opacity: .75; }
/* Item 8b: per-side high-vs-low green-rate trend, beside the 9a trust badge. */
#panel-pythia .py-hl-trend { font-weight: 600; }
#panel-pythia .py-hl-trend span { font-weight: 700; }

#panel-pythia .py-chart-wrap {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .35rem .25rem 0;
}
#panel-pythia .py-chart { display: block; width: 100%; height: auto; }
#panel-pythia .py-hover { cursor: help; }

#panel-pythia .py-legend {
  display: flex; flex-wrap: wrap; gap: 1.1rem;
  padding: .55rem .25rem .15rem;
  font-size: .75rem; color: var(--muted);
}
#panel-pythia .py-legend .sw {
  display: inline-block; width: .85rem; height: .55rem;
  vertical-align: middle; border-radius: 2px; margin-right: .3rem;
}
/* Iter 15: after-hours toggle (24h-predictions checkbox) in the
   watchlist toolbar. Sits next to the refresh button. */
#panel-pythia .py-after-hours {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--muted);
  padding: .15rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  cursor: pointer;
  user-select: none;
  margin-right: .6rem;
}
#panel-pythia .py-after-hours:hover { color: var(--text); border-color: var(--accent-edge); }
#panel-pythia .py-after-hours input[type="checkbox"] {
  width: 1rem; height: 1rem; accent-color: var(--accent);
  margin: 0;
}
#panel-pythia .py-after-hours:has(input:checked) {
  color: var(--accent);
  border-color: var(--accent-edge);
  background: var(--accent-soft);
}

/* iter 13: legend swatches mirror the in-chart band colors.
   Pending is now violet (was teal — same as pass, indistinguishable).
   Opacity bumped to 0.22 fill / 0.90 edge to match the chart bands.    */
/* PR-4: 3-color band swatches matching the in-chart green/yellow/red bands. */
#panel-pythia .py-legend .sw.band-green   { background: rgba(74,222,128,0.24);  border: 1px dashed rgba(74,222,128,0.95); }
#panel-pythia .py-legend .sw.band-yellow  { background: rgba(251,191,36,0.22);  border: 1px dashed rgba(251,191,36,0.92); }
#panel-pythia .py-legend .sw.band-red     { background: rgba(248,113,113,0.24); border: 1px dashed rgba(248,113,113,0.92); }
#panel-pythia .py-legend .sw.band-pending { background: rgba(167,139,250,0.22); border: 1px dashed rgba(167,139,250,0.90); }
#panel-pythia .py-legend .sw.candle-up   { background: rgba(74,222,128,0.32);  border: 1px solid #4ade80; }
#panel-pythia .py-legend .sw.candle-down { background: rgba(248,113,113,0.32); border: 1px solid #f87171; }
/* Buy-signal TRUST badge (dip-buy expectancy verdict). Word-coded for the
   blind-friendly header; the figures appear only with Audit numbers on. */
#panel-pythia .py-trust { font-weight: 800; }
#panel-pythia .py-trust-proven    { color: var(--good); }
#panel-pythia .py-trust-promising { color: var(--warn); }
#panel-pythia .py-trust-unproven  { color: var(--muted); }
#panel-pythia .py-trust-noedge    { color: var(--bad); }
/* Always-visible directional hit-rate (not audit-gated) — the plain accuracy
   of the daily directional call. `.pending` = calls made but not graded yet. */
#panel-pythia .py-sig-hitrate { font-weight: 800; color: var(--text); }
#panel-pythia .py-sig-hitrate.pending { font-weight: 600; color: var(--muted); }

/* PR-4: the collapsible daily-candle chart panel (default hidden via the
   [hidden] attribute, shown only when the "Daily candles" toggle is on). */
#panel-pythia .py-daily-chart-panel {
  margin-top: .6rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .35rem .25rem .25rem;
}
#panel-pythia .py-daily-chart-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
  padding: .15rem .35rem .35rem;
}
#panel-pythia .py-daily-chart-title {
  font-size: .82rem; font-weight: 600; color: var(--text);
}
#panel-pythia .py-daily-chart-rth {
  font-size: .7rem; font-weight: 600; color: var(--muted);
  letter-spacing: .01em; white-space: nowrap;
}
#panel-pythia .py-daily-chart-sub {
  font-size: .72rem; color: var(--muted);
}

/* Hover tooltip */
#panel-pythia .py-tooltip {
  position: absolute; max-width: 420px; min-width: 280px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--accent-edge);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem .7rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  pointer-events: none; z-index: 10;
  font-size: .85rem;
  animation: py-tt-in .12s ease;
}
/* When pinned from a history-table row, the tooltip is positioned in
   viewport coordinates so it can appear next to the clicked row (outside
   the chart wrap). Raised z-index keeps it above the table. */
#panel-pythia .py-tooltip.py-tooltip-fixed { position: fixed; z-index: 1000; }
@keyframes py-tt-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
#panel-pythia .py-tt-head { display: flex; align-items: center; gap: .5rem; margin: 0 0 .45rem; }
#panel-pythia .py-tt-sym { font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: .04em; color: var(--text); }
#panel-pythia .py-tt-time { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
#panel-pythia .py-tt-made {
  color: var(--accent);
  font-size: .76rem;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  margin: 0 0 .5rem;
  letter-spacing: .02em;
}
#panel-pythia .py-tt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: 0 0 .5rem; }
#panel-pythia .py-tt-grid > div {
  display: flex; justify-content: space-between;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .25rem .55rem;
  font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums;
}
#panel-pythia .py-tt-grid .lbl { color: var(--muted); font-size: .72rem; }
#panel-pythia .py-tt-grid .val { font-weight: 600; }
#panel-pythia .py-tt-grid .val.up   { color: var(--good); }
#panel-pythia .py-tt-grid .val.down { color: var(--bad); }
#panel-pythia .py-tt-reasons {
  margin: 0; color: var(--text-2); font-size: .82rem; line-height: 1.5;
  padding-top: .35rem; border-top: 1px dashed var(--line);
  white-space: pre-wrap;
}
#panel-pythia .py-tt-reasons-label {
  display: block; color: var(--muted); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .07em;
  margin: .35rem 0 .2rem;
}

#panel-pythia .py-history-head {
  display: flex; align-items: baseline; gap: .6rem;
  margin: 0 0 .55rem;
}
#panel-pythia .py-history-head h2 { margin: 0; font-size: 1.05rem; }
#panel-pythia .py-hist-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: .88rem;
}
#panel-pythia .py-hist-table th,
#panel-pythia .py-hist-table td {
  padding: .55rem .85rem; text-align: left;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
#panel-pythia .py-hist-table th {
  background: var(--bg-2); color: var(--muted);
  font-weight: 500; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .07em;
}
#panel-pythia .py-hist-table tr:last-child td { border-bottom: 0; }

/* History rows are clickable — they pin the same rich tooltip the chart
   shows on a prediction click. The whole row (including the stacked
   high/low lines) highlights on hover with a left accent bar. */
#panel-pythia .py-hist-row { cursor: pointer; transition: background .12s ease, box-shadow .12s ease; }
#panel-pythia .py-hist-table tbody tr.py-hist-row:hover {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
/* Merged High/Low column: the high value sits on top, the low directly
   beneath, inside one cell (so a record stays a single hoverable row). */
#panel-pythia .py-hl-cell { padding-top: .4rem; padding-bottom: .4rem; }
#panel-pythia .py-hl-line {
  display: flex; align-items: baseline; gap: .4rem;
  font-variant-numeric: tabular-nums; line-height: 1.45;
}
#panel-pythia .py-hl-line + .py-hl-line { margin-top: .1rem; }
#panel-pythia .py-hl-tag {
  display: inline-block; min-width: .9rem;
  font-size: .62rem; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); text-transform: uppercase;
}
#panel-pythia .py-hl-num { font-weight: 600; }
#panel-pythia .py-hl-num.up   { color: var(--good); }
#panel-pythia .py-hl-num.down { color: var(--bad); }
/* Sublabel under each merged column header ("high · low") */
#panel-pythia .py-hl-th { white-space: nowrap; }
#panel-pythia .py-hl-th-sub {
  display: block; margin-top: .1rem;
  font-size: .6rem; font-weight: 500; letter-spacing: .02em;
  color: var(--muted); text-transform: none; opacity: .75;
}
#panel-pythia .py-hist-pill {
  font-size: .68rem; padding: .15rem .55rem;
  border-radius: var(--radius-pill);
  font-weight: 600; letter-spacing: .04em;
  border: 1px solid; text-transform: uppercase;
}
/* Per-side outcome pills (Jun-18): High stacked above Low, each with its own
   color + error % inline. */
#panel-pythia .py-hist-outcome { white-space: nowrap; }
#panel-pythia .py-hist-side {
  display: block; width: max-content; margin: 1px 0; padding: .12rem .4rem;
  font-size: .66rem; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
/* iter 13: pending = violet (was teal — chart pass was also teal,
   making the two visually indistinguishable). */
#panel-pythia .py-hist-pill.pending {
  background: rgba(167, 139, 250, 0.12); color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.45);
}
/* 3-color grade: green <=5% / yellow <=15% of the realised RANGE / red, per
   side (high and low graded independently — no combined/worse grade). Replaces the
   old vol-scaled 5-level vocabulary (bullseye/wide_pass/near_miss/bad_fail). */
#panel-pythia .py-hist-pill.green {
  background: rgba(74, 222, 128, 0.14); color: var(--good);
  border-color: rgba(74, 222, 128, 0.55);
  font-weight: 700;
}
#panel-pythia .py-hist-pill.yellow {
  background: rgba(251, 191, 36, 0.14); color: var(--warn);
  border-color: rgba(251, 191, 36, 0.55);
}
#panel-pythia .py-hist-pill.red {
  background: rgba(248, 113, 113, 0.14); color: var(--bad);
  border-color: rgba(248, 113, 113, 0.55);
  font-weight: 700;
}
/* Directional-signals table — reuses the .py-hist-table shell; only the call
   arrow, hit/miss mark, and dip-buy R cells need their own color. */
#panel-pythia .py-sig-intro { color: var(--muted); font-size: .82rem; margin: .15rem 0 .55rem; }
#panel-pythia .py-sig-call { font-weight: 700; white-space: nowrap; }
#panel-pythia .py-sig-call.up { color: var(--good); }
#panel-pythia .py-sig-call.down { color: var(--bad); }
#panel-pythia .py-sig-hit { text-align: center; font-weight: 700; color: var(--muted); }
#panel-pythia .py-sig-hit.hit { color: var(--good); }
#panel-pythia .py-sig-hit.miss { color: var(--bad); }
#panel-pythia .py-sig-spot { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#panel-pythia .py-sig-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
#panel-pythia .py-sig-r.hit { color: var(--good); font-weight: 700; }
#panel-pythia .py-sig-r.miss { color: var(--bad); font-weight: 700; }
/* Directional daily-signal chart glyph: ▲ long (low_first/low_locked) /
   ▼ short (high_first/high_locked); the .py-ft-lock tick is the floor/ceiling
   drawn under/over the *_locked variants (the realised-extreme invalidation). */
#panel-pythia .py-ft-tri { pointer-events: none; }
#panel-pythia .py-ft-lock { pointer-events: none; }
/* Bottom-of-page expanders: collapsed shows the table's stats in the summary,
   expanded reveals the table. Default collapsed (no `open` attribute). */
#panel-pythia .py-expander { margin-top: 1.25rem; border-top: 1px solid rgba(255,255,255,0.08); padding-top: .35rem; }
#panel-pythia .py-expander > summary.py-exp-summary {
  cursor: pointer; list-style: none; display: flex; flex-wrap: wrap;
  align-items: baseline; gap: .35rem 1rem; padding: .4rem 0;
}
#panel-pythia .py-expander > summary.py-exp-summary::-webkit-details-marker { display: none; }
#panel-pythia .py-exp-title { font-size: 1.05rem; font-weight: 700; }
#panel-pythia .py-exp-title::before { content: '\25B8\00a0'; color: var(--muted); font-weight: 700; }
#panel-pythia .py-expander[open] > summary .py-exp-title::before { content: '\25BE\00a0'; }
#panel-pythia .py-exp-stats { color: var(--muted); font-size: .85rem; font-weight: 400; }
#panel-pythia .py-exp-stats:empty { display: none; }
/* Collapsed → show the table's stats in the summary; expanded → hide them and
   reveal the table. */
#panel-pythia .py-expander[open] > summary .py-exp-stats { display: none; }
/* Outcome-pill legend. Renamed to .py-pill-legend so it doesn't collide
   with the chart-band legend further up the page that already uses
   .py-legend. Collapsed by default; user expands to learn the 3-color
   grade (green / yellow / red). */
#panel-pythia .py-pill-legend {
  margin: 0 0 .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  font-size: .82rem;
}
#panel-pythia .py-pill-legend > summary {
  cursor: pointer; padding: .5rem .9rem;
  color: var(--muted); font-weight: 500;
  list-style: revert;
}
#panel-pythia .py-pill-legend > summary:hover { color: var(--ink); }
#panel-pythia .py-pill-legend[open] > summary { color: var(--ink); }
#panel-pythia .py-pill-legend-grid {
  display: grid; gap: .45rem .9rem;
  padding: .55rem .9rem .25rem;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  border-top: 1px solid var(--line);
}
#panel-pythia .py-pill-legend-item { display: contents; }
#panel-pythia .py-pill-legend-item > span:first-child {
  /* The pill itself */
  justify-self: start;
  min-width: 5.5rem; text-align: center;
}
#panel-pythia .py-pill-legend-item > span:last-child {
  color: var(--muted); line-height: 1.35;
}
/* Chart-tooltip "why this score" breakdown — the 3-color grade.
   Three rows (high, low, overall): each shows the green/yellow/red color
   plus the error as a % of the realised range (overall = the worse side).
   Plus a worked computation and a one-line plain-English sentence. All values
   are populated from the resolver's per_prediction_outcomes. */
.py-tooltip .py-tt-grade {
  margin: .45rem 0 0; padding: .45rem .55rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line); border-radius: 6px;
  font-size: .78rem;
}
.py-tooltip .py-tt-grade-side {
  display: grid; grid-template-columns: 2.6rem 1fr;
  gap: .15rem .55rem; align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.py-tooltip .py-tt-grade-side .lbl {
  color: var(--muted); font-size: .72rem;
}
/* Per-side / range grade value, colored by the 3-color grade. */
.py-tooltip .py-tt-grade-side .num.green  { color: var(--good); }
.py-tooltip .py-tt-grade-side .num.yellow { color: var(--warn); }
.py-tooltip .py-tt-grade-side .num.red    { color: var(--bad); }
.py-tooltip .py-tt-grade-math {
  margin: .35rem 0 0; padding: .4rem .55rem;
  background: rgba(148, 163, 184, 0.08);
  border-left: 2px solid var(--accent, #ff8a00); border-radius: 0 4px 4px 0;
  color: var(--text); font-size: .72rem; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Wrap, never clip — the tooltip is pointer-events:none so a horizontal
     scrollbar would be unreachable and hide the end of each line. The full
     calculation must always be visible. */
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.py-tooltip .py-tt-grade-why {
  margin-top: .25rem; color: var(--muted); line-height: 1.35;
}

#panel-pythia .py-pill-legend-foot {
  margin: .35rem 0 .25rem;
  padding: .55rem .9rem .55rem;
  color: var(--muted); font-size: .78rem; line-height: 1.45;
  border-top: 1px solid var(--line);
}

/* Score formula + worked example shown at the top of the outcome legend. */
#panel-pythia .py-formula-block {
  padding: .25rem .9rem .15rem;
  color: var(--muted); font-size: .8rem; line-height: 1.5;
}
#panel-pythia .py-formula-block p { margin: .35rem 0; }
#panel-pythia .py-formula {
  margin: .5rem 0; padding: .6rem .8rem;
  background: var(--panel-2, rgba(255,255,255,.03));
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); font-size: .82rem; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre; overflow-x: auto;
}
#panel-pythia .py-formula sub { font-size: .72em; }
#panel-pythia .py-formula sup { font-size: .72em; }
#panel-pythia .py-formula-table {
  margin: .4rem 0 .5rem; border-collapse: collapse; font-size: .78rem;
}
#panel-pythia .py-formula-table th {
  text-align: right; padding: .15rem .6rem .15rem 0; color: var(--muted); white-space: nowrap;
}
#panel-pythia .py-formula-table td {
  text-align: center; padding: .15rem .55rem; color: var(--ink);
  font-variant-numeric: tabular-nums; border-left: 1px solid var(--line);
}
#panel-pythia .py-worked-example {
  padding: .55rem .8rem; border-left: 3px solid var(--accent, #ff8a00);
  background: rgba(255,138,0,.06); border-radius: 0 6px 6px 0; color: var(--ink);
}

/* Discreet per-row delete button. Faint until you hover the row, so it
   doesn't compete with the data; turns red on direct hover so the
   destructive intent is clear. */
#panel-pythia .py-hist-del-cell {
  width: 1.6rem; padding: .25rem .35rem; text-align: center;
}
#panel-pythia .py-hist-del-btn {
  background: transparent; border: 0;
  color: var(--muted); opacity: .35;
  font-size: 1.05rem; line-height: 1; padding: .15rem .35rem;
  border-radius: 4px; cursor: pointer;
  transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}
#panel-pythia .py-hist-table tr:hover .py-hist-del-btn { opacity: .85; }
#panel-pythia .py-hist-del-btn:hover {
  opacity: 1; color: var(--bad);
  background: rgba(248, 113, 113, 0.10);
}
#panel-pythia .py-hist-del-btn:disabled {
  opacity: .45; cursor: wait; color: var(--muted); background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ── Helios — price targets panel ───────────────────────────────────── */
#panel-helios .py-watchlist {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  padding: .4rem;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin: 0 0 1rem;
}
/* Master circuit breaker — the one switch that halts the whole engine
   (streams dropped, no recomputes, no LLM calls, no orders). Deliberately
   loud and word-coded (ON/OFF in the button text) for screen readers. */
#panel-helios .hx-breaker {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  padding: .45rem .7rem;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin: 0 0 1rem;
}
#panel-helios .hx-breaker-label { font-weight: 800; font-size: .82rem; }
#panel-helios .hx-breaker-btn {
  font: inherit; font-weight: 800; font-size: .8rem;
  padding: .25rem .85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--good);
  color: var(--good);
  background: transparent;
  cursor: pointer;
}
#panel-helios .hx-breaker-btn.off {
  border-color: var(--bad);
  color: var(--bad);
  background: rgba(248, 113, 113, .08);
}
#panel-helios .hx-breaker-btn:disabled { opacity: .55; cursor: wait; }
#panel-helios .hx-breaker-note { font-size: .75rem; }
#panel-helios .py-watchlist-label {
  color: var(--muted); font-size: .82rem;
  padding: 0 .55rem 0 .65rem; letter-spacing: .02em;
}
#panel-helios .py-chips { display: contents; }
#panel-helios .py-sym-chip {
  background: transparent; color: var(--text-2);
  border: 0; padding: .5rem .85rem .5rem .75rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .9rem; font-weight: 600; letter-spacing: .04em;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
}
#panel-helios .py-sym-chip:hover { background: var(--surface-1); color: var(--text); }
#panel-helios .py-sym-x { color: var(--muted); font-weight: 400; font-size: .85em; padding-left: .15rem; }
#panel-helios .py-sym-x:hover { color: var(--bad); }
#panel-helios .py-sym-add {
  background: transparent; color: var(--muted);
  border: 1px dashed var(--line-strong);
  padding: .45rem .8rem; font-size: .85rem; font-family: inherit;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
#panel-helios .py-sym-add:hover { color: var(--accent); border-color: var(--accent-edge); }
#panel-helios .py-watchlist-spacer { flex: 1; }
#panel-helios .py-watchlist-meta {
  color: var(--muted); font-size: .78rem;
  padding-right: .55rem; font-variant-numeric: tabular-nums;
}
#panel-helios .hx-account {
  display: flex; flex-wrap: wrap; gap: 1.4rem;
  padding: .75rem 1rem;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 1.2rem;
}
#panel-helios .hx-stat { display: inline-flex; flex-direction: column; gap: .15rem; }
#panel-helios .hx-stat-label {
  color: var(--muted); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .07em;
}
#panel-helios .hx-stat-val {
  font-size: 1.05rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#panel-helios .py-history-head {
  display: flex; align-items: baseline; gap: .7rem;
  margin: 1.2rem 0 .5rem;
}
#panel-helios .py-history-head h2 { margin: 0; font-size: 1.02rem; }
#panel-helios .py-hist-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 1rem;
  font-size: .88rem;
}
#panel-helios .py-hist-table th,
#panel-helios .py-hist-table td {
  padding: .55rem .85rem; text-align: left;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
#panel-helios .py-hist-table th {
  background: var(--bg-2); color: var(--muted);
  font-weight: 500; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .07em;
}
#panel-helios .py-hist-table tr:last-child td { border-bottom: 0; }
#panel-helios .py-hist-pill {
  font-size: .68rem; padding: .15rem .55rem;
  border-radius: var(--radius-pill);
  font-weight: 600; letter-spacing: .04em;
  border: 1px solid; text-transform: uppercase;
}
#panel-helios .py-hist-pill.pass {
  background: rgba(74, 222, 128, 0.10); color: var(--good);
  border-color: rgba(74, 222, 128, 0.45);
}
#panel-helios .py-hist-pill.mixed {
  background: rgba(251, 191, 36, 0.10); color: var(--warn);
  border-color: rgba(251, 191, 36, 0.45);
}
#panel-helios .py-hist-pill.fail {
  background: rgba(248, 113, 113, 0.10); color: var(--bad);
  border-color: rgba(248, 113, 113, 0.45);
}
#panel-helios .py-hist-pill.pending {
  background: rgba(167, 139, 250, 0.12); color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.45);
}
#panel-helios .up   { color: var(--good); }
#panel-helios .down { color: var(--bad); }
#panel-helios .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ── Helios trades chart ─────────────────────────────────────────────── */
#panel-helios .hx-chart-wrap {
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .8rem .4rem;
  margin: 0 0 1.2rem;
}
#panel-helios .hx-chart-wrap svg { display: block; width: 100%; height: auto; color: var(--muted); }
#panel-helios .hx-grid { stroke: var(--line); stroke-dasharray: 3 4; }
#panel-helios .hx-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
#panel-helios .hx-equity-line { fill: none; stroke: var(--accent); stroke-width: 1.8; }
#panel-helios .hx-equity-area { fill: rgba(45, 212, 191, 0.08); stroke: none; }
#panel-helios .hx-fill-buy  { fill: var(--good); stroke: var(--surface-0); stroke-width: 1.2; cursor: pointer; }
#panel-helios .hx-fill-sell { fill: var(--bad);  stroke: var(--surface-0); stroke-width: 1.2; cursor: pointer; }
#panel-helios .hx-chart-legend {
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  padding: .35rem .2rem 0; font-size: .78rem; color: var(--muted);
}
#panel-helios .hx-chart-legend .sw {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: .3rem; vertical-align: -1px;
}
#panel-helios .hx-sw-equity { background: var(--accent); }
#panel-helios .hx-sw-buy { background: var(--good); }
#panel-helios .hx-sw-sell { background: var(--bad); }
#panel-helios .hx-periods { display: inline-flex; gap: .25rem; }
#panel-helios .hx-period {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .25rem .6rem; font-size: .78rem; font-family: inherit; cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
#panel-helios .hx-period:hover { color: var(--accent); border-color: var(--accent-edge); }
#panel-helios .hx-period[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #052625; border-color: transparent; font-weight: 600;
}

/* ── Symbol tape, activity feed, latency widget ──────────────────────── */
#panel-helios .hx-source {
  flex-basis: 100%; font-size: .72rem; color: var(--muted); opacity: .85;
  padding-top: .15rem; font-style: italic;
}
#panel-helios .hx-price-line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
#panel-helios .hx-tick { fill: #93c5fd; opacity: .75; cursor: pointer; }
#panel-helios .hx-target-line { stroke: var(--good); stroke-width: 1.2; stroke-dasharray: 6 4; }
#panel-helios .hx-stop-line { stroke: var(--bad); stroke-width: 1.2; stroke-dasharray: 2 4; }
#panel-helios .hx-target-label { fill: var(--good); }
#panel-helios .hx-stop-label { fill: var(--bad); }
#panel-helios .hx-sw-price { background: var(--accent); }
#panel-helios .hx-sw-tick { background: #93c5fd; }
#panel-helios .hx-sw-target { background: var(--good); }
#panel-helios .hx-sw-stop { background: var(--bad); }
#panel-helios .hx-activity {
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .35rem .6rem;
  margin: 0 0 1.2rem;
  max-height: 26rem;
  overflow-y: auto;
}
#panel-helios .hx-act-row {
  display: flex; align-items: baseline; gap: .6rem;
  padding: .4rem .25rem;
  border-bottom: 1px solid var(--line);
  font-size: .85rem; line-height: 1.45;
}
#panel-helios .hx-act-row:last-child { border-bottom: 0; }
#panel-helios .hx-act-time { color: var(--muted); font-size: .75rem; white-space: nowrap; }
#panel-helios .hx-act-badge { flex-shrink: 0; min-width: 5.2rem; text-align: center; }
#panel-helios .py-hist-pill.info {
  background: rgba(147, 197, 253, 0.12); color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.45);
}
#panel-helios .hx-act-body { color: var(--text-2); }
#panel-helios .hx-act-body b { font-weight: 600; }
#panel-helios .hx-act-link { color: var(--accent); text-decoration: none; }
#panel-helios .hx-act-link:hover { text-decoration: underline; }
#panel-helios .hx-latency { margin: 0 0 1.2rem; }

/* ── Helios engine config section ────────────────────────────────────── */
#panel-helios .hx-config {
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  margin: 0 0 1.2rem;
}
#panel-helios .hx-knobs {
  display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end;
  padding: .6rem 0;
}
#panel-helios .hx-knob { display: flex; flex-direction: column; gap: .25rem; }
#panel-helios .hx-knob-label { font-size: .72rem; color: var(--muted); }
#panel-helios .hx-knob-input {
  width: 11rem; padding: .35rem .5rem;
  background: var(--surface-1); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .85rem;
}
#panel-helios .hx-knob-input:focus { outline: none; border-color: var(--accent-edge); }

/* ── Helios L2 / book-imbalance strip ────────────────────────────────── */
#panel-helios .hx-l2 {
  padding: .55rem .2rem .2rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
}
#panel-helios .hx-l2-label { font-size: .8rem; color: var(--text-2); }
#panel-helios .hx-l2-chips { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
#panel-helios .hx-l2-chip {
  font-size: .75rem; padding: .12rem .5rem; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-1);
  font-variant-numeric: tabular-nums;
}
#panel-helios .hx-l2-chip.up   { color: var(--good); border-color: rgba(74,222,128,0.4); }
#panel-helios .hx-l2-chip.down { color: var(--bad);  border-color: rgba(248,113,113,0.4); }
#panel-helios .hx-l2-chip b { font-weight: 600; margin-right: .15rem; }
