@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  /* Nextspace-inspired palette. Cyan 100 (#061727) grounds the UI per the brand's
   * "monochromatic base, ≥2/3 of layout" rule. Accents pull from the brand's
   * screen-only accent set — electric cyan, lime, deep orange, deep purple —
   * used sparingly for signal, not decoration. */
  --bg: #061727;               /* Cyan 100 — deep navy ground */
  --panel: #0a2138;            /* One step lighter — pane surface */
  --panel-2: #0f2a48;          /* Elevated cards */
  --border: #1a3a5c;           /* Mid navy */
  --border-strong: #234a72;    /* Emphasised border */
  --text: #e2f1f8;             /* Blue Grey 150 — near-white with blue cast */
  --muted: #7a95ab;            /* Blue Grey 250, dimmed */

  /* Signal colours */
  --accent: #18ffff;           /* Cyan A200 — primary CTA, live indicators */
  --accent-2: #00afFA;         /* Blue 50 — hover / secondary */
  --accent-glow: rgba(24, 255, 255, 0.22);
  --accent-tint: rgba(24, 255, 255, 0.09);

  --user: #00afFA;             /* Blue 50 — user-typed content */
  --user-tint: rgba(0, 175, 250, 0.09);

  --assistant: #ff3d00;        /* Deep Orange A400 — assistant replies (Bruce warmth) */
  --assistant-tint: rgba(255, 61, 0, 0.09);

  --observer: #eeff41;         /* Lime A200 — observer commentary (lively pop) */
  --observer-tint: rgba(238, 255, 65, 0.08);
  --observer-border: rgba(238, 255, 65, 0.5);

  --phase: #7c4dff;            /* Deep Purple A200 — phase markers */
  --phase-tint: rgba(124, 77, 255, 0.1);

  --alert: #ff6b6b;            /* Soft red — actual alerts, danger states */
  --alert-tint: rgba(255, 107, 107, 0.1);
}

* { box-sizing: border-box; }
/* HTML's `hidden` attribute should always hide the element, regardless of other
 * `display:` rules from more-specific selectors. Without this, `display: flex/grid`
 * on any class beats the browser's built-in `hidden { display: none }` reset. */
[hidden] { display: none !important; }

/* When session.html is loaded inside the dashboard iframe (?embed=1), keep the session
 * CONTROLS (Start Listening, session picker, status pill, help) but hide the outer
 * chrome (brand, whoami, dashboard link) since the dashboard shell already provides
 * those. Header becomes a compact controls strip. */
html.embedded body { background-image: none; }
html.embedded > body > header {
  padding: 6px 12px;
  box-shadow: none;
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
}
html.embedded > body > header .brand,
html.embedded > body > header #whoami,
html.embedded > body > header a.nav-link { display: none; }
/* In embedded mode the controls bar is the ONLY row in the header, so give it
   the full header width + anchor the session label on the LEFT with the rest
   of the actions floated right. Previous margin-left:auto pushed the whole
   lot to the far right, which left the session name indistinguishable from
   the Start / ? / status chips. */
html.embedded > body > header .controls {
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
}
html.embedded > body > header #sessionBtn { margin-right: auto; }

/* And in embedded mode, every button in the controls bar matches .nav-link
   sizing — same height, padding, font-weight, border-radius as the Refresh /
   Snapshot / Restore row in the dashboard above. Without this override, the
   base <button> rule paints Start Listening / ? as chunky bright-accent
   primaries that are visually inconsistent with every other toolbar on the
   page. #sessionBtn.active is softened too (subtle user-color border rather
   than full fill) so the "I'm in a session" cue remains without shouting. */
html.embedded > body > header .controls button {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
html.embedded > body > header .controls button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}
html.embedded > body > header #sessionBtn.active {
  background: transparent;
  color: var(--user);
  border-color: var(--user);
  box-shadow: none;
}

/* View mode — session is opened read-only for observer Q&A. Hide mic capture affordances
 * (Start Listening + Join mic toggle + cadence slider) and show a "Viewing" pill so the
 * user knows they're in a non-recording mode. Send input stays functional. */
html.view-only #startBtn,
html.view-only #joinBtn,
html.view-only .cadence-control { display: none !important; }
html.view-only .transcript-pane h2::after {
  content: 'READ-ONLY';
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--observer-tint);
  color: var(--observer);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border: 1px solid var(--observer-border);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  /* Subtle atmospheric depth — a soft cyan radial glow ties the eye to the top-left
   * without overwhelming the monochromatic dark base. */
  background-image: radial-gradient(ellipse 800px 600px at 15% -10%, rgba(24, 255, 255, 0.06), transparent 60%);
}

header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Thin accent line hugs the underside of the header — a nod to the brand's
   * layered visual language without hijacking the monochrome base. */
  box-shadow: 0 1px 0 0 rgba(24, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  letter-spacing: -0.01em;
  /* Cyan-tinted gradient text for a subtle "live product" feel. */
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
a.brand {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 120ms ease;
}
a.brand:hover { opacity: 0.85; }
.brand .logo {
  width: 28px;
  height: 33px;
  flex-shrink: 0;
}

/* Session button matches the primary Start Listening styling — it's the entry point to the workflow. */
#sessionBtn { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sessionBtn.active {
  background: var(--user);
  color: var(--bg);
  box-shadow: 0 0 0 1px var(--user), 0 0 12px rgba(0, 175, 250, 0.35);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}
.modal-overlay[hidden] { display: none; }
.modal-panel {
  position: relative;
  width: min(600px, 92vw);
  max-height: 88vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 10px;
}
.modal-close:hover { color: var(--text); }
.modal-title { margin: 0 0 16px; font-size: 20px; }
.modal-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 14px 0 8px;
}

.session-active {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.session-active[hidden] { display: none; }
.session-active .name { font-weight: 600; color: var(--accent); }
.session-active .meta { font-size: 11px; color: var(--muted); }

.session-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.session-row .name { flex: 1; }
.session-row .meta { font-size: 11px; color: var(--muted); }
.session-row .meta .owner { color: var(--user); }
.session-row button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.session-row button.danger { color: var(--alert); border-color: var(--alert); }
.session-empty { font-size: 12px; color: var(--muted); padding: 6px 0; }

.session-mode-choice {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.mode-btn {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
}
.mode-btn em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.mode-btn.selected, .mode-btn:hover { border-color: var(--accent); color: var(--accent); }
.mode-btn:disabled, .mode-btn.loading { opacity: 0.4; cursor: wait; }
.mode-btn:disabled:hover, .mode-btn.loading:hover { border-color: var(--border); color: inherit; }

.session-create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.session-create-form input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.session-create-form input:focus,
.session-create-form select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.session-create-form select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
}
.wizard-field { display: flex; flex-direction: column; gap: 4px; }
.wizard-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.wizard-hint { font-size: 11px; color: var(--muted); font-style: italic; }
.wizard-req {
  color: var(--alert);
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
  font-size: 11px;
}
.wizard-opt {
  color: var(--muted);
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
  font-size: 11px;
}
.wizard-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.wizard-input-row { display: flex; gap: 6px; }
.wizard-input-row input { flex: 1; }
.wizard-input-row button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
}
.wizard-input-row button:hover { border-color: var(--accent); color: var(--accent); }
.wizard-input-row button:disabled { opacity: 0.5; cursor: wait; }
.wizard-result {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px;
  background: var(--panel);
  border-radius: 4px;
  border: 1px solid var(--border);
}
.wizard-result.ok { color: var(--accent); border-color: var(--accent); }
.wizard-result.err { color: var(--alert); border-color: var(--alert); }
.wizard-doc-list {
  max-height: 220px;
  overflow-y: auto;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 6px;
  background: var(--panel);
  border-radius: 4px;
  border: 1px solid var(--border);
}
.wizard-doc-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 3px;
}
.wizard-doc-list label:hover { background: var(--bg); }
.wizard-doc-list input[type=checkbox] { margin: 0; }
.wizard-doc-list .doc-meta { color: var(--muted); font-size: 11px; margin-left: auto; }
.wizard-doc-list .doc-nontext { color: var(--muted); }
.session-form-actions { display: flex; gap: 6px; }
.session-msg { font-size: 12px; color: var(--muted); }
.session-msg.err { color: var(--alert); }
.session-msg.ok { color: var(--accent); }

.session-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 23, 39, 0.92);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  z-index: 2;
}
.session-loading-overlay[hidden] { display: none; }
.session-loading-title { font-size: 15px; color: var(--accent); font-weight: 600; }
.session-loading-detail { font-size: 12px; color: var(--muted); max-width: 320px; line-height: 1.4; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.controls { display: flex; gap: 10px; align-items: center; }

.whoami {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whoami.signed-in {
  color: var(--accent);
  border-color: var(--border-strong);
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.whoami.signed-in::before { content: '● '; color: var(--accent); }
.whoami.signed-in:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-tint);
}

/* Sign-in gate — covers the whole viewport at max z-index, hides everything behind. */
.signin-overlay { z-index: 3000; }
.signin-panel {
  width: min(460px, 92vw);
  padding: 32px 28px 28px;
  text-align: center;
}
.signin-logo {
  width: 48px;
  height: 56px;
  margin: 0 auto 16px;
  display: block;
}
.signin-title {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--text);
}
.signin-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.5;
}
.signin-btn {
  min-width: 240px;
  padding: 10px 18px;
  font-size: 14px;
}
.signin-status {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.signin-status a { color: var(--accent); text-decoration: none; }
.signin-status a:hover { text-decoration: underline; }
.signin-code-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}
.signin-code {
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 24px;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 6px;
  user-select: all;
  line-height: 1.2;
}
.signin-copy-btn {
  padding: 0 14px;
  font-size: 14px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
  white-space: nowrap;
}
.signin-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.signin-copy-btn.copied { color: #4ade80; border-color: #4ade80; }
.signin-ext-instructions {
  margin-top: 20px;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}
.signin-ext-instructions h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
  text-align: center;
}
.signin-ext-instructions h4.signin-ext-h4 {
  margin: 16px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.signin-ext-sub {
  margin: 0 0 14px;
  text-align: center;
  line-height: 1.5;
}
.signin-ext-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  line-height: 1.55;
}
.signin-ext-steps li { margin-bottom: 4px; }
.signin-ext-steps code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg);
  color: var(--accent);
  font-family: Consolas, monospace;
  font-size: 12px;
}
/* Links inside the extension install/update dialog — override the browser
   default (dark blue on dark background = unreadable) with the app accent. */
.signin-ext-instructions a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 2px;
}
.signin-ext-instructions a:hover {
  text-decoration-color: var(--accent);
}
.signin-ext-hint {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
#signInExtRecheck { width: 100%; margin-top: 8px; }
.signin-ext-note {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.signin-ext-diag {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.signin-ext-diag code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg);
  color: var(--accent);
  font-family: Consolas, monospace;
}
.signin-waiting {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin: 12px 0 0;
}
.signin-waiting::before {
  content: '● ';
  color: var(--accent);
  animation: sn-pulse 1.6s ease-in-out infinite;
}
@keyframes sn-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.signin-error {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--alert-tint);
  color: var(--alert);
  font-size: 12px;
}

/* When sign-in is required, hide the app shell so the modal is the only interactive
 * surface. Body class is toggled by the guard code in dashboard.js / app.js. */
body.signin-required > header,
body.signin-required > main,
body.signin-required > .dashboard-layout { visibility: hidden; }

.nav-link {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  transition: border-color 120ms ease, color 120ms ease;
}
.nav-link:hover { border-color: var(--accent); color: var(--accent); }

button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: box-shadow 120ms ease, transform 80ms ease;
}
button:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--accent), 0 0 16px var(--accent-glow); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button:disabled { opacity: 0.4; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary[aria-pressed="true"] {
  color: var(--observer);
  border-color: var(--observer);
}

.status {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.status.live { color: var(--accent); border-color: var(--accent); }
.status.error { color: var(--alert); border-color: var(--alert); }

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}

.pane {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane h2 {
  margin: 0;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-weight: 600;
  /* Subtle top accent line — mirrors the header's accent stripe pattern. */
  position: relative;
}
.pane h2::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 32px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transition: background 300ms ease;
}
.transcript-pane h2::before { background: linear-gradient(90deg, var(--user), transparent); }
.commentary-pane h2::before { background: linear-gradient(90deg, var(--observer), transparent); }

/* Transcript metadata strip — prominent "Last message" + hover shows
   the created date. Sits above the pane h2 so it reads as session
   context, not transcript content. */
.transcript-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}
.transcript-meta[hidden] { display: none; }
.transcript-meta-last {
  color: var(--text);
  font-weight: 600;
  cursor: default;
}
.transcript-meta-last[data-live="1"] { color: var(--accent); }
.transcript-meta-sep { color: var(--border-strong); }
.transcript-meta-created { cursor: default; }

/* Animated "active" strip — slides the accent bar back and forth across the
   pane's top edge to signal live activity (observer thinking, hydration
   loading, etc). Toggled via .pane-active. While active we also make the
   strip taller + wider so it's genuinely visible; static state stays subtle. */
.pane.pane-active h2::before {
  animation: strip-sweep 2.4s ease-in-out infinite alternate;
  height: 4px;
  width: 60px;
}
@keyframes strip-sweep {
  from { left: 0; }
  to { left: calc(100% - 60px); }
}
/* Colour variants for the observer strip based on the latest commentary kind.
   Applied to the observer pane wrapper (JS toggles strip-passive|info|alert
   as commentary arrives). Static AND animated strip pick these up. */
.commentary-pane.strip-passive h2::before { background: linear-gradient(90deg, #4ade80, transparent); }
.commentary-pane.strip-info    h2::before { background: linear-gradient(90deg, #f59e0b, transparent); }
.commentary-pane.strip-alert   h2::before { background: linear-gradient(90deg, #ef4444, transparent); }
/* Loading state (blue) — hydration in progress, template body fetching, etc.
   Overrides other strip colours while active; released on ready/failed. */
.commentary-pane.strip-loading h2::before { background: linear-gradient(90deg, #38bdf8, transparent); }

.heartbeat {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  opacity: 0.7;
}
.heartbeat.pulse {
  color: var(--accent);
  opacity: 1;
  transition: opacity 0.2s, color 0.2s;
}

.cadence-control {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}
.cadence-control input[type="range"] {
  width: 90px;
  accent-color: var(--accent);
  cursor: pointer;
}
.cadence-control label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
.cadence-control #cadenceValue {
  min-width: 26px;
  text-align: right;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* .teams-badge + .knowledge-badge now match .nav-link sizing exactly so the
   Teams / Open Meeting / Upload transcript buttons in the transcript h2 line
   up with Refresh / Snapshot / Restore in the dashboard header above. */
.knowledge-badge, .teams-badge {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  transition: border-color 120ms ease, color 120ms ease;
}
.knowledge-badge:hover, .teams-badge:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}
/* Cadence sits between the h2 title and the other badges; kill the auto-left-margin on subsequent ones so they don't jump */
.cadence-control ~ .knowledge-badge, .cadence-control ~ .teams-badge { margin-left: 0; }
.teams-badge.active { color: var(--accent); border-color: var(--accent); }

/* Open-Meeting split button + chain dropdown. The main button opens
   the latest-added meeting (or prompts for a URL if none bound yet);
   the ▾ arrow button reveals the chain when there's more than one. */
.teams-open-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}
.teams-open-group > .teams-frame-toggle {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.teams-open-group > .teams-open-more {
  padding: 5px 8px;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.teams-open-group > .teams-open-more[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}
.teams-open-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 320px;
  max-width: 480px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.teams-open-menu[hidden] { display: none; }
.teams-open-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.teams-open-item:hover,
.teams-open-item:focus-visible {
  background: rgba(24, 255, 255, 0.06);
  border-color: rgba(24, 255, 255, 0.3);
  outline: none;
}
.teams-open-item-label {
  display: block;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}
.teams-open-item-url {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-family: Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.teams-open-item-meta {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}
.teams-open-item-add {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.teams-open-item-add .teams-open-item-label { color: var(--text); }
.teams-open-item-add:hover .teams-open-item-label,
.teams-open-item-add:focus-visible .teams-open-item-label { color: var(--accent); }

.teams-panel {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  background: var(--bg);
}
.teams-form {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.teams-form input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
}
.teams-form input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.teams-form button { padding: 4px 10px; font-size: 11px; }
.teams-status { color: var(--muted); font-size: 11px; }
.teams-status.ok { color: var(--accent); }
.teams-status.err { color: var(--alert); }

.teams-bindings-list {
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.teams-bindings-header {
  font-size: 10px;
  color: var(--muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.teams-binding-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  font-size: 11px;
}
.teams-binding-info {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text, #e2e8f0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.teams-binding-open,
.teams-binding-remove {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim, #94a3b8);
  padding: 1px 6px;
  font-size: 12px;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
}
.teams-binding-open:hover { color: var(--text, #e2e8f0); border-color: rgba(255, 255, 255, 0.14); }
.teams-binding-remove:hover { color: #f87171; border-color: rgba(239, 68, 68, 0.4); }

.turn.teams-cue {
  border-left: 2px solid var(--user);
  padding: 6px 12px;
  background: rgba(0, 175, 250, 0.05);
  border-radius: 0 6px 6px 0;
  margin-bottom: 10px;
}
.turn.teams-cue .role {
  color: var(--user);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.turn.teams-cue .time {
  color: var(--muted);
  font-size: 10px;
  margin-left: 6px;
}

/* Page-context card — compact, shown in the transcript when the Chrome
   extension injects a webpage as context for the session. Doesn't render
   the extracted body text; a "View extracted text" button loads it on
   demand into an overlay modal. */
.turn.page-context-card {
  border-left: 3px solid var(--accent, #4fc3f7);
  padding: 8px 12px;
  background: rgba(79, 195, 247, 0.06);
  border-radius: 0 6px 6px 0;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.page-context-card .ctx-badge {
  align-self: flex-start;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(79, 195, 247, 0.2);
  color: var(--accent, #4fc3f7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.page-context-card .ctx-title {
  font-weight: 600;
  font-size: 13px;
  word-break: break-word;
}
.page-context-card .ctx-url {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  text-decoration: none;
}
.page-context-card .ctx-url:hover { text-decoration: underline; }
.page-context-card .ctx-meta {
  color: var(--muted);
  font-size: 10px;
}
.page-context-card .ctx-view-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 3px 10px;
  font-size: 11px;
  background: transparent;
  color: var(--accent, #4fc3f7);
  border: 1px solid var(--accent, #4fc3f7);
  border-radius: 4px;
  cursor: pointer;
}
.page-context-card .ctx-view-btn:hover {
  background: rgba(79, 195, 247, 0.1);
}

/* Modal overlay for viewing the full extracted text on demand. */
.ctx-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ctx-modal {
  background: var(--bg, #1a1f2e);
  color: var(--fg, #e0e0e0);
  border-radius: 8px;
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.ctx-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.ctx-modal-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.ctx-modal-url {
  font-size: 11px;
  color: var(--accent, #4fc3f7);
  word-break: break-all;
}
.ctx-modal-close {
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.ctx-modal-close:hover { color: var(--fg, #e0e0e0); }
.ctx-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  font-family: inherit;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  flex: 1;
}

.knowledge-details {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  background: var(--bg);
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(55vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}
.knowledge-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.knowledge-details ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text);
}
.knowledge-details li { padding: 1px 0; }
.knowledge-details .src-type {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  margin-right: 6px;
}

.external-dirs { margin-top: 8px; }
.attached-resources-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.attached-resources-header button { padding: 4px 10px; font-size: 12px; }
.attached-resources-header > div { display: flex; flex-wrap: wrap; gap: 6px; }
.resource-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0; overflow-wrap: anywhere; }
.resource-breadcrumb button, .resource-folder { background: none; border: none; color: var(--user); cursor: pointer; padding: 4px; text-align: left; }
.resource-folder { display: block; width: 100%; }
.resource-folder:hover { text-decoration: underline; }
.picker-row-name { overflow-wrap: anywhere; min-width: 0; }
.external-dir {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--user);
  padding: 3px 0;
  word-break: break-all;
}
.external-dir button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}
.external-dir button:hover { color: var(--alert); border-color: var(--alert); }

.add-folder-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.add-folder-form input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
}
.add-folder-form input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.add-folder-form button { padding: 4px 10px; font-size: 11px; }

.add-folder-msg {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.add-folder-msg.ok { color: var(--accent); }
.add-folder-msg.err { color: var(--alert); }

/* Add Customer picker — opens below the form when 'Pick…' is clicked.
   Lists each file under <customer>/_AI/ grouped by its first subfolder
   (CONTENT, SESSIONS, etc.), with a checkbox per file. User trims the
   list and hits 'Add selected'; checked paths become the pickOnly set
   passed to scanSharePointFolder, so only those files are downloaded. */
.customer-picker {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  padding: 8px;
  font-size: 11px;
}
.customer-picker-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.customer-picker-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.picker-group {
  margin-bottom: 8px;
}
.picker-group-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 4px 0 2px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.picker-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
}
.picker-row:hover { background: rgba(255, 255, 255, 0.04); }
.picker-row input[type=checkbox] { margin: 0; }
.picker-row-name { flex: 1; }
.picker-row-meta { color: var(--muted); font-size: 10px; }
.customer-picker-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.customer-picker-actions button { padding: 4px 10px; font-size: 11px; }
.picker-spacer { flex: 1; }

.sharepoint-reset { margin-top: 8px; }
.link-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--user); }

.device-code-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--observer);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  font-size: 13px;
  line-height: 1.5;
}
.device-code-banner .dc-title {
  font-weight: 600;
  color: var(--observer);
  margin-bottom: 6px;
}
.device-code-banner .dc-body {
  color: var(--muted);
  margin-bottom: 8px;
}
.device-code-banner .dc-code {
  font-family: Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  padding: 1px 4px;
  background: rgba(24, 255, 255, 0.1);
  border-radius: 3px;
}
.device-code-banner a { color: var(--user); }
.device-code-banner button {
  margin-left: 4px;
  padding: 2px 8px;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* ── Help-mode floating tooltip ─────────────────────────────────────
   Rendered beside the mouse cursor while help mode is active (toggled
   via the ? button in the header). Content is a rich HTML fragment
   from public/help-content.js keyed by the hovered element's id. */
.help-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10000;
  max-width: 420px;
  min-width: 300px;
  padding: 16px 18px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.help-tooltip.visible { opacity: 1; transform: translateY(0); }
.help-tooltip[aria-hidden="true"]:not(.visible) { visibility: hidden; }
.help-tooltip h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--accent);
}
.help-tooltip p { margin: 6px 0; }
.help-tooltip ul, .help-tooltip ol { margin: 6px 0 6px 20px; padding: 0; }
.help-tooltip li { margin: 3px 0; }
.help-tooltip code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: var(--observer);
}
.help-tooltip strong { color: var(--text); font-weight: 600; }
.help-tooltip em { color: var(--muted); font-style: italic; }
.help-tooltip .help-tip {
  margin-top: 10px;
  padding: 8px 11px;
  background: rgba(16, 163, 127, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.5;
}
.help-tooltip .help-tip strong { color: var(--accent); }

/* While help mode is active, nudge the cursor into a question-mark
   shape over any registered element so it's obvious where to hover. */
body.help-mode [id] { cursor: help; }
body.help-mode #helpBtn { cursor: pointer; } /* keep ? itself clickable */

/* ? button active state. Matches the aria-pressed convention used by
   the Join mic button and other secondary toggles. */
#helpBtn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.turn {
  margin-bottom: 12px;
  line-height: 1.4;
  position: relative;
}

/* Hover × on transcript entries — deletes the entry from chat.jsonl.
   Only rendered by JS on transcript-pane elements (not commentary).
   Kept subtle: transparent until hover, muted-red on hover of the
   button itself. */
.turn-delete {
  position: absolute;
  top: -2px;
  right: 0;
  opacity: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity 0.1s, color 0.1s, background 0.1s, border-color 0.1s;
}
.turn:hover .turn-delete { opacity: 0.7; }
.turn-delete:hover {
  opacity: 1;
  color: var(--alert);
  border-color: var(--alert);
  background: rgba(239, 68, 68, 0.08);
}

.turn .role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}
.turn .role.speaker { color: var(--user); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; }
.turn .role.speaker.reconciled {
  color: var(--observer);
  cursor: help;
  border-bottom: 1px dotted var(--observer);
  display: inline-block;
}
.turn.reconciled {
  border-left: 2px solid rgba(238, 255, 65, 0.4);
  padding-left: 8px;
  margin-left: -10px;
}

/* "Thinking..." placeholder shown in the observer pane while an ask is in flight.
   Removed by renderAnswer / renderAnswerInTranscript when the reply arrives. */
.comment.thinking {
  opacity: 0.85;
  border-left-style: dashed;
}
.comment.thinking .thinking-body {
  color: var(--muted);
  font-style: italic;
}
.comment.thinking .thinking-dots {
  display: inline-block;
  animation: thinking-pulse 1.2s ease-in-out infinite;
}
/* "Preparing context" variant — same layout as thinking but distinguishable so
   the user knows the wait right now is context-load, not Claude latency. Left
   border switches from default to the accent hue for a subtle tint. */
.comment.thinking.preparing {
  border-left-color: var(--accent);
}
.comment.thinking.preparing .thinking-body::before {
  content: "⏳ ";
}
@keyframes thinking-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Markdown-rendered observer output. Keep spacing tight — we're in a scrolling
   pane, not a document. First/last block have no outer margin so they hug the
   container edges. Applied to .comment .body and .turn .markdown wrappers. */
.markdown p,
.markdown ul,
.markdown ol,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 4px 0;
}
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child { margin-bottom: 0; }
.markdown ul,
.markdown ol {
  padding-left: 18px;
}
.markdown li {
  margin: 2px 0;
}
.markdown h4,
.markdown h5,
.markdown h6 {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.markdown code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.markdown strong { font-weight: 700; }
.markdown em { font-style: italic; }
.markdown a { color: var(--observer); text-decoration: underline; text-decoration-thickness: 1px; }
.markdown a:hover { opacity: 0.85; }

/* Observer speaking into the meeting as a participant. Visually distinct so
   participants can tell the AI is contributing (rather than a human speaker). */
.hydration-chip {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  cursor: help;
  vertical-align: middle;
}
/* Explicit mic opt-in toggle sitting next to Start Listening. Small, muted,
   not a shout — the Start button stays the primary action. */
.mic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  font-size: 11px;
  color: var(--text-muted, #888);
  cursor: pointer;
  user-select: none;
}
.mic-toggle input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}
.mic-toggle:hover { color: var(--text); }
.hydration-chip.hydration-loading {
  background: rgba(24, 255, 255, 0.12);
  color: var(--accent);
  animation: hydration-pulse 1.4s ease-in-out infinite;
}
.hydration-chip.hydration-ready {
  background: rgba(88, 224, 140, 0.14);
  color: #58e08c;
}
.hydration-chip.hydration-failed {
  background: rgba(255, 90, 90, 0.14);
  color: #ff9090;
}
@keyframes hydration-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1.0; }
}

.turn.participant-ai {
  border-left: 2px solid rgba(146, 84, 222, 0.7);
  padding-left: 8px;
  margin-left: -10px;
  background: rgba(146, 84, 222, 0.06);
  border-radius: 3px;
}
.turn.participant-ai .role.speaker.ai-participant {
  color: #c8a2ff;
  border-bottom: none;
  cursor: help;
}

.turn.user .role { color: var(--user); }
.turn.assistant .role { color: var(--assistant); }

.comment {
  border-left: 2px solid var(--observer);
  padding: 8px 12px;
  margin-bottom: 12px;
  background: rgba(238, 255, 65, 0.05);
  border-radius: 0 6px 6px 0;
  /* New commentary fades in — subtle enough to not distract, present enough to
   * signal "something just arrived". */
  animation: sn-fade-in 260ms ease-out;
}
@keyframes sn-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.comment.suggestion {
  border-left-color: var(--accent);
  background: rgba(24, 255, 255, 0.06);
}

.comment.alert {
  border-left-color: var(--alert);
  background: rgba(255, 107, 107, 0.08);
}
.comment.alert .topic { color: var(--alert); }

.comment .topic {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--observer);
  margin-bottom: 4px;
}

.comment.suggestion .topic { color: var(--accent); }

.comment .body { line-height: 1.45; }
.comment .comment-cutoff {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.comment.suggestion .comment-cutoff { color: rgba(24, 255, 255, 0.7); }
.comment.alert .comment-cutoff { color: rgba(255, 107, 107, 0.7); }

.comment.answer {
  border-left-color: var(--user);
  background: rgba(0, 175, 250, 0.06);
}
.comment.answer .topic { color: var(--user); }

.comment.kickoff {
  border-left-color: var(--user);
  background: rgba(0, 175, 250, 0.08);
  border-left-width: 3px;
  /* Kickoff is the first thing the observer says — it deserves a soft glow to
   * mark the start of the session. Runs once, then settles. */
  box-shadow: 0 0 24px rgba(0, 175, 250, 0.12);
  animation: sn-kickoff-in 500ms ease-out;
}
@keyframes sn-kickoff-in {
  from { opacity: 0; transform: translateY(6px); box-shadow: 0 0 0 rgba(0, 175, 250, 0); }
  to   { opacity: 1; transform: translateY(0);   box-shadow: 0 0 24px rgba(0, 175, 250, 0.12); }
}
.comment.kickoff .topic { color: var(--user); }
.comment.kickoff .body { white-space: pre-wrap; }

/* Rendered GFM pipe tables inside observer commentary / answers / asks.
   The observer frequently emits comparison tables (format support status,
   participant stance matrices, etc.); without styling they rendered as
   literal pipe-separated text runs. Compact borders + tight padding so the
   table fits the narrow observer pane without wrapping every cell. */
.md-table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 12px;
  table-layout: auto;
}
.md-table th,
.md-table td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
  line-height: 1.4;
}
.md-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.md-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.md-table code {
  font-size: 11px;
  padding: 1px 4px;
}

.comment.manifest-diff {
  border-left-color: var(--muted);
  background: rgba(139, 147, 165, 0.08);
}
.comment.manifest-diff .topic { color: var(--muted); }

.comment.actors-discovered {
  border-left-color: var(--muted);
  background: rgba(139, 147, 165, 0.08);
}
.comment.actors-discovered .topic { color: var(--muted); }

.comment .sources {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.comment .sources a {
  color: var(--user);
  text-decoration: none;
}
.comment .sources a:hover { text-decoration: underline; }

.template-picker {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
}
.template-picker label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
/* Header row — "Template" label on the left, ✎ Edit pinned on the right.
   Keeps Edit well away from the select's dropdown so a click near the
   dropdown edge can't accidentally hit the Edit button. */
.template-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.template-picker select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
}
.template-picker select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.template-picker select:disabled { opacity: 0.5; cursor: not-allowed; }
.template-description {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  min-height: 14px;
}

.transition-btn {
  align-self: flex-start;
  margin-top: 6px;
  background: var(--accent);
  color: #0f1115;
  font-weight: 600;
  padding: 6px 12px;
  font-size: 12px;
}
.transition-btn:hover { filter: brightness(1.1); }

.turn.phase-marker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  padding: 6px 0;
  border-top: 1px solid var(--observer);
  border-bottom: 1px solid var(--observer);
}
.turn.phase-marker .phase-label {
  color: var(--observer);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.turn.phase-marker .phase-meta {
  color: var(--muted);
  font-size: 11px;
}

.watch-for {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.watch-for label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.watch-for textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
  resize: vertical;
  min-height: 40px;
}
.watch-for textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.ask-form {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.ask-form input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
}
.ask-form input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.ask-form button { padding: 6px 12px; }
.ask-form button.secondary[aria-pressed="true"] {
  color: var(--alert);
  border-color: var(--alert);
  background: rgba(255, 107, 107, 0.08);
}

/* Staff-only Correction toggle on the ask form. Hidden by default; revealed
   when /me returns partnerModeEligible=true. Tick → next Send routes to
   generateKnowledgeRevision instead of a regular observer answer. */
.ask-correction-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
}
.ask-correction-toggle input { margin: 0; }
.ask-correction-toggle:has(input:checked) {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

/* 📌 Save-as-fact pin, positioned top-right of each observer comment card.
   Hover-revealed; stays visible once used so the capture result persists.
   Staff-only (JS gated on isStaffUser) — rendered inline into the comment
   DOM, so no .comment layout change needed beyond with-save-fact. */
.comment.with-save-fact { position: relative; }
.save-fact-pin {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  font-size: 11px;
  line-height: 1;
  transition: opacity 120ms ease, border-color 120ms ease, background 120ms ease;
}
.comment.with-save-fact:hover .save-fact-pin,
.save-fact-pin:focus-visible,
.save-fact-pin.save-fact-done,
.save-fact-pin.save-fact-err { opacity: 1; }
.save-fact-pin:hover:not(:disabled) {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}
.save-fact-pin:disabled { cursor: default; }
.save-fact-pin.save-fact-done {
  opacity: 1;
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.14);
  color: #4ade80;
}
.save-fact-pin.save-fact-err {
  opacity: 1;
  border-color: var(--alert);
  background: rgba(255, 107, 107, 0.14);
  color: var(--alert);
}

/* Knowledge Revision Proposal card (observer pane). Rendered inline in
   response to a Correction-toggle submit. Lives inside .comment.answer so
   it inherits the base comment card styling; .kr-card overlays an amber
   left border + warm tint so it's visually distinct. */
.comment.answer.kr-card {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}
.kr-body-wrap { white-space: normal; }
.kr-header {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  margin: 4px 0 6px;
}
.kr-badge {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
}
.kr-badge-add       { color: #4ade80; background: rgba(74, 222, 128, 0.14); }
.kr-badge-correct   { color: #f59e0b; background: rgba(245, 158, 11, 0.14); }
.kr-badge-supersede { color: #ef4444; background: rgba(239, 68, 68, 0.14); }
.kr-badge-retire    { color: #9ca3af; background: rgba(156, 163, 175, 0.14); }
.kr-class { color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kr-conf  { margin-left: auto; color: var(--muted); font-size: 10px; }
.kr-conf-high { color: #4ade80; }
.kr-conf-med  { color: #f59e0b; }
.kr-conf-low  { color: #ef4444; }
.kr-title { font-size: 14px; font-weight: 600; margin: 6px 0; }
.kr-rationale { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.kr-supersedes, .kr-edges, .kr-open { font-size: 12px; margin: 6px 0; }
.kr-supersedes ul, .kr-open ul { margin: 2px 0 0 20px; padding: 0; }
.kr-body { font-size: 12px; margin: 8px 0; }
.kr-body summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.kr-body-inner { padding: 8px; background: rgba(0, 0, 0, 0.08); border-radius: 3px; margin-top: 6px; }
.kr-actions { display: flex; gap: 6px; margin-top: 10px; }
.kr-actions button {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}
.kr-accept  { border-color: rgba(74, 222, 128, 0.5) !important; color: #4ade80 !important; }
.kr-accept:hover  { background: rgba(74, 222, 128, 0.12) !important; }
.kr-correct { border-color: rgba(245, 158, 11, 0.5) !important; color: #f59e0b !important; }
.kr-correct:hover { background: rgba(245, 158, 11, 0.12) !important; }
.kr-reject  { border-color: rgba(239, 68, 68, 0.4)  !important; color: var(--alert) !important; }
.kr-reject:hover  { background: rgba(239, 68, 68, 0.12) !important; }
.kr-locked .kr-actions { opacity: 0.4; pointer-events: none; }
.kr-status { margin-top: 8px; font-size: 11px; }
.kr-status-pending { color: var(--muted); }
.kr-status-ok      { color: #4ade80; }
.kr-status-reject  { color: #9ca3af; }
.kr-status-err     { color: var(--alert); }
.kr-error { color: var(--alert); }
.kr-fallback { font-size: 11px; opacity: 0.7; white-space: pre-wrap; margin-top: 6px; }
.turn.join .role {
  color: var(--observer);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.turn.ai-reply {
  border-left: 2px solid var(--accent);
  padding: 8px 12px;
  background: rgba(24, 255, 255, 0.05);
  border-radius: 0 6px 6px 0;
}
.turn.ai-reply .role {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.turn.ai-reply .sources {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.turn.ai-reply .sources a {
  color: var(--accent);
  text-decoration: none;
}
.turn.ai-reply .sources a:hover { text-decoration: underline; }

/* ── Template editor overlay (staff-only, in-app) ─────────────────
   Fills most of the viewport so the user doesn't lose their place in
   the host app. Click outside or Esc closes; dirty-check prompts on
   discard. */
.template-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.template-editor-card {
  width: min(1200px, 100%);
  height: min(880px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.template-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.template-editor-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.template-editor-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 10px;
  line-height: 1;
}
.template-editor-close:hover { color: var(--text); }
.template-editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}
.template-editor-list {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.template-editor-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.template-editor-new-btn {
  font: inherit;
  font-size: 11px;
  padding: 3px 10px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
}
.template-editor-new-btn:hover { background: rgba(24, 255, 255, 0.08); }
.template-editor-list-items { flex: 1; overflow-y: auto; padding: 6px; }
.template-editor-list-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 2px;
}
.template-editor-list-item:hover { background: rgba(255, 255, 255, 0.03); }
.template-editor-list-item.active {
  background: rgba(24, 255, 255, 0.06);
  border-color: rgba(24, 255, 255, 0.3);
}
.template-editor-list-name { font-size: 13px; font-weight: 500; }
.template-editor-list-id { font-size: 11px; color: var(--muted); font-family: Consolas, monospace; }
.template-editor-detail {
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 0;
}
.template-editor-detail .muted { color: var(--muted); font-size: 13px; }
.template-editor-form { display: flex; flex-direction: column; gap: 14px; }
.template-editor-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.template-editor-form-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.template-editor-form-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.template-editor-form-row > .template-editor-field { flex: 0 0 auto; width: 220px; }
.template-editor-form-row > .template-editor-field-grow { flex: 1 1 auto; width: auto; }
.template-editor-field { display: flex; flex-direction: column; gap: 4px; }
.template-editor-field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.template-editor-field em { color: var(--muted); font-style: normal; font-weight: 400; }
.template-editor-field input,
.template-editor-field textarea,
.template-editor-field select {
  padding: 7px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  box-sizing: border-box;
}
.template-editor-field textarea {
  font-family: 'ui-monospace', Consolas, 'SF Mono', monospace;
  resize: vertical;
}
.template-editor-field input:focus,
.template-editor-field textarea:focus,
.template-editor-field select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.template-editor-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.template-editor-form-actions .btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: 8px 20px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.template-editor-form-actions .btn-primary:hover { filter: brightness(0.95); }
.template-editor-cancel-btn,
.template-editor-del-btn {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
}
.template-editor-cancel-btn:hover { background: rgba(255, 255, 255, 0.04); }
.template-editor-del-btn {
  color: var(--alert);
  border-color: var(--alert);
}
.template-editor-del-btn:hover { background: var(--alert-tint); }
.template-editor-status {
  min-height: 18px;
  font-size: 12px;
  margin-top: 6px;
}
.template-editor-status.ok { color: var(--accent); }
.template-editor-status.err { color: var(--alert); }

/* Loading state inside the editor's detail pane — shown while the
   /staff/templates/:id fetch is in flight. Reuses the same keyframe
   as the chat-loading spinner. */
.template-editor-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 20px 20px;
  color: var(--muted);
}
.template-editor-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.template-editor-loading-text { font-size: 13px; }
.template-editor-loading-text strong { color: var(--text); font-weight: 600; }

/* Pencil button next to a template dropdown. Small, unobtrusive;
   only rendered for staff by whichever surface wires it. */
.template-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.template-edit-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─────────────────────────── Checklists */

.checklist-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 4px 6px;
  margin: 2px 0 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}
.checklist-nav {
  flex: 0 0 auto;
  background: transparent;
  color: var(--text-dim, #94a3b8);
  border: none;
  padding: 0 6px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
}
.checklist-nav:hover { color: var(--text, #e2e8f0); background: rgba(255, 255, 255, 0.06); }
.checklist-tab-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1 1 auto;
}
.checklist-tab-list::-webkit-scrollbar { display: none; }
.checklist-tab {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  /* Cap each tab at ~1/3 of the strip so a long name on one tab can't push
     every other tab out of sight. Short names stay compact. */
  max-width: 33%;
}
.checklist-tab-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.checklist-tab:hover { color: var(--text, #e2e8f0); border-color: rgba(255, 255, 255, 0.14); }
.checklist-tab.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--text, #e2e8f0);
  border-color: rgba(56, 189, 248, 0.3);
}
.checklist-tab-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--text-dim, #94a3b8);
}
.checklist-tab-pip.pip-grey  { background: transparent; border-color: rgba(148, 163, 184, 0.6); }
.checklist-tab-pip.pip-green { background: #4ade80; border-color: #4ade80; }
.checklist-tab-pip.pip-amber { background: #f59e0b; border-color: #f59e0b; }
.checklist-tab-pip.pip-red   { background: #ef4444; border-color: #ef4444; }

/* Pinned card lives above the main commentary scroll. */
.checklist-pinned-card {
  margin: 2px 0 6px;
}

/* Shared card layout — reused inline + pinned. */
.checklist-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text, #e2e8f0);
}
.checklist-card-inline {
  margin: 8px 0;
  border-left: 2px solid rgba(56, 189, 248, 0.4);
}
.checklist-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.checklist-card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text, #e2e8f0);
  cursor: text;
  border-bottom: 1px dashed transparent;
  padding-bottom: 1px;
  outline: none;
  flex: 1 1 auto;
  min-width: 0;
}
.checklist-card-title:hover,
.checklist-card-title:focus-visible {
  border-bottom-color: rgba(148, 163, 184, 0.5);
}
.checklist-card-title-input {
  width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--text, #e2e8f0);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 3px;
  padding: 1px 4px;
  outline: none;
}
.checklist-card-actions {
  display: flex;
  gap: 4px;
}
.checklist-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim, #94a3b8);
  padding: 2px 6px;
  font-size: 13px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
}
.checklist-action:hover { color: var(--text, #e2e8f0); border-color: rgba(255, 255, 255, 0.14); }
.checklist-action.active { color: #38bdf8; border-color: rgba(56, 189, 248, 0.4); }

.checklist-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 3px;
  line-height: 1.4;
}
.checklist-item:hover { background: rgba(255, 255, 255, 0.03); }
.checklist-item-toggle {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  background: transparent;
  color: var(--text-dim, #94a3b8);
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
}
.checklist-item-toggle:hover { background: rgba(255, 255, 255, 0.07); color: var(--text, #e2e8f0); }
.checklist-item-text {
  flex: 1 1 auto;
  color: var(--text, #e2e8f0);
}
.checklist-item-tail {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-dim, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}
.checklist-item-checked .checklist-item-text {
  color: var(--text-dim, #94a3b8);
  text-decoration: line-through;
}
.checklist-item-checked .checklist-item-toggle { color: #4ade80; }
.checklist-item-partial .checklist-item-toggle { color: #f59e0b; }
.checklist-item-overdue .checklist-item-toggle { color: #ef4444; }
.checklist-progress {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim, #94a3b8);
  text-align: right;
}

/* ─────────────────────── File-request approval UI */
.file-request-badge {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 4px;
  animation: file-request-pulse 2s ease-in-out infinite;
}
.file-request-badge:hover { background: rgba(245, 158, 11, 0.22); }
@keyframes file-request-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0); }
  50%      { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3); }
}
.file-request-popup {
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--text, #e2e8f0);
}
.file-request-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}
.file-request-popup-close {
  background: transparent;
  border: none;
  color: var(--text-dim, #94a3b8);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
}
.file-request-popup-close:hover { color: var(--text, #e2e8f0); }
.file-request-popup-list { display: flex; flex-direction: column; gap: 4px; }
.file-request-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.03);
}
.file-request-info { flex: 1 1 auto; min-width: 0; }
.file-request-path {
  font-family: monospace;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text, #e2e8f0);
}
.file-request-meta { font-size: 10px; color: var(--text-dim, #94a3b8); margin-top: 2px; }
.file-request-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.file-request-approve, .file-request-reject {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
}
.file-request-approve {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
}
.file-request-approve:hover { background: rgba(74, 222, 128, 0.25); }
.file-request-reject {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.file-request-reject:hover { background: rgba(239, 68, 68, 0.2); }
.file-request-popup-auto {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--text-dim, #94a3b8);
  cursor: pointer;
}

/* Attention routing — flash a tab or an inline card to catch the user's eye.
   Green (something covered), amber (partially / needs attention), red (overdue).
   Red is solid-persistent until the next status change on that list clears it. */
@keyframes checklist-flash-green {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.0); }
  40%  { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.0); }
}
@keyframes checklist-flash-amber {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0); }
  40%  { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0); }
}
@keyframes checklist-flash-red {
  0%, 100% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.14); }
  50%      { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.22); }
}
.checklist-tab.flash-green,
.checklist-card.flash-green  { animation: checklist-flash-green 1.6s ease-out 1; }
.checklist-tab.flash-amber,
.checklist-card.flash-amber  { animation: checklist-flash-amber 1.6s ease-out 1; }
.checklist-tab.flash-red,
.checklist-card.flash-red    { animation: checklist-flash-red 1.8s ease-in-out infinite; }
