/* Hopper — warm editorial theme (claude.ai-style) */

@font-face {
  font-family: "Hopper Serif";
  src: url("/static/fonts/source-serif-400.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root, [data-theme="light"] {
  --bg: #faf9f5;
  --bg-sidebar: #faf9f5;
  --bg-composer: #ffffff;
  --bg-bubble: #f0eee6;
  --bg-raised: #ebe9e0;
  --bg-input: #ffffff;
  --bg-banner: #f0efe8;
  --border: #e8e6dc;
  --border-strong: #dbd8cc;
  --text: #29261b;
  --text-dim: #8a8574;
  --accent: #c96442;
  --accent-hover: #b5532f;
  --accent-soft: rgba(201, 100, 66, 0.1);
  --danger: #b0382a;
  --avatar-bg: #3d3929;
  --shadow: 0 2px 16px rgba(41, 38, 27, 0.05);
  --shadow-composer: 0 6px 28px rgba(41, 38, 27, 0.08);
}

[data-theme="dark"] {
  --bg: #262624;
  --bg-sidebar: #1f1e1d;
  --bg-composer: #30302e;
  --bg-bubble: #33322f;
  --bg-raised: #34332f;
  --bg-input: #30302e;
  --bg-banner: #2d2c2a;
  --border: #3b3a36;
  --border-strong: #4a4944;
  --text: #ececea;
  --text-dim: #a6a39a;
  --accent: #d97757;
  --accent-hover: #e08a6e;
  --accent-soft: rgba(217, 119, 87, 0.12);
  --danger: #d05548;
  --avatar-bg: #ececea;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.22);
  --shadow-composer: 0 6px 28px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

:root {
  --font-ui: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-serif: "Hopper Serif", "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 15px;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  transition: background 0.25s, color 0.25s;
}

.hidden { display: none !important; }

.icon {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.spark-svg { stroke: var(--accent); stroke-width: 2.2; }

/* ============ auth page ============ */
.auth-body { display: flex; align-items: center; justify-content: center; }
.auth-card {
  width: 400px; max-width: 92vw;
  background: var(--bg-composer);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-composer);
}
.auth-logo {
  text-align: center; margin: 0 0 6px;
  font-family: var(--font-serif); font-weight: 500; font-size: 1.7rem;
}
.auth-logo .spark { color: var(--accent); }
.auth-sub {
  text-align: center; color: var(--text-dim); font-size: 0.88rem; margin: 0 0 26px;
}
.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 22px;
  background: var(--bg-raised); border-radius: 10px; padding: 4px;
}
.auth-tab {
  flex: 1; padding: 8px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-dim); cursor: pointer;
  font-size: 0.92rem; font-family: inherit;
}
.auth-tab.active { background: var(--bg-composer); color: var(--text); box-shadow: var(--shadow); }
.auth-error {
  background: var(--accent-soft); border: 1px solid var(--danger); color: var(--danger);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.88rem;
}
.auth-error.auth-ok { border-color: #3a8f5d; color: #3a8f5d; }
.auth-hint { color: var(--text-dim); font-size: 0.8rem; text-align: center; margin-top: 20px; line-height: 1.5; }

/* ============ form controls ============ */
label { display: block; margin-bottom: 15px; font-size: 0.85rem; color: var(--text-dim); }
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 13px;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 0.93rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: 10px; }

.btn-primary, .btn-secondary, .btn-danger {
  padding: 11px 16px; border-radius: 10px; border: none;
  font-size: 0.93rem; cursor: pointer; font-family: inherit; width: 100%;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--accent-soft); }

/* ============ layout ============ */
.layout { display: flex; height: 100vh; }

/* slim icon rail */
.rail {
  width: 52px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 0;
  background: var(--bg); border-right: 1px solid var(--border);
  z-index: 10;
}
.rail-btn {
  width: 36px; height: 36px; border: none; border-radius: 9px;
  background: transparent; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.rail-btn:hover { background: var(--bg-raised); color: var(--text); }
.rail-btn .icon { width: 19px; height: 19px; stroke-width: 2; }
.rail-plus { background: var(--bg-raised); color: var(--text); border-radius: 50%; margin-top: 14px; }
.rail-plus:hover { background: var(--border-strong); }
.rail-spacer { flex: 1; }
.rail-avatar {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--avatar-bg); color: var(--bg);
  font-size: 0.88rem; font-weight: 600; font-family: inherit; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
}
.rail-avatar:hover { opacity: 0.85; }

/* expandable panel */
.sidebar {
  width: 272px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  transition: margin-left 0.2s ease;
  overflow: hidden;
}
.sidebar.collapsed { margin-left: -272px; }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 10px 18px;
}
.wordmark { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 500; cursor: pointer; }
.wordmark:hover { color: var(--accent); }
.side-head-btns { display: flex; gap: 2px; }
.side-icon {
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.side-icon:hover { background: var(--bg-raised); color: var(--text); }
.side-icon .icon { width: 18px; height: 18px; stroke-width: 2; }

.side-search { padding: 0 12px 6px; }
.side-search input { margin-top: 0; padding: 7px 11px; font-size: 0.88rem; border-radius: 9px; }

.side-nav { padding: 2px 8px 6px; display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 10px 11px; border: none; border-radius: 10px;
  background: transparent; color: var(--text);
  font-size: 0.95rem; font-weight: 500; cursor: pointer; font-family: inherit; text-align: left;
}
.side-item:hover { background: var(--bg-raised); }
.side-item .icon { width: 19px; height: 19px; color: var(--text); stroke-width: 2; }
.nav-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--bg-raised); margin: -2px -2px -2px -3px;
}
.nav-plus .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.side-item:hover .nav-plus { background: var(--border-strong); }
.side-item .shortcut { margin-left: auto; font-size: 0.74rem; color: var(--text-dim); font-weight: 400; }

.spark { color: var(--accent); }

.conv-section { padding: 14px 19px 6px; font-size: 0.82rem; color: var(--text-dim); }
.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; }
.conv-item {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 11px; border-radius: 10px; cursor: pointer;
  color: var(--text); font-size: 0.91rem; font-weight: 450; margin-bottom: 1px;
}
.conv-item:hover { background: var(--bg-raised); }
.conv-item.active { background: var(--bg-raised); }
.conv-item .conv-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-del {
  visibility: hidden; color: var(--text-dim); border: none;
  background: none; cursor: pointer; font-size: 0.8rem; padding: 2px 4px;
}
.conv-item:hover .conv-del { visibility: visible; }
.conv-item .conv-del:hover { color: var(--danger); }
.conv-item .conv-star { width: 13px; height: 13px; flex: 0 0 auto; color: var(--accent); }
.conv-item .conv-star use { fill: var(--accent); }
.conv-item .conv-kebab {
  visibility: hidden; flex: 0 0 auto; color: var(--text-dim); border: none;
  background: none; cursor: pointer; padding: 2px; border-radius: 6px; line-height: 0;
}
.conv-item .conv-kebab .icon { width: 16px; height: 16px; }
.conv-item:hover .conv-kebab, .conv-item .conv-kebab[data-open="1"] { visibility: visible; }
.conv-item .conv-kebab:hover { background: var(--border); color: var(--text); }
.conv-rename {
  flex: 1; min-width: 0; font: inherit; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--bg); color: var(--text);
}
.conv-snippet { flex-basis: 100%; font-size: .76rem; color: var(--text-dim); margin: 1px 0 2px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-empty { padding: 24px 16px; text-align: center; color: var(--text-dim); font-size: .86rem; }

/* conversation actions popover */
.conv-pop {
  position: fixed; z-index: 3500; min-width: 168px; padding: 6px;
  background: var(--bg-elev, var(--bg-banner)); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(0,0,0,.22);
}
.conv-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: none; cursor: pointer; border-radius: 8px;
  color: var(--text); font-size: .89rem;
}
.conv-pop button .icon { width: 15px; height: 15px; color: var(--text-dim); }
.conv-pop button:hover { background: var(--bg-raised); }
.conv-pop button.danger { color: var(--danger); }
.conv-pop button.danger .icon { color: var(--danger); }
.conv-pop button.danger:hover { background: rgba(201,66,66,.10); }

/* share modal extras */
.share-card { max-width: 440px; max-height: 86vh; overflow-y: auto; }
.share-sep { border: none; border-top: 1px solid var(--border); margin: 18px 0 12px; }
.share-note { font-size: .85rem; color: var(--text-dim); margin: -6px 0 14px; line-height: 1.5; }
.share-link-row { display: flex; gap: 8px; margin-bottom: 16px; }
.share-link-row input { flex: 1; min-width: 0; padding: 9px 11px; font-size: .84rem;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg-raised); color: var(--text); }
.share-link-row button { padding: 9px 16px; }

.sidebar-bottom { padding: 10px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; border-radius: 10px;
  background: transparent; cursor: pointer; font-family: inherit;
  color: var(--text); font-size: 0.9rem; text-align: left;
}
.user-chip:hover { background: var(--bg-raised); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--avatar-bg); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 600; text-transform: uppercase;
}
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-meta .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.user-meta .user-plan { font-size: 0.74rem; color: var(--text-dim); }
.user-chip .chev { color: var(--text-dim); width: 15px; height: 15px; }

.main { flex: 1; display: flex; flex-direction: row; min-width: 0; position: relative; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ===== artifact pane (right split) ===== */
.artifact-pane {
  flex: 0 0 54%; min-width: 0; display: flex; flex-direction: column;
  border-left: 1px solid var(--border); background: var(--bg-sidebar);
}
.art-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.art-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.art-title-wrap .icon { width: 16px; height: 16px; color: var(--text-dim); }
.art-title { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-tabs { display: flex; background: var(--bg-raised); border-radius: 9px; padding: 3px; }
.art-tab {
  border: none; background: transparent; color: var(--text-dim);
  font-family: inherit; font-size: 0.82rem; padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.art-tab.active { background: var(--bg-composer); color: var(--text); }
.art-actions { display: flex; gap: 2px; }
.art-body { flex: 1; min-height: 0; position: relative; }
.art-frame { width: 100%; height: 100%; border: none; background: #fff; }
.art-code {
  position: absolute; inset: 0; margin: 0; overflow: auto;
  background: var(--bg); padding: 16px; font-size: 0.82rem; line-height: 1.5;
}
.art-code code { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; white-space: pre; }
#art-code-el { display: block; }
.cl-row { display: flex; }
.cl-num {
  width: 2.6em; flex-shrink: 0; text-align: right; padding-right: 14px;
  color: var(--text-dim); opacity: 0.55; user-select: none;
}
.cl-txt { white-space: pre; flex: 1; min-width: 0; }
.cl-hl { background: var(--accent-soft); margin: 0 -16px; padding: 0 16px; }
.cl-hl .cl-num { color: var(--accent); opacity: 1; }

/* artifact card shown inline in chat — compact, claude-style */
.artifact-card {
  display: inline-flex; align-items: center; gap: 11px; max-width: 320px;
  margin: 8px 0; padding: 8px 14px 8px 9px; text-align: left; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 11px;
  background: var(--bg-composer); font-family: var(--font-ui); color: var(--text);
}
.artifact-card:hover { background: var(--bg-raised); }
.artifact-card.writing { border-color: var(--accent); }
.artifact-card.writing .ac-sub { color: var(--accent); }
.artifact-card .ac-ico {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.artifact-card .ac-ico .icon { width: 16px; height: 16px; }
.artifact-card .ac-main { min-width: 0; flex: 1; }
.artifact-card .ac-title {
  display: block; font-size: 0.86rem; font-weight: 500; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.artifact-card .ac-sub { display: block; font-size: 0.73rem; color: var(--text-dim); line-height: 1.3; }

@media (max-width: 800px) {
  .artifact-pane { position: absolute; inset: 0; flex-basis: auto; z-index: 15; }
}

.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px 0; min-height: 20px; }
.btn-icon {
  background: transparent; border: none; color: var(--text-dim); font-size: 1rem;
  cursor: pointer; padding: 5px 9px; border-radius: 8px;
}
.btn-icon:hover { background: var(--bg-raised); color: var(--text); }
.topbar-title {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 0.88rem; color: var(--text-dim);
}

/* ============ empty-state hero ============ */
.hero {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 0 24px 10vh;
}
.hero-greeting { display: flex; align-items: center; gap: 16px; margin-bottom: 38px; }
.hero-greeting .greet-spark {
  width: 42px; height: 42px; color: var(--accent);
  stroke-width: 2.4;
}
.hero-greeting h1 {
  font-family: var(--font-serif); font-weight: 400; font-size: 2.85rem;
  margin: 0; letter-spacing: -0.015em;
}
.hero-slot { width: 100%; max-width: 700px; }
.hero .composer-wrap { padding: 0; max-width: none; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 15px;
  background: var(--bg-bubble); border: 1px solid var(--border-strong);
  border-radius: 10px; color: var(--text); font-family: inherit;
  font-size: 0.88rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
}
.chip .icon { width: 16px; height: 16px; color: var(--text); stroke-width: 2; }
.chip:hover { background: var(--bg-raised); border-color: var(--text-dim); }

/* ============ chat ============ */
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-inner { max-width: 740px; margin: 0 auto; padding: 18px 20px 8px; }

.msg { margin-bottom: 26px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .msg-body {
  background: var(--bg-bubble); border-radius: 16px 16px 4px 16px;
  padding: 11px 16px; max-width: 82%; line-height: 1.55;
  overflow-wrap: break-word;
}
/* shared-chat: anonymous sender handle stacked above a user bubble */
.msg.user .msg-stack { display: flex; flex-direction: column; align-items: flex-end; max-width: 82%; min-width: 0; }
.msg.user .msg-stack .msg-body { max-width: 100%; }
.msg-sender { font-size: .72rem; font-weight: 600; color: var(--text-dim); margin: 0 4px 3px 0; }
/* inline images in replies (e.g. /qr codes) */
.msg-img { max-width: 320px; width: 100%; height: auto; display: block; margin: 6px 0; border-radius: 10px; }
/* "you're in a shared chat" banner above the composer */
.share-banner {
  font-size: .8rem; color: var(--text-dim); background: var(--bg-bubble);
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px;
  margin: 0 auto 8px; max-width: 720px; text-align: center;
}
.model-btn.locked { opacity: .6; }
.msg.assistant { display: flex; gap: 13px; }
.msg.assistant .msg-avatar {
  width: 24px; height: 24px; flex-shrink: 0; margin-top: 4px;
  color: var(--accent);
}
.msg.assistant .msg-avatar .icon { width: 22px; height: 22px; stroke-width: 2.2; }
/* the Hopper logo hops while the assistant is thinking / writing */
@keyframes logo-hop {
  0%        { transform: translateY(0)      scaleY(1); }
  18%       { transform: translateY(-5px)   scaleY(1.05); }
  36%       { transform: translateY(0)      scaleY(0.93); }
  46%       { transform: translateY(0)      scaleY(1); }
  60%       { transform: translateY(-2.5px) scaleY(1.02); }
  74%       { transform: translateY(0)      scaleY(0.97); }
  82%, 100% { transform: translateY(0)      scaleY(1); }
}
.msg.assistant.streaming .msg-avatar .icon {
  animation: logo-hop 1.15s ease-in-out infinite;
  transform-origin: bottom center;
}

/* ============ slide decks ============ */
.deck-block {
  border: 1px solid var(--border-strong); border-radius: 14px;
  margin: 14px 0; overflow: hidden; background: var(--bg-composer);
}
.deck-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-strong);
}
.deck-title { font-weight: 600; font-family: var(--font-serif); font-size: 1.05rem; }
.deck-count { color: var(--text-dim); font-size: 0.8rem; font-family: var(--font-sans, sans-serif); margin-left: 10px; }
.deck-actions { display: flex; gap: 8px; }
.deck-actions .btn-secondary { padding: 6px 14px; font-size: 0.85rem; }
.deck-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px;
}
.deck-thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 10px; background: #ddd;
}
.deck-thumb:hover { border-color: var(--accent); }
.deck-thumb iframe {
  width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none;
}
.deck-n {
  position: absolute; right: 8px; bottom: 6px; z-index: 2;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 0.72rem;
  padding: 2px 8px; border-radius: 999px;
}
.present-overlay { position: fixed; inset: 0; z-index: 340; background: #101010; }
.present-overlay iframe {
  position: absolute; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0;
}
.present-bar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 2;
  background: rgba(0,0,0,0.55); border-radius: 999px; padding: 6px 14px;
  color: #eee; font-size: 0.9rem; opacity: 0.25; transition: opacity 0.2s;
}
.present-bar:hover { opacity: 1; }
.present-btn {
  background: none; border: 0; color: #eee; font-size: 1rem; cursor: pointer;
  padding: 4px 8px; border-radius: 8px;
}
.present-btn:hover { background: rgba(255,255,255,0.15); }

/* SSH approval bar pinned above the composer */
.approval-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin: 0 4px 8px; padding: 10px 14px;
  border: 1px solid var(--danger); border-radius: 12px; background: var(--accent-soft);
}
.approval-bar .ab-text { font-size: 0.9rem; min-width: 0; overflow-wrap: anywhere; }
.approval-bar code { font-family: var(--font-mono, monospace); font-size: 0.85rem;
  background: var(--bg); padding: 2px 6px; border-radius: 6px; }
.approval-bar .ab-actions { display: flex; gap: 8px; flex-shrink: 0; }
.approval-bar .ab-actions button { padding: 6px 12px; font-size: 0.85rem; }
.pm-conn-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SSH command approval card */
.ssh-approval {
  border: 1px solid var(--danger); border-radius: 14px; padding: 14px; margin: 12px 0;
  background: var(--accent-soft); display: flex; flex-direction: column; gap: 10px;
}
.ssh-head { font-weight: 600; }
.ssh-reason { color: var(--text-dim); font-size: 0.9rem; }
.ssh-cmd { margin: 0; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.ssh-cmd code { font-family: var(--font-mono, monospace); font-size: 0.88rem; white-space: pre-wrap; }
.ssh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ssh-actions button { padding: 7px 14px; font-size: 0.88rem; }
.ssh-state { font-size: 0.85rem; color: var(--text-dim); }
.ssh-output { margin: 8px 0; }
.ssh-output > summary { cursor: pointer; color: var(--text-dim); font-size: 0.82rem; }
.ssh-output pre { background: var(--bg-raised, #1c1b19); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0 0; }
.ssh-output code { font-family: var(--font-mono, monospace); font-size: 0.82rem; white-space: pre-wrap; }

/* clarifying-questions card (```ask``` blocks) */
.ask-card {
  border: 1px solid var(--border-strong); border-radius: 14px; padding: 16px;
  margin: 12px 0; background: var(--bg-composer); display: flex; flex-direction: column; gap: 16px;
}
.ask-q { display: flex; flex-direction: column; gap: 8px; }
.ask-qt { font-weight: 600; }
.ask-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-opt {
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; cursor: pointer; font-family: inherit;
}
.ask-opt:hover { border-color: var(--accent); }
.ask-opt.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.ask-other {
  border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 12px;
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.9rem; max-width: 360px;
}
.ask-send { align-self: flex-start; padding: 8px 18px; }
.ask-send:disabled { opacity: 0.5; cursor: default; }

/* small "switched model for this turn" notice chip above an answer */
.route-note {
  display: inline-block; font-size: 0.78rem; color: var(--text-dim);
  background: var(--accent-soft); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 3px 11px; margin-bottom: 8px;
}

/* ============ draw across the whole conversation ============ */
/* annotating + inked share the side border so the frozen ink stays aligned after capture */
#chat-messages.annotating, #chat-messages.inked {
  position: relative; padding-left: 48px; padding-right: 48px;
}
#chat-messages.annotating { padding-bottom: 240px; }   /* room to draw below the last line */
.annot-canvas {
  position: absolute; top: 0; left: 0; z-index: 50; touch-action: none; cursor: crosshair;
}
/* already-captured layers stay visible but never block drawing/clicking on top of them */
.annot-canvas.annot-frozen { pointer-events: none; cursor: default; }
.annot-spacer { width: 100%; pointer-events: none; }
.annot-toolbar {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%);
  z-index: 200; display: flex; align-items: center; gap: 10px;
  background: var(--bg-composer); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 8px 14px; box-shadow: var(--shadow);
}
.annot-swatches { display: inline-flex; gap: 6px; }
.sketch-sep { width: 1px; height: 20px; background: var(--border-strong); }
.sk-swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
}
.sk-swatch.active { border-color: var(--text); transform: scale(1.12); }
.sketch-tool {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-composer); color: var(--text);
  border-radius: 9px; padding: 5px 9px; font-size: 0.82rem; font-family: inherit;
}
.sketch-tool .icon { width: 15px; height: 15px; }
.annot-toolbar .btn-primary, .annot-toolbar .btn-secondary { padding: 6px 14px; font-size: 0.85rem; }
.ma-btn.active { color: var(--accent); }

/* ============ voice call (premium) ============ */
.voice-overlay {
  position: fixed; inset: 0; z-index: 320;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 18%, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(100% 80% at 50% 100%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 60%),
    var(--bg);
  animation: voice-in 0.35s ease both;
}
@keyframes voice-in { from { opacity: 0; } to { opacity: 1; } }
.voice-stage {
  display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px;
  animation: voice-rise 0.45s cubic-bezier(0.2,0.7,0.2,1) both;
}
@keyframes voice-rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* the orb */
.voice-orb { position: relative; width: 220px; height: 220px;
  display: flex; align-items: center; justify-content: center; }
.orb-core {
  position: relative; z-index: 2; width: 116px; height: 116px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%,
    color-mix(in srgb, var(--accent) 78%, white) 0%, var(--accent) 55%,
    color-mix(in srgb, var(--accent) 70%, black) 100%);
  box-shadow: 0 12px 50px -8px var(--accent), inset 0 2px 10px rgba(255,255,255,0.35);
  animation: orb-breathe 4s ease-in-out infinite;
}
.orb-core .icon { width: 52px; height: 52px; color: #fff; stroke-width: 2; }
@keyframes orb-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.orb-ring {
  position: absolute; inset: 0; margin: auto; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
  opacity: 0; transform: scale(0.5);
}
/* idle = gentle slow ripple */
.voice-orb .r1 { animation: orb-ripple 3.6s ease-out infinite; }
.voice-orb .r2 { animation: orb-ripple 3.6s ease-out infinite 1.2s; }
.voice-orb .r3 { animation: orb-ripple 3.6s ease-out infinite 2.4s; }
@keyframes orb-ripple {
  0% { opacity: 0.55; transform: scale(0.52); }
  80% { opacity: 0; transform: scale(1.5); }
  100% { opacity: 0; transform: scale(1.5); }
}
/* listening = faster, fuller ripples + brighter core */
.voice-orb.v-listen .r1, .voice-orb.v-listen .r2, .voice-orb.v-listen .r3 { animation-duration: 2.2s; }
.voice-orb.v-listen .orb-core { animation-duration: 2.2s; box-shadow: 0 14px 60px -6px var(--accent), inset 0 2px 12px rgba(255,255,255,0.45); }
/* thinking = core shimmer + slow rotating gradient feel */
.voice-orb.v-think .orb-core { animation: orb-think 1.1s ease-in-out infinite; }
.voice-orb.v-think .orb-ring { animation-play-state: paused; opacity: 0.2; }
@keyframes orb-think { 0%,100% { transform: scale(0.97); filter: brightness(0.95); } 50% { transform: scale(1.04); filter: brightness(1.15); } }
/* speaking = quick energetic ripples */
.voice-orb.v-speak .r1, .voice-orb.v-speak .r2, .voice-orb.v-speak .r3 { animation-duration: 1.1s; border-width: 2px; }
.voice-orb.v-speak .orb-core { animation: orb-speak 0.5s ease-in-out infinite; }
@keyframes orb-speak { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.voice-status { font-family: var(--font-serif); font-size: 1.7rem; color: var(--text); letter-spacing: -0.01em; }
.voice-last { color: var(--text-dim); font-size: 1rem; max-width: 520px; text-align: center; min-height: 1.4em; font-style: italic; }
.voice-hint { color: var(--text-dim); font-size: 0.82rem; opacity: 0.8; }
.voice-controls { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.voice-voice-wrap {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg-composer) 70%, transparent); backdrop-filter: blur(6px);
}
.voice-voice-wrap .icon { width: 16px; height: 16px; color: var(--text-dim); }
.voice-select { border: none; background: transparent; color: var(--text); font-family: inherit; font-size: 0.9rem; outline: none; }
.voice-end-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 26px -6px var(--danger); transition: transform 0.15s, filter 0.15s;
}
.voice-end-btn .icon { width: 24px; height: 24px; }
.voice-end-btn:hover { transform: scale(1.08); filter: brightness(1.08); }
.ma-btn.speaking { color: var(--accent); animation: orb-speak 1.2s ease-in-out infinite; }

/* the call button in the composer — subtle premium accent */
#btn-wave:hover .icon { color: var(--accent); }
.msg.assistant .msg-body {
  min-width: 0; flex: 1; line-height: 1.65; overflow-wrap: break-word;
  font-family: var(--font-serif); font-size: 1.04rem;
}

.msg-body p { margin: 0 0 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body pre {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; overflow-x: auto; font-size: 0.82rem; line-height: 1.55;
}
/* code block with a header bar + Copy button (terminal commands / snippets) */
.code-wrap { margin: 10px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px 5px 14px; background: var(--bg-raised); border-bottom: 1px solid var(--border);
}
.code-lang { font-size: 0.72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.code-copy {
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-dim);
  border-radius: 7px; padding: 3px 12px; font-size: 0.76rem; cursor: pointer; font-family: inherit;
}
.code-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-wrap pre { margin: 0; border: none; border-radius: 0; }
/* inline code — subtle neutral badge, claude-style */
.msg-body code {
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px; padding: 0.5px 5px;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 0.82em;
}
.msg-body pre code { background: none; color: inherit; padding: 0; border: none; border-radius: 0;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace; }
.msg-body ul, .msg-body ol { margin: 0 0 12px; padding-left: 22px; }
.msg-body h2, .msg-body h3, .msg-body h4 { margin: 16px 0 8px; }
.msg-body blockquote {
  margin: 0 0 12px; padding-left: 14px; border-left: 3px solid var(--accent);
  color: var(--text-dim);
}
.msg-body a { color: var(--accent); }
.msg-error { color: var(--danger); font-size: 0.9rem; font-family: var(--font-ui); }
.stopped-note { color: var(--text-dim); font-size: 0.82rem; font-family: var(--font-ui); font-style: italic; }

/* ricardo.ch marketplace results — 2-column cards with image, price, live auction timer */
.ric-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 10px 0; font-family: var(--font-ui);
}
.ric-card {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-composer); text-decoration: none; color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.ric-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ric-card .rc-img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: var(--bg-raised); display: block;
}
.ric-card .rc-noimg { display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.ric-card .rc-noimg .icon { width: 28px; height: 28px; }
.ric-card .rc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.ric-card .rc-title {
  font-size: 0.86rem; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ric-card .rc-price { font-size: 0.95rem; font-weight: 600; color: var(--accent); }
.ric-card .rc-cond {
  font-size: 0.68rem; font-weight: 500; color: var(--text-dim);
  background: var(--bg-raised); padding: 1px 6px; border-radius: 999px; margin-left: 4px;
}
.ric-card .rc-meta { font-size: 0.76rem; color: var(--text-dim); margin-top: 2px; }
.ric-card .rc-auction .rc-timer { color: var(--text); font-variant-numeric: tabular-nums; }
.ric-card .rc-timer.rc-ended { color: var(--danger); }
.ric-card .rc-buynow { color: #4d8055; font-weight: 500; }
[data-theme="dark"] .ric-card .rc-buynow { color: #7fc98e; }
.ric-card .rc-ship { color: var(--text-dim); font-weight: 500; }
@media (max-width: 620px) { .ric-grid { grid-template-columns: 1fr; } }

/* message action bar (copy / read aloud / retry / speed / sources) */
.msg-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  margin-top: 10px; font-family: var(--font-ui);
}
.msg-actions .ma-btn {
  border: none; background: transparent; color: var(--text-dim);
  cursor: pointer; padding: 6px; border-radius: 8px; display: flex;
}
.msg-actions .ma-btn:hover { background: var(--bg-raised); color: var(--text); }
.msg-actions .ma-btn .icon { width: 16px; height: 16px; }
.msg-actions .ma-speed {
  font-size: 0.76rem; color: var(--text-dim); margin-left: 8px;
  padding: 2px 8px; border-radius: 999px; background: var(--bg-raised);
}
/* sources toggle sits inline with the action buttons; pills drop below when opened */
.msg-actions .sources { margin: 0 4px 0 0; align-self: center; }
.msg-actions .sources[open] { width: 100%; order: 9; margin-top: 8px; }

/* sources shown claude-style: a small "Sources" toggle that expands to pills */
.sources { font-family: var(--font-ui); margin-top: 14px; }
.sources > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  user-select: none; list-style: none; width: fit-content;
  font-size: 0.76rem; color: var(--text-dim);
}
.sources > summary::-webkit-details-marker { display: none; }
.sources > summary:hover { color: var(--text); }
.sources .src-n {
  background: var(--bg-raised); border-radius: 999px;
  padding: 0 6px; font-size: 0.7rem; margin-left: 2px;
}
.sources-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px;
}
.src-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  background: var(--bg-bubble); color: var(--text);
  font-size: 0.74rem; text-decoration: none; max-width: 220px;
}
.src-chip:hover { background: var(--bg-raised); }
.src-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@keyframes blink { 50% { opacity: 0; } }

/* deep search progress bar — a bigger, smoothly moving bar */
.progress-block {
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg-banner); padding: 15px 17px 14px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.progress-block .p-top {
  display: flex; align-items: center; gap: 9px; margin-bottom: 11px;
}
.progress-block .p-spin {
  width: 15px; height: 15px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: pspin .8s linear infinite;
}
@keyframes pspin { to { transform: rotate(360deg); } }
.progress-block .p-title {
  font-weight: 650; font-size: .95rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.progress-block .p-bar {
  height: 8px; border-radius: 999px; position: relative;
  background: var(--bg-raised); overflow: hidden;
}
.progress-block .p-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--accent);
  background-image: linear-gradient(90deg,
    var(--accent) 0%, var(--accent-hover) 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: sheen 1.6s linear infinite;
  transition: none;
}
.progress-block .p-stage {
  margin-top: 9px; font-size: .82rem; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@keyframes sheen { from { background-position: 200% 0; } to { background-position: 0 0; } }

/* custom confirm dialog (replaces the native browser confirm) */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 4000; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.42); opacity: 0; transition: opacity .16s ease;
  backdrop-filter: blur(2px);
}
.confirm-overlay.show { opacity: 1; }
.confirm-card {
  background: var(--bg-elev, var(--bg-banner)); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px 22px 18px; max-width: 380px; width: 100%;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  transform: translateY(8px) scale(.98); transition: transform .16s ease;
}
.confirm-overlay.show .confirm-card { transform: translateY(0) scale(1); }
.confirm-msg { font-size: .98rem; font-weight: 550; color: var(--text); margin-bottom: 18px; line-height: 1.4; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-actions button { font-size: .88rem; padding: 8px 16px; }

/* slash command palette */
.slash-menu {
  background: var(--bg-composer); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 6px; margin: 0 4px 8px;
  box-shadow: var(--shadow-composer); overflow: hidden;
}
.slash-cmd {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 9px 12px; border: none; border-radius: 9px;
  background: transparent; color: var(--text); font-family: inherit;
  cursor: pointer; text-align: left;
}
.slash-cmd.active, .slash-cmd:hover { background: var(--bg-raised); }
.slash-cmd .sc-name {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.9rem; font-weight: 600; color: var(--accent); flex-shrink: 0;
}
.slash-cmd .sc-args {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.78rem; color: var(--text-dim); flex-shrink: 0;
}
.slash-cmd .sc-desc {
  font-size: 0.82rem; color: var(--text-dim); margin-left: auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* collapsible thinking block, like claude.ai */
.thinking {
  font-family: var(--font-ui); font-size: 0.85rem; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-banner);
}
.thinking summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 7px;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary .t-caret { transition: transform 0.15s; font-size: 0.7rem; }
.thinking[open] summary .t-caret { transform: rotate(90deg); }
.thinking .t-body {
  margin-top: 8px; white-space: pre-wrap; line-height: 1.5;
  max-height: 260px; overflow-y: auto;
}
/* playful "thinking" status line (italic serif + pulsing dot), like claude.ai */
.status-line { display: flex; align-items: center; gap: 12px; padding: 2px 0 6px; }
.status-line .status-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  flex-shrink: 0; animation: status-pulse 1.3s ease-in-out infinite;
}
.status-line .status-text {
  font-family: var(--font-serif); font-style: italic; font-size: 0.9rem;
  color: var(--text-dim);
}
.status-line .status-dot { width: 7px; height: 7px; }
@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.tool-line { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.tool-line .icon { width: 13px; height: 13px; color: var(--text-dim); flex-shrink: 0; }
.thinking summary { color: var(--text-dim); }   /* thought summary stays gray, like claude */
.thinking .t-label { transition: opacity 0.2s; }
.thinking.active .t-label { animation: think-fade 1.6s ease-in-out infinite; }
@keyframes think-fade { 50% { opacity: 0.5; } }

/* ============ composer ============ */
.composer-wrap { max-width: 740px; width: 100%; margin: 0 auto; padding: 0 20px 16px; }
.composer {
  background: var(--bg-composer); border: 1px solid var(--border);
  border-radius: 22px; padding: 16px 16px 12px;
  box-shadow: var(--shadow-composer);
}
.composer:focus-within { border-color: var(--border-strong); }
.composer textarea {
  display: block; width: 100%; border: none; background: transparent; resize: none;
  max-height: 240px; margin: 0; padding: 2px 4px 14px; font-size: 1rem;
  box-shadow: none;
}
.composer textarea::placeholder { color: var(--text-dim); }
.composer textarea:focus { box-shadow: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; }
.composer-bar-right { display: flex; align-items: center; gap: 2px; }

.bar-icon {
  width: 34px; height: 34px; border-radius: 9px; border: none;
  background: transparent; color: var(--text-dim);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.bar-icon:hover { background: var(--bg-raised); color: var(--text); }
.bar-icon.recording { color: var(--danger); background: var(--accent-soft); }

.model-picker { position: relative; }
.effort-btn { color: var(--text-dim); }
.effort-btn #effort-btn-label { opacity: 0.85; }
.menu-title {
  padding: 8px 12px 6px; font-size: 0.75rem; color: var(--text-dim);
  font-weight: 500;
}
.effort-menu { min-width: 270px; }
.effort-menu .model-option { align-items: flex-start; padding: 8px 12px; }
.effort-menu .check { margin-top: 2px; }
.opt-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.opt-label { font-size: 0.89rem; }
.opt-desc { font-size: 0.76rem; color: var(--text-dim); line-height: 1.35; }
.menu-divider { height: 1px; background: var(--border); margin: 5px 8px; }
.model-btn {
  display: flex; align-items: center; gap: 5px;
  background: transparent; border: none; border-radius: 8px;
  color: var(--text-dim); font-size: 0.86rem; font-family: inherit;
  padding: 7px 9px; cursor: pointer;
}
.model-btn:hover { background: var(--bg-raised); color: var(--text); }
.model-btn .caret { font-size: 0.8rem; line-height: 0.5; }
.model-menu {
  position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 220px;
  background: var(--bg-composer); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 6px; box-shadow: var(--shadow-composer); z-index: 30;
}
.model-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 9px 11px; border: none; border-radius: 8px;
  background: transparent; color: var(--text); font-family: inherit;
  font-size: 0.88rem; cursor: pointer; text-align: left;
}
.model-option:hover { background: var(--bg-raised); }
.model-option .check { color: var(--accent); visibility: hidden; }
.model-option.selected .check { visibility: visible; }

.btn-send {
  background: var(--accent); color: #fff; border: none; border-radius: 50%;
  width: 34px; height: 34px; cursor: pointer; flex-shrink: 0; margin-left: 4px;
  display: flex; align-items: center; justify-content: center;
}
.btn-send .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.btn-send:hover { background: var(--accent-hover); }
.btn-send:disabled { opacity: 0.45; cursor: default; }
.btn-stop { background: var(--text); }
.btn-stop:hover { background: var(--text-dim); }
.btn-stop .icon { width: 13px; height: 13px; }

/* + menu — compact, claude-style */
.plus-menu { left: 0; right: auto; min-width: 215px; bottom: calc(100% + 8px); padding: 5px; }
.plus-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--text); font-family: inherit;
  font-size: 0.9rem; cursor: pointer; text-align: left;
}
.plus-item:hover { background: var(--bg-raised); }
.plus-item .icon { width: 17px; height: 17px; color: var(--text-dim); }
.plus-item .check { margin-left: auto; color: var(--accent); visibility: hidden; }
.plus-item.active .check { visibility: visible; }
.plus-item.active .icon { color: var(--accent); }
.plus-item.plus-sub { padding-left: 22px; font-size: 0.86rem; }   /* indented quick-toggle */
.plus-item.plus-sub .icon { width: 15px; height: 15px; }
.pm-caret { margin-left: auto; color: var(--text-dim); transition: transform 0.15s; }
.plus-item.open .pm-caret { transform: rotate(180deg); }

/* attachment chips above the composer */
.attach-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px 8px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 5px 10px; font-size: 0.82rem; background: var(--bg-composer);
}
.attach-chip .x { cursor: pointer; color: var(--text-dim); display: flex; }
.attach-chip .x:hover { color: var(--danger); }
.attach-chip .icon { width: 14px; height: 14px; color: var(--text-dim); }
.attach-chip.attach-image img {
  width: 28px; height: 28px; border-radius: 6px; object-fit: cover; display: block;
}
/* drag-and-drop a file/image anywhere on the chat */
.layout.drop-active::after {
  content: "Drop images or files to attach";
  position: fixed; inset: 12px; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 1.3rem; color: var(--accent);
  background: var(--accent-soft); border: 2px dashed var(--accent);
  border-radius: 18px; pointer-events: none;
}
/* images the user attached, shown inside their message bubble */
.msg-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.msg-images img {
  max-width: 260px; max-height: 260px; border-radius: 12px; object-fit: cover;
  border: 1px solid var(--border-strong);
}
/* KaTeX: keep display equations tidy and let long ones scroll instead of overflowing */
.msg-body .katex-display { margin: 0.6em 0; overflow-x: auto; overflow-y: hidden; }
.msg-body .katex { font-size: 1.05em; }

/* skills / styles / connectors list rows */
.row-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 9px;
}
.row-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.row-card .rc-ico { color: var(--text-dim); }
.row-card .rc-main { flex: 1; min-width: 0; }
.row-card .rc-name { font-size: 0.92rem; font-weight: 500; }
.row-card .rc-desc {
  font-size: 0.78rem; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-card .rc-actions { display: flex; gap: 4px; align-items: center; }
.row-card .rc-btn {
  border: none; background: transparent; color: var(--text-dim);
  cursor: pointer; padding: 5px; border-radius: 7px; display: flex;
}
.row-card .rc-btn:hover { background: var(--bg-raised); color: var(--text); }
.row-card .rc-btn .icon { width: 16px; height: 16px; }
.switch {
  position: relative; width: 38px; height: 22px; flex-shrink: 0;
  border-radius: 999px; background: var(--border-strong); cursor: pointer;
  transition: background 0.15s;
}
.switch.on { background: var(--accent); }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 0.15s;
}
.switch.on::after { transform: translateX(16px); }

.composer-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-banner); border-radius: 10px;
  margin: 8px 6px 0; padding: 7px 12px;
  color: var(--text-dim); font-size: 0.8rem;
}
.composer-banner .banner-text { display: flex; align-items: center; gap: 8px; }
.composer-banner .icon { width: 14px; height: 14px; }
.banner-close {
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  padding: 3px; border-radius: 6px; display: flex;
}
.banner-close:hover { color: var(--text); background: var(--bg-raised); }

/* ============ modals ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30, 26, 18, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  width: 560px; max-width: 94vw; max-height: 86vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 18px; padding: 24px 28px; box-shadow: var(--shadow-composer);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; font-family: var(--font-serif); font-weight: 500; }

/* ===== Customize page — fills the content area, app sidebar stays ===== */
.cz-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; background: var(--bg);
}
.cz-side {
  width: 250px; flex-shrink: 0; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); padding: 14px 12px; display: flex; flex-direction: column;
}
.cz-head {
  display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px;
  font-family: var(--font-serif); font-size: 1.15rem; font-weight: 500;
}
.cz-head .btn-icon { padding: 4px; }
.cz-head .icon { width: 18px; height: 18px; }
.cz-nav-list { display: flex; flex-direction: column; gap: 2px; }
.cz-nav {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border: none; border-radius: 9px;
  background: transparent; color: var(--text); font-family: inherit;
  font-size: 0.92rem; cursor: pointer; text-align: left;
}
.cz-nav:hover { background: var(--bg-raised); }
.cz-nav.active { background: var(--bg-raised); }
.cz-nav .icon { width: 17px; height: 17px; color: var(--text-dim); }
.cz-nav.active .icon { color: var(--accent); }

.cz-main { flex: 1; overflow-y: auto; padding: 40px 48px; }

/* ===== Chats page ===== */
.chats-overlay .cz-main { max-width: 780px; margin: 0 auto; padding: 32px 40px; width: 100%; }
.chats-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.chats-head .btn-icon { padding: 5px; }
.chats-head .icon { width: 19px; height: 19px; }
.chats-search {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 8px;
}
.chats-search .icon { width: 18px; height: 18px; color: var(--text-dim); flex-shrink: 0; }
.chats-search input { margin: 0; padding: 0; border: none; background: transparent; font-size: 0.95rem; }
.chats-search input:focus { box-shadow: none; }
.chats-count { font-size: 0.8rem; color: var(--text-dim); padding: 6px 2px 10px; }
.chats-group-label {
  font-size: 0.78rem; font-weight: 600; color: var(--text-dim);
  padding: 16px 4px 8px;
}
.chat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 11px; cursor: pointer;
  border: 1px solid transparent;
}
.chat-row:hover { background: var(--bg-raised); }
.chat-row .cr-main { flex: 1; min-width: 0; }
.chat-row .cr-title {
  font-size: 0.93rem; font-weight: 500; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.chat-row .cr-time { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.chat-row .cr-del {
  visibility: hidden; border: none; background: transparent; color: var(--text-dim);
  cursor: pointer; padding: 6px; border-radius: 8px; display: flex; flex-shrink: 0;
}
.chat-row:hover .cr-del { visibility: visible; }
.chat-row .cr-del:hover { color: var(--danger); background: var(--bg-composer); }
.chat-row .cr-del .icon { width: 16px; height: 16px; }
.chats-empty { text-align: center; color: var(--text-dim); padding: 40px; font-size: 0.9rem; }
.cz-title { margin: 0 0 4px; font-family: var(--font-serif); font-weight: 500; font-size: 1.4rem; }

.cz-hero { text-align: center; margin: 6vh 0 36px; }
.cz-hero-ico {
  width: 64px; height: 64px; fill: none; stroke: var(--text);
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.cz-hero h2 { font-family: var(--font-serif); font-weight: 400; font-size: 1.9rem; margin: 14px 0 8px; }
.cz-hero p { color: var(--text-dim); font-size: 0.95rem; margin: 0; }

.cz-cards { display: flex; flex-direction: column; gap: 12px; max-width: 620px; margin: 0 auto; }
.cz-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-composer); cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow);
}
.cz-card:hover { border-color: var(--border-strong); }
.cz-card-ico {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-raised); color: var(--text);
}
.cz-card-ico .icon { width: 20px; height: 20px; }
.cz-card-title { display: block; font-size: 0.98rem; font-weight: 500; margin-bottom: 3px; }
.cz-card-desc { display: block; font-size: 0.85rem; color: var(--text-dim); }

.modal-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.modal-tab {
  padding: 9px 14px; border: none; background: transparent; cursor: pointer;
  color: var(--text-dim); font-size: 0.88rem; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.theme-row { display: flex; gap: 10px; margin-top: 8px; }
.theme-card {
  flex: 1; padding: 14px 10px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: 12px;
  background: var(--bg-composer); color: var(--text); font-family: inherit; font-size: 0.85rem;
}
.theme-card .swatch {
  display: block; height: 38px; border-radius: 8px; margin-bottom: 8px;
  border: 1px solid var(--border);
}
.theme-card .swatch.light { background: linear-gradient(135deg, #faf9f5 60%, #f0eee6); }
.theme-card .swatch.dark { background: linear-gradient(135deg, #262624 60%, #1f1e1d); }
.theme-card .swatch.system { background: linear-gradient(90deg, #faf9f5 50%, #262624 50%); }
.theme-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.setting-note { color: var(--text-dim); font-size: 0.78rem; margin: 4px 0 16px; line-height: 1.5; }

.modal-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.modal-section:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.modal-section h3 { margin: 0 0 10px; font-size: 0.95rem; }
.modal-msg { border-radius: 10px; padding: 10px 13px; margin: 14px 0 0; font-size: 0.87rem; }
.modal-msg.ok { background: rgba(94, 154, 102, 0.14); border: 1px solid #5e9a66; color: #4d8055; }
[data-theme="dark"] .modal-msg.ok { color: #a9d8b1; }
.modal-msg.err { background: var(--accent-soft); border: 1px solid var(--danger); color: var(--danger); }
.account-line { color: var(--text-dim); font-size: 0.9rem; margin-top: 0; }

/* memory rows in settings */
.mem-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px;
}
.mem-row .mem-text { flex: 1; font-size: 0.86rem; }
.mem-del { border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; flex-shrink: 0; }
.mem-del:hover { color: var(--danger); background: var(--bg-raised); }
.mem-del .icon { width: 14px; height: 14px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--text); color: var(--bg);
  padding: 9px 18px; border-radius: 10px; font-size: 0.87rem;
  opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 80;
  box-shadow: var(--shadow-composer);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- toggle rows (settings) ---------------- */
.toggle-row { display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-weight: 500; margin: 6px 0; }
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent, #c96442);
  flex: 0 0 auto; cursor: pointer; }

/* ---------------- plan-mode indicator ---------------- */
.plan-on #composer-wrap { box-shadow: 0 0 0 2px rgba(201,100,66,.35); border-radius: 16px; }
#plan-indicator { display: flex; align-items: center; gap: 8px; align-self: center;
  margin: 0 0 8px; padding: 5px 14px; font-size: .82rem; font-weight: 600;
  color: var(--accent, #c96442); background: rgba(201,100,66,.10);
  border: 1px solid rgba(201,100,66,.30); border-radius: 999px; }
#plan-indicator kbd { font: inherit; background: rgba(201,100,66,.16); padding: 1px 6px;
  border-radius: 6px; font-weight: 700; }
#plan-indicator .pm-dot { width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent, #c96442); animation: pmPulse 1.6s ease-in-out infinite; }
@keyframes pmPulse { 0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.7); } }
.ask-accept { margin-top: 8px; margin-left: 8px; }

/* ===== Settings — left-nav two-column layout ===== */
#settings-modal { z-index: 60; }
.settings-shell {
  width: 940px; max-width: 95vw; height: 700px; max-height: 90vh;
  display: flex; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-composer);
}
.settings-nav {
  width: 218px; flex: 0 0 auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-banner); border-right: 1px solid var(--border);
}
.settings-nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 12px; font-weight: 700; font-size: 1.05rem;
}
.set-nav {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 12px; border: none; background: none; cursor: pointer; border-radius: 10px;
  color: var(--text); font-size: 0.92rem; font-weight: 500;
}
.set-nav .icon { width: 17px; height: 17px; color: var(--text-dim); }
.set-nav:hover { background: var(--bg-raised); }
.set-nav.active { background: var(--bg-raised); font-weight: 600; }
.set-nav.active .icon { color: var(--accent); }
.settings-main { flex: 1; min-width: 0; overflow-y: auto; padding: 30px 34px 40px; }
.set-pane { max-width: 560px; }
.set-h { margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; }
.set-lead { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 22px; line-height: 1.5; }
.set-sub { margin: 22px 0 12px; font-size: 0.98rem; font-weight: 650; }
.set-pane > .set-sub:first-of-type, .set-pane .modal-section:first-child .set-sub { margin-top: 4px; }
.set-field { display: block; margin: 0 0 18px; font-size: 0.88rem; font-weight: 600; color: var(--text); }
.set-field input[type=text], .set-field input[type=email], .set-field input[type=password],
.set-field input[type=number], .set-field select, .set-field textarea {
  display: block; width: 100%; margin-top: 7px; padding: 10px 12px; font-size: 0.92rem;
  font-weight: 400; border: 1px solid var(--border); border-radius: 11px;
  background: var(--bg-raised); color: var(--text); font-family: inherit;
}
.set-field textarea { resize: vertical; line-height: 1.55; }
.set-field input:focus, .set-field textarea:focus, .set-field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,100,66,.14);
}
.set-advanced { margin: 4px 0 20px; }
.set-advanced summary { cursor: pointer; color: var(--text-dim); font-size: 0.86rem;
  font-weight: 600; padding: 6px 0; user-select: none; }
.set-advanced summary:hover { color: var(--text); }
.set-advanced[open] summary { margin-bottom: 10px; }
@media (max-width: 680px) {
  .settings-shell { flex-direction: column; height: 92vh; width: 96vw; }
  /* nav becomes a compact, height-capped scrollable tab strip so the pane always keeps room */
  .settings-nav { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; max-height: 26vh;
    overflow-y: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 10px; }
  .settings-nav-head { width: 100%; }
  .set-nav { flex: 0 0 auto; white-space: nowrap; padding: 7px 11px; font-size: 0.86rem; }
  .settings-main { padding: 20px 16px 28px; }
  .set-pane { max-width: none; }            /* use the full width on small screens */
  #pane-admin .admin-embed { min-height: 220px; }
}
.settings-shell { position: relative; }
#settings-modal #settings-msg {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 8px 16px; border-radius: 999px; font-size: 0.85rem; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.16); z-index: 5;
}

/* ===== command palette (Cmd/Ctrl+K) ===== */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 4200; display: flex; justify-content: center;
  align-items: flex-start; padding: 12vh 16px 16px; background: rgba(0,0,0,.40);
  opacity: 0; transition: opacity .13s ease; backdrop-filter: blur(2px);
}
.cmdk-overlay.show { opacity: 1; }
.cmdk-box {
  width: 600px; max-width: 100%; background: var(--bg-elev, var(--bg-banner));
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.32);
  transform: translateY(-8px) scale(.985); transition: transform .14s ease;
}
.cmdk-overlay.show .cmdk-box { transform: none; }
.cmdk-inwrap { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.cmdk-ico { width: 18px; height: 18px; color: var(--text-dim); flex: 0 0 auto; }
.cmdk-input { flex: 1; border: none; background: none; outline: none; font-size: 1.02rem;
  color: var(--text); font-family: inherit; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 7px; }
.cmdk-section { padding: 9px 12px 5px; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-dim); }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: none; cursor: pointer; border-radius: 10px;
  color: var(--text); font-size: .94rem; }
.cmdk-item .icon { width: 17px; height: 17px; color: var(--text-dim); flex: 0 0 auto; }
.cmdk-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item.sel { background: var(--bg-raised); }
.cmdk-item.sel .icon { color: var(--accent); }
.cmdk-kbd { font-size: .72rem; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.cmdk-empty { padding: 26px; text-align: center; color: var(--text-dim); font-size: .9rem; }

/* shortcuts cheat-sheet */
.kbd-card { max-width: 420px; }
.kbd-list { margin: 4px 0 16px; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 8px 2px; border-bottom: 1px solid var(--border); }
.kbd-row:last-child { border-bottom: none; }
.kbd-row span { font-size: .9rem; color: var(--text); }
.kbd-row kbd { font: inherit; font-size: .78rem; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 7px; padding: 3px 9px; color: var(--text-dim); white-space: nowrap; }

/* ===== Projects ===== */
.proj-side-actions { padding: 6px 12px 10px; }
.proj-side-actions .btn-primary { width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; }
.proj-side-actions .icon { width: 15px; height: 15px; }
.proj-list { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.proj-card {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: none; cursor: pointer; border-radius: 11px; margin-bottom: 2px;
}
.proj-card:hover { background: var(--bg-raised); }
.proj-card.active { background: var(--bg-raised); }
.proj-card-name { font-weight: 600; font-size: .92rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-card-meta { font-size: .76rem; color: var(--text-dim); }
.proj-empty-list, .proj-files-empty { padding: 18px 12px; color: var(--text-dim); font-size: .85rem; text-align: center; }
.proj-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.proj-name-input {
  flex: 1; min-width: 0; font-size: 1.5rem; font-weight: 700; border: 1px solid transparent;
  background: none; color: var(--text); padding: 5px 9px; border-radius: 10px; font-family: inherit;
}
.proj-name-input:hover { border-color: var(--border); }
.proj-name-input:focus { outline: none; border-color: var(--accent); background: var(--bg-raised); }
.proj-detail-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.proj-del-btn:hover { color: var(--danger); }
.proj-cols { display: grid; grid-template-columns: 1fr 320px; gap: 34px; align-items: start; }
.proj-h { font-size: 1rem; font-weight: 650; margin: 0 0 8px; }
.proj-col textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-raised); color: var(--text); font-family: inherit; font-size: .92rem;
  line-height: 1.55; resize: vertical;
}
.proj-col textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,100,66,.14); }
.proj-files { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.proj-file-row { display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--bg-raised); font-size: .87rem; }
.proj-file-row .icon { width: 16px; height: 16px; color: var(--text-dim); flex: 0 0 auto; }
.pf-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-size { font-size: .74rem; color: var(--text-dim); flex: 0 0 auto; }
.pf-del { border: none; background: none; cursor: pointer; color: var(--text-dim); padding: 2px; line-height: 0; flex: 0 0 auto; }
.pf-del:hover { color: var(--danger); }
.pf-del .icon { width: 14px; height: 14px; }
.proj-add-file { display: flex; gap: 8px; }
.proj-add-file .btn-secondary { display: flex; align-items: center; gap: 6px; font-size: .85rem; padding: 8px 13px; }
.proj-add-file .icon { width: 14px; height: 14px; }
.proj-chats { display: flex; flex-direction: column; gap: 3px; }
.proj-chat-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border: none; background: none; cursor: pointer; border-radius: 10px;
  color: var(--text); font-size: .9rem; }
.proj-chat-row:hover { background: var(--bg-raised); }
.proj-chat-row .icon { width: 15px; height: 15px; color: var(--text-dim); flex: 0 0 auto; }
.proj-chat-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .proj-cols { grid-template-columns: 1fr; gap: 22px; } }

/* uiPrompt dialog */
.up-card { max-width: 460px; }
.up-name, .up-input {
  width: 100%; margin-bottom: 12px; padding: 10px 12px; font-size: .92rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raised); color: var(--text);
}
.up-input { line-height: 1.55; resize: vertical; }
.up-name:focus, .up-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,100,66,.14); }

/* ---- skill cards (in chat) + skills/profiles settings panes ---- */
.skill-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin: 10px 0;
  background: var(--bg-raised); max-width: 520px; }
.sk-head { display: flex; align-items: center; gap: 10px; }
.sk-ico { font-size: 1.4rem; line-height: 1; }
.sk-name { font-weight: 650; flex: 1; overflow-wrap: anywhere; }
.sk-badge { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sk-badge.ok { background: rgba(46,160,67,.14); color: #2ea043; }
.sk-badge.warn { background: var(--accent-soft); color: var(--accent); }
.sk-badge.saved { background: var(--accent-soft); color: var(--accent); }
.sk-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sk-btn { font: inherit; font-size: .84rem; font-weight: 600; padding: 7px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; }
.sk-btn:hover { background: var(--bg-banner); }
.sk-btn.sk-add { background: var(--accent); color: #fff; border-color: var(--accent); }
.sk-btn.sk-add:hover { background: var(--accent-hover); }
.sk-btn:disabled { opacity: .6; cursor: default; }

.set-list-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.profile-edit { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-top: 12px;
  background: var(--bg-raised); }
.rc-emoji { font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
.rc-btn.rc-run { font-size: .9rem; }
.pm-emoji { font-size: 1.05rem; width: 20px; text-align: center; display: inline-block; }
.pm-skill-empty { padding: 8px 14px; font-size: .82rem; color: var(--text-dim); }
.pm-skill-empty code, .set-lead code, .set-h code { background: var(--bg); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 6px; font-size: .86em; }

/* clarifying-question hint (the answer is typed in the message box and sent silently) */
.ask-hint { margin-top: 10px; font-size: .8rem; color: var(--text-dim); }

/* profile image (avatar) */
.avatar-row { display: flex; align-items: center; gap: 16px; margin: 0 0 22px; }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.avatar-prev { width: 72px; height: 72px; border-radius: 50%; flex: 0 0 auto;
  background: var(--bg-raised) center/cover no-repeat; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem; font-weight: 700;
  color: var(--text-dim); overflow: hidden; }
.msg.user { gap: 11px; }
.msg.user .msg-avatar { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; order: 2;
  background: var(--accent-soft) center/cover no-repeat; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; font-weight: 700; color: var(--accent); margin-top: 2px; }

/* voice picker in Settings */
.voice-pick-row { display: flex; gap: 10px; align-items: center; margin: 4px 0 18px; flex-wrap: wrap; }
.voice-pick-select { flex: 1; min-width: 180px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-raised); color: var(--text); font-family: inherit; font-size: .92rem; }
.voice-pick-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,100,66,.14); }
#btn-voice-sample { white-space: nowrap; }

/* log out at the bottom of the settings nav */
.set-nav.set-logout { margin-top: auto; color: var(--danger); }
.set-nav.set-logout .icon { color: var(--danger); }
.set-nav.set-logout:hover { background: var(--accent-soft); }
/* "remember me" on the login form */
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--text-dim);
  margin: -2px 0 6px; cursor: pointer; }
.auth-remember input { width: auto; margin: 0; }

/* bare URLs rendered as short, clickable links */
.msg-body a.pretty-link { color: var(--accent); text-decoration: none; font-weight: 600;
  border-bottom: 1px solid var(--accent-soft); }
.msg-body a.pretty-link:hover { border-bottom-color: var(--accent); }
.msg-body a.pretty-link::after { content: " ↗"; font-size: .82em; opacity: .55; }

/* the /admin dashboard is embedded in the Admin settings pane. The iframe auto-grows to its
   content height (JS sizeAdminFrame), so there's NO inner scrollbar — the Settings pane scrolls
   the whole thing normally (the wheel works everywhere and nothing overlaps). */
#pane-admin { max-width: none; }
.admin-embed { width: 100%; min-height: 300px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg); display: block; }
