/* QuarkCube brand: Pulse THEME_GUIDE.md / Brand Guidelines 2020.
 * Cyan, dark blue, teal; Prompt body and Heebo headings. Assets served locally. */
@font-face { font-family: 'Prompt'; src: url('/fonts/prompt-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Prompt'; src: url('/fonts/prompt-medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Prompt'; src: url('/fonts/prompt-semibold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('/fonts/heebo.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --qc-primary: #00a0d3;
  --qc-primary-dark: #016188;
  --qc-teal: #8ccbbe;
  --bg: #f7fafc;
  --panel: #ffffff;
  --panel-2: #edf5f8;
  --ink: #122b3a;
  --ink-2: #405969;
  --ink-3: #546776;
  --line: #d5e4eb;
  --accent: #016188;
  --accent-ink: #ffffff;
  --accent-soft: #e6f7fc;
  --user: #016188;
  --user-ink: #ffffff;
  --danger: #b4233d;
  --success: #18754d;
  --code-bg: #edf5f8;
  --shadow: 0 8px 24px rgba(1, 65, 88, .09);
  --radius: 12px;
  --font: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --headline: 'Heebo', var(--font);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #091b26;
  --panel: #102936;
  --panel-2: #183746;
  --ink: #edf7fa;
  --ink-2: #bed3df;
  --ink-3: #a4becb;
  --line: #2b4b5b;
  --accent: #33b3dc;
  --accent-ink: #071c28;
  --accent-soft: #143b4c;
  --user: #016188;
  --user-ink: #ffffff;
  --danger: #ff9aab;
  --success: #8ccbbe;
  --code-bg: #102f3e;
  --shadow: 0 8px 24px rgba(0, 0, 0, .24);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
  --bg: #091b26;
  --panel: #102936;
  --panel-2: #183746;
  --ink: #edf7fa;
  --ink-2: #bed3df;
  --ink-3: #a4becb;
  --line: #2b4b5b;
  --accent: #33b3dc;
  --accent-ink: #071c28;
  --accent-soft: #143b4c;
  --user: #016188;
  --user-ink: #ffffff;
  --danger: #ff9aab;
  --success: #8ccbbe;
  --code-bg: #102f3e;
  --shadow: 0 8px 24px rgba(0, 0, 0, .24);
  color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { height: 100dvh; }
.boot { height: 100%; display: grid; place-items: center; }
.boot-mark { width: 56px; height: 56px; opacity: .85; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.94); } }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; font-weight: 500;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-wide { width: 100%; }
.btn-danger { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }

/* ── sign-in / enrol gate ────────────────────────────────── */
.gate {
  min-height: 100dvh; display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.gate-card { width: 100%; max-width: 380px; text-align: center; }
.gate-mark { width: 72px; height: 72px; }
.gate-title { margin: 14px 0 4px; font-size: 30px; letter-spacing: -.02em; }
.gate-sub { margin: 0 0 28px; color: var(--ink-2); }
.gate-msg { min-height: 24px; margin: 14px 0 0; color: var(--ink-2); font-size: 14px; }
.gate-msg.err { color: var(--danger); }
.gate-foot { margin-top: 28px; color: var(--ink-3); font-size: 13px; }
.field { display: block; text-align: left; margin: 0 0 16px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── shell ───────────────────────────────────────────────── */
.shell { height: 100dvh; display: flex; }
.drawer {
  width: 284px; flex: none; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; letter-spacing: -.01em; }
.brand img { width: 28px; height: 28px; }
.btn-new { width: 100%; justify-content: flex-start; }
.conv-list { flex: 1; overflow-y: auto; margin: 12px -4px; padding: 0 4px; }
.conv-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border-radius: 10px; margin: 1px 0;
}
.conv-item > button.conv-open {
  flex: 1; min-width: 0; text-align: left; min-height: 40px; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 10px; cursor: pointer;
  color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item.active > button.conv-open { color: var(--ink); font-weight: 550; }
.conv-del { width: 34px; height: 34px; opacity: 0; }
.conv-del svg { width: 17px; height: 17px; }
.conv-item:hover .conv-del, .conv-item.active .conv-del, .conv-del:focus-visible { opacity: 1; }
.conv-group { font-size: 12px; color: var(--ink-3); margin: 14px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.conv-empty { color: var(--ink-3); font-size: 14px; padding: 8px 10px; }
.drawer-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.me {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 8px;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: var(--ink-2);
}
.me:hover { background: var(--panel-2); }
.me-name { flex: 1; text-align: left; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 14px;
}
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 4px; min-height: 56px;
  padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.engine {
  display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer;
}
.engine:hover { border-color: var(--accent); color: var(--ink); }
.engine::after { content: "⇄"; font-size: 11px; opacity: .7; }
.topbar-title {
  max-width: 100%; margin: 0; font-size: 16px; font-weight: 600; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.only-narrow { display: none; }

/* ── thread ──────────────────────────────────────────────── */
.thread { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.thread-inner {
  max-width: 760px; margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) 28px max(16px, env(safe-area-inset-left));
}
.empty { text-align: center; padding: 14vh 8px 0; color: var(--ink-2); }
.empty img { width: 56px; height: 56px; }
.empty h3 { margin: 12px 0 6px; color: var(--ink); font-size: 22px; letter-spacing: -.01em; }
.empty p { margin: 0 auto; max-width: 340px; }
.suggestions { display: grid; gap: 8px; margin: 24px auto 0; max-width: 420px; }
.suggestions button {
  text-align: left; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink-2);
}
.suggestions button:hover { border-color: var(--accent); color: var(--ink); }

.msg { margin: 0 0 18px; display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 100%; overflow-wrap: anywhere; }
.msg.user .bubble {
  max-width: 82%; background: var(--user); color: var(--user-ink);
  padding: 10px 14px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap;
}
.msg.assistant .bubble { width: 100%; }
.msg.error .bubble {
  width: 100%; color: var(--danger); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-3); font-size: 14px; margin: 2px 0 10px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 40% { opacity: .2; } }
.chip { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); }

/* markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.3; letter-spacing: -.01em; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 17px; } .md h4 { font-size: 16px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--code-bg); padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: 0 0 12px; }
.md pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.5; }
.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md .table-wrap { overflow-x: auto; margin: 0 0 12px; }
.md table { border-collapse: collapse; font-size: 14.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); font-weight: 600; }
.msg-tools { display: flex; gap: 2px; margin-top: 6px; }
.msg-tools .icon-btn { width: 32px; height: 32px; color: var(--ink-3); }
.msg-tools svg { width: 17px; height: 17px; }

/* ── composer ────────────────────────────────────────────── */
.composer {
  padding: 8px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--bg);
}
.composer-row, .attachments { max-width: 760px; margin: 0 auto; }
.composer-row {
  display: flex; align-items: flex-end; gap: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.composer-row:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; min-height: 44px; max-height: 40vh; resize: none; border: 0; outline: 0; background: transparent;
  padding: 10px 6px; line-height: 1.45; font-size: 16px;
}
.attach { flex: none; }
.attach input { display: none; }
.send {
  flex: none; width: 40px; height: 40px; margin: 2px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.send:disabled { background: var(--panel-2); color: var(--ink-3); cursor: default; }
.send svg { width: 20px; height: 20px; stroke-width: 2.2; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.att {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  padding: 4px 4px 4px 10px; border-radius: 10px; background: var(--panel-2); font-size: 13px;
}
.att span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att button { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.att button svg { width: 15px; height: 15px; }

/* ── settings sheet ──────────────────────────────────────── */
.sheet-wrap { position: fixed; inset: 0; background: rgba(7, 28, 40, .45); display: grid; place-items: center; z-index: 30; padding: 16px; }
.sheet {
  width: 100%; max-width: 460px; max-height: 88dvh; overflow-y: auto;
  background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); padding: 8px 20px 20px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -8px; z-index: 3; background: var(--panel); padding: 16px 0 8px; margin-top: -8px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.sheet-sec:first-of-type { border-top: 0; }
.sheet-sec h4 { margin: 0 0 6px; font-size: 15px; }
.hint { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.devices { list-style: none; margin: 0 0 12px; padding: 0; }
.devices li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.devices li:last-child { border-bottom: 0; }
.dev-name { flex: 1; min-width: 0; }
.dev-name b { display: block; font-weight: 550; }
.dev-name small { color: var(--ink-3); }
.link-box { margin-top: 12px; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 40; max-width: calc(100vw - 32px);
}

/* ── narrow screens: drawer slides over ──────────────────── */
@media (max-width: 899px) {
  .only-narrow { display: inline-grid; }
  .drawer {
    position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(86vw, 320px);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .shell.drawer-open .drawer { transform: none; }
  .shell.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(7, 28, 40, .35); }
  .msg.user .bubble { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer { transition: none; }
  .boot-mark, .dots i { animation: none; }
}

/* Connections (Settings) */
.conns { display: grid; gap: 10px; }
.conn { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); }
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-name { font-weight: 600; }
.conn-state { font-size: 13px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.conn-state.ok::before { content: "● "; color: var(--success); }
.conn-body { margin-top: 10px; display: grid; gap: 8px; }
.conn-body .field { margin: 0; }
.conn-code { font-family: var(--mono); font-size: 22px; letter-spacing: 2px; padding: 8px 12px; border-radius: 10px; background: var(--code-bg); text-align: center; user-select: all; }
.conn-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.conn-err { color: var(--danger); font-size: 13px; margin: 0; }

/* Websites: the person's private browser, full screen over the app. */
.conn-head .conn-actions { display: flex; gap: 6px; flex-shrink: 0; }
.webview { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
.webview-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.webview-head .hint { flex: 1; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.webview iframe { flex: 1; width: 100%; border: 0; background: #111; }
@media (max-width: 560px) { .webview-head .hint { display: none; } .webview-head b { flex: 1; } }

/* Voice: the mic button turns red while recording. */
.mic { flex: none; }
.mic.recording { color: #fff; background: #d23c3c; animation: atom-rec 1.2s ease-in-out infinite; }
.mic:disabled { opacity: .5; }
@keyframes atom-rec { 50% { opacity: .65; } }

/* Stop: the Send button while Atom answers. */
.send.stop { background: var(--ink); color: var(--bg); }
.send.stop svg path { fill: currentColor; stroke: none; }

/* Rich replies: diagrams, charts, images, file previews, tables. */
.md .visual { margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow-x: auto; }
.md .visual canvas { max-width: 100%; }
.md-img { display: block; max-width: 100%; max-height: 480px; margin: 8px 0; border-radius: 10px; cursor: zoom-in; }
.md-img.diagram { max-height: none; background: transparent; }
.md-missing { color: var(--ink-3); font-size: 13px; }
.file-link { font-weight: 500; }
.table-box { position: relative; margin: 8px 0; padding-top: 22px; display: inline-block; max-width: 100%; vertical-align: top; }
.table-copy { position: absolute; top: 0; right: 0; font-size: 11px; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; opacity: .8; z-index: 1; }
.table-copy:hover { opacity: 1; }
.att { display: inline-flex; align-items: center; gap: 6px; }
.att-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: rgba(7, 28, 40, .92); }
.viewer-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); color: #fff; }
.viewer-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-img { flex: 1; min-height: 0; object-fit: contain; margin: 0 auto; max-width: 100%; }
.viewer-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.viewer-media { margin: auto; max-width: 100%; }

/* agents & personas */
.new-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px auto 0; max-width: 420px; }
.new-opts select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 10px; font: inherit; }
.agent-toggle.on { border-color: var(--accent); color: var(--accent); background: var(--panel-2); }
.agent-hint { max-width: 420px; margin: 10px auto 0; text-align: center; }
.persona-chip { display: inline-block; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); margin: 0 0 14px; }
.agent-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0 0 16px; background: var(--panel); color: var(--ink-2); font-size: 14px; }
.agent-banner .status { margin: 0; }
.agent-banner.running { border-color: var(--accent); }
.agent-banner.failed, .agent-banner.interrupted { color: var(--danger); }
.pair-cmd { white-space: pre-wrap; word-break: break-all; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; user-select: all; }

/* approvals, activity, memory, assistant */
.approvals-btn { margin: 0 12px 8px; display: flex; justify-content: space-between; align-items: center; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.approval { border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; margin: 0 0 16px; background: var(--panel); }
.approval.approved, .approval.declined, .approval.replaced { border-color: var(--line); opacity: .8; }
.approval-head { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.approval-text { margin-bottom: 10px; color: var(--ink); }
.approval-row { margin-bottom: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.templates { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chip-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 999px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.chip-btn:hover { border-color: var(--accent); color: var(--ink); }
.act-row { padding: 8px 2px; border-bottom: 1px solid var(--line); }
.act-row.clickable { cursor: pointer; }
.act-row.clickable:hover .act-title { color: var(--accent); }
.act-row.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.act-title { display: flex; gap: 8px; align-items: baseline; color: var(--ink); }
.act-icon { width: 1.4em; text-align: center; }
.avatar-big { font-size: 48px; line-height: 56px; }
.check { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; color: var(--ink-2); margin: 4px 0 12px; }
.field select, .field textarea { width: 100%; }

/* shared chats */
.msg { flex-wrap: wrap; }
.msg-time { flex-basis: 100%; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.msg.user .msg-time { text-align: right; }
.field-label { display: block; font-size: 13px; color: var(--ink-2); margin: 4px 0 6px; }
.share-result { display: grid; gap: 10px; }
.share-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.share-line .field-label { grid-column: 1 / -1; margin: 0; }
.share-line code { overflow-wrap: anywhere; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.share-key { font-size: 16px !important; letter-spacing: .06em; }
.shared-page { min-height: 100vh; background: var(--bg); }
.shared-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.shared-head img { width: 24px; height: 24px; }
.shared-body { max-width: 760px; margin: 0 auto; padding: 16px; }
.shared-gate { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 10px; text-align: center; }
.shared-gate input { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 12px; font: inherit; text-align: center; letter-spacing: .05em; }
.shared-meta h2 { margin: 6px 0 4px; }
.shared-thread { padding-left: 0; padding-right: 0; }

/* + menu, talk */
.plus-wrap { position: relative; display: flex; align-items: flex-end; }
.plus-menu { position: absolute; bottom: 48px; left: 0; z-index: 20; min-width: 230px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: grid; }
.plus-menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; font: inherit; color: var(--ink); cursor: pointer; }
.plus-menu button:hover { background: var(--panel-2); }
.talk { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; }
.talk-orb { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--qc-teal), var(--qc-primary)); box-shadow: 0 0 0 0 rgba(0,160,211,.5); }
.talk[data-phase=listen] .talk-orb { animation: talkpulse 1.4s infinite; }
.talk[data-phase=think] .talk-orb { opacity: .6; animation: blink 1.2s infinite; }
.talk[data-phase=speak] .talk-orb { animation: talkpulse .7s infinite; }
.talk-line { font-size: 20px; color: var(--ink); margin: 0; }
@keyframes talkpulse { 0% { box-shadow: 0 0 0 0 rgba(0,160,211,.45); } 70% { box-shadow: 0 0 0 26px rgba(0,160,211,0); } 100% { box-shadow: 0 0 0 0 rgba(0,160,211,0); } }

/* Screen-reader-only live region for status text. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Agent progress ("↻ Step 2 of 8"): a status line, not a user bubble. */
.msg.step { justify-content: center; margin: 0 0 12px; }
.msg.step .bubble { color: var(--ink-3); font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); }
.msg.step .msg-time { display: none; }

/* Brand accents share the same tokens on chat, settings, auth and public shares. */
h1, h2, h3, h4, .brand { font-family: var(--headline); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--ink); }
.gate-card { max-width: 420px; padding: 32px 24px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--qc-primary); border-radius: 16px; }
.gate-title { font-size: 36px; font-weight: 600; }
.brand-lockup { display: flex; flex-direction: column; gap: 0; line-height: 1.15; }
.brand-lockup small { font: 400 10px/1.6 var(--font); letter-spacing: .06em; color: var(--ink-2); }
.brand-credit { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 20px 0 0; color: var(--ink-2); font-size: 12px; }
.brand-credit img { width: 22px; height: 22px; border-radius: 5px; }
.drawer { border-top: 3px solid var(--qc-primary); }
.btn-new { border-color: var(--accent); color: var(--accent); font-weight: 500; }
.conv-item.active { box-shadow: inset 3px 0 var(--qc-primary); }
.composer-row:focus-within { border-color: var(--qc-primary); }
.sheet-head h3 { font-size: 21px; }
.sheet-sec h4 { font-weight: 600; }
.appearance-choice { display: grid; gap: 6px; color: var(--ink-2); font-size: 14px; }
.appearance-choice select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--panel-2); color: var(--ink); }
@media (max-width: 400px) { .gate-card { padding: 24px 18px; } }

.webview-paste { margin: 0; padding: 8px 16px; background: var(--panel); color: var(--ink-2); font-size: 13px; }
.webview-paste input { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--panel-2); color: var(--ink); }

/* Teach remains beside the existing private-browser surface. */
.teach-panel { flex: 0 0 auto; max-height: 45vh; overflow: auto; padding: 16px; border-bottom: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.teach-panel[hidden] { display: none; }
.teach-panel > .btn { margin: 4px 8px 4px 0; }
.teach-field { display: inline-flex; flex-direction: column; gap: 5px; margin: 8px 16px 8px 0; }
.teach-field input, .teach-steps input:not([type=checkbox]) { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; }
.teach-steps li { margin: 8px 0; }
.teach-steps .btn { margin-left: 10px; }
.teach-snapshot { display: block; max-width: 100%; max-height: 360px; margin-top: 8px; object-fit: contain; }
