/* ============================================================
   HackCode Studio — friendly local AI interface
   ============================================================ */

:root {
  --bg: #0a0e17;
  --bg-2: #0e1421;
  --panel: #121a29;
  --panel-2: #162033;
  --panel-hi: #1b2740;
  --line: #223049;
  --line-soft: #1a2437;
  --text: #f7f0f0;
  --text-dim: #c2a9a9;
  --text-faint: #8a6f6f;
  --accent: #ff2d3f;
  --accent-2: #ff5c6a;
  --accent-warm: #ff3d7f;
  --good: #35d07a;
  --warn: #ffb020;
  --bad: #ff3b30;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 8px 24px -14px rgba(0, 0, 0, 0.7);
  --grad: linear-gradient(135deg, #ff2d3f 0%, #ff5c6a 100%);
  --grad-soft: linear-gradient(135deg, rgba(255,45,63,.18), rgba(255,92,106,.14));
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win over component display rules. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(1100px 700px at 88% -8%, rgba(var(--accent-2-rgb), 0.10), transparent 60%),
    radial-gradient(900px 620px at -6% 4%, rgba(var(--accent-rgb), 0.14), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(var(--accent-rgb), 0.4); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #33222a transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2b1a20; border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #3d2830; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── Layout ─────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 288px) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(18, 26, 41, 0.75), rgba(10, 14, 23, 0.85));
  border-right: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
  min-height: 0;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 6px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 14px rgba(var(--accent-rgb), 0.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 0.16em; text-transform: uppercase; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .12s ease, box-shadow .16s ease, opacity .16s;
}
.btn:hover { background: var(--panel-hi); border-color: #3a252c; }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--grad);
  border: none;
  color: #0b0508;
  box-shadow: 0 10px 26px -12px rgba(var(--accent-rgb), 0.9);
  font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.07); background: var(--grad); }
.btn-ghost { background: transparent; border-color: var(--line-soft); color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-plus { font-size: 17px; line-height: 1; margin-top: -1px; }

.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--text-faint);
  border-radius: 9px; width: 30px; height: 30px; display: grid; place-items: center;
  cursor: pointer; font-size: 14px; transition: all .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-soft); }

/* Mode switch */
.mode-switch {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 4px; gap: 4px;
}
.mode-btn {
  position: relative; z-index: 2;
  background: transparent; border: none; color: var(--text-dim);
  font: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 6px;
  border-radius: 9px; cursor: pointer; transition: color .18s;
}
.mode-btn.active { color: #0b0508; }
.mode-slider {
  position: absolute; z-index: 1; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 20px) / 4);
  border-radius: 9px; background: var(--grad);
  transition: transform .26s cubic-bezier(.3, .8, .3, 1);
  box-shadow: 0 8px 20px -10px rgba(var(--accent-rgb), 0.9);
}
.mode-switch[data-mode="agent"] .mode-slider { transform: translateX(calc(100% + 4px)); }
.mode-switch[data-mode="crew"] .mode-slider { transform: translateX(calc(200% + 8px)); }
.mode-switch[data-mode="guide"] .mode-slider { transform: translateX(calc(300% + 12px)); }

.section-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-faint); padding: 2px 8px; margin-top: 2px;
}

.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; min-height: 0; padding-right: 2px; }
.conv-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; color: var(--text-dim);
  transition: background .14s, color .14s, border-color .14s;
}
.conv-item:hover { background: var(--panel); color: var(--text); }
.conv-item.active { background: var(--grad-soft); border-color: rgba(var(--accent-rgb), 0.35); color: var(--text); }
.conv-item .ci-title { flex: 1; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .ci-del {
  opacity: 0; border: none; background: transparent; color: var(--text-faint);
  cursor: pointer; border-radius: 7px; width: 22px; height: 22px; font-size: 12px; flex: none;
  transition: opacity .15s, background .15s, color .15s;
}
.conv-item:hover .ci-del { opacity: 1; }
.conv-item .ci-del:hover { background: rgba(255, 59, 48, 0.16); color: var(--bad); }
.ci-tools { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .12s; }
.conv-item:hover .ci-tools, .conv-item.active .ci-tools { opacity: 1; }
.conv-item .ci-act {
  background: transparent; border: 0; color: var(--text-faint);
  font-size: 12px; line-height: 1; cursor: pointer;
  padding: 4px 5px; border-radius: 6px; transition: background .12s, color .12s;
}
.conv-item .ci-act:hover { background: rgba(var(--accent-rgb), 0.16); color: var(--text); }
.conv-item.pinned .ci-title { font-weight: 600; }
.msg-actions { margin-left: 8px; }
.msg-actions .act-btn {
  background: transparent; border: 1px solid var(--line); color: var(--text-faint);
  font-size: 11px; cursor: pointer; padding: 2px 8px; border-radius: 999px;
  transition: background .12s, color .12s, border-color .12s;
}
.msg-actions .act-btn:hover { background: var(--panel); color: var(--text); border-color: var(--accent); }
.conv-empty { color: var(--text-faint); font-size: 12.5px; padding: 10px; text-align: center; }

.sidebar-footer { display: flex; flex-direction: column; gap: 9px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.conn { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 12px; color: var(--text-faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 3px rgba(255,255,255,.03); flex: none; }
.dot.ok { background: var(--good); box-shadow: 0 0 12px rgba(53, 208, 122, .8); }
.dot.bad { background: var(--bad); box-shadow: 0 0 12px rgba(255, 59, 48, .7); }

/* ── Main ───────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 22px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(18,26,41,.55), rgba(18,26,41,0));
  backdrop-filter: blur(8px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.model-badge {
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px; max-width: 46vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  color: var(--text-dim); background: var(--panel); border: 1px solid var(--line-soft);
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; flex: none;
}
.pill.accent { color: #0b0508; background: var(--grad); border: none; }

.messages {
  flex: 1; overflow-y: auto; padding: 26px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 0; scroll-behavior: smooth;
}
.messages > * { width: 100%; max-width: 860px; padding-left: 24px; padding-right: 24px; }

/* Empty state */
.empty { position: relative; text-align: center; padding: 8vh 24px 40px; }
.empty-glow {
  position: absolute; inset: 0; margin: auto; width: 420px; height: 260px;
  background: radial-gradient(closest-side, rgba(255,45,63,.22), transparent 72%);
  filter: blur(12px); pointer-events: none; z-index: 0;
}
.empty > * { position: relative; z-index: 1; }
.empty h1 { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; margin: 0 0 12px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.empty-sub { color: var(--text-dim); max-width: 560px; margin: 0 auto 30px; font-size: 15.5px; }
.empty-note { color: var(--text-faint); font-size: 12.5px; margin-top: 20px; }

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 640px; margin: 0 auto; }
.chip {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 1px solid var(--line-soft); color: var(--text);
  border-radius: 14px; padding: 13px 15px; cursor: pointer; font: inherit;
  transition: transform .16s, border-color .16s, background .16s, box-shadow .16s;
}
.chip:hover { transform: translateY(-2px); border-color: rgba(255,45,63,.5); background: var(--panel-2); box-shadow: var(--shadow-soft); }
.chip-ic { font-size: 20px; flex: none; }
.chip span { display: flex; flex-direction: column; line-height: 1.35; }
.chip b { font-size: 14px; font-weight: 650; }
.chip small { color: var(--text-faint); font-size: 12px; }

/* Messages */
.row { display: flex; gap: 14px; margin: 12px 0; animation: rise .32s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.row.user { justify-content: flex-end; }

.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 15px; margin-top: 2px;
  background: var(--grad); color: #0b0508; font-weight: 800;
}
.bubble {
  border-radius: 15px; padding: 12px 16px; max-width: 100%; min-width: 0;
  border: 1px solid var(--line-soft); box-shadow: var(--shadow-soft);
}
.row.assistant .bubble { background: var(--panel); border-top-left-radius: 5px; max-width: 88%; }
.row.user .bubble {
  background: var(--grad-soft); border-color: rgba(255,45,63,.34);
  border-top-right-radius: 5px; max-width: 78%;
}
.bubble .who { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.msg-meta { display: flex; gap: 10px; align-items: center; margin-top: 9px; font-size: 11px; color: var(--text-faint); }
.msg-meta .tag { background: var(--panel-2); border: 1px solid var(--line-soft); padding: 2px 8px; border-radius: 999px; }

/* Markdown */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 8px; line-height: 1.3; letter-spacing: -0.01em; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 14.5px; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md a { color: var(--accent-2); text-decoration: none; border-bottom: 1px solid rgba(255,92,106,.4); }
.md a:hover { border-bottom-color: var(--accent-2); }
.md blockquote {
  margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--accent);
  background: rgba(255,45,63,.08); border-radius: 0 8px 8px 0; color: var(--text-dim);
}
.md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md code {
  font-family: var(--mono); font-size: 13px;
  background: #0c1322; border: 1px solid var(--line-soft);
  padding: 1.5px 6px; border-radius: 6px; color: #ffb8be;
}
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.md th { background: var(--panel-2); font-weight: 650; }
.md del { color: var(--text-faint); }

/* Code blocks */
.code-wrap { position: relative; margin: 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0c0709; }
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 6px 13px; background: #130b0d; border-bottom: 1px solid var(--line-soft);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint);
}
.code-copy {
  border: 1px solid var(--line-soft); background: transparent; color: var(--text-dim);
  font: inherit; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 7px; cursor: pointer; transition: all .15s;
}
.code-copy:hover { background: var(--panel-hi); color: var(--text); }
.code-copy.done { color: var(--good); border-color: rgba(53,208,122,.5); }
.code-wrap pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code-wrap code { background: none; border: none; padding: 0; color: #f0d6d8; font-size: 13px; line-height: 1.65; }

/* Cursor while streaming */
.cursor {
  display: inline-block; width: 8px; height: 16px; margin-left: 2px;
  background: var(--accent-2); border-radius: 2px; vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Thinking indicator */
.thinking { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13.5px; }
.thinking .dots { display: inline-flex; gap: 4px; }
.thinking .dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2);
  animation: bounce 1.2s infinite ease-in-out;
}
.thinking .dots i:nth-child(2) { animation-delay: .15s; }
.thinking .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }
.elapsed { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }

/* Agent task card */
.task-card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; box-shadow: var(--shadow-soft); max-width: 92%; }
.task-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 15px;
  background: linear-gradient(135deg, rgba(255,61,127,.12), rgba(255,45,63,.12));
  border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.task-head .t-title { font-weight: 650; }
.task-head .t-state { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.task-log {
  font-family: var(--mono); font-size: 12px; color: var(--text-faint);
  padding: 10px 15px; max-height: 120px; overflow-y: auto; white-space: pre-wrap;
  border-bottom: 1px solid var(--line-soft); background: #0c0709;
}
.task-log:empty { display: none; }
.task-body { padding: 14px 16px; }
.task-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stat { font-size: 11px; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--line-soft); padding: 3px 9px; border-radius: 999px; }
.stat b { color: var(--text); font-weight: 650; }
.tool-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chip { font-family: var(--mono); font-size: 11px; color: #ffc4c8; background: rgba(255,45,63,.14); border: 1px solid rgba(255,45,63,.32); padding: 2px 8px; border-radius: 7px; }

/* Errors */
.bubble.err { background: rgba(255,59,48,.1); border-color: rgba(255,59,48,.4); }
.bubble.err .who { color: var(--bad); }

/* Composer */
.composer { padding: 12px 24px 18px; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.composer-inner {
  width: 100%; max-width: 860px; display: flex; align-items: flex-end; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 9px 9px 9px 16px; box-shadow: var(--shadow); transition: border-color .18s, box-shadow .18s;
}
.composer-inner:focus-within { border-color: rgba(255,45,63,.6); box-shadow: 0 0 0 4px rgba(255,45,63,.12), var(--shadow); }
#input {
  flex: 1; resize: none; border: none; outline: none; background: transparent; color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.55; max-height: 190px; padding: 8px 0; min-height: 24px;
}
#input::placeholder { color: var(--text-faint); }
.composer-actions { display: flex; gap: 8px; align-items: center; }
.btn-send {
  width: 42px; height: 42px; padding: 0; border: none; border-radius: 13px;
  background: var(--grad); color: #0b0508; font-size: 16px; flex: none;
  box-shadow: 0 10px 24px -12px rgba(255,45,63,.95);
}
.btn-send:hover { filter: brightness(1.08); background: var(--grad); }
.btn-send:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-stop { background: rgba(255,59,48,.14); border-color: rgba(255,59,48,.45); color: #ffc9c6; padding: 9px 13px; }
.btn-stop:hover { background: rgba(255,59,48,.24); border-color: rgba(255,59,48,.6); }
.btn-stop .sq { width: 9px; height: 9px; background: currentColor; border-radius: 2px; }
.composer-hint { font-size: 11.5px; color: var(--text-faint); display: flex; gap: 8px; align-items: center; }
.composer-hint .sep { opacity: .5; }
.speed-switch {
  display: inline-flex; gap: 2px; padding: 2px; margin-left: 2px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 9px;
}
.speed-switch[hidden] { display: none; }
.speed-btn {
  background: transparent; border: none; color: var(--text-faint);
  font: inherit; font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 7px; cursor: pointer; transition: color .15s, background .15s;
}
.speed-btn:hover { color: var(--text-dim); }
.speed-btn.active { background: var(--grad); color: #0b0508; font-weight: 700; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 8, 15, 0.66); backdrop-filter: blur(5px);
  display: grid; place-items: center; z-index: 50; padding: 20px;
  animation: fade .18s ease;
}
/* The [hidden] attribute must win over the grid display above. */
.modal-backdrop[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 650; color: var(--text-dim); letter-spacing: .02em; }
.field-help { font-size: 11.5px; color: var(--text-faint); }
.field input, .field select, .field textarea {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; font-family: var(--sans); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255,45,63,.6); box-shadow: 0 0 0 3px rgba(255,45,63,.12); }
.field select option { background: var(--panel); }

.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--panel-hi);
  border: 1px solid var(--line); position: relative; transition: background .2s, border-color .2s; margin-top: 1px;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-dim); transition: transform .2s cubic-bezier(.3,.8,.3,1), background .2s;
}
.switch input:checked + .switch-track { background: var(--grad); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); background: #0b0508; }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-text b { font-size: 13.5px; font-weight: 650; }
.switch-text small { color: var(--text-faint); font-size: 11.5px; line-height: 1.45; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-top: 1px solid var(--line-soft); }
.save-state { font-size: 12.5px; color: var(--good); opacity: 0; transition: opacity .2s; }
.save-state.show { opacity: 1; }

/* ── Toasts ─────────────────────────────────────────────── */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 60; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 11px 15px; font-size: 13px; box-shadow: var(--shadow);
  animation: slidein .24s cubic-bezier(.2,.9,.3,1.2); max-width: 340px;
}
.toast.err { border-color: rgba(255,59,48,.5); background: rgba(255,59,48,.12); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 288px; z-index: 40; transform: translateX(-102%); transition: transform .25s ease; }
  .app.show-sidebar .sidebar { transform: none; box-shadow: var(--shadow); }
  .messages > * { padding-left: 14px; padding-right: 14px; }
  .chips { grid-template-columns: 1fr; }
  .empty h1 { font-size: 26px; }
  .menu-toggle { display: grid !important; }
  .model-badge { max-width: 38vw; }
  .topbar-left, .topbar-right { gap: 7px; min-width: 0; }
}
.menu-toggle { display: none; }

/* Crew-mode model picker (composer hint row) */
.crew-model {
  max-width: 26ch;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  opacity: 0.85;
}

/* Per-agent crew model pickers (composer hint row, crew mode only) */
.crew-models {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.crew-models[hidden] { display: none; }
.crew-role { display: inline-flex; gap: 5px; align-items: center; }
.crew-role-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  opacity: 0.7;
}
.crew-models .crew-model { max-width: 24ch; }

/* Per-run workspace override (composer hint row) */
.run-workspace {
  max-width: 30ch;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: inherit;
  opacity: 0.85;
}
.run-workspace::placeholder { color: currentColor; opacity: 0.5; }
.run-workspace:focus { opacity: 1; outline: none; border-color: var(--accent, #ff2d3f); }

/* Conversation search (sidebar) */
.conv-search { position: relative; display: flex; align-items: center; margin: 0 0 6px; }
.conv-search-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 26px 7px 10px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.conv-search-input::placeholder { color: var(--text-faint); }
.conv-search-input:focus { border-color: rgba(var(--accent-rgb), 0.55); background: var(--panel-2); }
.conv-search-input::-webkit-search-cancel-button { display: none; }
.conv-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
}
.conv-search-clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

/* Conversation row: title above a meta line or match snippet */
.conv-item .ci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.conv-item .ci-body .ci-title { flex: none; min-width: 0; }
.conv-item .ci-snippet {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.conv-item.active .ci-snippet { color: var(--text-dim); }

/* ── Models modal ─────────────────────────────────────────── */
.modal-wide { width: min(720px, 100%); }
.modal-note { font-size: 12px; color: var(--text-faint); }

.pull-row { display: flex; gap: 10px; }
.pull-input {
  flex: 1; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.pull-input:focus { border-color: rgba(255,45,63,.6); box-shadow: 0 0 0 3px rgba(255,45,63,.12); }
.pull-row .btn { flex: none; }

.pull-progress {
  display: flex; flex-direction: column; gap: 8px; background: var(--panel);
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px;
}
.pull-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-dim); }
.pull-status { text-transform: capitalize; }
.pull-pct { font-family: var(--mono); color: var(--accent-2); }
.progress-track { height: 8px; background: var(--panel-hi); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--grad); border-radius: 999px; transition: width .25s ease; }
.pull-note { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); word-break: break-all; }

.section-mini {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); margin-top: 4px;
}

.model-list { display: flex; flex-direction: column; gap: 10px; }
.model-card {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 13px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, background .15s;
}
.model-card:hover { border-color: var(--line); background: var(--panel-2); }
.model-card.active { border-color: rgba(255,45,63,.55); background: var(--grad-soft); }
.model-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-name { font-weight: 650; font-size: 13.5px; font-family: var(--mono); word-break: break-all; }
.cur-tag {
  font-size: 10px; background: var(--grad); color: #0b0508; padding: 2px 7px; border-radius: 999px;
  font-family: var(--sans); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle;
}
.model-size { flex: none; font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.model-meta { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }
.model-caps { display: flex; gap: 6px; flex-wrap: wrap; }
.cap {
  font-size: 10.5px; color: var(--text-dim); background: var(--panel-hi);
  border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px;
}
.model-actions { display: flex; gap: 8px; }
.btn-mini { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-mini.danger { color: var(--bad); border-color: rgba(255,59,48,.35); }
.btn-mini.danger:hover { background: rgba(255,59,48,.12); border-color: rgba(255,59,48,.55); }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-val {
  float: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  opacity: 0.75;
}
.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.builder {
  margin: 4px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
}
.builder > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}
.builder-body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pull-select,
.build-system {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.build-system {
  resize: vertical;
  min-height: 62px;
  width: 100%;
  box-sizing: border-box;
}
.mini-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  opacity: 0.9;
}
.mini-field input {
  width: 110px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
}
.pull-row .pull-select {
  flex: 1 1 auto;
  min-width: 0;
}

.export-wrap {
  position: relative;
  display: inline-flex;
}
.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 156px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(24, 24, 32, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.export-menu button {
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
}
.export-menu button:hover {
  background: rgba(255, 255, 255, 0.07);
}
.pull-line .btn-mini {
  flex: none;
}

.model-empty {
  padding: 18px; text-align: center; color: var(--text-faint); font-size: 13px;
  border: 1px dashed var(--line); border-radius: 12px;
}

/* ── Sidebar drag-resizer ────────────────────────────────── */
.sidebar-resizer {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 6; touch-action: none;
}
.sidebar-resizer::after {
  content: ""; position: absolute; top: 0; right: 3px; width: 2px; height: 100%;
  background: transparent; transition: background .15s;
}
.sidebar-resizer:hover::after,
body.resizing .sidebar-resizer::after { background: var(--accent); }
body.resizing { user-select: none; cursor: col-resize; }
body.resizing * { cursor: col-resize !important; }

/* ── Keyboard shortcuts help ─────────────────────────────── */
.shortcut-list { display: flex; flex-direction: column; gap: 2px; }
.shortcut {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 10px; border-radius: 9px;
}
.shortcut:hover { background: rgba(255, 255, 255, 0.04); }
.shortcut .keys { display: inline-flex; gap: 5px; }
.shortcut .sc-desc { color: var(--text-dim); font-size: 13.5px; }
kbd {
  font-family: var(--mono); font-size: 11.5px; line-height: 1;
  padding: 5px 8px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-bottom-width: 2px; color: var(--text);
}
.sc-note { margin: 4px 0 0; font-size: 12px; color: var(--text-faint); }
.msg-actions .act-btn.done, .code-copy.done { color: var(--good); border-color: var(--good); }

@media (max-width: 820px) {
  .sidebar-resizer { display: none; }
}

/* ── Skills & tool allow-list ────────────────────────────── */
.skills-intro { margin: 0 0 4px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.skills-intro code {
  font-family: var(--mono); font-size: 12px;
  background: var(--panel-hi); padding: 1px 6px; border-radius: 6px;
}
.model-row {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 13px;
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: border-color .15s, background .15s;
}
.model-row:hover { border-color: var(--line); background: var(--panel-2); }
.model-row .model-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.model-row .model-sub {
  font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); word-break: break-word;
}
.model-row .model-actions { flex: none; }
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px; margin: 8px 0 10px; max-height: 260px; overflow-y: auto;
  padding: 10px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px;
}
.tool-chip {
  display: flex; align-items: center; gap: 7px; font-size: 12px; font-family: var(--mono);
  color: var(--text-dim); cursor: pointer; padding: 3px 5px; border-radius: 7px;
}
.tool-chip:hover { background: var(--panel-hi); color: var(--text); }
.tool-chip input { accent-color: var(--accent); margin: 0; }
.tool-actions { display: flex; gap: 8px; }

/* ── Pentest Toolkit ─────────────────────────────────────── */
.tk-body { gap: 14px; }
.tk-count { color: var(--accent-2); font-family: var(--mono); font-size: 12px; }
.tk-toolbar { display: flex; flex-direction: column; gap: 10px; }
.tk-search { width: 100%; }
.tk-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-cat {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  background: var(--panel-hi); border: 1px solid var(--line-soft); color: var(--text-dim);
}
.tk-cat:hover { color: var(--text); }
.tk-cat.on { background: rgba(255,45,63,.18); border-color: rgba(255,45,63,.5); color: #ffc4c8; }
.tk-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px; max-height: 320px; overflow-y: auto; padding-right: 2px;
}
.tk-card {
  border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px;
  background: var(--panel-hi); display: flex; flex-direction: column; gap: 6px;
}
.tk-card.off { opacity: .62; }
.tk-card-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tk-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tk-dot.ok { background: #35d07a; box-shadow: 0 0 6px rgba(53,208,122,.6); }
.tk-dot.off { background: #8a6f6f; }
.tk-card-name { font-weight: 600; font-size: 13.5px; }
.tk-card-cat { font-size: 10.5px; font-family: var(--mono); color: var(--text-faint); }
.tk-badge { font-size: 9.5px; font-family: var(--mono); padding: 1px 6px; border-radius: 6px; }
.tk-badge.gui { background: rgba(var(--accent-2-rgb),.16); color: #7dd3fc; border: 1px solid rgba(var(--accent-2-rgb),.4); }
.tk-badge.miss { background: rgba(255,59,48,.14); color: #ff9c98; border: 1px solid rgba(255,59,48,.35); }
.tk-card-desc { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.tk-eg {
  font-family: var(--mono); font-size: 11px; color: #ff9aa2;
  background: rgba(15,23,42,.5); border-radius: 6px; padding: 4px 6px; word-break: break-all;
}
.tk-install { font-family: var(--mono); font-size: 11px; color: #ff9c98; word-break: break-all; }
.tk-install-btn { border-color: rgba(255,59,48,.45); color: #ff9c98; }
.tk-install-btn:hover { background: rgba(255,59,48,.12); color: #ffc9c6; }
.tk-card-acts { display: flex; gap: 6px; margin-top: auto; }
.tk-empty { color: var(--text-faint); font-size: 13px; padding: 14px 2px; }
.tk-run {
  border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: rgba(15,23,42,.35);
}
.tk-run-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tk-run-title { font-weight: 600; font-size: 13.5px; }
.tk-run-hint { font-family: var(--mono); font-size: 11px; color: var(--text-faint); word-break: break-all; }
.tk-spacer { flex: 1 1 auto; }
.tk-args { width: 100%; font-family: var(--mono); }
.tk-run-status { font-size: 11.5px; color: var(--text-dim); font-family: var(--mono); }
.tk-out {
  margin: 0; max-height: 240px; overflow: auto; background: #0c0709; color: #e6d6d8;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.45; padding: 10px;
  border-radius: 8px; border: 1px solid var(--line-soft); white-space: pre-wrap; word-break: break-word;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================================
   R8 — PREMIUM DARK LAYER
   A modern, high-contrast "HQ" finish layered over the original
   theme. Tokens are redefined here so every existing component
   inherits the new palette without touching markup.
   ============================================================ */

:root {
  /* R14 — BLACK / RED hacker palette */
  --bg: #050507;
  --bg-2: #0a0a0d;
  --panel: #0d0d11;
  --panel-2: #141418;
  --panel-hi: #1c1c22;
  --line: #2a1417;
  --line-soft: #1e1013;

  --text: #f7f0f0;
  --text-dim: #c2a9a9;
  --text-faint: #8a6f6f;

  --accent: #ff2d3f;
  --accent-2: #ff5c6a;
  --accent-warm: #ff3d7f;
  --good: #35d07a;
  --warn: #ffb020;
  --bad: #ff3b30;

  --radius: 18px;
  --radius-sm: 12px;

  --shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(var(--accent-rgb), 0.05) inset;
  --shadow-soft: 0 14px 40px -22px rgba(0, 0, 0, 0.85);

  --grad: linear-gradient(135deg, #ff2d3f 0%, #ff6a3d 100%);
  --accent-rgb: 255, 45, 63;
  --accent-2-rgb: 255, 92, 106;
  --accent-warm-rgb: 255, 61, 127;
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), 0.20), rgba(var(--accent-2-rgb), 0.10));

  /* premium additions */
  --hair: rgba(var(--accent-2-rgb), 0.10);
  --hair-strong: rgba(var(--accent-2-rgb), 0.18);
  --glass: rgba(22, 14, 16, 0.72);
  --glass-2: rgba(13, 9, 10, 0.86);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.28);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 55%);

  --sans: "Inter", "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background:
    radial-gradient(1200px 760px at 92% -12%, rgba(var(--accent-2-rgb), 0.09), transparent 62%),
    radial-gradient(1000px 700px at -10% 2%, rgba(var(--accent-rgb), 0.13), transparent 60%),
    radial-gradient(760px 520px at 50% 118%, rgba(var(--accent-warm-rgb), 0.06), transparent 60%),
    var(--bg);
  font-size: 14.5px;
  letter-spacing: 0.001em;
}

::selection { background: rgba(var(--accent-rgb), 0.42); }

/* Hairline, low-profile scrollbars */
* { scrollbar-color: #33222a transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2b1a20; border-radius: 20px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #3d2a30; background-clip: padding-box; }

/* ── Shell ─────────────────────────────────────────────── */
.app { background: transparent; }

.sidebar {
  background: linear-gradient(180deg, rgba(12, 14, 21, 0.92), rgba(8, 9, 14, 0.96));
  border-right: 1px solid var(--hair);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.brand { padding: 8px 8px 10px; }
.brand-name { font-size: 16.5px; font-weight: 800; letter-spacing: -0.02em; }
.brand-sub { font-size: 10px; letter-spacing: 0.24em; color: var(--text-faint); }
.brand-mark { filter: drop-shadow(0 10px 22px rgba(var(--accent-rgb), 0.55)); }

.section-label { letter-spacing: 0.14em; font-size: 10.5px; color: var(--text-faint); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(30, 35, 48, 0.85), rgba(19, 22, 31, 0.85));
  color: var(--text-dim);
  font-weight: 550;
  letter-spacing: -0.005em;
  transition: background .16s ease, border-color .16s ease, transform .12s ease, box-shadow .16s ease, color .16s ease;
}
.btn:hover {
  background: linear-gradient(180deg, rgba(38, 44, 60, 0.92), rgba(24, 28, 39, 0.92));
  border-color: var(--hair-strong);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.btn-primary {
  background: var(--grad);
  border: none;
  color: #0b0508;
  font-weight: 700;
  box-shadow: 0 12px 30px -14px rgba(var(--accent-rgb), 0.85), var(--sheen);
}
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); background: var(--grad); box-shadow: 0 16px 38px -14px rgba(var(--accent-rgb), 0.95); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--hair);
  color: var(--text);
}
.btn-block { border-radius: 12px; }
.btn-mini, .btn-sm { border-radius: 9px; font-weight: 550; }
.btn-stop { background: rgba(255, 59, 48, 0.14); border-color: rgba(255, 59, 48, 0.42); color: #ffc6c3; }
.btn-stop:hover { background: rgba(255, 59, 48, 0.22); border-color: rgba(255, 59, 48, 0.6); }

.icon-btn {
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--text-dim);
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--hair); color: var(--text); }

/* ── Mode switch ───────────────────────────────────────── */
.mode-switch {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--hair);
  border-radius: 13px;
  padding: 4px;
}
.mode-btn { font-weight: 550; color: var(--text-dim); letter-spacing: -0.005em; }
.mode-btn.active { color: #0b0508; font-weight: 700; }
.mode-slider { background: var(--grad); border-radius: 10px; box-shadow: 0 10px 24px -12px rgba(var(--accent-rgb), 0.9); }

/* ── Conversation list ─────────────────────────────────── */
.conv-search-input {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--hair);
  border-radius: 11px;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.conv-search-input:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.6); box-shadow: var(--ring); background: rgba(255, 255, 255, 0.055); }
.conv-search-input::placeholder { color: var(--text-faint); }

.conv-item {
  border-radius: 11px;
  border: 1px solid transparent;
  transition: background .14s ease, border-color .14s ease, transform .1s ease;
}
.conv-item:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--hair); }
.conv-item.active {
  background: var(--grad-soft);
  border-color: rgba(var(--accent-rgb), 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.conv-item .ci-title { letter-spacing: -0.005em; }
.conv-item .ci-del:hover { background: rgba(255, 59, 48, 0.16); color: var(--bad); }
.conv-item .ci-act:hover { background: rgba(var(--accent-rgb), 0.18); color: var(--text); }

.sidebar-footer { border-top: 1px solid var(--hair); padding-top: 12px; }
.conn { color: var(--text-faint); }
.conn .dot { box-shadow: 0 0 10px currentColor; }

.sidebar-resizer { transition: background .16s ease; }
.sidebar-resizer:hover, body.resizing .sidebar-resizer { background: linear-gradient(180deg, transparent, rgba(var(--accent-rgb), 0.55), transparent); }

/* ── Top bar ───────────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 40;
  background: linear-gradient(180deg, rgba(9, 11, 17, 0.86), rgba(9, 11, 17, 0.62));
  border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.model-badge {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--hair);
  border-radius: 999px;
  color: var(--text);
  font-weight: 550;
  letter-spacing: -0.005em;
}
.pill {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--hair);
  border-radius: 999px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.pill.accent { background: var(--grad); color: #0b0508; font-weight: 700; }
.export-menu {
  background: var(--glass-2);
  border: 1px solid var(--hair-strong);
  border-radius: 13px;
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.export-menu button { color: var(--text-dim); }
.export-menu button:hover { background: rgba(var(--accent-rgb), 0.16); color: var(--text); }

/* ── Composer ──────────────────────────────────────────── */
.composer {
  background: linear-gradient(0deg, rgba(6, 7, 11, 0.96), rgba(6, 7, 11, 0.55));
  border-top: 1px solid transparent;
}
.composer-inner {
  background: linear-gradient(180deg, rgba(23, 27, 38, 0.92), rgba(15, 18, 26, 0.92));
  border: 1px solid var(--hair-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-soft), var(--sheen);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer-inner:focus-within { border-color: rgba(var(--accent-rgb), 0.55); box-shadow: var(--shadow), var(--ring); }
#input { color: var(--text); background: transparent; }
#input::placeholder { color: var(--text-faint); }
.btn-send {
  background: var(--grad);
  color: #0b0508;
  border: none;
  font-weight: 700;
  box-shadow: 0 12px 28px -14px rgba(var(--accent-rgb), 0.95), var(--sheen);
}
.btn-send:hover { filter: brightness(1.07); }
.composer-hint { color: var(--text-faint); letter-spacing: 0.005em; }
.run-workspace, .crew-model {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hair);
  border-radius: 9px;
  color: var(--text-dim);
}
.run-workspace:focus, .crew-model:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.55); box-shadow: var(--ring); }

/* ── Messages ──────────────────────────────────────────── */
.messages { background: transparent; }
.row { animation: hcsRise .34s cubic-bezier(.2, .8, .2, 1); }
@keyframes hcsRise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.bubble {
  border-radius: 16px;
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.row.assistant .bubble {
  background: linear-gradient(180deg, rgba(21, 25, 35, 0.86), rgba(14, 17, 25, 0.86));
  border-top-left-radius: 6px;
}
.row.user .bubble {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-2-rgb), 0.10));
  border-color: rgba(var(--accent-rgb), 0.30);
  border-top-right-radius: 6px;
}
.bubble .who { font-size: 10.5px; letter-spacing: 0.16em; color: var(--text-faint); }
.avatar {
  background: var(--grad);
  color: #0b0508;
  box-shadow: 0 12px 26px -14px rgba(var(--accent-rgb), 0.95);
}
.msg-meta { color: var(--text-faint); }
.msg-meta .tag { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--hair); border-radius: 999px; }
.msg-actions .act-btn { border-radius: 8px; border-color: var(--hair); color: var(--text-faint); background: rgba(255, 255, 255, 0.03); }
.msg-actions .act-btn:hover { background: rgba(var(--accent-rgb), 0.16); color: var(--text); border-color: rgba(var(--accent-rgb), 0.45); }

.md a { color: var(--accent-2); border-bottom-color: rgba(var(--accent-2-rgb), 0.35); }
.md code { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--hair); border-radius: 7px; }
.md blockquote { border-left: 3px solid rgba(var(--accent-rgb), 0.55); background: rgba(var(--accent-rgb), 0.06); border-radius: 0 10px 10px 0; }
.md th { background: rgba(255, 255, 255, 0.045); }
.md th, .md td { border-color: var(--hair); }

.code-wrap { border: 1px solid var(--hair-strong); border-radius: 14px; background: #0a0709; box-shadow: var(--shadow-soft); }
.code-head {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border-bottom: 1px solid var(--hair);
  color: var(--text-faint);
  letter-spacing: 0.1em;
}
.code-copy { border: 1px solid var(--hair); border-radius: 8px; color: var(--text-dim); background: rgba(255, 255, 255, 0.03); }
.code-copy:hover { background: rgba(var(--accent-rgb), 0.18); color: var(--text); }

/* ── Empty state ───────────────────────────────────────── */
.empty-glow { background: radial-gradient(circle at 50% 40%, rgba(var(--accent-rgb), 0.26), transparent 62%); filter: blur(26px); }
.empty h1 { font-size: 38px; font-weight: 800; letter-spacing: -0.035em; }
.empty-sub { color: var(--text-dim); font-size: 15.5px; }
.chip {
  border-radius: 15px;
  border: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(22, 26, 37, 0.85), rgba(14, 17, 25, 0.85));
  box-shadow: var(--shadow-soft);
  transition: transform .16s cubic-bezier(.2,.8,.2,1), border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.chip:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.55);
  background: linear-gradient(180deg, rgba(30, 35, 50, 0.95), rgba(19, 22, 32, 0.95));
  box-shadow: 0 24px 50px -26px rgba(var(--accent-rgb), 0.75);
}
.chip b { font-weight: 650; letter-spacing: -0.01em; }

/* ── Modals ────────────────────────────────────────────── */
.modal-backdrop {
  background: rgba(3, 4, 8, 0.66);
  backdrop-filter: blur(9px) saturate(1.15);
  -webkit-backdrop-filter: blur(9px) saturate(1.15);
  animation: hcsFade .18s ease;
}
@keyframes hcsFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: linear-gradient(180deg, rgba(20, 24, 34, 0.96), rgba(11, 13, 20, 0.98));
  border: 1px solid var(--hair-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.3);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  animation: hcsPop .24s cubic-bezier(.2, .9, .25, 1);
  overflow: hidden;
}
@keyframes hcsPop { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-head {
  border-bottom: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0));
}
.modal-head h2 { font-size: 17.5px; font-weight: 750; letter-spacing: -0.025em; }
.modal-foot { border-top: 1px solid var(--hair); background: rgba(255, 255, 255, 0.014); }
.modal-note { color: var(--text-faint); }

.pull-input, .build-system, select, textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hair);
  border-radius: 11px;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.pull-input:focus, .build-system:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: var(--ring);
  background: rgba(255, 255, 255, 0.055);
}
.pull-input::placeholder, textarea::placeholder { color: var(--text-faint); }

.builder summary, details summary { color: var(--text-dim); font-weight: 600; letter-spacing: -0.01em; }
.builder summary:hover, details summary:hover { color: var(--text); }
.shortcut-list kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hair-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono);
}
.tool-chip { background: rgba(var(--accent-rgb), 0.13); border: 1px solid rgba(var(--accent-rgb), 0.30); border-radius: 8px; color: #ffb0b6; }
.tool-chip:hover { background: rgba(var(--accent-rgb), 0.20); color: var(--text); }
.tool-chip input { accent-color: var(--accent); }

/* Toasts */
.toast {
  background: var(--glass-2);
  border: 1px solid var(--hair-strong);
  border-radius: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}
.toast.err { border-color: rgba(255, 59, 48, 0.5); background: rgba(45, 16, 20, 0.92); }

/* ── Full internet browser ─────────────────────────────── */
.modal.browser-modal { width: min(1180px, 96vw); height: min(88vh, 900px); display: flex; flex-direction: column; }
.bm-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--hair); }
.bm-nav { display: flex; align-items: center; gap: 4px; }
.bm-url {
  flex: 1; min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hair);
  border-radius: 11px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 9px 12px;
}
.bm-url:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.6); box-shadow: var(--ring); }
.bm-status {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px; font-family: var(--mono); font-size: 11px;
  color: var(--text-faint); border-bottom: 1px solid var(--hair);
}
.bm-status .bm-secure { color: var(--good); }
.bm-status .bm-insecure { color: var(--warn); }
.bm-status .bm-spacer { flex: 1; }
.bm-progress { height: 2px; background: transparent; overflow: hidden; }
.bm-progress.on { background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); animation: hcsSlide 1.1s linear infinite; }
@keyframes hcsSlide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.bm-stage { flex: 1; position: relative; background: #0b0809; min-height: 0; }
.bm-frame { width: 100%; height: 100%; border: 0; background: #ffffff; display: block; }
.bm-reader {
  position: absolute; inset: 0; overflow: auto; padding: 24px 30px;
  background: linear-gradient(180deg, #0c0809, #0a0708);
}
.bm-reader h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.02em; }
.bm-reader .bm-src { font-family: var(--mono); font-size: 11.5px; color: var(--accent-2); margin-bottom: 14px; word-break: break-all; }
.bm-reader .bm-text { white-space: pre-wrap; font-size: 14px; line-height: 1.65; color: var(--text-dim); max-width: 900px; }
.bm-links { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 7px; }
.bm-links a {
  font-size: 12px; padding: 4px 10px; border-radius: 8px; text-decoration: none;
  background: rgba(var(--accent-rgb), 0.12); border: 1px solid rgba(var(--accent-rgb), 0.28);
  color: #ffb0b6; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bm-links a:hover { background: rgba(var(--accent-rgb), 0.2); color: #fff; }

.bm-home { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 40px 24px; }
.bm-home .bm-logo { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bm-home .bm-search { display: flex; gap: 9px; width: min(620px, 100%); }
.bm-home .bm-search input { flex: 1; }
.bm-quick { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; max-width: 720px; }
.bm-quick button {
  border-radius: 999px; border: 1px solid var(--hair); background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim); font-size: 12.5px; padding: 7px 14px; cursor: pointer;
}
.bm-quick button:hover { color: var(--text); border-color: rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.14); }
.bm-hist { width: min(720px, 100%); display: flex; flex-direction: column; gap: 5px; }
.bm-hist .bm-hist-row {
  display: flex; align-items: center; gap: 9px; padding: 6px 11px; border-radius: 9px;
  border: 1px solid transparent; cursor: pointer; font-size: 12.5px; color: var(--text-dim);
}
.bm-hist .bm-hist-row:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--hair); color: var(--text); }

@media (max-width: 820px) {
  .modal.browser-modal { width: 100vw; height: 100vh; border-radius: 0; }
  .empty h1 { font-size: 30px; }
}

/* ===== R9: Intel / OSINT + Memory ===== */
.intel-tabs { display: inline-flex; gap: 4px; margin-left: 12px; padding: 3px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.intel-tab { border: none; background: transparent; color: var(--text-faint); font-size: 12px; font-weight: 600; padding: 5px 14px; border-radius: 999px; cursor: pointer; letter-spacing: 0.02em; }
.intel-tab:hover { color: var(--text); }
.intel-tab.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -10px rgba(255,45,63,.9); }
.intel-modal .modal-body, .mem-modal .modal-body { max-height: min(70vh, 680px); overflow: auto; }
.intel-body { display: flex; flex-direction: column; gap: 14px; }
.intel-pane { display: flex; flex-direction: column; gap: 12px; }
.intel-bar { display: flex; gap: 10px; }
.intel-input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; }
.intel-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,45,63,.18); }
.intel-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.intel-chip { border: 1px solid var(--line); background: transparent; color: var(--text-faint); font-size: 12px; padding: 5px 13px; border-radius: 999px; cursor: pointer; }
.intel-chip.on { background: var(--grad-soft); border-color: rgba(255,45,63,.45); color: var(--text); }
.intel-results { display: flex; flex-direction: column; gap: 16px; }
.intel-sum { font-size: 12px; color: var(--text-faint); letter-spacing: 0.03em; text-transform: uppercase; }
.intel-sec { display: flex; flex-direction: column; gap: 8px; }
.intel-sec-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.intel-sec-count { color: var(--accent-2); font-weight: 600; }
.intel-card { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 11px 13px; display: flex; flex-direction: column; gap: 5px; transition: border-color .15s, transform .15s; }
.intel-card:hover { border-color: rgba(255,45,63,.4); transform: translateY(-1px); }
.intel-card-top { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.intel-title { color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.intel-title:hover { color: var(--accent-2); }
.intel-meta { color: var(--warn); font-size: 11px; white-space: nowrap; }
.intel-hostname { color: var(--text-faint); font-family: var(--mono); font-size: 11px; }
.intel-snippet { color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.intel-actions { display: flex; gap: 8px; margin-top: 3px; }
.intel-err { color: var(--bad); font-size: 12px; font-family: var(--mono); }
.intel-empty { color: var(--text-faint); font-size: 13px; padding: 10px 2px; }
.intel-note { color: var(--warn, #f59e0b); font-size: 11.5px; font-family: var(--mono); padding: 6px 8px; margin: 6px 0 2px; border-left: 2px solid var(--warn, #f59e0b); background: rgba(245, 158, 11, .07); border-radius: 0 6px 6px 0; word-break: break-word; }
.intel-kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 12.5px; }
.intel-k { color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; padding-top: 1px; }
.intel-v { color: var(--text-dim); font-family: var(--mono); word-break: break-word; }
.intel-sublist { display: flex; flex-wrap: wrap; gap: 6px; }
.intel-sub { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 6px; padding: 3px 9px; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

.mem-body { display: flex; flex-direction: column; gap: 14px; }
.mem-toggle, .mem-auto { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); margin-left: auto; }
.mem-add { display: flex; gap: 8px; flex-wrap: wrap; }
.mem-kind { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; }
.mem-input { flex: 1 1 260px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 14px; }
.mem-input:focus, .mem-tags:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,45,63,.18); }
.mem-tags { flex: 0 1 140px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13px; }
.mem-reflect { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.mem-reflect-head { display: flex; align-items: center; gap: 12px; }
.mem-reflect-head > span { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.mem-reflect-out { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px; font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: pre-wrap; max-height: 260px; overflow: auto; line-height: 1.55; }
.mem-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 2px 0 2px; }
.mem-stats { font-size: 11.5px; font-family: var(--mono); color: var(--text-faint); letter-spacing: 0.04em; margin-left: auto; }
.mem-list { display: flex; flex-direction: column; gap: 8px; }
.mem-row { display: flex; align-items: flex-start; gap: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 11px 13px; }
.mem-row.off { opacity: 0.5; }
.mem-main { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.mem-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.mem-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 999px; background: var(--panel-hi); color: var(--text-dim); }
.mem-kind-correction { background: rgba(255,59,48,.16); color: var(--bad); }
.mem-kind-lesson { background: rgba(255,45,63,.18); color: #ff9aa2; }
.mem-kind-preference { background: rgba(255,92,106,.16); color: var(--accent-2); }
.mem-kind-fact { background: rgba(53,208,122,.16); color: var(--good); }
.mem-src, .mem-hits, .mem-tag { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); }
.mem-tag::before { content: "#"; }
.mem-text { color: var(--text); font-size: 13.5px; line-height: 1.5; }
.mem-acts { display: flex; gap: 6px; flex-shrink: 0; }

/* R11 - progressive intel stream (results appear as each source completes) */
.intel-stream { display: flex; flex-direction: column; gap: 12px; }
.intel-sec.pending { opacity: .6; }
.intel-sec.pending .intel-sec-count { font-style: italic; }

/* ── Skills manager (R12: search, viewer, count) ─────────── */
.skill-count {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: var(--text-dim); background: var(--panel-hi);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 7px; margin-left: 6px; letter-spacing: 0; text-transform: none;
}
.skill-toolbar { margin: 8px 0 2px; }
.skill-toolbar .pull-input { width: 100%; }
.skill-item {
  display: flex; flex-direction: column; gap: 0;
}
.skill-item .model-row { border-radius: 13px; }
.skill-body {
  margin: 6px 0 0; padding: 10px 12px;
  background: var(--panel-hi); border: 1px solid var(--line-soft); border-radius: 11px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  color: var(--text-dim); white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow: auto;
}

/* ── R15: model quick-switch popover (topbar badge) ──────── */
.model-switch { position: relative; display: inline-flex; align-items: center; }
.model-badge {
  cursor: pointer; font: inherit;
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  padding: 5px 22px 5px 11px; border-radius: 999px; max-width: 46vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  position: relative; transition: border-color .15s, background .15s;
}
.model-badge::after {
  content: "\25BE"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 9px; color: var(--text-faint);
}
.model-badge:hover { border-color: rgba(255,45,63,.55); background: var(--panel-2); }
.model-badge[aria-expanded="true"] { border-color: var(--accent); }
.model-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 260px; max-width: 340px; max-height: 60vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 13px; box-shadow: var(--shadow);
  padding: 7px; display: flex; flex-direction: column; gap: 3px;
}
.mm-empty { padding: 12px; color: var(--text-faint); font-size: 12.5px; text-align: center; }
.mm-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  align-items: center; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  padding: 8px 10px; color: var(--text); font: inherit;
}
.mm-item:hover { background: var(--panel-2); border-color: var(--line-soft); }
.mm-item.cur { background: var(--grad-soft); border-color: rgba(255,45,63,.4); }
.mm-name { font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-cur { grid-column: 2; grid-row: 1; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2); }
.mm-meta { grid-column: 1 / -1; font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); }
.mm-foot { display: flex; gap: 6px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.mm-foot-btn {
  flex: 1; cursor: pointer; font: inherit; font-size: 12px; font-weight: 550;
  color: var(--text-dim); background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 8px; padding: 7px 6px;
  white-space: nowrap;
}
.mm-foot-btn:hover { color: var(--text); border-color: rgba(255,45,63,.5); background: var(--panel-hi); }

/* ── R15: quick-pick pull chips ──────────────────────────── */
.pull-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.qchip {
  cursor: pointer; font-family: var(--mono); font-size: 11px;
  color: var(--text-dim); background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px 10px;
  transition: color .12s, border-color .12s, background .12s;
}
.qchip:hover { color: var(--text); border-color: rgba(255,45,63,.5); background: var(--panel-hi); }

/* ── R15: GGUF upload dropzone + list ────────────────────── */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; cursor: pointer;
  padding: 22px 16px; margin-bottom: 10px;
  border: 1.5px dashed var(--line); border-radius: 13px;
  background: var(--panel-2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.hot, .dropzone:focus-visible {
  border-color: var(--accent); background: var(--grad-soft); outline: none;
}
.dropzone.hot { border-style: solid; }
.dropzone-ico { font-size: 22px; color: var(--accent-2); }
.dropzone-text { font-size: 13px; color: var(--text-dim); }
.dropzone-text b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.dropzone-sub { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); word-break: break-all; }

.upload-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.up-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 7px 10px;
}
.up-row.sel { border-color: rgba(255,45,63,.55); background: var(--grad-soft); }
.up-name { flex: 1; font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-size { font-family: var(--mono); font-size: 11px; color: var(--text-faint); flex: none; }
.up-empty { padding: 10px; font-size: 12px; color: var(--text-faint); text-align: center; }

@media (max-width: 620px) {
  .model-menu { max-width: 78vw; }
}

/* ── Zero-Day Lab ─────────────────────────────────────────── */
.zd-status {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--panel-hi);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 12px;
  word-break: break-word;
}
.zd-status b { color: var(--accent); font-weight: 600; }
.zd-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 11px 12px;
  margin-bottom: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.zd-card-title {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.zd-out {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin: 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.zd-log { max-height: 200px; }
.zd-crashes { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.zd-crash {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-hi);
  padding: 7px 9px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}
.zd-crash:hover { border-color: rgba(255,45,63,.55); background: var(--grad-soft); }
.zd-crash-id { color: var(--accent); font-weight: 600; }
.zd-crash-meta { color: var(--text-faint); font-size: 10.5px; }
.zd-crash-err { color: var(--warn); font-size: 10.5px; word-break: break-word; }
.zd-empty { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); padding: 2px 0; }
.zd-card .pull-row { flex-wrap: wrap; }
.zd-card .pull-input { flex: 1 1 200px; }

/* ── R19: incognito toggle, zero-day quick scan ────────── */
.pill.toggle { cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }
.pill.toggle[aria-pressed="true"] { background: var(--grad); color: #0b0508; border: none; font-weight: 700; }
.pill.toggle::before { content: "\25cb "; opacity: .7; }
.pill.toggle[aria-pressed="true"]::before { content: "\25cf "; opacity: 1; }
.app.incognito .topbar::after {
  content: "INCOGNITO"; position: absolute; right: 12px; bottom: -1px;
  font-size: 9px; letter-spacing: .18em; color: var(--accent-2); opacity: .8;
}
.zd-simple { border-color: rgba(var(--accent-rgb), 0.4); background: rgba(var(--accent-rgb), 0.05); }
.zd-advanced { margin-top: 12px; }
.zd-advanced > summary {
  cursor: pointer; list-style: none; font-weight: 650; font-size: 13px;
  color: var(--text-dim); padding: 8px 6px; border-radius: 9px;
}
.zd-advanced > summary:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.zd-advanced > summary::-webkit-details-marker { display: none; }
.zd-advanced > summary::before { content: "\25b8  "; }
.zd-advanced[open] > summary::before { content: "\25be  "; }

/* ============================================================
   R21 — PREMIUM THEME ENGINE + VISUAL POLISH
   5 accent palettes driven by RGB channels, so every glow,
   ring, hairline and hover inherits the active palette.
   ============================================================ */

html[data-theme="crimson"] {
  --accent-rgb: 255, 45, 63; --accent-2-rgb: 255, 92, 106; --accent-warm-rgb: 255, 61, 127;
  --accent: #ff2d3f; --accent-2: #ff5c6a; --accent-warm: #ff3d7f;
  --grad: linear-gradient(135deg, #ff2d3f 0%, #ff6a3d 100%);
}
html[data-theme="midnight"] {
  --accent-rgb: 34, 211, 238; --accent-2-rgb: 56, 189, 248; --accent-warm-rgb: 45, 212, 191;
  --accent: #22d3ee; --accent-2: #38bdf8; --accent-warm: #2dd4bf;
  --grad: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), .20), rgba(var(--accent-2-rgb), .10));
}
html[data-theme="emerald"] {
  --accent-rgb: 52, 211, 153; --accent-2-rgb: 16, 185, 129; --accent-warm-rgb: 163, 230, 53;
  --accent: #34d399; --accent-2: #10b981; --accent-warm: #a3e635;
  --grad: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), .20), rgba(var(--accent-2-rgb), .10));
}
html[data-theme="violet"] {
  --accent-rgb: 168, 85, 247; --accent-2-rgb: 217, 70, 239; --accent-warm-rgb: 244, 114, 182;
  --accent: #a855f7; --accent-2: #d946ef; --accent-warm: #f472b6;
  --grad: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), .20), rgba(var(--accent-2-rgb), .10));
}
html[data-theme="gold"] {
  --accent-rgb: 251, 191, 36; --accent-2-rgb: 245, 158, 11; --accent-warm-rgb: 251, 146, 60;
  --accent: #fbbf24; --accent-2: #f59e0b; --accent-warm: #fb923c;
  --grad: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), .20), rgba(var(--accent-2-rgb), .10));
}

html[data-theme="royal"] {
  --accent-rgb: 124, 92, 255; --accent-2-rgb: 168, 85, 247; --accent-warm-rgb: 251, 191, 36;
  --accent: #7c5cff; --accent-2: #a855f7; --accent-warm: #fbbf24;
  --grad: linear-gradient(135deg, #7c5cff 0%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-warm-rgb), .10));
}
html[data-theme="platinum"] {
  --accent-rgb: 165, 180, 252; --accent-2-rgb: 129, 140, 248; --accent-warm-rgb: 56, 189, 248;
  --accent: #a5b4fc; --accent-2: #818cf8; --accent-warm: #38bdf8;
  --grad: linear-gradient(135deg, #c7d2fe 0%, #818cf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-2-rgb), .12));
}

/* Smooth palette transitions everywhere */
html, body, .btn, .pill, .icon-btn, .conv-item, .composer-inner, .mode-slider,
.topbar, .sidebar, .msg, .bubble, .tool-chip { transition: background-color .28s ease, border-color .28s ease, color .2s ease, box-shadow .28s ease; }

/* Aurora backdrop that re-tints with the palette */
.app::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 620px at 88% -8%, rgba(var(--accent-2-rgb), .10), transparent 62%),
    radial-gradient(820px 560px at -8% 6%, rgba(var(--accent-rgb), .12), transparent 60%);
  animation: hcsAurora 18s ease-in-out infinite alternate;
}
@keyframes hcsAurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: .85; }
  100% { transform: translate3d(0, -18px, 0) scale(1.04); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .app::before { animation: none; } }

/* Animated gradient wordmark */
.brand-name {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--accent);
  background-size: 200% 200%;
  animation: hcsWordmark 7s ease infinite;
}
@keyframes hcsWordmark { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* Primary button shine sweep */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -140%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.42), transparent);
  transform: skewX(-18deg); transition: left .55s ease;
}
.btn-primary:hover::after { left: 140%; }

/* Chip lift */
.chips .chip, .tool-chip { transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease; }
.chips .chip:hover, .tool-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

/* Message hover glow */
.msg:hover .bubble, .msg:hover .msg-body { box-shadow: 0 12px 34px -22px rgba(var(--accent-rgb), .55); }

/* ── Theme picker ─────────────────────────────────────── */
.theme-wrap { position: relative; display: inline-flex; }
.theme-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 176px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: var(--glass-2); border: 1px solid var(--hair-strong); border-radius: 13px;
  backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--shadow); overflow: hidden;
}
.theme-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: none; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13px; font-weight: 550; text-align: left;
  padding: 7px 9px; border-radius: 9px; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.theme-menu button:hover { background: rgba(var(--accent-rgb), .16); color: var(--text); }
.theme-menu button[aria-checked="true"] { color: var(--text); background: rgba(var(--accent-rgb), .10); }
.theme-menu button[aria-checked="true"]::after { content: "\2713"; margin-left: auto; color: var(--accent); font-weight: 800; }
.theme-menu .sw {
  width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 0 12px 0 currentColor;
}
.theme-menu .tm-head {
  font-size: 10px; letter-spacing: .16em; color: var(--text-faint);
  padding: 6px 9px 4px; text-transform: uppercase;
}


/* ============================================================
   R22 — LUXURY LAYER + PAYLOAD STUDIO
   ============================================================ */

/* Depth: soft vignette folded into the aurora backdrop (stays behind content)
   + a fine accent hairline on the top bar. */
.app::before {
  background:
    radial-gradient(900px 620px at 88% -8%, rgba(var(--accent-2-rgb), .10), transparent 62%),
    radial-gradient(820px 560px at -8% 6%, rgba(var(--accent-rgb), .12), transparent 60%),
    radial-gradient(135% 130% at 50% -10%, transparent 58%, rgba(0,0,0,.30) 100%);
}
.topbar { position: relative; }
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-warm-rgb), .45), rgba(var(--accent-rgb), .30), transparent);
  opacity: .7;
}
/* Modal gets a jewel hairline + deeper shadow for a premium feel */
.modal { border-top: 1px solid rgba(var(--accent-warm-rgb), .28); }
.modal-head h2 { letter-spacing: .01em; }
.icon-btn { transition: transform .18s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.icon-btn:hover { transform: translateY(-1px); }

/* ---- Payload Studio ---- */
.ps-body { max-height: min(74vh, 720px); overflow: auto; }
.ps-tabs { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.ps-tab {
  border: 1px solid var(--hair-strong); background: transparent; color: var(--text-dim);
  padding: 6px 13px; border-radius: 999px; font: inherit; font-size: 12.5px; cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.ps-tab:hover { color: var(--text); border-color: rgba(var(--accent-rgb), .45); }
.ps-tab.active { background: var(--grad-soft); color: var(--text); border-color: rgba(var(--accent-rgb), .55); box-shadow: 0 6px 16px -12px rgba(var(--accent-rgb), .9); }
.ps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.ps-grid .ps-wide { grid-column: 1 / -1; }
.ps-grid select, .ps-grid input { width: 100%; }
.ps-blurb {
  margin: 12px 0; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; color: var(--text-dim);
  background: var(--grad-soft); border: 1px solid rgba(var(--accent-rgb), .22);
}
.ps-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.ps-spacer { flex: 1 1 auto; }
.ps-status { font-size: 12px; color: var(--text-faint); }
.ps-out { min-height: 90px; max-height: 240px; overflow: auto; margin: 8px 0 0; }
.ps-result {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--grad-soft); border: 1px solid rgba(var(--accent-rgb), .35);
  box-shadow: 0 14px 32px -22px rgba(var(--accent-rgb), .9);
}
.ps-res-title { font-weight: 800; margin-bottom: 6px; color: var(--text); letter-spacing: .01em; }
.ps-res-row { font-size: 12.5px; color: var(--text-dim); margin: 3px 0; }
.ps-hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
.ps-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.c2-session { border: 1px solid var(--line, #2b2b33); border-radius: 10px; padding: 10px 12px; background: var(--panel, #17171c); }
.c2-session b { color: var(--accent, #6af); }
.ps-row {
  border: 1px solid var(--hair-strong); border-radius: 12px; padding: 10px 12px;
  background: rgba(255,255,255,.02); transition: border-color .2s ease, box-shadow .2s ease;
}
.ps-row:hover { border-color: rgba(var(--accent-rgb), .4); box-shadow: 0 10px 26px -20px rgba(var(--accent-rgb), .9); }
.ps-row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ps-row-name { font-weight: 700; font-size: 13px; color: var(--text); }
.ps-row-meta { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; }
.ps-row-head .ps-copy { margin-left: auto; }
.ps-cmd {
  margin: 0; padding: 9px 11px; border-radius: 9px; background: rgba(0,0,0,.32);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  color: var(--text-dim); white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
.ps-inline { max-width: 190px; }
.ps-inline-num { max-width: 110px; }
.ps-history {
  border-top: 1px solid var(--hair); padding: 12px 18px; max-height: 220px; overflow: auto;
}
.ps-hist-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.ps-hist-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.ps-hist-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ps-hist-meta { color: var(--text-faint); font-size: 11.5px; }
.ps-empty { color: var(--text-faint); font-size: 12.5px; }
@media (max-width: 720px) { .ps-grid { grid-template-columns: 1fr; } }

/* ── R24 — RAT forge + Trojanize panes ─────────────────────────────────── */
.ps-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 6px; }
.ps-out-tall { max-height: 320px; min-height: 170px; }
.ps-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.ps-check input { accent-color: var(--accent, #ff2d3f); }
@media (max-width: 720px) { .ps-cols { grid-template-columns: 1fr; } }

/* --- R25: Simple wizard + Live session mirror --- */
.ps-undetect { font-weight: 600; }
.ps-undetect input[type="checkbox"] { accent-color: #7dd3fc; transform: scale(1.15); }
.ps-blurb-note { opacity: .82; font-size: 12.5px; }
.ps-steps { margin: 6px 0 10px 18px; padding: 0; }
.ps-steps li { margin: 4px 0; line-height: 1.45; }
ul.ps-steps { list-style: disc; }

/* ============================================================
   R26 — DEMON MODE theme + own-options RAT forge styling
   ============================================================ */

html[data-theme="demon"] {
  --accent-rgb: 255, 26, 26;
  --accent-2-rgb: 255, 122, 24;
  --accent-warm-rgb: 255, 46, 99;
  --accent: #ff1a1a;
  --accent-2: #ff7a18;
  --accent-warm: #ff2e63;
  --grad: linear-gradient(135deg, #ff1a1a 0%, #ff7a18 100%);
  --grad-soft: linear-gradient(135deg, rgba(255, 26, 26, .24), rgba(255, 122, 24, .10));
  --bg: #070404;
  --bg-2: #0c0606;
  --panel: #100707;
  --panel-2: #170a0a;
  --panel-hi: #200d0d;
  --line: #351410;
  --line-soft: #250d0c;
  --text: #fff2ee;
  --text-dim: #d8ad9f;
  --text-faint: #98665a;
}

/* Hellfire aura (reuses the existing .app::before pseudo-element) */
html[data-theme="demon"] .app::before {
  content: "";
  background:
    radial-gradient(900px 620px at 88% -8%, rgba(255, 122, 24, .16), transparent 62%),
    radial-gradient(820px 560px at -8% 6%, rgba(255, 26, 26, .20), transparent 60%),
    radial-gradient(760px 520px at 50% 120%, rgba(255, 26, 26, .14), transparent 66%);
  animation: r26-ember 6.5s ease-in-out infinite alternate;
}
@keyframes r26-ember { from { opacity: .6; } to { opacity: 1; } }

html[data-theme="demon"] .brand-mark { filter: drop-shadow(0 0 16px rgba(255, 26, 26, .8)); }
html[data-theme="demon"] .btn-primary { box-shadow: 0 12px 32px -12px rgba(255, 26, 26, .9); }
html[data-theme="demon"] .empty-glow {
  background: radial-gradient(circle at 50% 42%, rgba(255, 26, 26, .38), rgba(255, 122, 24, .12) 55%, transparent 76%);
}

/* --- own-options / flagship RAT pane --- */
.ps-textarea { min-height: 96px; font-family: var(--mono); font-size: 12px; resize: vertical; line-height: 1.45; }
/* R39_EMAIL_DELIVERY */
.ps-email-flow { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 4px; }
.ps-email-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--hair-strong); border-radius: 12px; background: rgba(255, 255, 255, .015); }
.ps-email-num { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent, #ff2d3f), #b3122a); box-shadow: 0 6px 16px -10px rgba(var(--accent-rgb), 1); }
.ps-email-step-body { flex: 1 1 auto; min-width: 0; }
.ps-email-step-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
@media (max-width: 720px) { .ps-email-step { flex-direction: column; } }
/* end R39_EMAIL_DELIVERY */
.ps-mods { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 6px 0 14px; }
.ps-mod {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim);
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; transition: border-color .2s ease, color .2s ease;
}
.ps-mod:hover { border-color: rgba(var(--accent-rgb), .55); color: var(--text); }
.ps-mod input { accent-color: var(--accent); }
.ps-own-adv { margin: 6px 0 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 9px 13px; background: var(--panel-2); }
.ps-own-adv > summary { cursor: pointer; font-size: 13px; color: var(--text-dim); }
.ps-vars { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.ps-var-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; }
.ps-files { list-style: none; margin: 6px 0 12px; padding: 0; }
.ps-files li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.ps-file-name { font-family: var(--mono); color: var(--accent-2); }
.ps-file-meta { color: var(--text-faint); font-family: var(--mono); font-size: 12px; }
/* ============================================================
   R27 — no-skill RAT wizard + Apex Android builder
   ============================================================ */
.wz-steps { display: flex; gap: 8px; list-style: none; margin: 6px 0 14px; padding: 0; }
.wz-step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line, #2a2a35); border-radius: 12px; background: rgba(255, 255, 255, 0.02); color: var(--text-faint, #8b8b99); font-size: 13px; transition: all .18s ease; }
.wz-step .wz-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); font-weight: 600; font-size: 12px; }
.wz-step.is-active { border-color: rgba(var(--accent-rgb, 255, 60, 60), 0.7); background: rgba(var(--accent-rgb, 255, 60, 60), 0.10); color: var(--text, #f2f2f5); }
.wz-step.is-active .wz-num { background: var(--grad, linear-gradient(135deg, #ff1a1a, #ff7a18)); color: #fff; }
.wz-step.is-done { border-color: rgba(80, 200, 120, 0.5); color: var(--text, #f2f2f5); }
.wz-step.is-done .wz-num { background: rgba(80, 200, 120, 0.85); color: #06210f; }

.wz-view { min-height: 150px; }
.wz-q { font-size: 15px; font-weight: 600; margin: 4px 0 10px; color: var(--text, #f2f2f5); }
.wz-q2 { margin-top: 16px; }
.wz-help, .wz-tip { font-size: 12.5px; color: var(--text-faint, #8b8b99); margin: 0 0 12px; line-height: 1.5; }
.wz-tip { padding: 8px 10px; border-left: 2px solid rgba(var(--accent-rgb, 255, 60, 60), 0.6); background: rgba(255, 255, 255, 0.02); border-radius: 6px; margin-top: 12px; }

.wz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.wz-card { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px; border: 1px solid var(--line, #2a2a35); border-radius: 12px; background: rgba(255, 255, 255, 0.02); color: var(--text, #f2f2f5); cursor: pointer; transition: all .16s ease; }
.wz-card:hover { border-color: rgba(var(--accent-rgb, 255, 60, 60), 0.55); transform: translateY(-1px); }
.wz-card.is-sel { border-color: rgba(var(--accent-rgb, 255, 60, 60), 0.9); background: rgba(var(--accent-rgb, 255, 60, 60), 0.10); box-shadow: 0 10px 30px -18px rgba(var(--accent-rgb, 255, 60, 60), 0.9); }
.wz-card-wide { grid-column: 1 / -1; }
.wz-card-ico { font-size: 22px; line-height: 1; }
.wz-card-t { font-size: 14px; font-weight: 600; }
.wz-card-s { font-size: 12px; color: var(--text-faint, #8b8b99); line-height: 1.45; }

.wz-mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.wz-mod { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line, #2a2a35); border-radius: 10px; background: rgba(255, 255, 255, 0.02); cursor: pointer; }
.wz-mod input { margin-right: 6px; }
.wz-mod.is-on { border-color: rgba(var(--accent-rgb, 255, 60, 60), 0.75); background: rgba(var(--accent-rgb, 255, 60, 60), 0.08); }
.wz-mod-t { font-size: 13px; font-weight: 600; color: var(--text, #f2f2f5); }
.wz-mod-s { font-size: 11.5px; color: var(--text-faint, #8b8b99); line-height: 1.4; }

.wz-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wz-chip { padding: 6px 12px; border: 1px solid var(--line, #2a2a35); border-radius: 999px; background: rgba(255, 255, 255, 0.03); color: var(--text, #f2f2f5); font-size: 12.5px; cursor: pointer; transition: all .15s ease; }
.wz-chip:hover { border-color: rgba(var(--accent-rgb, 255, 60, 60), 0.7); }

.wz-inline-toggles { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; }
.wz-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text, #f2f2f5); }

.wz-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.wz-nav-label { font-size: 12px; color: var(--text-faint, #8b8b99); }

.wz-receipt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.wz-ok { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(80, 200, 120, 0.18); color: #5ecb82; font-size: 18px; font-weight: 700; }
.wz-receipt-title { font-size: 15px; font-weight: 700; color: var(--text, #f2f2f5); }
.wz-receipt-sub { font-size: 12px; color: var(--text-faint, #8b8b99); }
.wz-receipt-steps { margin: 6px 0 0; padding-left: 22px; }
.wz-receipt-steps li { font-size: 13px; color: var(--text, #f2f2f5); line-height: 1.6; margin-bottom: 4px; }

/* ============================================================
   R28 — "STEALTH SAVAGE CODING"
   Obsidian & Gold luxury theme + HQ visual refinement.
   Adds the "savage" palette (new default) and a global polish
   pass: gold hairlines, glass bevels, refined type, richer depth.
   ============================================================ */

/* ── Savage Luxe: obsidian black · champagne gold · ivory ────── */
html[data-theme="savage"] {
  --bg: #07070a;
  --bg-2: #0b0b10;
  --panel: #100f15;
  --panel-2: #16141c;
  --panel-hi: #1e1b25;
  --line: #332c22;
  --line-soft: #221f26;
  --text: #f7f2e6;
  --text-dim: #c9bda7;
  --text-faint: #8d8272;

  --accent: #e9c65a;
  --accent-2: #f5b342;
  --accent-warm: #d9a02a;
  --accent-rgb: 233, 198, 90;
  --accent-2-rgb: 245, 179, 66;
  --accent-warm-rgb: 217, 160, 42;

  --grad: linear-gradient(135deg, #fbdd8a 0%, #e9c65a 45%, #c9962c 100%);
  --grad-soft: linear-gradient(135deg, rgba(233, 198, 90, .18), rgba(233, 198, 90, .05));

  --good: #58c98a;
  --warn: #f0a93c;
  --bad: #ff5a4d;

  --hair: rgba(233, 198, 90, .14);
  --hair-strong: rgba(233, 198, 90, .26);
  --glass: rgba(18, 16, 22, .70);
  --glass-2: rgba(10, 9, 13, .88);
  --shadow: 0 34px 80px -30px rgba(0, 0, 0, .98), 0 0 0 1px rgba(233, 198, 90, .06) inset;
  --shadow-soft: 0 16px 44px -24px rgba(0, 0, 0, .9);
  --ring: 0 0 0 3px rgba(233, 198, 90, .26);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, 0) 58%);
}

/* Warm obsidian aurora for the default theme */
html[data-theme="savage"] .app::before {
  background:
    radial-gradient(980px 660px at 90% -10%, rgba(245, 179, 66, .13), transparent 62%),
    radial-gradient(880px 600px at -10% 4%, rgba(233, 198, 90, .11), transparent 60%),
    radial-gradient(760px 520px at 52% 118%, rgba(201, 150, 44, .10), transparent 64%),
    radial-gradient(135% 130% at 50% -10%, transparent 56%, rgba(0, 0, 0, .34) 100%);
}
html[data-theme="savage"] .empty-glow {
  background: radial-gradient(circle at 50% 42%, rgba(233, 198, 90, .30), rgba(245, 179, 66, .10) 55%, transparent 76%);
}

/* ── Global HQ polish layer ──────────────────────────────────── */

/* Fine grain + vignette on top of everything, non-interactive. */
.app::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background-image:
    radial-gradient(120% 120% at 50% -20%, transparent 60%, rgba(0, 0, 0, .34) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  mix-blend-mode: normal; opacity: .9;
}

/* Gold hairline seam on the top bar (refines the R22 tint) */
.topbar::after {
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .55) 18%, rgba(var(--accent-2-rgb), .42) 50%, rgba(var(--accent-rgb), .55) 82%, transparent);
  opacity: .85;
}

/* Sidebar: deeper obsidian glass + inner gold edge */
.sidebar {
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), .035), rgba(0, 0, 0, 0) 30%),
    linear-gradient(180deg, var(--glass-2), rgba(0, 0, 0, .92));
  border-right: 1px solid var(--hair-strong);
}

/* Wordmark: add a soft gold bloom behind the gradient text */
.brand { position: relative; }
.brand-mark { filter: drop-shadow(0 8px 20px rgba(var(--accent-rgb), .55)); }
.brand-name { text-shadow: 0 0 22px rgba(var(--accent-rgb), .28); }
.brand-sub { color: rgba(var(--accent-rgb), .78); }

/* Panels, cards and modals get a bevel + jewel hairline */
.panel, .card, .ps-row, .task-card, .tool-card {
  box-shadow: var(--shadow-soft), var(--sheen);
}
.modal {
  border-top: 1px solid rgba(var(--accent-rgb), .38);
  box-shadow: 0 60px 130px -40px rgba(0, 0, 0, .98), var(--sheen);
}
.bubble { box-shadow: var(--shadow-soft), var(--sheen); }
.row.assistant .bubble { border-left: 2px solid rgba(var(--accent-rgb), .35); }

/* Buttons: crisper gold primary with a brighter sheen */
.btn-primary {
  color: #140f04;
  box-shadow: 0 14px 34px -14px rgba(var(--accent-rgb), .95), var(--sheen);
  letter-spacing: .005em;
}
.btn-primary::after {
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .58), transparent);
}
.btn:focus-visible, .icon-btn:focus-visible, .ps-tab:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible { outline: none; box-shadow: var(--ring); }

/* Refined type: tighter display, wider micro-labels */
.brand-name { font-weight: 800; letter-spacing: .01em; }
.empty h1 { letter-spacing: -0.035em; font-weight: 800; }
.section-label { letter-spacing: .2em; }
.pill, .mode-btn, .ps-tab { letter-spacing: .01em; }

/* Chip / tab lift with a warm gold rim */
.chips .chip, .tool-chip, .ps-tab { border-color: var(--hair-strong); }
.chips .chip:hover, .tool-chip:hover { border-color: rgba(var(--accent-rgb), .65); }
.ps-tab.active { box-shadow: 0 8px 20px -14px rgba(var(--accent-rgb), 1); }

/* Scrollbars match the gold rim */
*::-webkit-scrollbar-thumb { background: #2a2318; border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #3d3323; background-clip: padding-box; }
* { scrollbar-color: #2a2318 transparent; }

/* Gold hairline separators where plain borders were used */
.sidebar-footer, .ps-history { border-top-color: var(--hair); }
.composer { background: linear-gradient(0deg, rgba(7, 7, 10, .97), rgba(7, 7, 10, .55)); }
.composer-inner {
  background: linear-gradient(180deg, rgba(26, 23, 32, .94), rgba(15, 14, 20, .94));
  border-color: var(--hair-strong);
}

/* Gem status dots */
.dot, .status-dot { box-shadow: 0 0 10px 0 currentColor; }

/* Theme menu polish */
.theme-menu { border-color: var(--hair-strong); }
.theme-menu button[aria-checked="true"] { box-shadow: inset 0 0 0 1px var(--hair-strong); }

/* Respect reduced motion for the new layers */
@media (prefers-reduced-motion: reduce) { .app::after { opacity: .6; } }


/* ============================================================
   R28 — first-run onboarding card (friendly, dismissible)
   ============================================================ */
.firstrun {
  position: relative; z-index: 2;
  max-width: 560px; margin: 22px auto 0; padding: 16px 18px 15px;
  text-align: left;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .07), rgba(0, 0, 0, .28));
  border: 1px solid var(--hair-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-soft), var(--sheen);
}
.firstrun .fr-close {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--text-faint);
  font-size: 12px; line-height: 1; cursor: pointer; transition: all .15s ease;
}
.firstrun .fr-close:hover { background: rgba(255, 255, 255, .06); border-color: var(--hair); color: var(--text); }
.firstrun .fr-title {
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: rgba(var(--accent-rgb), .92); margin-bottom: 8px;
}
.firstrun .fr-steps { margin: 0 0 12px; padding-left: 20px; }
.firstrun .fr-steps li { font-size: 13.5px; color: var(--text-dim); line-height: 1.62; margin: 3px 0; }
.firstrun .fr-steps b { color: var(--text); }
.firstrun .fr-key {
  display: inline-block; padding: 0 5px; border-radius: 6px;
  background: var(--grad-soft); border: 1px solid var(--hair-strong); color: var(--accent);
}
.firstrun .fr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.firstrun .fr-actions .btn { padding: 8px 14px; font-size: 13px; }
@media (max-width: 620px) { .firstrun { margin-top: 16px; padding: 14px; } }

/* ============================================================
   R33 — GUIDED TOOLKIT (beginner "no skill required" layer)
   ============================================================ */
.tk-tabs {
  display: inline-flex; gap: 4px; padding: 3px; margin: 0 0 4px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 999px;
}
.tk-tab {
  appearance: none; border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  padding: 6px 16px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.tk-tab:hover { color: var(--text); }
.tk-tab.is-active {
  background: linear-gradient(180deg, rgba(255,45,63,.22), rgba(255,45,63,.1));
  color: #ffd7db; box-shadow: inset 0 0 0 1px rgba(255,45,63,.45);
}

.tk-guided, .tk-all { display: flex; flex-direction: column; gap: 12px; }

.tk-target-label {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: -4px;
}
.tk-target {
  width: 100%; font-family: var(--mono); font-size: 13.5px;
}
.tk-target-help { margin: 0; font-size: 12px; color: var(--text-faint); line-height: 1.5; }

.tk-tasks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px; max-height: 340px; overflow-y: auto; padding-right: 2px;
}
.tk-task-card {
  appearance: none; text-align: left; font: inherit; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 13px;
  background: var(--panel-hi); display: flex; flex-direction: column; gap: 7px;
  color: var(--text); transition: border-color .15s, transform .15s, background .15s;
}
.tk-task-card:hover {
  border-color: rgba(255,45,63,.5); background: var(--panel-2); transform: translateY(-1px);
}
.tk-task-card.off { opacity: .6; }
.tk-task-card.off:hover { border-color: var(--line-soft); transform: none; }
.tk-task-head { display: flex; align-items: flex-start; gap: 8px; }
.tk-task-icon { font-size: 16px; line-height: 1.2; flex: none; }
.tk-task-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.tk-task-blurb { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.tk-task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tk-task-tool {
  font-family: var(--mono); font-size: 10.5px; color: #7dd3fc;
  background: rgba(var(--accent-2-rgb),.14); border: 1px solid rgba(var(--accent-2-rgb),.35);
  padding: 1px 7px; border-radius: 6px;
}
.tk-task-needs { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); }

.tk-chosen {
  border: 1px solid rgba(255,45,63,.32); border-radius: 12px; padding: 12px 13px;
  background: linear-gradient(180deg, rgba(255,45,63,.08), rgba(255,45,63,.02));
  display: flex; flex-direction: column; gap: 6px;
}
.tk-chosen-title { font-size: 13.5px; font-weight: 600; color: #ffd7db; }
.tk-chosen-what { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.tk-chosen-when { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.tk-chosen-cmd {
  font-family: var(--mono); font-size: 11.5px; color: #ff9aa2;
  background: rgba(15,23,42,.5); border-radius: 7px; padding: 6px 8px; word-break: break-all;
}
.tk-chosen-tip { font-size: 11.5px; color: var(--warn); line-height: 1.5; }

@media (max-width: 620px) {
  .tk-tabs { width: 100%; justify-content: stretch; }
  .tk-tab { flex: 1 1 auto; text-align: center; }
  .tk-tasks { grid-template-columns: 1fr; }
}

/* ============================================================
   R36 — CALL & SMS STUDIO (caller-ID / sender-ID guided layer)
   ============================================================ */
.cm-body { display: flex; flex-direction: column; gap: 12px; }
.cm-pane { display: flex; flex-direction: column; gap: 12px; }
.cm-pane[hidden] { display: none; }

.cm-group { display: flex; flex-direction: column; gap: 8px; }
.cm-group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-dim);
}
.cm-group-icon { font-size: 14px; }
.cm-body .tk-tasks { max-height: none; overflow: visible; }

.cm-builder {
  border: 1px solid rgba(255,45,63,.32); border-radius: 12px; padding: 12px 13px;
  background: linear-gradient(180deg, rgba(255,45,63,.08), rgba(255,45,63,.02));
  display: flex; flex-direction: column; gap: 10px;
}
.cm-builder-head { display: flex; align-items: center; gap: 8px; }
.cm-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 10px; }
.cm-field { display: flex; flex-direction: column; gap: 4px; }
.cm-field-label { font-size: 11px; color: var(--text-dim); font-weight: 600; }
.cm-field-input { width: 100%; font-family: var(--mono); font-size: 12.5px; }
.cm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cm-preview { max-height: 320px; overflow: auto; white-space: pre; margin: 0; }

.cm-notes { font-size: 12px; color: var(--text-dim); line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.cm-notes-head { font-size: 12px; font-weight: 700; color: var(--text); margin-top: 2px; }
.cm-step-list, .cm-note-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.cm-tip {
  font-size: 11.5px; color: var(--warn); line-height: 1.5;
  background: rgba(255,180,0,.08); border: 1px solid rgba(255,180,0,.25);
  border-radius: 8px; padding: 6px 9px;
}

.cm-ref-block { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.cm-ref-title { font-size: 13px; font-weight: 700; }
.cm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cm-table th, .cm-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.cm-table th { color: var(--text-dim); font-weight: 600; }
.cm-table tr:last-child td { border-bottom: 0; }
.cm-ref-note { font-size: 11px; color: var(--text-faint); }

.cm-tool {
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 13px;
  background: var(--panel-hi); display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
}
.cm-tool-title { font-size: 13.5px; font-weight: 600; }
.cm-tool-blurb { margin: 0; font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.cm-tool-row { display: flex; gap: 8px; }
.cm-tool-input { flex: 1 1 auto; font-family: var(--mono); font-size: 13px; }
.cm-tool-out { max-height: 260px; overflow: auto; white-space: pre; margin: 0; }

@media (max-width: 620px) {
  .cm-fields { grid-template-columns: 1fr; }
  .cm-tool-row { flex-direction: column; }
}

/* ============================================================
   R38 - Call & SMS Studio UX + premium polish
   ============================================================ */
#commsModal [hidden] { display: none !important; }

/* search + chips */
.cm-search-wrap { display: flex; flex-direction: column; gap: 9px; }
.cm-search-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-hi); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 7px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.cm-search-row:focus-within {
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12);
}
.cm-search-icon { font-size: 13px; opacity: .7; }
.cm-search-input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent;
  color: var(--text); font-size: 13.5px; padding: 4px 2px; outline: none;
}
.cm-search-input::placeholder { color: var(--text-faint); }
.cm-search-clear { flex: 0 0 auto; }
.cm-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cm-chip {
  appearance: none; border: 1px solid var(--line-soft); background: var(--panel);
  color: var(--text-dim); font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.cm-chip:hover { color: var(--text); border-color: var(--hair-strong); }
.cm-chip.is-active {
  color: #0b0d12;
  background: linear-gradient(180deg, var(--accent), var(--accent-2, var(--accent)));
  border-color: transparent;
  box-shadow: 0 6px 16px -8px rgba(var(--accent-rgb), .9);
}
.cm-search-meta { margin-left: auto; font-size: 11px; color: var(--text-faint); font-family: var(--mono); }

/* "Start here" row */
.cm-start {
  display: flex; flex-direction: column; gap: 9px;
  border: 1px solid var(--hair-strong); border-radius: 14px; padding: 12px 13px;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .08), rgba(0, 0, 0, .22));
  box-shadow: var(--shadow-soft), var(--sheen);
}
.cm-start-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.cm-start-badge {
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #0b0d12; background: var(--accent); padding: 3px 9px; border-radius: 999px;
}
.cm-start-sub { font-size: 12px; color: var(--text-dim); }
.cm-start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 9px; }
.cm-start-card {
  text-align: left; appearance: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px;
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 11px 12px;
  background: var(--panel-hi); color: var(--text);
  transition: border-color .15s, transform .15s, background .15s;
}
.cm-start-card:hover {
  border-color: rgba(var(--accent-rgb), .55); transform: translateY(-1px);
  background: var(--panel-2);
}
.cm-start-icon { font-size: 16px; }
.cm-start-title { font-size: 13px; font-weight: 700; }
.cm-start-plain { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.cm-start-go { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 2px; }

/* picker / builder focus modes */
.cm-picker { display: flex; flex-direction: column; gap: 12px; }

/* premium task cards */
.cm-card { position: relative; }
.cm-card-icon { font-size: 15px; }
.cm-card-plain { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.cm-level {
  margin-left: auto; flex: 0 0 auto;
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; font-family: var(--mono);
}
.cm-level-beginner { color: #7ff0b0; background: rgba(46, 204, 113, .13); border: 1px solid rgba(46, 204, 113, .32); }
.cm-level-intermediate { color: #ffd479; background: rgba(241, 196, 15, .12); border: 1px solid rgba(241, 196, 15, .30); }
.cm-level-advanced { color: #ff9c8f; background: rgba(231, 76, 60, .13); border: 1px solid rgba(231, 76, 60, .32); }
.cm-needs-k { color: var(--text-faint); }
.cm-card .cm-needs { font-family: inherit; }

/* empty state */
.cm-empty {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-align: center; padding: 28px 16px;
  border: 1px dashed var(--line-soft); border-radius: 14px; background: var(--panel-hi);
}
.cm-empty-icon { font-size: 22px; opacity: .8; }
.cm-empty-title { font-size: 14px; font-weight: 700; }
.cm-empty-text { font-size: 12.5px; color: var(--text-dim); }

/* builder header: back + steps + what panel */
.cm-builder-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-back { flex: 0 0 auto; }
.cm-steps {
  list-style: none; margin: 0 0 0 auto; padding: 0;
  display: flex; align-items: center; gap: 4px;
}
.cm-step {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--text-faint);
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent;
}
.cm-step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  font-size: 10.5px; font-family: var(--mono);
  background: rgba(255, 255, 255, .07); color: var(--text-dim);
}
.cm-step.is-on { color: var(--text); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .09); }
.cm-step.is-on .cm-step-n { background: var(--accent); color: #0b0d12; }
.cm-step.is-done .cm-step-n { background: rgba(var(--accent-rgb), .35); color: var(--text); }

.cm-what {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--line-soft); border-left: 3px solid rgba(var(--accent-rgb), .6);
  border-radius: 10px; padding: 10px 12px; background: var(--panel-hi);
}
.cm-what-row { display: flex; gap: 10px; align-items: baseline; }
.cm-what-k {
  flex: 0 0 118px; font-size: 11px; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .03em;
}
.cm-what-v { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.cm-what-warn { border-top: 1px solid var(--line-soft); padding-top: 7px; }
.cm-what-warn .cm-what-v { color: #ffcf9c; }

/* primary copy button */
.cm-copy-primary { font-weight: 700; }
.cm-actions .cm-copy-primary { order: -1; }

@media (max-width: 640px) {
  .cm-start-grid { grid-template-columns: 1fr; }
  .cm-steps { margin-left: 0; }
  .cm-what-row { flex-direction: column; gap: 2px; }
  .cm-what-k { flex: 0 0 auto; }
}

/* R39 callerid toolkit form */
.tk-callerid{padding:14px 16px}
.tk-cid-help{color:var(--muted,#9aa);font-size:12.5px;margin:4px 0 12px;line-height:1.5}
.tk-cid-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;margin-bottom:10px}
.tk-cid-field{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--muted,#9aa)}
.tk-cid-field .pull-input{width:100%}
.tk-cid-opts{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:10px}
.tk-cid-radio{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--fg,#ddd)}
.tk-cid-bridge{max-width:200px}
.tk-cid-opts2{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:12px}
.tk-cid-field-sm{max-width:240px}
.tk-cid-actions{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.tk-cid-status{font-size:12px;color:var(--muted,#9aa)}
@media(max-width:640px){.tk-cid-grid{grid-template-columns:1fr}}
.tk-cid-preview{margin:2px 0 10px;padding:7px 10px;border-radius:7px;background:var(--panel2,#1b1f27);color:var(--fg,#ddd);font-size:12.5px;line-height:1.5}
.tk-cid-recents{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.tk-cid-recents-label{font-size:12px;color:var(--muted,#9aa)}
.tk-cid-chip{border:1px solid var(--border,#333);background:var(--panel2,#1b1f27);color:var(--fg,#ddd);font-size:12px;padding:4px 9px;border-radius:999px;cursor:pointer;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tk-cid-chip:hover{border-color:var(--accent,#5a9);color:var(--accent,#5a9)}

/* ---- R40 link delivery segmented control ---- */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px;
  background: var(--panel, #1b1e27); border: 1px solid var(--line, #2c3040); }
.seg-btn { appearance: none; border: 0; background: transparent; color: var(--muted, #9aa0b5);
  font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.seg-btn:hover { color: var(--fg, #e7ebf5); }
.seg-btn.is-active { background: var(--accent, #3b6ef0); color: #fff; }
.seg-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted, #9aa0b5); }
.ps-res-row code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; word-break: break-all; }

/* ============================================================
   R41 — HackerAI visual parity
   Flat near-black surface, Geist type, orange accent, white
   circular send button, 22px glass composer, 768px message column.
   ============================================================ */
html[data-theme="hackerai"] {
  --bg: #141414;
  --bg-2: #111111;
  --panel: #141414;
  --panel-2: #111111;
  --panel-hi: #1a1a1a;
  --line: #333333;
  --line-soft: #2a2a2a;

  --text: #f5f5f5;
  --text-dim: #b3b3b3;
  --text-faint: #999999;

  --accent: #ff4500;
  --accent-2: #ff6534;
  --accent-warm: #ff6534;
  --accent-rgb: 255, 69, 0;
  --accent-2-rgb: 255, 101, 52;
  --accent-warm-rgb: 255, 101, 52;

  --radius: 10px;
  --radius-sm: 8px;

  --shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 6px 20px -14px rgba(0, 0, 0, 0.5);
  --grad: linear-gradient(135deg, #ff4500 0%, #ff6534 100%);
  --grad-soft: linear-gradient(135deg, rgba(255, 69, 0, 0.16), rgba(255, 101, 52, 0.10));

  --hair: #2a2a2a;
  --hair-strong: #333333;
  --glass: rgba(26, 26, 26, 0.72);
  --glass-2: rgba(20, 20, 20, 0.86);
  --ring: 0 0 0 3px rgba(255, 69, 0, 0.25);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 55%);

  --sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Flat page surface — kill the red aurora + hairline gradients */
html[data-theme="hackerai"] body { background: var(--bg); }
html[data-theme="hackerai"] .app::before { display: none; }
html[data-theme="hackerai"] .topbar::after { display: none; }

/* Sidebar */
html[data-theme="hackerai"] .sidebar {
  background: #0a0a0a;
  border-right: 1px solid #333333;
  backdrop-filter: none;
}
html[data-theme="hackerai"] .brand-mark { filter: none; }
html[data-theme="hackerai"] .brand-mark svg rect,
html[data-theme="hackerai"] .brand-mark svg path,
html[data-theme="hackerai"] .brand-mark svg circle { fill: var(--accent); }
html[data-theme="hackerai"] .brand-name {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  color: #f5f5f5;
}

/* Topbar */
html[data-theme="hackerai"] .topbar {
  background: var(--bg);
  border-bottom: 1px solid #262626;
  backdrop-filter: none;
}

/* Message column — HackerAI uses a ~768px centered column */
html[data-theme="hackerai"] .messages > * { max-width: 768px; }

/* Assistant messages read as plain text; user messages get a subtle bubble */
html[data-theme="hackerai"] .row.assistant .bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  --sheen: none;
  padding-left: 0;
  max-width: 100%;
}
html[data-theme="hackerai"] .row.user .bubble {
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 18px;
  border-top-right-radius: 18px;
}
html[data-theme="hackerai"] .bubble { box-shadow: var(--shadow-soft); }
html[data-theme="hackerai"] .row.user .bubble { box-shadow: none; }

/* Message hover actions — HackerAI only reveals them on hover */
html[data-theme="hackerai"] .msg-actions { opacity: 0; transition: opacity .15s ease; }
html[data-theme="hackerai"] .row:hover .msg-actions,
html[data-theme="hackerai"] .row:focus-within .msg-actions { opacity: 1; }
html[data-theme="hackerai"] .msg-actions .act-btn {
  border-color: #333333;
  background: transparent;
  color: var(--text-faint);
}
html[data-theme="hackerai"] .msg-actions .act-btn:hover {
  background: #222222;
  border-color: #4d4d4d;
  color: var(--text);
}

/* Empty / home state */
html[data-theme="hackerai"] .empty-glow { display: none; }
html[data-theme="hackerai"] .empty h1 { font-weight: 500; letter-spacing: -0.02em; }

/* Suggestion chips */
html[data-theme="hackerai"] .chip {
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 10px;
}
html[data-theme="hackerai"] .chip:hover {
  background: #222222;
  border-color: #4d4d4d;
  transform: none;
  box-shadow: none;
}

/* Conversations — section headers + flat rows */
html[data-theme="hackerai"] .conv-section-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 10px 4px;
}
html[data-theme="hackerai"] .conv-item { border-radius: 10px; }
html[data-theme="hackerai"] .conv-item.active { background: #1a1a1a; border-color: #333333; }
html[data-theme="hackerai"] .conv-empty { color: var(--text-faint); }

/* Mode switch — white active pill */
html[data-theme="hackerai"] .mode-switch { background: #111111; border-color: #333333; }
html[data-theme="hackerai"] .mode-slider { background: #ffffff; box-shadow: none; }
html[data-theme="hackerai"] .mode-btn.active { color: #0a0a0a; }

/* Primary buttons — white on black, like HackerAI */
html[data-theme="hackerai"] .btn-primary {
  background: #ffffff;
  color: #0a0a0a;
  border: none;
  box-shadow: none;
}
html[data-theme="hackerai"] .btn-primary:hover { background: #ececec; filter: none; }

/* ── Composer — 22px glass surface, 16px input, white circular send ── */
html[data-theme="hackerai"] .composer-inner {
  max-width: 768px;
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 22px;
  padding: 12px 16px;
  box-shadow: none;
  backdrop-filter: blur(10px);
}
html[data-theme="hackerai"] .composer-inner:focus-within {
  border-color: #4d4d4d;
  box-shadow: none;
}
html[data-theme="hackerai"] #input {
  font-size: 16px;
  line-height: 1.5;
  min-height: 28px;
  max-height: 300px;
  padding: 5px 0;
}
html[data-theme="hackerai"] .btn-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  color: #0a0a0a;
  border: none;
  box-shadow: none;
  display: grid;
  place-items: center;
}
html[data-theme="hackerai"] .btn-send:hover { background: #ececec; filter: none; }
html[data-theme="hackerai"] .btn-send:disabled { opacity: .5; background: #ffffff; filter: none; }
html[data-theme="hackerai"] .btn-send svg { width: 16px; height: 16px; }
html[data-theme="hackerai"] .btn-stop {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  color: #0a0a0a;
  display: grid;
  place-items: center;
}
html[data-theme="hackerai"] .btn-stop:hover { background: #ececec; border: none; }
html[data-theme="hackerai"] .btn-stop .sq { width: 11px; height: 11px; background: #0a0a0a; border-radius: 2px; }
html[data-theme="hackerai"] .composer-hint { color: var(--text-faint); }

/* ── Scroll-to-bottom affordance ── */
html[data-theme="hackerai"] .main { position: relative; }
html[data-theme="hackerai"] .scroll-bottom {
  position: absolute;
  bottom: 104px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1a1a1a;
  border: 1px solid #333333;
  color: var(--text-dim);
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.8);
  transition: background .15s, color .15s, border-color .15s;
}
html[data-theme="hackerai"] .scroll-bottom:hover {
  background: #222222;
  border-color: #4d4d4d;
  color: var(--text);
}

/* Theme menu */
html[data-theme="hackerai"] .theme-menu { background: #1a1a1a; border-color: #333333; }
html[data-theme="hackerai"] .theme-menu button[aria-checked="true"] { background: #222222; }
