:root {
  /* Code Assistant = Blue (also the pre-login default) */
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --border: #2a2f3a;
  --text: #e6e8ec; --muted: #9aa3b2; --accent: #5b8cff; --accent2: #3b6fe0;
  --accent-soft: #1b2236; --on-accent: #ffffff; --user: #24303f; --ok: #3fb950; --warn: #d29922;
  /* Fixed per-assistant identity colors (the switcher dots use these regardless of active theme) */
  --a-atlas: #5b8cff; --a-prod_debug: #a978ff; --a-staging_debug: #e6a94d; --a-velocity: #6366f1;
}
/* Per-assistant color profiles — tint the WHOLE UI (bg, panels, borders, bubbles) + accent, so each
   assistant is unmistakable at a glance. --on-accent keeps text legible on accent-filled buttons. */
body[data-theme="prod_debug"] {   /* Violet */
  --bg: #120f19; --panel: #1a1526; --panel2: #241d34; --border: #352a49;
  --accent: #a978ff; --accent2: #8b5cf6; --accent-soft: #291f3d; --on-accent: #ffffff; --user: #2a2440;
}
body[data-theme="staging_debug"] {   /* Amber / warm */
  --bg: #15120b; --panel: #1f1a11; --panel2: #2a2316; --border: #40351f;
  --accent: #e6a94d; --accent2: #c98a3a; --accent-soft: #33290f; --on-accent: #241606; --user: #322815;
}
body[data-theme="velocity"] {   /* Indigo — the pipeline */
  --bg: #111319; --panel: #181a22; --panel2: #1f2230; --border: #343863;
  --accent: #6366f1; --accent2: #4f46e5; --accent-soft: #23264d; --on-accent: #ffffff; --user: #262a48;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

/* Login */
.login { height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 44px; text-align: center; max-width: 420px; }
.login-card .logo { font-size: 40px; }
.login-card h1 { margin: 6px 0 2px; }
.login-card p { color: var(--muted); }
.gbtn { display: inline-block; margin: 18px 0 8px; padding: 11px 22px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; }
.gbtn:hover { background: var(--accent2); }
.fine { font-size: 12px; }

/* App layout */
.app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px; gap: 12px; min-height: 0; overflow: hidden; }
.brand { font-weight: 700; font-size: 18px; }
.new-chat { background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; cursor: pointer; font-weight: 600; }
.new-chat:hover { border-color: var(--accent); }
.conv-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.conv { padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--muted);
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv:hover { background: var(--panel2); color: var(--text); }
.conv.active { background: var(--panel2); color: var(--text); }
.user { position: relative; border-top: 1px solid var(--border); padding-top: 10px; }
.user-btn { width: 100%; display: flex; align-items: center; gap: 8px; background: transparent;
  border: 1px solid transparent; border-radius: 10px; padding: 7px 8px; cursor: pointer;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; }
.user-btn:hover { background: var(--panel2); border-color: var(--border); }
.user-btn img { width: 26px; height: 26px; border-radius: 50%; }
.user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { color: var(--muted); font-size: 11px; }
.user-menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); display: flex; flex-direction: column; }
.user-menu a { padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.user-menu a:hover { background: var(--panel); }
.um-head { padding: 4px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text); display: flex; flex-direction: column; }
.um-head span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 24px;
  border-bottom: 1px solid var(--border); background: var(--panel); }
.repo-label { color: var(--muted); font-size: 13px; }
.repo-select { background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 14px; }
.repo-select:focus { outline: none; border-color: var(--accent); }
.repo-hint { color: var(--muted); font-size: 12px; margin-left: 4px; }
.code-controls { display: flex; align-items: center; gap: 10px; min-width: 0; }
.answer-label { margin-left: 6px; }

/* Assistant switcher (top-right): a prominent dropdown — Code / Prod Debug / Kitchen Debug */
.assistant-switch { position: relative; margin-left: auto; flex: none; }
.asw-toggle { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft);
  color: var(--text); border: 1.5px solid var(--accent); border-radius: 10px; padding: 8px 14px;
  cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; }
.asw-toggle:hover { filter: brightness(1.12); }
.asw-toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.asw-toggle .caret { color: var(--accent); font-size: 11px; margin-left: 2px; }
.asw-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 210px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,.5); }
.asw-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; color: var(--text); font-size: 14px; }
.asw-item:hover { background: var(--panel); }
.asw-item.active { background: var(--accent-soft); }
.asw-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.asw-item[data-key="atlas"] .dot { background: var(--a-atlas); }
.asw-item[data-key="prod_debug"] .dot { background: var(--a-prod_debug); }
.asw-item[data-key="staging_debug"] .dot { background: var(--a-staging_debug); }
.asw-item[data-key="velocity"] .dot { background: var(--a-velocity); }
/* Velocity composer controls: repo picker + base field + mode picker (+ CI toggle) — its own row
   directly above the composer (not the top toolbar); card-wrapped like .velocity-progress/.gate-card
   so it reads as a distinct, intentional control group rather than bare floating controls. */
.velocity-controls { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap;
  max-width: 820px; margin: 0 auto 10px; padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; }
.seg-toggle { display: inline-flex; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px; }
.seg-btn { padding: 6px 12px; background: transparent; color: var(--muted); border: none;
  border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.seg-btn.active { background: var(--accent); color: var(--on-accent); }
.seg-btn:not(.active):hover { color: var(--text); }
.base-input { width: 150px; }
/* In-chat pipeline gate card (confirm intent / safety sign-off / feedback) + run controls */
.gate-card { max-width: 820px; margin: 8px auto; padding: 12px 16px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); background: var(--panel); border-radius: 10px; }
.gate-card .gate-head { font-weight: 700; margin-bottom: 6px; color: var(--accent); }
.gate-card .gate-q { color: var(--muted); font-size: 13px; margin: 8px 0 3px; }
.gate-card textarea { width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; font: inherit; min-height: 54px; }
.gate-card textarea:focus { outline: none; border-color: var(--accent); }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gate-btn { padding: 7px 14px; background: var(--accent); color: var(--on-accent); border: none;
  border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; }
.gate-btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.gate-btn:hover { filter: brightness(1.1); }
.gate-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Destructive gate actions (Abort / Reject) read clearly as "stop", not as a primary choice. */
.gate-btn.danger { background: transparent; color: #ef6b6b; border: 1px solid rgba(239,107,107,.5); }
.gate-btn.danger:hover { background: rgba(239,107,107,.13); filter: none; }
/* Keep gate-prompt markdown headings as compact sub-labels — not full page H2s that dwarf the card. */
.gate-card .gate-prompt h1, .gate-card .gate-prompt h2, .gate-card .gate-prompt h3 {
  font-size: 14px; font-weight: 700; margin: 12px 0 4px; line-height: 1.3; }
.gate-card .gate-prompt h1:first-child, .gate-card .gate-prompt h2:first-child,
.gate-card .gate-prompt h3:first-child { margin-top: 0; }
.gate-card .gate-prompt p { margin: 4px 0; }

/* ── Changed-files tree (gate prompt + persisted result message) ── */
.file-tree, .file-tree ul { list-style: none; margin: 2px 0; padding: 0; }
.file-tree .file-tree { padding-left: 12px; margin: 2px 0 2px 5px; border-left: 1px solid var(--border); }
.file-tree { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.7; }
.ft-dir-label { color: var(--accent); font-weight: 600; }
.ft-file { color: var(--muted); }
.ft-file::before { content: "– "; color: var(--border); }
.ft-more { color: var(--muted); font-size: 12px; font-style: italic; margin-top: 4px; }

/* ── Velocity run progress: persistent pipeline stepper + spinner + elapsed timer ── */
.velocity-progress { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; margin: 8px 0; }
.velocity-progress .stage-track { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 11px; font-size: 12px; color: var(--muted); }
.stg { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 20px;
  background: var(--panel2); border: 1px solid var(--border); white-space: nowrap; }
.stg .stg-ico { font-size: 10px; line-height: 1; }
.stg.done { color: var(--ok); }
.stg.done .stg-ico { color: var(--ok); }
.stg.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.stg.on .stg-ico { animation: atlas-pulse 1.2s ease-in-out infinite; }
.stg-sep { color: var(--muted); opacity: .45; }
.v-status { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.v-status .v-status-text { font-style: italic; color: var(--muted); animation: none; }
.v-spin { width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid var(--border); border-top-color: var(--accent); animation: v-rot .8s linear infinite; }
@keyframes v-rot { to { transform: rotate(360deg); } }
.v-elapsed { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.v-stop-btn { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 2px 7px; font-size: 12px; line-height: 1.6; cursor: pointer; }
.v-stop-btn:hover { border-color: #ef6b6b; color: #ef6b6b; }

/* ── Velocity live pipeline log console ── */
.v-console { margin-top: 11px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.v-console-hd { display: flex; align-items: center; gap: 8px; padding: 7px 11px; cursor: pointer;
  background: var(--panel2); user-select: none; }
.v-console-toggle { font-size: 10px; color: var(--muted); width: 10px; text-align: center; }
.v-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none;
  animation: atlas-pulse 1.5s ease-in-out infinite; }
.v-console-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.v-console-count { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-console[data-open="0"] .v-console-body { display: none; }
.v-console-body { position: relative; background: #0b0d12; height: 240px; min-height: 120px;
  max-height: 60vh; overflow-y: auto; overflow-x: hidden; padding: 8px 11px; resize: vertical; }
.v-console-lines { display: flex; flex-direction: column; gap: 1px; }
.v-log-line { display: flex; gap: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.55; }
.v-log-ts { flex: none; color: #6b7280; font-variant-numeric: tabular-nums; }
.v-log-text { overflow-wrap: anywhere; word-break: break-word; color: #cbd5e1; }
.v-log-section .v-log-text, .v-log-milestone .v-log-text { color: #8a94a6; font-weight: 700; }
.v-log-attempt .v-log-text, .v-log-pass .v-log-text { color: #8a94a6; }
.v-log-blocking .v-log-text, .v-log-finding-blocking .v-log-text, .v-log-finding-minor .v-log-text { color: #ef6b6b; }
.v-log-scout .v-log-text, .v-log-file .v-log-text, .v-log-plain .v-log-text { color: #8a94a6; }
.v-log-group { margin: 1px 0; }
.v-log-group summary { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  color: #8a94a6; cursor: pointer; padding: 1px 0; }
.v-log-group summary:hover { color: var(--accent); }
.v-log-group-body { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.08); margin: 2px 0 2px 3px; }
.v-console-jump { position: sticky; bottom: 6px; display: block; width: fit-content; margin: 6px 0 0 auto;
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 20px;
  padding: 4px 12px; font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.v-console-jump[hidden] { display: none; }   /* class-level display:block otherwise beats the UA [hidden] rule */

/* ── Assistant empty state (Velocity: teaches the flow + example prompts) ── */
.empty-state { max-width: 720px; margin: 44px auto; padding: 0 24px; text-align: center; }
.empty-state .es-logo { font-size: 42px; line-height: 1; }
.empty-state h2 { margin: 12px 0 6px; font-size: 22px; }
.empty-state .es-lead { color: var(--muted); line-height: 1.6; margin: 0 auto 24px; max-width: 560px; }
.es-modes { display: flex; gap: 12px; justify-content: center; margin-bottom: 26px; flex-wrap: wrap; text-align: left; }
.es-mode { flex: 1; min-width: 220px; max-width: 320px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.es-mode-h { color: var(--text); font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.es-eg-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.es-egs { display: flex; flex-direction: column; gap: 8px; }
.es-eg { text-align: left; background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; font: inherit; font-size: 13.5px; line-height: 1.4; }
.es-eg:hover { border-color: var(--accent); background: var(--accent-soft); }
.es-eg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px 0; min-width: 0; }
.row { max-width: 820px; margin: 0 auto; padding: 6px 24px; }
.msg { padding: 14px 16px; border-radius: 12px; margin: 8px 0; line-height: 1.55;
  min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.msg > * { max-width: 100%; }
.msg.user { background: var(--user); }
.msg.assistant { background: var(--panel); border: 1px solid var(--border); }
.msg.assistant.refused { border-color: var(--warn); }
.msg .meta { margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border);
  padding-top: 8px; }
.msg .caveats { margin-top: 8px; font-size: 12px; color: var(--muted); background: rgba(255,180,0,0.07);
  border-left: 2px solid rgba(255,180,0,0.5); padding: 6px 10px; border-radius: 4px; }
.msg .caveats b { color: var(--fg); font-weight: 600; }
.msg .caveats div { margin-top: 2px; }
.msg pre { background: #0b0d12; padding: 12px; border-radius: 8px; max-width: 100%;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.msg code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.msg :not(pre) > code { background: #0b0d12; padding: 1px 5px; border-radius: 4px;
  overflow-wrap: anywhere; word-break: break-all; }
.msg table { border-collapse: collapse; display: block; width: max-content; max-width: 100%;
  overflow-x: auto; }
.msg th, .msg td { border: 1px solid var(--border); padding: 5px 9px; }
.thinking { color: var(--muted); font-style: italic; animation: atlas-pulse 1.5s ease-in-out infinite; }
@keyframes atlas-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.msg.assistant.thinking { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.msg.assistant.thinking .stop-btn { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 2px 7px; font-size: 12px; line-height: 1.6; cursor: pointer; flex: none;
  font-style: normal; animation: none; }
.msg.assistant.thinking .stop-btn:hover { border-color: #ef6b6b; color: #ef6b6b; }

/* Composer */
.composer { max-width: 820px; margin: 0 auto; width: 100%; padding: 14px 24px 22px;
  display: flex; gap: 10px; }
.composer textarea { flex: 1; resize: none; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font: inherit;
  max-height: 200px; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer button { background: var(--accent); color: var(--on-accent); border: none; border-radius: 12px;
  padding: 0 20px; font-weight: 600; cursor: pointer; }
.composer button:disabled { opacity: .5; cursor: default; }
.composer-hint { max-width: 820px; margin: -6px auto 8px; padding: 0 24px; color: var(--warn); font-size: 12px; }

/* Sidebar feedback indicator */
.conv { display: flex; align-items: center; gap: 6px; }
.conv .fb { margin-left: auto; font-size: 12px; opacity: .8; }
.conv .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center;
  z-index: 50; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px 26px; width: min(440px, 92vw); }
.modal-card h3 { margin: 0 0 4px; }
.fb-sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.fb-title { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text); margin: 0 0 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-buttons { display: flex; gap: 10px; }
.fb-btn { flex: 1; padding: 12px; border-radius: 10px; background: var(--panel2);
  border: 1px solid var(--border); color: var(--text); cursor: pointer; font-weight: 600; }
.fb-btn:hover { border-color: var(--accent); }
.fb-btn.sel { border-color: var(--accent); background: #24303f; }
.fb-btn[data-rating="down"].sel { border-color: var(--warn); background: #34291a; }
.modal-card textarea { width: 100%; margin: 12px 0 16px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.btn-primary { background: var(--accent); border: none; color: var(--on-accent); border-radius: 10px;
  padding: 9px 18px; font-weight: 600; cursor: pointer; }
.btn-primary:disabled { opacity: .5; cursor: default; }

/* Admin page */
.admin { max-width: 1120px; margin: 0 auto; padding: 0 24px 48px; }
.admin-header { position: sticky; top: 0; background: var(--bg); display: flex; align-items: center;
  gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; z-index: 5; }
.admin-header .brand { font-weight: 700; font-size: 18px; }
.admin-filters { display: flex; gap: 16px; color: var(--muted); font-size: 13px; align-items: center; }
.admin-filters select { margin-left: 6px; }
.admin-back { margin-left: auto; color: var(--accent); text-decoration: none; }
.admin-body { padding-top: 18px; }
.admin-count { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); }
.admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table tbody tr { cursor: pointer; }
.admin-table tbody tr:hover { background: var(--panel); }
.admin-table .t-title { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-back-btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; margin-bottom: 14px; }
.admin-detail-head h2 { margin: 4px 0; }
.admin-sub { color: var(--muted); font-size: 13px; }
.fb-block { margin-top: 8px; padding: 8px 12px; border-radius: 8px; font-size: 14px;
  background: var(--panel2); border: 1px solid var(--border); display: inline-block; }
.fb-block.up { border-color: var(--ok); }
.fb-block.down { border-color: var(--warn); }
.fb-block.none { color: var(--muted); }
.admin-messages { padding-top: 10px; }
.admin-messages .row { max-width: 100%; margin: 0; padding: 6px 0; }

/* Per-message optional feedback bar */
.msg-fb { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.msg-fb .mfb-lbl { color: var(--muted); }
.msg-fb .mfb-btn { background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 3px 9px; cursor: pointer; font-size: 14px; line-height: 1.2; }
.msg-fb .mfb-btn:hover { border-color: var(--accent); }
.msg-fb .mfb-note { flex: 1; min-width: 160px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 13px; }
.msg-fb .mfb-note:focus { outline: none; border-color: var(--accent); }
.msg-fb .mfb-done { color: var(--ok); }
.msg-fb .mfb-btn.sel { border-color: var(--accent); background: #24303f; }
.msg-fb .mfb-save { background: var(--accent); border: none; color: var(--on-accent); border-radius: 8px;
  padding: 4px 12px; cursor: pointer; font-size: 13px; }
.msg-fb .mfb-save:disabled { opacity: .5; cursor: default; }
.msg-fb .mfb-status { color: var(--ok); font-size: 12px; min-width: 54px; }

/* Repo multi-select dropdown (topbar) */
.repo-multi { position: relative; display: inline-block; }
.repo-toggle { cursor: pointer; min-width: 150px; max-width: 320px; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 210px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.repo-menu .repo-opt { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text); }
.repo-menu .repo-opt:hover { background: var(--panel); }
.repo-menu .repo-opt input { accent-color: var(--accent); }

/* Info tooltip (ⓘ next to Repo / Answer) */
.info { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); color: var(--muted);
  font-size: 10px; cursor: help; flex: none; }
.info:hover { color: var(--text); border-color: var(--accent); }
.info:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 0;
  z-index: 40; width: 260px; background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 400; line-height: 1.45;
  white-space: normal; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.info.info-r:hover::after { left: auto; right: 0; }

/* Topbar Help link */
.topbar-help { margin-left: 16px; color: var(--muted); text-decoration: none; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; white-space: nowrap; }
.topbar-help:hover { color: var(--text); border-color: var(--accent); }

/* Sidebar unread badge */
.conv .unread { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 5px; flex: none; }

/* Help / FAQ page */
.help { max-width: 780px; margin: 0 auto; padding: 36px 24px 72px; line-height: 1.65; }
.help .back { color: var(--accent); text-decoration: none; font-size: 14px; }
.help h1 { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.help .lead { color: var(--muted); margin-top: 0; }
.help h2 { margin-top: 30px; border-bottom: 1px solid var(--border); padding-bottom: 6px; font-size: 19px; }
.help p, .help li { color: var(--text); }
.help a { color: var(--accent); }
.help code { background: #0b0d12; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* How-it-works page (diagrams) */
.how h2 { margin-top: 34px; }
.how .note { color: var(--muted); font-size: 13px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-top: 2px; }
.how .note code { background: #0b0d12; }
.diagram { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin: 14px 0 8px; overflow-x: auto; }
.diagram .mermaid { display: flex; justify-content: center; min-height: 40px; }
.diagram svg { max-width: 100%; height: auto; }

/* Rating-gate hint (shown until a 👍/👎 is picked) */
.fb-hint { color: var(--warn); font-size: 12px; margin: 10px 0 0; }

/* Mobile: hamburger toggles an off-canvas sidebar drawer over a backdrop */
.menu-toggle { display: none; background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 11px; font-size: 16px; line-height: 1; cursor: pointer; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.5); }

@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; width: 264px; max-width: 84vw; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .menu-toggle { display: inline-flex; align-items: center; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .assistant-switch { margin-left: auto; }
  .row { padding: 6px 14px; }
  .velocity-controls { padding: 8px 10px; }
  .composer { padding: 12px 14px 18px; }
  .info:hover::after { width: min(260px, 78vw); }
}

/* ── Update banner ────────────────────────────────────────── */
#updateBanner {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #1e2736; border: 1px solid #5b8cff; border-radius: 8px;
  padding: 10px 16px; box-shadow: 0 4px 16px rgba(0,0,0,.5);
  color: #e6e8ec; font-size: 13.5px; z-index: 9999; white-space: nowrap;
}
#updateBanner span { flex: 1; }
#updateReload {
  background: #5b8cff; color: #fff; border: none; border-radius: 5px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; font-weight: 600;
}
#updateReload:hover { background: #4a7aee; }
#updateDismiss {
  background: none; border: none; color: #9aa3b2; font-size: 15px;
  cursor: pointer; padding: 0 2px; line-height: 1;
}
#updateDismiss:hover { color: #e6e8ec; }
