/* sidekick.css — unified Sidekick brain UI (streaming turns, tool cards,
   session history). Layered on top of concept.css/project.css; tuned for the
   default black theme but uses soft, theme-agnostic surfaces. */

/* ── Toolbar: New chat / History ─────────────────────────────────────────── */
.sk-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sk-tool-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sk-tool-btn:hover { background: rgba(26, 143, 227, 0.15); color: #fff; }

/* Light theme — the rgba-white defaults above are invisible on a white panel.
   Give the New chat / History buttons real light-surface styling. */
html:not([data-theme="black"]) .sk-tool-btn {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
html:not([data-theme="black"]) .sk-tool-btn:hover {
  background: rgba(26, 143, 227, 0.10);
  border-color: #1a8fe3;
  color: #1a8fe3;
}

/* ── History popup ───────────────────────────────────────────────────────────
   Floating card anchored below the toolbar (same look/behaviour as DEV
   mode's "Jump to message" panel): header + date-range filter chips +
   sessions grouped by Today / Yesterday / … . Dark defaults, light-theme
   overrides below. */
.pw-sidekick { position: relative; }
.sk-history-panel {
  position: absolute;
  top: 96px;                       /* just under the sk-toolbar */
  left: 10px;
  right: 10px;
  z-index: 60;
  display: none;
  flex-direction: column;
  background: #10151d;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.sk-history-panel.open { display: flex; }
.sk-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
}
.sk-history-head i { margin-right: 4px; }
.sk-history-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.sk-history-close:hover { color: #e2e8f0; background: rgba(255, 255, 255, 0.08); }
.sk-history-filters {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}
.sk-history-filter {
  flex: 1;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  color: #94a3b8;
  font-family: inherit;
  transition: all 0.12s;
}
.sk-history-filter:hover { border-color: #1a8fe3; color: #1a8fe3; }
.sk-history-filter.active {
  background: #1a8fe3;
  border-color: #1a8fe3;
  color: #fff;
  font-weight: 600;
}
.sk-history-group {
  padding: 8px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  position: sticky;
  top: 0;
  background: #10151d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1;
}
.sk-sessions {
  padding: 4px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 48vh;
  min-height: 80px;
}
.sk-sessions-empty { padding: 24px 12px; color: #64748b; font-size: 12.5px; text-align: center; }
.sk-session {
  text-align: left;
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sk-session:hover { background: rgba(255, 255, 255, 0.07); }
.sk-session-active { border-color: rgba(26, 143, 227, 0.6); background: rgba(26, 143, 227, 0.12); }
.sk-session-time { font-size: 10px; color: #64748b; line-height: 1.35; }
.sk-session-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sk-session-title { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-session-meta { font-size: 11px; color: #64748b; }

/* Light theme — dark-surface defaults above are unreadable on white. */
html:not([data-theme="black"]) .sk-history-panel {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
html:not([data-theme="black"]) .sk-history-head {
  border-bottom-color: #eef2f7;
  color: #475569;
}
html:not([data-theme="black"]) .sk-history-close:hover { color: #0f172a; background: #f1f5f9; }
html:not([data-theme="black"]) .sk-history-filters {
  background: #f8fafc;
  border-bottom-color: #eef2f7;
}
html:not([data-theme="black"]) .sk-history-filter {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
}
html:not([data-theme="black"]) .sk-history-filter.active { background: #1a8fe3; border-color: #1a8fe3; color: #fff; }
html:not([data-theme="black"]) .sk-history-group {
  background: #ffffff;
  border-bottom-color: #eef2f7;
  color: #94a3b8;
}
html:not([data-theme="black"]) .sk-session { background: #f8fafc; }
html:not([data-theme="black"]) .sk-session:hover { background: #eef2f7; }
html:not([data-theme="black"]) .sk-session-active { border-color: rgba(26, 143, 227, 0.5); background: rgba(26, 143, 227, 0.08); }
html:not([data-theme="black"]) .sk-session-title { color: #0f172a; }
html:not([data-theme="black"]) .sk-session-time,
html:not([data-theme="black"]) .sk-session-meta,
html:not([data-theme="black"]) .sk-sessions-empty { color: #94a3b8; }

/* Per-message timestamp (bottom-right of every chat bubble). */
.ai-message .ai-message-time {
  font-size: 10px;
  color: #64748b;
  text-align: right;
  margin-top: 3px;
  user-select: none;
}
html:not([data-theme="black"]) .ai-message .ai-message-time { color: #94a3b8; }

/* ── Streaming turn + prose ──────────────────────────────────────────────── */
.sk-turn-content .sk-prose {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  margin: 2px 0;
}
.sk-turn-content .sk-prose code,
.ai-message-content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

/* ── Tool / action cards ─────────────────────────────────────────────────── */
.sk-action {
  margin: 8px 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}
.sk-action-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.04);
}
.sk-action-spin { color: #1a8fe3; width: 16px; text-align: center; }
.sk-action-ok .sk-action-spin { color: #22c55e; }
.sk-action-err .sk-action-spin { color: #ef4444; }
.sk-action-name { font-weight: 700; color: #e2e8f0; }
.sk-action-param {
  color: #94a3b8;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  border-radius: 5px;
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sk-action-status { margin-left: auto; font-size: 11px; color: #64748b; }
.sk-action-body {
  margin: 0;
  padding: 9px 11px;
  max-height: 240px;
  overflow: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  line-height: 1.45;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.sk-action-body:empty { display: none; }
.sk-action-collapsed .sk-action-body { max-height: 76px; }
.sk-action-streaming .sk-action-body::after {
  content: '▍';
  color: #1a8fe3;
  animation: sk-blink 1s steps(2, start) infinite;
}
@keyframes sk-blink { to { visibility: hidden; } }

/* Light theme — the action cards above use rgba-white surfaces and light text
   (#e2e8f0 / #cbd5e1) that all but vanish on the white panel. Restyle them onto a
   light surface with dark, readable text. Dark/black theme keeps the defaults. */
html:not([data-theme="black"]) .sk-action {
  border-color: #e2e8f0;
  background: #f8fafc;
}
html:not([data-theme="black"]) .sk-action-head {
  background: #f1f5f9;
}
html:not([data-theme="black"]) .sk-action-name { color: #1e293b; }
html:not([data-theme="black"]) .sk-action-param {
  color: #475569;
  background: rgba(0, 0, 0, 0.06);
}
html:not([data-theme="black"]) .sk-action-status { color: #64748b; }
html:not([data-theme="black"]) .sk-action-body {
  color: #334155;
  border-top-color: #e2e8f0;
}
html:not([data-theme="black"]) .sk-turn-content .sk-prose code,
html:not([data-theme="black"]) .ai-message-content code {
  background: rgba(0, 0, 0, 0.06);
  color: #334155;
}

/* ── No horizontal scroll on the chat window ─────────────────────────────────
   The messages column itself never scrolls sideways. Wide content (markdown
   tables, long code lines) keeps its NATURAL layout — never crushed to fit —
   and simply extends past the bubble edge, scrollable inside the bubble
   (min-width: 0 lets the bubble, a flex child of .ai-message, stay at panel
   width instead of stretching the whole panel). The user can widen the chat
   to see more. */
.ai-chat-messages { overflow-x: hidden; }
.ai-chat-messages .ai-message { max-width: 100%; }
.ai-chat-messages .ai-message-content {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}
.ai-chat-messages .ai-message-content pre { max-width: 100%; overflow-x: auto; }

/* ── Markdown tables + headings (rendered by fmt() in sidekick-brain.js) ───────
   Dark/black theme is the default; light theme is restyled below. The same
   markup is used in the Think DEV chat (.md-table in style.css). */
.md-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 10px 0;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
  white-space: normal;
}
.md-table th, .md-table td {
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: normal;
}
.md-table thead th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  color: #4fb0ff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid rgba(79, 176, 255, 0.35);
}
.md-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.md-table tbody tr:last-child td { border-bottom: none; }
.md-table tbody tr:hover { background: rgba(26, 143, 227, 0.10); }
.md-table td { color: #cbd5e1; }
.md-table code { background: rgba(255, 255, 255, 0.12); }

/* Shown while a [[TABLE]] block is still streaming — replaces the raw
   half-built "| d | d |" rows until the closing [[/TABLE]] arrives. */
.md-table-loading {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 8px 0; padding: 6px 11px;
  font-size: 12px; color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}
.md-table-loading i { color: #4fb0ff; animation: mdTblPulse 1.1s ease-in-out infinite; }
@keyframes mdTblPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.95; } }
html:not([data-theme="black"]) .md-table-loading {
  color: #64748b; background: #f8fafc; border-color: #e2e8f0;
}
html:not([data-theme="black"]) .md-table-loading i { color: #1a8fe3; }

.sk-prose .md-h { display: block; font-weight: 700; color: #e2e8f0; margin: 10px 0 2px; line-height: 1.3; }
.sk-prose .md-h1 { font-size: 15px; }
.sk-prose .md-h2 { font-size: 14px; }
.sk-prose .md-h3, .sk-prose .md-h4, .sk-prose .md-h5, .sk-prose .md-h6 { font-size: 13px; }

/* Light theme restyle */
html:not([data-theme="black"]) .md-table {
  background: #ffffff;
  border-color: #e2e8f0;
}
html:not([data-theme="black"]) .md-table th,
html:not([data-theme="black"]) .md-table td {
  border-bottom-color: #eef2f7;
}
html:not([data-theme="black"]) .md-table thead th {
  background: #f1f5f9;
  color: #1a6fb5;
  border-bottom-color: rgba(26, 143, 227, 0.35);
}
html:not([data-theme="black"]) .md-table tbody tr:nth-child(even) { background: #f8fafc; }
html:not([data-theme="black"]) .md-table tbody tr:hover { background: rgba(26, 143, 227, 0.08); }
html:not([data-theme="black"]) .md-table td { color: #334155; }
html:not([data-theme="black"]) .md-table code { background: rgba(0, 0, 0, 0.06); color: #334155; }
html:not([data-theme="black"]) .sk-prose .md-h { color: #1e293b; }

/* Send button turns into a stop button while a turn is streaming (JS toggles
   the icon); keep its hit area comfortable. */
.ai-chat-send-icon-btn .fa-stop { color: #ef4444; }

/* ── System status lines (what the brain DID — no AI call) ───────────────────
   Centered, muted "pill" rows distinct from user/bot bubbles. */
/* System status lines render with the regular AI (bot) bubble — they carry the
   .ai-message-bot + .ai-message-content classes, so their surface/colour/shape
   come from that styling (and its theme-black override) automatically. They just
   sit a little tighter together than full chat turns. */
.ai-message.ai-message-system { margin-bottom: 10px; }

/* ── "What's next?" chips (journey-grounded next-step suggestions) ───────────
   Rendered by renderNextSteps() after real work completes. Dark/black theme is
   the default; light theme is restyled below with the other overrides. */
.sk-next-content { padding: 10px 12px; }
.sk-next-header {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.sk-next-options { display: flex; flex-direction: column; gap: 6px; }
.sk-next-option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid rgba(147, 197, 253, 0.25);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  color: inherit;
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .1s;
}
.sk-next-option:hover:not(:disabled) {
  border-color: rgba(147, 197, 253, 0.6);
  background: rgba(59, 130, 246, 0.16);
  transform: translateY(-1px);
}
.sk-next-option:disabled { opacity: .55; cursor: default; }
.sk-next-option.sk-next-picked { opacity: 1; border-color: #3b82f6; background: rgba(59, 130, 246, 0.22); }
.sk-next-icon {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  font-size: 13px;
}
.sk-next-texts { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sk-next-label { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.sk-next-desc { font-size: 11.5px; color: #94a3b8; line-height: 1.35; }

html:not([data-theme="black"]) .sk-next-header { color: #1a8fe3; }
html:not([data-theme="black"]) .sk-next-option {
  border-color: #d3e2f2;
  background: #f4f9ff;
}
html:not([data-theme="black"]) .sk-next-option:hover:not(:disabled) {
  border-color: #1a8fe3;
  background: rgba(26, 143, 227, 0.08);
}
html:not([data-theme="black"]) .sk-next-option.sk-next-picked { border-color: #1a8fe3; background: rgba(26, 143, 227, 0.12); }
html:not([data-theme="black"]) .sk-next-icon { background: rgba(26, 143, 227, 0.12); color: #1a8fe3; }
html:not([data-theme="black"]) .sk-next-label { color: #1e293b; }
html:not([data-theme="black"]) .sk-next-desc { color: #64748b; }

/* Inline AskUser card (simple single-choice questions answered in the chat) —
   shares the .sk-next chip look; these are just its question text + hint. */
.sk-ask-inline-text {
  font-size: 13px;
  color: #e2e8f0;
  margin-bottom: 8px;
  line-height: 1.45;
}
.sk-ask-inline-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 7px;
  font-style: italic;
}
html:not([data-theme="black"]) .sk-ask-inline-text { color: #1e293b; }
html:not([data-theme="black"]) .sk-ask-inline-hint { color: #94a3b8; }

/* Inline FA icons rendered in place of status/AI emojis. Colors are tuned for
   the light theme here; theme-black.css brightens them for dark. */
.sk-ico { margin-right: 2px; font-size: .95em; }
.sk-ico-build  { color: #d97706; }
.sk-ico-done   { color: #16a34a; }
.sk-ico-ui     { color: #7c3aed; }
.sk-ico-ask    { color: #2563eb; }
.sk-ico-info   { color: #0ea5e9; }
.sk-ico-warn   { color: #d97706; }
.sk-ico-accent { color: #2563eb; }
.sk-ico-err    { color: #dc2626; }
.sk-ico-muted  { color: #64748b; }

/* ── AskUser popup (mirrors DEV mode; tuned for the dark Sidekick theme) ───── */
.sk-ask-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 14, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .22s ease;
}
.sk-ask-overlay.open { opacity: 1; }
.sk-ask-overlay.closing { opacity: 0; }

.sk-ask-popup {
  width: 520px;
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f1722;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  animation: sk-ask-in .32s cubic-bezier(.34, 1.56, .64, 1);
}
.sk-ask-overlay.closing .sk-ask-popup { animation: sk-ask-out .22s ease forwards; }
@keyframes sk-ask-in { from { opacity: 0; transform: scale(.93) translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes sk-ask-out { from { opacity: 1; } to { opacity: 0; transform: scale(.96) translateY(8px); } }

.sk-ask-header {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sk-ask-header-icon {
  width: 40px; height: 40px; min-width: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  background: rgba(26, 143, 227, 0.16);
  color: #4fb0ff;
  font-size: 17px;
}
.sk-ask-header-text { flex: 1; }
.sk-ask-title { font-size: 16px; font-weight: 700; color: #e8eef6; margin-bottom: 3px; }
.sk-ask-description { font-size: 12.5px; color: #93a2b6; line-height: 1.45; }

.sk-ask-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sk-ask-question { display: flex; flex-direction: column; gap: 9px; }
.sk-ask-question-text { font-size: 13.5px; font-weight: 600; color: #dbe4ef; }
.sk-ask-options { display: flex; flex-direction: column; gap: 6px; }

.sk-ask-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
  transition: background .14s, border-color .14s;
}
.sk-ask-option:hover { border-color: rgba(79, 176, 255, 0.6); background: rgba(26, 143, 227, 0.10); }
.sk-ask-option input { display: none; }

.sk-ask-radio, .sk-ask-check {
  width: 18px; height: 18px; min-width: 18px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  position: relative;
  transition: border-color .14s, background .14s;
}
.sk-ask-radio { border-radius: 50%; }
.sk-ask-check { border-radius: 5px; display: flex; align-items: center; justify-content: center; }
.sk-ask-option input[type="radio"]:checked ~ .sk-ask-radio { border-color: #4fb0ff; }
.sk-ask-option input[type="radio"]:checked ~ .sk-ask-radio::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 8px; height: 8px; border-radius: 50%; background: #4fb0ff;
}
.sk-ask-option input[type="checkbox"]:checked ~ .sk-ask-check { border-color: #4fb0ff; background: #4fb0ff; }
.sk-ask-option input[type="checkbox"]:checked ~ .sk-ask-check::after { content: '✓'; color: #06121f; font-size: 12px; font-weight: 800; }
.sk-ask-option-text { font-size: 13px; color: #cdd8e6; }
.sk-ask-option:has(input:checked) { border-color: #4fb0ff; background: rgba(26, 143, 227, 0.14); }
.sk-ask-option:has(input:checked) .sk-ask-option-text { color: #eaf3ff; font-weight: 600; }

.sk-ask-text-input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  font-size: 13.5px;
  color: #e8eef6;
  background: rgba(0, 0, 0, 0.28);
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.sk-ask-text-input::placeholder { color: #62748a; }
.sk-ask-text-input:focus { border-color: #4fb0ff; box-shadow: 0 0 0 3px rgba(26, 143, 227, 0.18); }

/* GitHub-import dialog (self-contained, reuses the sk-ask popup shell) */
.sk-gh-field { margin-bottom: 14px; }
.sk-gh-field:last-child { margin-bottom: 0; }
.sk-gh-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #b8c6d6;
}
.sk-gh-hint { font-weight: 400; color: #62748a; }
.sk-gh-error {
  display: none;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #ff9b9b;
  font-size: 12.5px;
}

.sk-ask-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.sk-ask-cancel-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.sk-ask-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.sk-ask-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border: none;
  border-radius: 9px;
  background: #1a8fe3;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .14s, transform .14s, box-shadow .14s;
}
.sk-ask-submit-btn:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26, 143, 227, 0.35); }
.sk-ask-submit-btn:active { transform: none; }

/* ── One-click copy on chat blocks ───────────────────────────────────────── */
/* The button flows beside the bubble (outer side thanks to the row/row-reverse
   flex), fades in on hover, and flashes a check when the copy lands. Uses the
   shared theme variables so it reads correctly in both black and light. */
.ai-message { position: relative; }
.sk-copy-btn {
  align-self: flex-start;
  flex-shrink: 0;
  margin: 2px 6px 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  background: var(--bg-primary, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s;
}
.ai-message:hover .sk-copy-btn { opacity: 1; }
.sk-copy-btn:hover { color: #1a8fe3; border-color: #1a8fe3; }
.sk-copy-btn.t4e-copied { opacity: 1; color: #10b981; border-color: #10b981; }
/* Touch devices have no hover — keep the button faintly visible. */
@media (hover: none) { .sk-copy-btn { opacity: .55; } }

/* ── "New messages" pill (smart auto-scroll) ─────────────────────────────── */
/* Shown when chat content arrives while the user is scrolled up (same UX as
   /together). Anchors to .pw-sidekick when docked (ai-chat-window is static
   there) or to the floating chat window otherwise. Accent-on-white works in
   both the black and light themes. */
.sk-new-msgs-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  bottom: 150px;
  z-index: 30;
  display: none;
  align-items: center;
  gap: 6px;
  background: #1a8fe3;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s;
  opacity: 0;
}
.sk-new-msgs-pill.show {
  display: inline-flex;
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.sk-new-msgs-pill:hover { filter: brightness(1.08); }
.sk-new-msgs-pill i { font-size: 11px; }

/* ── AskUser popup: light theme ──────────────────────────────────────────── */
/* The popup shell above is dark-first; on the light theme swap to a white
   card with slate text so questions/options are readable. */
html:not([data-theme="black"]) .sk-ask-overlay {
  background: rgba(15, 23, 42, 0.35);
}
html:not([data-theme="black"]) .sk-ask-popup {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}
html:not([data-theme="black"]) .sk-ask-header { border-bottom-color: #eef2f7; }
html:not([data-theme="black"]) .sk-ask-header-icon {
  background: rgba(26, 143, 227, 0.12);
  color: #1a8fe3;
}
html:not([data-theme="black"]) .sk-ask-title { color: #0f172a; }
html:not([data-theme="black"]) .sk-ask-description { color: #64748b; }
html:not([data-theme="black"]) .sk-ask-question-text { color: #1e293b; }
html:not([data-theme="black"]) .sk-ask-option {
  border-color: #dbe3ec;
  background: #f8fafc;
}
html:not([data-theme="black"]) .sk-ask-option:hover {
  border-color: #1a8fe3;
  background: rgba(26, 143, 227, 0.07);
}
html:not([data-theme="black"]) .sk-ask-option-text { color: #334155; }
html:not([data-theme="black"]) .sk-ask-radio,
html:not([data-theme="black"]) .sk-ask-check { border-color: #b6c2d1; }
html:not([data-theme="black"]) .sk-ask-option input[type="radio"]:checked ~ .sk-ask-radio { border-color: #1a8fe3; }
html:not([data-theme="black"]) .sk-ask-option input[type="radio"]:checked ~ .sk-ask-radio::after { background: #1a8fe3; }
html:not([data-theme="black"]) .sk-ask-option input[type="checkbox"]:checked ~ .sk-ask-check {
  border-color: #1a8fe3;
  background: #1a8fe3;
}
html:not([data-theme="black"]) .sk-ask-option input[type="checkbox"]:checked ~ .sk-ask-check::after { color: #fff; }
html:not([data-theme="black"]) .sk-ask-option:has(input:checked) {
  border-color: #1a8fe3;
  background: rgba(26, 143, 227, 0.10);
}
html:not([data-theme="black"]) .sk-ask-option:has(input:checked) .sk-ask-option-text { color: #0c2a40; }
html:not([data-theme="black"]) .sk-ask-text-input {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}
html:not([data-theme="black"]) .sk-ask-text-input::placeholder { color: #94a3b8; }
html:not([data-theme="black"]) .sk-ask-text-input:focus {
  border-color: #1a8fe3;
  box-shadow: 0 0 0 3px rgba(26, 143, 227, 0.15);
}
html:not([data-theme="black"]) .sk-ask-footer { border-top-color: #eef2f7; }
html:not([data-theme="black"]) .sk-ask-cancel-btn {
  border-color: #cbd5e1;
  color: #475569;
}
html:not([data-theme="black"]) .sk-ask-cancel-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}
/* GitHub-import dialog fields (same popup shell) */
html:not([data-theme="black"]) .sk-gh-label { color: #334155; }
html:not([data-theme="black"]) .sk-gh-hint { color: #94a3b8; }
html:not([data-theme="black"]) .sk-gh-error {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
}

/* ── ConfirmChanges popup (reuses the sk-ask shell; adds the change list) ── */
.sk-confirm-popup { width: 560px; }
.sk-confirm-header-icon {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}
.sk-confirm-lead {
  font-size: 12.5px;
  color: #93a2b6;
  margin-bottom: -6px;
}
.sk-confirm-list { display: flex; flex-direction: column; gap: 8px; }
.sk-confirm-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
}
.sk-confirm-badge {
  min-width: 58px;
  margin-top: 1px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-align: center;
  background: rgba(26, 143, 227, 0.16);
  color: #4fb0ff;
}
.sk-confirm-badge-create { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.sk-confirm-badge-delete { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.sk-confirm-badge-run    { background: rgba(217, 119, 6, 0.18);  color: #fbbf24; }
.sk-confirm-item-text { flex: 1; min-width: 0; }
.sk-confirm-target { font-size: 12.5px; font-weight: 700; color: #dbe4ef; }
.sk-confirm-detail { font-size: 12.5px; color: #93a2b6; line-height: 1.45; margin-top: 2px; word-break: break-word; }
.sk-confirm-reject-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 9px;
  background: transparent;
  color: #f87171;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.sk-confirm-reject-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.65);
}
.sk-confirm-approve-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border: none;
  border-radius: 9px;
  background: #10b981;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .14s, transform .14s, box-shadow .14s;
}
.sk-confirm-approve-btn:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35); }
.sk-confirm-approve-btn:active { transform: none; }

/* ConfirmChanges popup: light theme */
html:not([data-theme="black"]) .sk-confirm-header-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
html:not([data-theme="black"]) .sk-confirm-lead { color: #64748b; }
html:not([data-theme="black"]) .sk-confirm-item {
  border-color: #dbe3ec;
  background: #f8fafc;
}
html:not([data-theme="black"]) .sk-confirm-badge { background: rgba(26, 143, 227, 0.12); color: #1a6fb0; }
html:not([data-theme="black"]) .sk-confirm-badge-create { background: rgba(16, 185, 129, 0.14); color: #047857; }
html:not([data-theme="black"]) .sk-confirm-badge-delete { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
html:not([data-theme="black"]) .sk-confirm-badge-run    { background: rgba(217, 119, 6, 0.14);  color: #b45309; }
html:not([data-theme="black"]) .sk-confirm-target { color: #1e293b; }
html:not([data-theme="black"]) .sk-confirm-detail { color: #64748b; }
html:not([data-theme="black"]) .sk-confirm-reject-btn {
  border-color: rgba(220, 38, 38, 0.4);
  color: #dc2626;
}
html:not([data-theme="black"]) .sk-confirm-reject-btn:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.6);
}
