/* =========================================================
   AXION AI — Main stylesheet v2.5 (Claude-inspired UI).
   Charcoal/violet palette, centered chat column,
   bot avatar, collapsible "Thought for Ns" blocks, search
   source "balls" bottom-left of AI bubbles. Dual theme.
   ========================================================= */
:root, [data-theme="dark"] {
  --bg: #0B0E14;
  --bg-grad-1: #11151d;
  --bg-grad-2: #0B0E14;
  --panel: rgba(22, 27, 34, 0.92);
  --panel-solid: #161B22;
  --panel-2: #11161d;
  --border: #30363D;
  --border-strong: #424b56;
  --text: #C9D1D9;
  --text-dim: #A3ADB8;
  --text-dim-2: #8B949E;
  --primary: #A371F7;
  --primary-2: #8957E5;
  --primary-hover: #B58AF9;
  --accent-grad: linear-gradient(135deg, #A371F7, #8250DF);
  --user-bg: #202938;
  --bot-bg: transparent;
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --code-bg: #0D1117;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --step-run: #A371F7;
  --ball-1: #A371F7; --ball-2: #60a5fa; --ball-3: #4ade80; --ball-4: #fbbf24; --ball-5: #c084fc; --ball-6: #f472b6;
}
[data-theme="light"] {
  --bg: #F6F8FA;
  --bg-grad-1: #FFFFFF;
  --bg-grad-2: #F6F8FA;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-solid: #FFFFFF;
  --panel-2: #EEF1F5;
  --border: #D8DEE4;
  --border-strong: #AFB8C1;
  --text: #24292F;
  --text-dim: #57606A;
  --text-dim-2: #6E7781;
  --primary: #8250DF;
  --primary-2: #6639BA;
  --primary-hover: #8957E5;
  --accent-grad: linear-gradient(135deg, #A371F7, #8250DF);
  --user-bg: #EAE6F8;
  --bot-bg: transparent;
  --code-bg: #F6F8FA;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  --step-run: #8250DF;
  --ball-1: #8250DF; --ball-2: #2563eb; --ball-3: #16a34a; --ball-4: #d97706; --ball-5: #7c3aed; --ball-6: #db2777;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
/* ---------- Layout: sidebar + main ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 10px;
  gap: 4px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: white; font-size: 13px;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.2px; }
.brand-name span { color: var(--primary); -webkit-text-fill-color: var(--primary); background: none; }
.brand-sub { font-size: 10.5px; color: var(--text-dim-2); margin-top: 1px; }
.new-chat-side { margin: 2px 6px 8px; justify-content: center; background: var(--panel-solid); border: 1px solid var(--border-strong); color: var(--text); }
.new-chat-side:hover { background: var(--panel-2); color: var(--primary); border-color: var(--primary); transform: none; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.nav-link:hover { background: var(--panel-solid); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--panel-solid); color: var(--text); font-weight: 600; }
.nav-link .nav-icon { width: 18px; text-align: center; opacity: 0.9; font-size: 14px; }
.history-section { margin-top: 14px; flex: 1; overflow-y: auto; min-height: 0; }
.history-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim-2); padding: 6px 12px; }
.history-label::after { content: " · long-press to delete"; font-size: 9px; font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 4px; }
.history-list { display: flex; flex-direction: column; gap: 1px; }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text-dim);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.history-item:hover { background: var(--panel-solid); color: var(--text); }
.history-item.active { background: var(--panel-solid); color: var(--text); font-weight: 500; }
.history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.history-close { opacity: 0; font-size: 16px; line-height: 1; padding: 0 4px; color: var(--text-dim-2); }
.history-item:hover .history-close { opacity: 0.7; }
.history-close:hover { color: var(--danger) !important; opacity: 1 !important; }
.sidebar-footer { padding: 10px; font-size: 11px; color: var(--text-dim-2); line-height: 1.5; }
.sidebar-footer .privacy-badge { display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(74, 222, 128, 0.12); color: var(--success); font-weight: 600; font-size: 10px; }
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
}
.menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.topbar-title { font-weight: 600; font-size: 14px; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 6px var(--success); }
select, input[type="text"], input[type="password"], input[type="number"], textarea {
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text); font-size: 13px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.18); }
select { cursor: pointer; max-width: 220px; font-size: 12.5px; }
.btn {
  padding: 8px 14px; border-radius: 10px; border: none;
  background: var(--primary); color: white;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-solid); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: var(--danger); }
.icon-btn { background: none; border: 1px solid var(--border); color: var(--text-dim); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.temp-btn.active { border-color: var(--warn); color: var(--warn); background: rgba(251, 191, 36, 0.1); }
.temp-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(251, 191, 36, 0.12); color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.35);
  margin-left: 6px; vertical-align: middle;
}
/* ---------- Chat area (centered column, Claude-style) ---------- */
.chat-area { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.chat {
  flex: 1; overflow-y: auto;
  padding: 28px 20px 12px;
  display: flex; flex-direction: column; gap: 22px;
  scroll-behavior: smooth;
  align-items: center;
}
.chat > * { width: 100%; max-width: 760px; }
.chat::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.welcome { max-width: 620px; margin: 6vh auto 0; text-align: center; padding: 30px 20px; }
.welcome h2 { font-size: 24px; margin-bottom: 14px; font-weight: 700; color: var(--text); }
.welcome p { color: var(--text-dim); line-height: 1.7; font-size: 14px; margin-bottom: 10px; }
.welcome-hint { font-size: 12px !important; color: var(--text-dim-2) !important; margin-top: 16px; }
.welcome-temp { color: var(--warn) !important; font-size: 13px !important; font-weight: 600; margin-top: 14px; }
/* ---------- Messages ---------- */
.msg { line-height: 1.65; font-size: 14.5px; word-wrap: break-word; animation: msgIn .25s ease; position: relative; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-user {
  align-self: flex-end; max-width: 78%; width: auto; margin-left: auto;
  background: var(--user-bg); color: var(--text);
  padding: 11px 16px; border-radius: 18px; border-bottom-right-radius: 6px;
  white-space: pre-wrap;
}
.msg-user .msg-text { white-space: pre-wrap; }
.msg-bot {
  align-self: flex-start; max-width: 100%;
  display: flex; gap: 12px; align-items: flex-start;
  background: transparent; border: none; padding: 0;
}
.bot-avatar {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: var(--accent-grad); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.3px;
  margin-top: 2px;
}
.bot-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.msg-error { align-self: center; background: rgba(248, 113, 113, 0.1); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.3); font-size: 13px; max-width: 90%; padding: 10px 14px; border-radius: 10px; }
/* Markdown */
.md p { margin: 0 0 .7em; } .md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 .4em; line-height: 1.3; font-weight: 700; }
.md h1 { font-size: 1.4em; } .md h2 { font-size: 1.22em; } .md h3 { font-size: 1.08em; }
.md ul, .md ol { padding-left: 1.4em; margin: 0 0 .7em; } .md li { margin: .2em 0; }
.md code:not(pre code) { background: var(--code-bg); padding: 2px 6px; border-radius: 5px; font-size: .88em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--primary); border: 1px solid var(--border); }
.md pre { background: var(--code-bg); padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: .7em 0; border: 1px solid var(--border); }
.md pre code { font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.md blockquote { border-left: 3px solid var(--primary); padding-left: 12px; color: var(--text-dim); margin: .7em 0; }
.md table { border-collapse: collapse; margin: .7em 0; } .md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
/* ---------- Agent timeline: thinking + steps (Claude-style) ---------- */
.agent-timeline { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.tl-step, .tl-thinking { border-radius: 8px; overflow: hidden; }
.tl-step summary, .tl-thinking summary {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; cursor: pointer; font-size: 12.5px;
  list-style: none; user-select: none; border-radius: 8px;
  color: var(--text-dim); width: fit-content; max-width: 100%;
}
.tl-step summary::-webkit-details-marker, .tl-thinking summary::-webkit-details-marker { display: none; }
.tl-step summary:hover, .tl-thinking summary:hover { background: var(--panel-2); }
.tl-bullet { color: var(--text-dim-2); font-size: 11px; width: 12px; text-align: center; flex-shrink: 0; }
.tl-thinking .tl-bullet { color: var(--primary); }
.tl-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tl-status.running { background: var(--step-run); box-shadow: 0 0 6px var(--step-run); animation: pulse 1.2s infinite; }
.tl-status.done { background: var(--success); }
.tl-status.error { background: var(--danger); }
.tl-status.stopped { background: var(--warn); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.tl-label { font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.tl-thinking .tl-label { color: var(--primary); }
.tl-duration { color: var(--text-dim-2); font-weight: 400; font-size: 11.5px; white-space: nowrap; }
.tl-detail { color: var(--text-dim-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; font-size: 11.5px; }
.tl-body { padding: 6px 10px 10px 28px; font-size: 12px; color: var(--text-dim); font-family: ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; line-height: 1.55; }
.tl-thinking.tl-done summary { opacity: 0.85; }
.tl-thinking.tl-done .tl-label::after { content: ""; }
.stopped-note { margin-top: 10px; font-size: 12px; color: var(--warn); font-weight: 600; padding: 6px 10px; background: rgba(251, 191, 36, 0.08); border-radius: 8px; border: 1px solid rgba(251, 191, 36, 0.25); width: fit-content; }
/* ---------- Search source "balls" (bottom-left of AI bubble) ---------- */
.search-balls {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 8px; cursor: pointer; padding: 4px 6px;
  border-radius: 999px; width: fit-content;
  transition: background .15s;
}
.search-balls:hover { background: var(--panel-2); }
.search-ball {
  display: inline-flex; align-items: center; max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 22px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 10px; line-height: 1.2; color: var(--text-dim); background: var(--panel-solid);
  animation: ballIn .3s ease backwards;
}
.search-ball:nth-child(1) { border-color: var(--ball-1); }
.search-ball:nth-child(2) { border-color: var(--ball-2); }
.search-ball:nth-child(3) { border-color: var(--ball-3); }
.search-ball:nth-child(4) { border-color: var(--ball-4); }
.search-ball:nth-child(5) { border-color: var(--ball-5); }
.search-ball:nth-child(6) { border-color: var(--ball-6); }
@keyframes ballIn { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
.search-ball-more { font-size: 10.5px; font-weight: 700; color: var(--text-dim-2); padding-left: 2px; }
.src-popover {
  position: fixed; z-index: 350; width: 320px; max-width: 90vw;
  max-height: 380px; overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow); padding: 8px;
  animation: ctxIn .12s ease;
}
.src-pop-title { font-size: 12px; font-weight: 700; color: var(--text-dim-2); text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 8px 8px; }
.src-pop-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.src-pop-item:hover { background: var(--panel-2); text-decoration: none; }
.src-pop-host { font-size: 11px; color: var(--primary); font-weight: 600; }
.src-pop-t { font-size: 12.5px; color: var(--text-dim); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* ---------- Artifact cards ---------- */
.artifact-card { display: flex; align-items: center; gap: 12px; background: var(--code-bg); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; margin: 10px 0; transition: border-color .15s; }
.artifact-card:hover { border-color: var(--primary); }
.artifact-card.is-zip { border-style: dashed; border-color: var(--warn); cursor: pointer; }
.artifact-icon { width: 40px; height: 40px; border-radius: 9px; background: var(--accent-grad); color: white; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; letter-spacing: 0.5px; }
.artifact-info { flex: 1; min-width: 0; }
.artifact-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-meta { font-size: 11.5px; color: var(--text-dim-2); margin-top: 2px; }
.artifact-actions { display: flex; gap: 6px; flex-shrink: 0; }
.image-wrap { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.image-wrap img { max-width: 100%; max-height: 320px; border-radius: 10px; border: 1px solid var(--border); }
.audio-note { font-size: 12px; color: var(--success); margin: 8px 0 4px; font-weight: 600; }
audio { width: 100%; margin-top: 4px; border-radius: 8px; }
/* Artifact panel */
.artifact-panel { width: 46%; max-width: 720px; min-width: 300px; background: var(--panel-solid); border-left: 1px solid var(--border); display: none; flex-direction: column; overflow: hidden; }
.artifact-panel.open { display: flex; }
.artifact-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.artifact-header .name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-body { flex: 1; overflow: auto; min-height: 0; background: var(--code-bg); }
.artifact-body iframe { width: 100%; height: 100%; border: none; background: white; min-height: 400px; }
.artifact-body pre { padding: 16px; font-size: 13px; font-family: ui-monospace, Menlo, monospace; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
/* ---------- Input area (Claude-style composer) ---------- */
.input-zone { border-top: 1px solid var(--border); background: var(--bg); padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.input-zone > * { width: 100%; max-width: 100%; }
.file-preview { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--panel-solid); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-dim); }
.chip-rm { cursor: pointer; color: var(--danger); font-weight: 700; }
.thinking-controls { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.thinking-controls label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.thinking-levels { display: flex; gap: 4px; }
.thinking-levels button { padding: 4px 11px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel-solid); color: var(--text-dim); font-size: 11.5px; cursor: pointer; font-family: inherit; transition: all .15s; }
.thinking-levels button.active { background: var(--primary); color: white; border-color: var(--primary); }
.input-row { display: flex; gap: 8px; align-items: flex-end; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 18px; padding: 6px 8px 6px 6px; transition: border-color .15s, box-shadow .15s; }
.input-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.12); }
.input-row textarea { flex: 1; resize: none; padding: 10px 8px; border-radius: 12px; max-height: 160px; min-height: 24px; line-height: 1.45; border: none; background: transparent; font-size: 14.5px; }
.input-row textarea:focus { box-shadow: none; border: none; }
.input-row .icon-btn { width: 34px; height: 34px; border: none; border-radius: 10px; flex-shrink: 0; }
.send-btn { height: 36px; padding: 0 18px; border-radius: 12px; font-size: 13.5px; flex-shrink: 0; }
.stop-btn { height: 36px; padding: 0 16px; border-radius: 12px; background: var(--danger); display: none; flex-shrink: 0; font-size: 13px; }
.enter-hint { font-size: 11px; color: var(--text-dim-2); text-align: center; padding-top: 7px; }
/* ---------- Message actions (copy / edit on hover) ---------- */
.msg-actions { position: absolute; top: -10px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.msg-user:hover .msg-actions, .msg-bot:hover .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 0.55; } }
.msg-action { background: none; border: none; color: var(--text-dim); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.msg-action:hover { background: var(--panel-2); color: var(--primary); }
.msg-files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.msg-file-chip { font-size: 11px; background: rgba(255,255,255,0.12); padding: 2px 8px; border-radius: 999px; }
.bot-footer { display: flex; gap: 6px; margin-top: 6px; }
.bot-footer .btn { font-size: 11.5px; padding: 4px 10px; opacity: 0.7; background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.bot-footer .btn:hover { opacity: 1; color: var(--primary); border-color: var(--primary); background: transparent; transform: none; }
/* Edit message inline */
.edit-textarea { width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--primary); background: var(--panel-solid); color: var(--text); font-family: inherit; font-size: 14px; resize: vertical; line-height: 1.5; }
.edit-bar { display: flex; gap: 6px; margin-top: 8px; }
/* ---------- Long-press context menu / select mode / modal / toast ---------- */
html, body { overscroll-behavior-x: none; }
@media (hover: none) and (pointer: coarse) {
  .msg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .msg.sel-mode, .msg.sel-mode * { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
}
.msg.sel-mode { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.msg.sel-mode ::selection { background: rgba(163, 113, 247, 0.35); }
.ctx-menu {
  position: fixed; z-index: 200; display: flex; gap: 2px; padding: 4px;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow);
  animation: ctxIn .12s ease;
}
@keyframes ctxIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.ctx-item {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px;
  background: transparent; border: none; border-radius: 9px; color: var(--text);
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.ctx-item:hover, .ctx-item:active { background: rgba(163, 113, 247, 0.12); color: var(--primary); }
.ctx-icon { opacity: .85; }
.axion-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 10px);
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--border-strong);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 300; opacity: 0; transition: opacity .2s, transform .2s;
  max-width: 90vw; text-align: center; pointer-events: none;
}
.axion-toast.show { opacity: 1; transform: translate(-50%, 0); }
.axion-modal-wrap { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.axion-modal { width: 100%; max-width: 440px; background: var(--panel-solid); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); max-height: 85vh; overflow-y: auto; }
.axion-modal h3 { font-size: 15px; margin-bottom: 8px; }
.axion-modal-msg { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; word-break: break-word; }
.axion-modal-detail { margin-top: 10px; padding: 9px 11px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; font-size: 11.5px; max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: var(--text-dim); }
.axion-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
/* Workspace modal */
.ws-modal { max-width: 560px; }
.ws-list { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.ws-empty { font-size: 13px; color: var(--text-dim); padding: 16px 8px; text-align: center; }
.ws-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ws-row:hover { background: var(--panel-2); }
.ws-path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-size { font-size: 11px; color: var(--text-dim-2); flex-shrink: 0; }
.ws-preview { margin-top: 10px; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-family: ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; color: var(--text-dim); }
/* Sidebar backdrop + swipe (mobile) */
.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s; z-index: 30; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .chat { padding: 20px 14px 10px; gap: 18px; }
  .msg-user { max-width: 88%; }
  .topbar select { max-width: 130px; }
  .topbar .btn-ghost { display: none; }
}
/* ---------- Settings / content pages ---------- */
.page-scroll { flex: 1; overflow-y: auto; padding: 28px 32px; }
.page-container { max-width: 820px; margin: 0 auto; }
.page-container h1 { font-size: 24px; margin-bottom: 6px; font-weight: 700; }
.page-container .lead { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; line-height: 1.6; }
.settings-section { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.settings-section h2 { font-size: 15px; margin-bottom: 14px; font-weight: 700; }
.settings-row { margin-bottom: 14px; }
.settings-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
.settings-inputs { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-inputs input { flex: 1; min-width: 160px; }
.settings-desc { font-size: 11.5px; color: var(--text-dim-2); margin-top: 5px; line-height: 1.5; }
.permission-note { font-size: 12px; margin-top: 6px; padding: 8px 10px; border-radius: 8px; }
.permission-note.risk-safe { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.permission-note.risk-medium { background: rgba(251, 191, 36, 0.1); color: var(--warn); }
.permission-note.risk-high { background: rgba(248, 113, 113, 0.1); color: var(--danger); }
.test-results { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.test-row { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; flex-wrap: wrap; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.test-row.ok > span:first-child { color: var(--success); font-weight: 800; }
.test-row.fail > span:first-child { color: var(--danger); font-weight: 800; }
.test-row em { color: var(--text-dim-2); font-style: normal; font-size: 11px; }
.test-info { color: var(--text-dim); font-size: 11.5px; word-break: break-word; flex-basis: 100%; }
.saved-note { color: var(--success); font-weight: 600; font-size: 13px; opacity: 0; transition: opacity .3s; margin-left: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-size: 13px; color: var(--text); font-weight: 500; }
/* =========================================================
   v2.6 — Claude-style composer + SVG icons
   ========================================================= */
.ic { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.ic svg { display: block; }
.topbar-spacer { flex: 1; }
.link-btn { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; padding: 4px 0; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.link-btn:hover { color: var(--primary); }
.sidebar-footer .link-btn { margin-bottom: 6px; }
/* Empty-state greeting (clean, like Claude) */
.welcome { margin: 10vh auto 0; text-align: center; padding: 20px; }
.welcome-logo {
  width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 16px;
  background: var(--accent-grad); color: white; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 0.5px;
  box-shadow: 0 8px 24px rgba(163, 113, 247, 0.35);
}
.welcome h2 { font-size: 22px; font-weight: 600; color: var(--text); margin: 0; }
.welcome p { display: none; }
.welcome .welcome-temp { display: block; color: var(--warn); font-size: 13px; margin-top: 14px; font-weight: 600; }
/* Composer pill */
.composer {
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 8px 10px 8px 8px;
  transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 6px;
}
.composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.12); }
.composer textarea {
  width: 100%; resize: none; border: none; background: transparent;
  padding: 6px 10px 2px; font-size: 15px; line-height: 1.5; color: var(--text);
  font-family: inherit; max-height: 160px; min-height: 24px;
}
.composer textarea:focus { outline: none; box-shadow: none; border: none; }
.composer-bar { display: flex; align-items: center; gap: 6px; position: relative; }
.composer-spacer { flex: 1; }
.icon-circle {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: transparent; color: var(--text-dim); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.icon-circle:hover { background: var(--panel-2); color: var(--primary); }
.model-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-dim); font-size: 12.5px; font-weight: 600;
  cursor: pointer; font-family: inherit; max-width: 200px; flex-shrink: 0;
  transition: all .15s;
}
.model-pill:hover { border-color: var(--primary); color: var(--primary); }
.model-pill #modelPillLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.model-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.model-popover {
  position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 50;
  width: 300px; max-width: 85vw;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  animation: ctxIn .12s ease;
}
.model-popover.hidden { display: none; }
.mp-row { display: flex; flex-direction: column; gap: 4px; }
.mp-row label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim-2); }
.mp-row select { width: 100%; }
/* Circular send / stop buttons (right of composer) */
.send-circle {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--primary); color: white; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.send-circle:hover { background: var(--primary-hover); transform: scale(1.05); }
.send-circle.hidden { display: none; }
.stop-circle {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--danger); color: white; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
  animation: pulse 1.4s infinite;
}
.stop-circle:hover { transform: scale(1.05); }
.stop-circle.hidden { display: none; }
/* Hide old input-row elements if present (v2.5 layout replaced) */
.input-row { display: none; }
.thinking-controls { display: none; }
@media (max-width: 900px) {
  .model-pill { max-width: 130px; }
  .model-pill #modelPillLabel { max-width: 80px; }
}
/* =========================================================
   v2.8 — UI overlap fixes + edit/thinking polish
   ========================================================= */
.edited-badge { font-size: 10.5px; color: var(--text-dim-2); font-style: italic; margin-left: 6px; opacity: 0.8; }
.msg-system { text-align: center; font-size: 12px; color: var(--text-dim-2); padding: 2px 0; font-style: italic; }
.model-popover { max-height: 70vh; overflow-y: auto; }
.topbar { flex-wrap: nowrap; }
.topbar .icon-btn { flex-shrink: 0; }
/* On touch devices, hover copy/edit chips are hidden (long-press menu provides them) → no overlap */
@media (hover: none) {
  .msg-actions { display: none !important; }
}
.tl-detail { max-width: 42vw; }
@media (min-width: 700px) { .tl-detail { max-width: 260px; } }
/* Artifact panel: on small screens it becomes a full overlay (would crush the 46% chat column otherwise) */
.chat-area { position: relative; }
@media (max-width: 900px) {
  .artifact-panel {
    position: absolute; inset: 0; z-index: 60;
    width: 100%; max-width: none; min-width: 0;
    border-left: none; box-shadow: var(--shadow);
  }
  .composer textarea { max-height: 120px; }
  .composer { padding: 6px 8px 6px 6px; }
  .input-zone { padding: 8px 10px 10px; }
}
/* Edit textarea: match composer styling, never overflows the bubble */
.edit-textarea { width: 100%; box-sizing: border-box; }
.edit-bar { flex-wrap: wrap; }
/* Ensure the composer bar never wraps the send button off-screen */
.composer-bar { flex-wrap: nowrap; min-width: 0; }
.model-pill { overflow: hidden; }
/* Thinking block: subtle left accent, readable body */
.tl-thinking { border-left: 2px solid var(--primary); padding-left: 6px; }
.tl-body { max-width: 100%; }
/* Stop note + error messages never overlap content */
.stopped-note, .msg-error { max-width: 100%; box-sizing: border-box; }

/* AXION AI update — attachment cards, revision state, token estimates and command Canvas. */
.token-counter { font-size: 10.5px; color: var(--text-dim-2); text-align: right; padding: 2px 4px 6px; font-variant-numeric: tabular-nums; }
.token-counter.token-warning { color: var(--danger); font-weight: 700; }
.file-preview { display: flex; flex-wrap: nowrap; gap: 8px; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 9px; scrollbar-width: thin; }
.composer-attachment-card, .msg-attachment-card { box-sizing: border-box; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 9px; flex: 0 0 150px; width:150px; min-width:150px; max-width:150px; height:100px; min-height:0; aspect-ratio: 3 / 2; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--panel-solid); color: var(--text); overflow: hidden; }
.composer-attachment-card { position: relative; }
.composer-attachment-card .attachment-file-icon, .msg-attachment-card .attachment-file-icon { align-self: center; flex-basis: 38px; width: 38px; height: 42px; margin: 0; }
.composer-attachment-card .chip-rm, .msg-attachment-card .attachment-download { position: absolute; top: 5px; right: 5px; }
.composer-attachment-card .attachment-file-name, .msg-attachment-card .attachment-file-name { flex: 1 1 auto; width:auto; text-align:left; margin:0; padding-right:9px; }
.msg-attachment-cards { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; margin: 9px 0 2px; padding: 2px 1px 8px; scrollbar-width: thin; }
.msg-attachment-card { flex: 0 0 150px; background: var(--panel-2); }
.attachment-file-icon { display: inline-flex; flex: 0 0 38px; width: 38px; height: 42px; align-items: center; justify-content: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-grad-1); color: var(--primary); font-size: 10px; font-weight: 750; letter-spacing: .3px; }
.attachment-file-name { min-width: 0; flex: 1; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; font-size: 12px; line-height: 1.35; }
.attachment-download, .composer-attachment-card .chip-rm { border: 0; background: transparent; color: var(--text-dim); border-radius: 6px; font: inherit; cursor: pointer; padding: 3px 6px; flex: 0 0 auto; }
.attachment-download:hover, .composer-attachment-card .chip-rm:hover { color: var(--primary); background: var(--panel); }
.revision-control { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--text-dim-2); font-size: 11px; width: max-content; max-width: 100%; }
.revision-arrow { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; border-radius: 7px; border: 1px solid var(--border); color: var(--text-dim); background: var(--panel-solid); cursor: pointer; font-size: 16px; line-height: 1; }
.revision-arrow:disabled { opacity: .35; cursor: default; }
.revision-count { font-variant-numeric: tabular-nums; }
.token-usage { color: var(--text-dim-2); font-size: 10.5px; margin-top: 7px; }
.step-by-step { margin: 0 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 3px; }
.step-by-step > summary { list-style: none; cursor: pointer; color: var(--text-dim-2); font-size: 11.5px; padding: 4px 0 8px; user-select: none; }
.step-by-step > summary::-webkit-details-marker { display: none; }
.step-by-step > summary::before { content: '›'; display: inline-block; margin-right: 7px; transition: transform .15s; }
.step-by-step[open] > summary::before { transform: rotate(90deg); }
.step-by-step .agent-timeline { padding-left: 1px; }
.canvas-card { border: 1px solid var(--border-strong); border-radius: 14px; background: var(--panel-solid); margin: 14px 0; overflow: hidden; }
.canvas-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.canvas-actions { display: flex; gap: 5px; }
.canvas-content { display: block; box-sizing: border-box; padding: 12px; margin: 0; max-height: 60vh; overflow: auto; white-space: pre; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }
.canvas-card.canvas-expanded .canvas-content { max-height: none; }
.attach-source-modal { display: flex; flex-direction: column; gap: 9px; }
.attach-source-modal h3 { margin-bottom: 3px; }
.attach-source-modal button { text-align: left; justify-content: flex-start; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.library-card { min-width: 0; border: 1px solid var(--border); border-radius: 14px; padding: 13px; background: var(--panel-solid); display: flex; flex-direction: column; gap: 8px; }
.library-file-icon { width: 43px; height: 43px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: 11px; }
.library-file-name { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.library-file-meta, .library-file-path { color: var(--text-dim-2); font-size: 11px; overflow-wrap: anywhere; }
.library-file-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 5px; }
.library-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 15px 0 6px; }
.library-toolbar input { flex: 1; min-width: 160px; }
.library-picker-list { max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.library-picker-row { display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--border); padding: 9px 2px; font-size: 12px; }
.library-picker-row input { width: auto; }
.empty-library { padding: 25px 12px; text-align: center; color: var(--text-dim); border: 1px dashed var(--border-strong); border-radius: 14px; margin-top: 14px; }
.empty-library h2 { font-size: 16px; margin-bottom: 6px; }
.hidden { display: none !important; }
@media (max-width: 640px) {
  .composer-attachment-card, .msg-attachment-card { flex-basis: 138px; width:138px; min-width:138px; max-width:138px; height:92px; min-height:0; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .canvas-head { align-items: flex-start; }
}

.library-preview-modal { max-width: 900px; width: min(900px, 100%); }
.library-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.library-preview-head h3 { overflow-wrap: anywhere; margin: 0; }
.library-preview-image { display: block; max-width: 100%; max-height: 68vh; margin: 0 auto; object-fit: contain; }
.library-preview-media { display: block; width: 100%; max-height: 68vh; }
.library-preview-pdf { width: 100%; height: 70vh; border: 0; background: white; }
.library-preview-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 68vh; overflow: auto; margin: 0; padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--code-bg); color: var(--text); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Revision 3 — settings reference design, restrained violet accent and generous spacing. */
.page-container { max-width: 900px; }
.page-container h1 { letter-spacing: -0.025em; }
.page-container .lead { max-width: 760px; line-height: 1.7; }
.settings-section { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 16px; padding: 22px 22px 10px; margin: 0 0 20px; box-shadow: 0 8px 22px rgba(0,0,0,.06); }
.settings-section h2 { display:flex; align-items:center; gap:10px; font-size:15px; margin:0 -2px 18px; padding-bottom:14px; border-bottom:1px solid var(--border); }
.settings-section h2 .ic { color:var(--primary); }
.settings-row { padding: 0 0 15px; margin-bottom: 15px; border-bottom:1px solid color-mix(in srgb, var(--border) 65%, transparent); }
.settings-row:last-child { border-bottom:0; margin-bottom:0; }
.settings-row label { color:var(--text); font-size:13px; font-weight:600; margin-bottom:7px; }
.settings-desc { font-size:12px; line-height:1.65; }
.settings-section input:not([type=checkbox]), .settings-section textarea, .settings-section select { max-width:100%; }
.settings-section select { min-height:38px; }
.settings-section input[type=checkbox] { accent-color:var(--primary); }
.form-actions { display:flex; gap:14px; align-items:center; padding:18px 0 36px; position:sticky; bottom:0; background:linear-gradient(transparent, var(--bg) 35%); }
.workspace-choice-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:0 0 18px; }
.workspace-choice { padding:14px; border:1px solid var(--border-strong); border-radius:12px; background:var(--panel-2); display:flex; align-items:center; justify-content:space-between; gap:10px; }
.workspace-choice.active { border-color:var(--primary); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--primary) 24%,transparent); }
.workspace-choice small { display:block; color:var(--text-dim-2); margin-top:4px; line-height:1.4; }
.coming-soon { display:inline-flex; padding:3px 8px; border-radius:999px; background:color-mix(in srgb,var(--primary) 14%,transparent); color:var(--primary); font-size:10px; font-weight:700; white-space:nowrap; }
/* Native file previews are documents only; the file itself always remains downloadable. */
.library-picker { width:min(900px,96vw); max-width:900px; height:min(88vh,900px); max-height:92vh; display:flex; flex-direction:column; }
.library-picker-list { flex:1; min-height:0; max-height:none; overflow:auto; }
.library-preview-wrap { padding:0; }
.library-preview-modal { max-width:none; width:100vw; height:100vh; height:100dvh; max-height:none; border:0; border-radius:0; padding:16px; display:flex; flex-direction:column; overflow:hidden; }
.library-preview-modal > :not(.library-preview-head) { min-height:0; }
.library-preview-modal .library-preview-text { flex:1; max-height:none; }
.library-preview-modal .library-preview-pdf { flex:1; height:auto; max-height:none; }
.ai-output-file-card { display:flex; width:100%; max-width:100%; border-left:3px solid var(--primary); background:color-mix(in srgb,var(--primary) 5%,var(--panel-solid)); }
.msg-user-stack { align-self:flex-end; width:auto; max-width:88%; display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
.msg-user-stack .msg-user { max-width:100%; width:auto; margin:0; }
.msg-user-stack .msg-attachment-cards { justify-content:flex-end; margin-top:0; }
.msg-user-stack .msg-attachment-card { background:var(--panel-solid); }
.bot-avatar { background:transparent; border:1px solid color-mix(in srgb,var(--primary) 38%,var(--border)); border-radius:50%; color:var(--primary); overflow:visible; }
.neural-indicator { display:block; width:22px; height:22px; position:relative; }
.neural-indicator svg { width:100%; height:100%; overflow:visible; }
.neural-indicator .neural-node { fill:var(--primary); transform-origin:center; animation:neuralPulse 2.2s ease-in-out infinite; }
.neural-indicator .neural-node:nth-child(2n) { animation-delay:.35s; }
.neural-indicator .neural-edge { stroke:var(--primary); stroke-width:1; opacity:.62; }
@keyframes neuralPulse { 0%,100% { opacity:.58; transform:scale(.85); } 50% { opacity:1; transform:scale(1.12); } }
.quick-scroll-controls { display:flex; justify-content:flex-end; gap:6px; min-height:0; }
.quick-scroll-btn { width:30px; height:30px; display:inline-flex; align-items:center; justify-content:center; border-radius:9px; border:1px solid var(--border); color:var(--text-dim); background:var(--panel-solid); cursor:pointer; }
.quick-scroll-btn:hover { color:var(--primary); border-color:var(--primary); }
.axion-fullscreen-viewer { position:fixed; inset:0; z-index:600; background:var(--bg); display:flex; flex-direction:column; padding:clamp(10px,2vw,24px); }
.axion-fullscreen-viewer .viewer-header { display:flex; align-items:center; gap:12px; padding:8px 0 14px; border-bottom:1px solid var(--border); }
.axion-fullscreen-viewer .viewer-title { flex:1; min-width:0; font-weight:650; overflow-wrap:anywhere; }
.axion-fullscreen-viewer .viewer-content { flex:1; min-height:0; overflow:auto; white-space:pre; overflow-wrap:normal; padding:18px 4px; font:13px/1.65 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
.axion-fullscreen-viewer .viewer-close { flex:0 0 auto; }
.library-top-menu { position:relative; }
.library-menu-pop { position:absolute; top:42px; right:0; z-index:100; width:210px; padding:6px; background:var(--panel-solid); border:1px solid var(--border-strong); border-radius:12px; box-shadow:var(--shadow); }
.library-menu-pop button { width:100%; text-align:left; padding:10px; border:0; background:transparent; color:var(--text); border-radius:8px; cursor:pointer; }
.library-menu-pop button:hover { background:var(--panel-2); }
.library-selection-toolbar { position:sticky; bottom:0; z-index:20; display:flex; align-items:center; justify-content:center; gap:8px; flex-wrap:wrap; padding:12px; margin:20px -12px -12px; border:1px solid var(--border); border-radius:14px 14px 0 0; background:var(--panel-solid); box-shadow:0 -10px 30px rgba(0,0,0,.16); }
.library-selectbox { position:absolute; top:10px; left:10px; z-index:2; width:18px; height:18px; accent-color:var(--primary); }
.library-card { position:relative; }
.library-card.is-selected { border-color:var(--primary); box-shadow:0 0 0 1px var(--primary); }
.history-menu { position:fixed; z-index:700; min-width:190px; padding:6px; border-radius:11px; background:var(--panel-solid); border:1px solid var(--border-strong); box-shadow:var(--shadow); }
.history-menu button { display:block; width:100%; text-align:left; border:0; background:transparent; color:var(--text); border-radius:7px; padding:9px 10px; font:inherit; cursor:pointer; }
.history-menu button:hover { background:var(--panel-2); }
.history-item.is-pinned .history-title::before { content:'◆ '; color:var(--primary); font-size:9px; }
.git-repo-suggest { position:absolute; left:12px; right:12px; bottom:calc(100% + 7px); z-index:60; background:var(--panel-solid); border:1px solid var(--border-strong); border-radius:12px; box-shadow:var(--shadow); max-height:260px; overflow:auto; }
.git-repo-suggest button { display:flex; flex-direction:column; width:100%; text-align:left; padding:10px 12px; gap:3px; background:transparent; border:0; color:var(--text); cursor:pointer; }
.git-repo-suggest button:hover { background:var(--panel-2); }
.git-repo-suggest small { color:var(--text-dim-2); }
.splash-screen { position:fixed; inset:0; z-index:1000; display:flex; align-items:center; justify-content:center; background:var(--bg); opacity:1; transition:opacity .18s ease; }
.splash-screen.is-leaving { opacity:0; pointer-events:none; }
.splash-mark { width:46px; height:46px; border-radius:14px; display:grid; place-items:center; color:#fff; font-weight:800; background:var(--accent-grad); box-shadow:0 0 30px color-mix(in srgb,var(--primary) 20%,transparent); }
.splash-content { display:flex; flex-direction:column; align-items:center; gap:14px; color:var(--text-dim); font-size:12px; }
.splash-spinner { width:16px; height:16px; border:2px solid var(--border-strong); border-top-color:var(--primary); border-radius:50%; animation:splashSpin .75s linear infinite; }
@keyframes splashSpin { to { transform:rotate(360deg); } }
@media(max-width:640px) { .page-scroll { padding:18px 14px; } .settings-section { padding:18px 15px 8px; } .workspace-choice-list { grid-template-columns:1fr; } .form-actions { padding-bottom:26px; } }

@keyframes splashProgress { from { transform:translateX(-55%); } to { transform:translateX(110%); } }
.library-picker .library-preview-head { display:flex; align-items:center; gap:12px; justify-content:space-between; padding-bottom:12px; border-bottom:1px solid var(--border); }
.library-picker .library-preview-head h3 { margin:0; }
.library-picker .library-preview-head [data-close] { width:34px; height:34px; flex:0 0 auto; }
.library-picker > p { color:var(--text-dim); margin:12px 0; }
#libraryMenuHolder .icon-btn { min-width:38px; min-height:38px; }
.library-card .library-file-actions { display:flex; flex-wrap:wrap; gap:6px; }
@media(max-width:600px){.workspace-choice-list{grid-template-columns:1fr}.library-picker{width:98vw;height:94dvh;max-height:96dvh}.library-selection-toolbar{gap:6px;padding:10px 6px}.library-selection-toolbar .btn{font-size:11px;padding:7px 8px}}

/* Revision 3 — artifact preview occupies the entire viewport on desktop and mobile. */
.artifact-panel.is-fullscreen { position:fixed; inset:0; z-index:800; width:100vw; height:100vh; height:100dvh; max-width:none; min-width:0; border:0; border-radius:0; box-shadow:none; }
.artifact-panel.is-fullscreen .artifact-header { flex:0 0 auto; padding:14px 18px; background:var(--bg); }
.artifact-panel.is-fullscreen .artifact-body { flex:1 1 auto; min-height:0; width:100%; overflow:auto; }
.artifact-panel.is-fullscreen .artifact-body iframe { min-height:0; height:100%; }
