@font-face {
  font-family: "InterVar";
  src: url("/vendor/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg-primary: #060608;
  --bg-secondary: #101015;
  --bg-tertiary: #17171f;
  --surface: #131319;
  --surface-2: #0c0c11;
  --glass: rgba(17,17,23,0.66);
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.10);
  --text-primary: rgba(255,255,255,0.93);
  --text-secondary: rgba(255,255,255,0.60);
  --text-tertiary: rgba(255,255,255,0.36);
  --accent: #6179ff;
  --accent-2: #8c61f2;
  --accent-soft: rgba(97,121,255,0.12);
  --danger: #ff5252;
  --success: #3ddb8f;
  --radius: 22px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.45), 0 2px 10px -2px rgba(0,0,0,0.35);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.45), 0 14px 36px -10px rgba(0,0,0,0.55);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.5), 0 36px 90px -18px rgba(0,0,0,0.65);
  --hl: inset 0 1px 0 rgba(255,255,255,0.05);
  --ring: 0 0 0 3px rgba(97,121,255,0.20);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "InterVar", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 264px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* Vignette over the aurora so edges stay near-black (z 1: above the aurora,
   below #gate and painted before #app in tree order) */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(120% 95% at 50% 0%, transparent 48%, rgba(0,0,0,0.45) 100%);
}
/* Film grain — keeps large dark surfaces from looking flat */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 99;
  opacity: 0.028; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Ambient aurora: three blurred blobs on slow GPU-only drifts */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; filter: blur(72px) saturate(120%); }
.aurora i { position: absolute; border-radius: 50%; will-change: transform; }
.aurora i:nth-child(1) {
  width: 58vmax; height: 58vmax; left: -12vmax; top: -22vmax; opacity: 0.24;
  background: radial-gradient(circle at 32% 32%, #6179ff, transparent 64%);
  animation: drift-a 80s var(--ease) infinite alternate;
}
.aurora i:nth-child(2) {
  width: 48vmax; height: 48vmax; right: -16vmax; top: -10vmax; opacity: 0.20;
  background: radial-gradient(circle at 66% 40%, #8c61f2, transparent 64%);
  animation: drift-b 95s var(--ease) infinite alternate;
}
.aurora i:nth-child(3) {
  width: 44vmax; height: 44vmax; left: 28vmax; bottom: -30vmax; opacity: 0.26;
  background: radial-gradient(circle at 50% 50%, #2e3a8c, transparent 64%);
  animation: drift-c 110s var(--ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(9vmax, 6vmax, 0) scale(1.12); } }
@keyframes drift-b { to { transform: translate3d(-7vmax, 9vmax, 0) scale(0.92); } }
@keyframes drift-c { to { transform: translate3d(-6vmax, -7vmax, 0) scale(1.08); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.965) translateY(6px); } to { opacity: 1; transform: none; } }
/* SEER logotype — the app's brandmark, traced to a gradient SVG */
.wordmark { display: inline-block; width: auto; vertical-align: middle; user-select: none; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid rgba(97,121,255,0.55); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ---------- Gate (hero) ---------- */
#gate {
  position: relative; z-index: 3; height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; padding-top: calc(24px + env(safe-area-inset-top));
}
#gate > * { animation: rise 0.65s var(--ease) backwards; }
#gate > *:nth-child(1) { animation-delay: 0.05s; }
#gate > *:nth-child(2) { animation-delay: 0.10s; }
#gate > *:nth-child(3) { animation-delay: 0.16s; }
#gate > *:nth-child(4) { animation-delay: 0.24s; }
#gate > *:nth-child(5) { animation-delay: 0.34s; }
#gate > *:nth-child(6) { animation-delay: 0.42s; }
#gate > *:nth-child(7) { animation-delay: 0.48s; }
#gate > *:nth-child(8) { animation-delay: 0.54s; }
#gate .wordmark { height: 34px; }
.gate-label { margin-top: 16px; font-size: 11px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--text-tertiary); }
.gate-tagline {
  margin: 20px 0 0; text-align: center;
  font-size: clamp(27px, 4.5vw, 38px); line-height: 1.14; font-weight: 590; letter-spacing: -0.025em;
  background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,0.55));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card {
  margin-top: 30px; width: 100%; max-width: 392px;
  position: relative; border: 1px solid transparent; border-radius: 24px;
  background:
    linear-gradient(var(--glass), var(--glass)) padding-box,
    linear-gradient(165deg, rgba(255,255,255,0.14), rgba(255,255,255,0.03) 40%, rgba(97,121,255,0.28)) border-box;
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--hl), var(--shadow-lg);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.card input {
  background: rgba(255,255,255,0.04); color: var(--text-primary);
  border: 0.5px solid var(--border-light); border-radius: 14px;
  padding: 15px 16px; font-family: var(--font); font-size: 15px; outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.card input:focus { border-color: rgba(97,121,255,0.45); box-shadow: var(--ring); }
.btn-primary {
  position: relative; overflow: hidden;
  border: none; border-radius: 999px; padding: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 13px; font-weight: 560; letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer; font-family: var(--font);
  box-shadow: 0 8px 26px -8px rgba(97,121,255,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.15s var(--ease), box-shadow 0.22s var(--ease);
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,0.28) 50%, transparent 68%);
  transform: translateX(-130%);
}
.btn-primary:hover { box-shadow: 0 12px 34px -8px rgba(97,121,255,0.7), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-primary:hover::after { transform: translateX(130%); transition: transform 0.65s var(--ease); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: var(--bg-tertiary); color: var(--text-tertiary); cursor: default; box-shadow: none; }
.btn-primary:disabled::after { display: none; }
.hint { font-size: 12px; color: var(--text-tertiary); text-align: center; line-height: 1.55; }
.hint a { color: var(--accent); text-decoration: none; }
.hint a:hover { text-decoration: underline; }
.gate-err { color: var(--danger); font-size: 12px; min-height: 14px; text-align: center; }
.gate-or { display: flex; align-items: center; gap: 12px; margin: 2px 0; }
.gate-or span { flex: 1; height: 0.5px; background: var(--border-light); }
.gate-or em { font-style: normal; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-tertiary); }
.btn-secondary {
  border: 0.5px solid var(--border-light); border-radius: 999px; padding: 13px;
  background: rgba(255,255,255,0.04); color: var(--text-primary);
  font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; font-family: var(--font); box-shadow: var(--hl);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.15s var(--ease);
}
.btn-secondary:hover { border-color: rgba(97,121,255,0.45); background: rgba(97,121,255,0.10); }
.btn-secondary:active { transform: scale(0.98); }
.btn-secondary:disabled { color: var(--text-tertiary); cursor: default; border-color: var(--border); background: transparent; }
.local-hint { font-size: 11.5px; color: var(--text-tertiary); line-height: 1.6; text-align: center; }
.local-hint em { font-style: normal; color: var(--text-secondary); }
.local-hint code {
  display: block; margin: 8px auto 6px; padding: 8px 12px; max-width: 100%;
  background: var(--surface-2); border: 0.5px solid var(--border); border-radius: 9px;
  font-family: var(--mono); font-size: 11px; color: var(--text-secondary);
  overflow-x: auto; white-space: nowrap; user-select: all;
}
.local-note { display: block; margin-top: 4px; font-size: 10.5px; opacity: 0.8; }
.mode-badge {
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--success); border: 0.5px solid rgba(61,219,143,0.35);
  background: rgba(61,219,143,0.08); border-radius: 999px; padding: 3px 9px; flex-shrink: 0;
}
.gate-remember { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.gate-remember input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.gate-features {
  display: flex; flex-wrap: wrap; gap: 9px 22px; justify-content: center;
  margin: 28px 0 0; padding: 0; list-style: none; max-width: 640px;
}
.gate-features li { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.gate-features svg { color: var(--accent); opacity: 0.9; flex-shrink: 0; }
.gate-ios {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 26px;
  padding: 9px 17px; border-radius: 999px; text-decoration: none;
  border: 0.5px solid var(--border-light); background: rgba(255,255,255,0.04);
  color: var(--text-primary); font-size: 12.5px;
  box-shadow: var(--hl);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.15s var(--ease);
}
.gate-ios:hover { border-color: rgba(97,121,255,0.45); background: rgba(97,121,255,0.10); transform: translateY(-1px); }
.gate-ios svg { opacity: 0.9; }
.gate-faq { margin-top: 36px; width: 100%; max-width: 480px; }
.gate-faq h2 {
  margin: 0 0 10px; text-align: center; font-weight: 500;
  font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-tertiary);
}
.gate-faq details {
  border: 0.5px solid var(--border); border-radius: 12px; margin-bottom: 8px;
  background: rgba(255,255,255,0.02); overflow: hidden;
}
.gate-faq summary {
  cursor: pointer; list-style: none; padding: 11px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-secondary);
}
.gate-faq summary::-webkit-details-marker { display: none; }
.gate-faq summary::after { content: "+"; color: var(--text-tertiary); font-size: 14px; flex-shrink: 0; }
.gate-faq details[open] summary { color: var(--text-primary); }
.gate-faq details[open] summary::after { content: "–"; }
.gate-faq p { margin: 0; padding: 0 14px 12px; font-size: 12.5px; line-height: 1.6; color: var(--text-tertiary); }
.gate-faq p a { color: var(--accent); text-decoration: none; }
.gate-faq p a:hover { text-decoration: underline; }
.gate-foot { margin-top: 20px; font-size: 11px; letter-spacing: 0.02em; color: var(--text-tertiary); }
.gate-foot a { color: var(--text-secondary); text-decoration: none; }
.gate-foot a:hover { color: var(--accent); text-decoration: underline; }
.gate-foot .dot { margin: 0 7px; opacity: 0.6; }
.side-credit { margin-top: 10px; text-align: center; font-size: 10.5px; letter-spacing: 0.02em; color: var(--text-tertiary); }
.side-credit a { color: var(--text-secondary); text-decoration: none; }
.side-credit a:hover { color: var(--accent); text-decoration: underline; }
.side-beta { margin-top: 6px; text-align: center; font-size: 10.5px; }
.side-beta a { color: var(--accent); text-decoration: none; }
.side-beta a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
#app { position: relative; z-index: 1; height: 100%; display: flex; }
#scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 14;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.drawer-open #scrim { opacity: 1; pointer-events: auto; }

/* ---------- Sidebar ---------- */
#sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: rgba(13,13,18,0.62); border-right: 0.5px solid var(--border);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.side-head { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.side-head .wordmark { height: 15px; }
.side-new {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent-soft); color: var(--accent); border: 0.5px solid rgba(97,121,255,0.2);
  border-radius: 12px; padding: 11px; font-size: 13px; cursor: pointer; font-family: var(--font);
}
.side-new:hover { background: rgba(97,121,255,0.18); }
.side-new .plus { font-size: 16px; line-height: 1; }
/* projects */
.project-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 0.5px solid var(--border); align-items: center; }
.proj-pill { background: var(--surface); border: 0.5px solid var(--border-light); color: var(--text-secondary); border-radius: 999px; padding: 5px 11px; font-size: 11.5px; cursor: pointer; font-family: var(--font); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-pill:hover { color: var(--text-primary); }
.proj-pill.active { background: var(--accent-soft); border-color: rgba(97,121,255,0.35); color: var(--text-primary); }
.proj-add { width: 26px; height: 26px; border-radius: 999px; border: 0.5px dashed var(--border-light); background: none; color: var(--text-secondary); cursor: pointer; font-size: 15px; line-height: 1; }
.proj-add:hover { color: var(--accent); border-color: var(--accent); }
.proj-edit { margin-left: auto; background: none; border: none; color: var(--accent); font-size: 11px; cursor: pointer; font-family: var(--font); }
.proj-edit:hover { text-decoration: underline; }

/* project editor */
.pj-size { font-size: 11px; color: var(--text-tertiary); letter-spacing: 0.02em; }
.pj-size.warn { color: var(--danger); }
.pj-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0.5px solid var(--border); border-radius: 9px; margin-bottom: 6px; }
.pj-file-name { flex: 1; font-family: var(--mono); font-size: 12.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-file-size { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }
.pj-file-x { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 12px; flex-shrink: 0; }
.pj-file-x:hover { color: var(--danger); }
.pj-empty { font-size: 12px; color: var(--text-tertiary); margin-bottom: 10px; }
.pj-upload-label { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 9px; padding: 8px 14px; font-size: 12px; cursor: pointer; margin: 4px 0 12px; }
.pj-upload-label:hover { background: rgba(97,121,255,0.18); }
.pj-paste { display: flex; flex-direction: column; gap: 8px; }
.pj-paste input { background: var(--surface); color: var(--text-primary); border: 0.5px solid var(--border-light); border-radius: 10px; padding: 9px 11px; font-family: var(--font); font-size: 13px; outline: none; }
.pj-paste input:focus { border-color: rgba(97,121,255,0.4); }
.pj-paste .mm-add-btn { align-self: flex-start; }
#pjDelete { color: var(--danger); }

.conv-list { flex: 1; overflow-y: auto; padding: 6px 10px; }
.conv-row {
  position: relative; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 2px;
}
.conv-row:hover { background: rgba(255,255,255,0.035); }
.conv-row.active { background: var(--accent-soft); }
.conv-row.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2.5px;
  background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 2px;
}
.conv-title { font-size: 13.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 44px; }
.conv-time { font-size: 10px; color: var(--text-tertiary); letter-spacing: 0.02em; }
.conv-actions { position: absolute; right: 8px; top: 8px; display: none; gap: 2px; }
.conv-row:hover .conv-actions { display: flex; }
.conv-act {
  background: none; border: none; color: var(--text-tertiary); cursor: pointer;
  width: 24px; height: 24px; border-radius: 6px; font-size: 12px; display: grid; place-items: center;
}
.conv-act:hover { color: var(--accent); background: rgba(255,255,255,0.06); }
.conv-act.del:hover { color: var(--danger); }
.conv-empty { padding: 18px 14px; font-size: 12px; color: var(--text-tertiary); text-align: center; }
.side-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 0.5px solid var(--border); }

.ghost {
  background: var(--accent-soft); color: var(--accent); border: none; border-radius: 999px;
  padding: 9px 16px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; font-family: var(--font); width: 100%;
}
.ghost:hover { background: rgba(97,121,255,0.18); }

/* ---------- Chat pane ---------- */
#chatPane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
header {
  position: relative; z-index: 6;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(6,6,8,0.55);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 0.5px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(255,255,255,0.10) 30%, rgba(97,121,255,0.22) 50%, rgba(255,255,255,0.10) 70%, transparent) 1;
}
header .brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
header .wordmark { height: 15px; }
.tagline { font-size: 9px; letter-spacing: 0.30em; color: var(--text-tertiary); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.icon-btn {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  font-size: 18px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.icon-btn svg { display: block; }
.hdr-tools { display: inline-flex; align-items: center; gap: 2px; }
.tools-slot:empty { display: none; }
.tools-slot { padding: 4px 14px 12px; }
.hdr-tools.in-sidebar { display: flex; width: 100%; justify-content: space-around; gap: 6px; padding: 5px; border: 0.5px solid var(--border); border-radius: 12px; }
.hdr-tools.in-sidebar .icon-btn { width: 46px; height: 40px; }
.icon-btn.on { color: var(--accent); }

/* github */
.gh-gate { display: flex; flex-direction: column; gap: 12px; }
.gh-gate .mm-search { margin-bottom: 0; }
.gh-gate .gate-err { text-align: left; }
.gh-acct { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.gh-acct b { color: var(--text-primary); }
.gh-list { max-height: 200px; overflow-y: auto; border: 0.5px solid var(--border); border-radius: 12px; margin-top: 10px; }
.gh-repo-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; border-bottom: 0.5px solid var(--border); padding: 9px 12px; cursor: pointer; font-family: var(--font); color: var(--text-primary); }
.gh-repo-row:last-child { border-bottom: none; }
.gh-repo-row:hover { background: rgba(255,255,255,0.04); }
.gh-repo-full { flex: 1; font-size: 12.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-badge { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); border: 0.5px solid var(--border-light); border-radius: 999px; padding: 2px 7px; }
.gh-loading { padding: 14px; text-align: center; font-size: 12px; color: var(--text-tertiary); }
.gh-repo-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.gh-repo-name { flex: 1; font-family: var(--mono); font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-branch { appearance: none; background: var(--bg-secondary); color: var(--text-secondary); border: 0.5px solid var(--border-light); border-radius: 999px; padding: 6px 12px; font-family: var(--mono); font-size: 11px; cursor: pointer; max-width: 45%; }
.gh-files { max-height: 280px; overflow-y: auto; border: 0.5px solid var(--border); border-radius: 12px; margin-top: 10px; }
.gh-file { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 0.5px solid var(--border); cursor: pointer; }
.gh-file:last-child { border-bottom: none; }
.gh-file:hover { background: rgba(255,255,255,0.03); }
.gh-file input { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.gh-file-path { flex: 1; font-family: var(--mono); font-size: 12px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-file-size { font-size: 10.5px; color: var(--text-tertiary); flex-shrink: 0; }
.gh-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.gh-sel { font-size: 12px; color: var(--text-secondary); }
.drawer-only { display: none; }
select#model {
  appearance: none; background: var(--bg-secondary); color: var(--text-secondary);
  border: 0.5px solid var(--border-light); border-radius: 999px;
  padding: 8px 30px 8px 14px; font-family: var(--font); max-width: 46vw;
  font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' stroke='%238a8a99' fill='none' stroke-width='1.2'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* settings labels (the popover itself was replaced by the settings modal) */
.sp-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-primary); margin-bottom: 8px; }
.sp-label span:last-child { color: var(--accent); font-variant-numeric: tabular-nums; }
.sp-hint { font-size: 10.5px; color: var(--text-tertiary); margin-top: 8px; line-height: 1.4; }
.sp-foot { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--border); }
.sp-link { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; font-family: var(--font); padding: 0; }
.sp-link:hover { text-decoration: underline; }
.sp-row { margin-bottom: 16px; }
.sp-row:last-child { margin-bottom: 0; }
.sp-hint code { font-family: var(--mono); font-size: 0.92em; color: var(--text-secondary); }

/* generation settings modal */
.set-section { margin-bottom: 22px; }
.set-section:last-child { margin-bottom: 0; }
.set-textarea {
  width: 100%; min-height: 92px; resize: vertical; background: var(--surface); color: var(--text-primary);
  border: 0.5px solid var(--border-light); border-radius: 10px; padding: 10px 12px;
  font-family: var(--font); font-size: 13.5px; line-height: 1.5; outline: none;
}
.set-textarea:focus { border-color: rgba(97,121,255,0.4); }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-field { display: flex; flex-direction: column; gap: 6px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.set-field-wide { margin-top: 12px; }
.set-field input {
  background: var(--surface); color: var(--text-primary); border: 0.5px solid var(--border-light);
  border-radius: 10px; padding: 9px 11px; font-family: var(--mono); font-size: 13px; outline: none; text-transform: none; letter-spacing: 0;
}
.set-field input:focus { border-color: rgba(97,121,255,0.4); }
.set-foot { display: flex; gap: 16px; align-items: center; }
.set-check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-primary); cursor: pointer; }
.set-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.tool-list { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 9px; }
.tool-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.tool-row input { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.tool-row input:disabled { opacity: 0.4; }
.tool-row b { color: var(--text-primary); font-weight: 500; }
.tool-row.conflict { opacity: 0.5; }
.mcp-tool-row { padding-left: 18px; }
/* MCP connectors */
.mcp-server-row { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 12.5px; color: var(--text-secondary); }
.mcp-server-row input { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.mcp-server-row b { color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.mcp-meta { flex: 1; font-size: 11px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary); flex-shrink: 0; }
.mcp-dot.ok { background: var(--success); }
.mcp-dot.error { background: var(--danger); }
.mcp-dot.connecting { background: var(--accent); }
.mcp-act { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 13px; padding: 2px 5px; flex-shrink: 0; }
.mcp-act:hover { color: var(--accent); }
.mcp-add { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.mcp-add .mm-add-btn { align-self: flex-start; }
#mcpErr { text-align: left; min-height: 0; margin-top: 6px; }
#mcpErr:empty { display: none; }

/* tool calls in chat */
.toolcall { margin: 0.5em 0; border: 0.5px solid var(--border); border-radius: 10px; background: var(--bg-primary); overflow: hidden; }
.toolcall summary { cursor: pointer; padding: 7px 12px; font-size: 11.5px; color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: 8px; }
.toolcall summary::-webkit-details-marker { display: none; }
.tc-name { font-family: var(--mono); color: var(--text-primary); }
.tc-status { margin-left: auto; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.tc-body { border-top: 0.5px solid var(--border); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.tc-args, .tc-result { margin: 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }
.tc-args { color: var(--text-tertiary); }
.tc-result { color: var(--text-primary); }
.tc-err { color: var(--danger); }
.sb-area { min-height: 64px; }

/* active scaffold bar */
.scaffold-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: 100%; max-width: 780px; margin: 0 auto; padding: 10px 20px 0; font-size: 12px;
}
.scaffold-bar .sb-name {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft);
  border: 0.5px solid rgba(97,121,255,0.25); color: var(--text-primary);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; max-width: 70%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scaffold-bar .sb-act { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; font-family: var(--font); padding: 0; }
.scaffold-bar .sb-act:hover { text-decoration: underline; }
.scaffold-bar .sb-sep { color: var(--text-tertiary); }
.icon-btn.on { color: var(--accent); }

/* scaffold library */
.sc-list { display: flex; flex-direction: column; gap: 8px; }
.sc-empty { font-size: 12px; color: var(--text-tertiary); }
.sc-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 0.5px solid var(--border); border-radius: 12px; }
.sc-row.active { border-color: rgba(97,121,255,0.5); background: var(--accent-soft); }
.sc-main { flex: 1; min-width: 0; }
.sc-name { font-size: 13.5px; color: var(--text-primary); font-weight: 500; }
.sc-sum { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 5px; letter-spacing: 0.02em; }
.sc-acts { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; justify-content: flex-end; max-width: 132px; }
.sc-acts button { border: none; border-radius: 7px; padding: 5px 10px; cursor: pointer; font-family: var(--font); font-size: 11px; background: var(--accent-soft); color: var(--accent); }
.sc-acts button:hover { background: rgba(97,121,255,0.18); }
.sc-acts button:disabled { background: transparent; color: var(--text-tertiary); cursor: default; }
.sc-acts .sc-ghost { background: transparent; color: var(--text-tertiary); padding: 5px 8px; }
.sc-acts .sc-ghost:hover { color: var(--text-primary); background: var(--surface); }
.sc-templates { display: flex; flex-direction: column; gap: 6px; }
.sc-tpl { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 0.5px solid var(--border); border-radius: 10px; cursor: pointer; }
.sc-tpl:hover { border-color: rgba(97,121,255,0.4); }
.sc-tpl-name { font-size: 13px; color: var(--text-primary); }
.sc-tpl-sum { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.sc-tpl .use { color: var(--accent); font-size: 11px; flex-shrink: 0; }

/* scaffold builder */
#scaffoldBuilder .set-field input { font-family: var(--font); }
.sc-opt { font-size: 9px; color: var(--text-tertiary); letter-spacing: 0.12em; }
.sb-errors { background: rgba(232,90,90,0.08); border: 0.5px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 10px 12px 10px 0; font-size: 12px; margin-bottom: 16px; }
.sb-errors ul { margin: 0; padding-left: 26px; }
.sb-errors li { margin: 2px 0; }
.sb-preview { background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; margin: 0; }

/* model management modal */
.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.modal-card {
  width: 100%; max-width: 460px; max-height: 82vh; display: flex; flex-direction: column;
  background: rgba(15,15,20,0.92); border: 0.5px solid var(--border-light); border-radius: 18px; overflow: hidden;
  box-shadow: var(--hl), var(--shadow-lg);
  animation: pop 0.28s var(--ease);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 0.5px solid var(--border); font-size: 14px; font-weight: 500; }
.mm-body { overflow-y: auto; padding: 16px 18px 20px; }
.mm-section { margin-bottom: 20px; }
.mm-section:last-child { margin-bottom: 0; }
.mm-label { font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 10px; }
.mm-count { letter-spacing: 0.04em; }
.mm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft);
  border: 0.5px solid rgba(97,121,255,0.2); color: var(--text-primary); border-radius: 999px;
  padding: 6px 8px 6px 13px; font-size: 12.5px; font-family: var(--mono);
}
.mm-chip button { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 13px; padding: 0 2px; line-height: 1; }
.mm-chip button:hover { color: var(--danger); }
.mm-empty { font-size: 12px; color: var(--text-tertiary); }
.mm-add { display: flex; gap: 8px; }
.mm-add input, .mm-search {
  flex: 1; width: 100%; background: var(--surface); color: var(--text-primary);
  border: 0.5px solid var(--border-light); border-radius: 10px; padding: 10px 12px;
  font-family: var(--font); font-size: 13.5px; outline: none;
}
.mm-add input:focus, .mm-search:focus { border-color: rgba(97,121,255,0.4); }
.mm-add-btn {
  border: none; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-family: var(--font);
  background: var(--accent-soft); color: var(--accent); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
.mm-add-btn:hover { background: rgba(97,121,255,0.18); }
.mm-search { margin-bottom: 10px; }
.mm-catalog { max-height: 240px; overflow-y: auto; border: 0.5px solid var(--border); border-radius: 12px; }
.mm-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 0.5px solid var(--border); }
.mm-row:last-child { border-bottom: none; }
.mm-row span { font-family: var(--mono); font-size: 12.5px; color: var(--text-primary); }
.mm-row button {
  border: none; border-radius: 7px; padding: 5px 11px; cursor: pointer; font-family: var(--font);
  background: var(--accent-soft); color: var(--accent); font-size: 11px; letter-spacing: 0.06em;
}
.mm-row button:hover { background: rgba(97,121,255,0.18); }
.mm-row button:disabled { background: transparent; color: var(--text-tertiary); cursor: default; }
.mm-loading { padding: 16px; text-align: center; font-size: 12px; color: var(--text-tertiary); }
/* model presets */
.preset-list { max-height: 220px; margin-bottom: 10px; }
.preset-list .mm-empty { padding: 12px; }
.preset-list .mm-row span { color: var(--accent); }
.preset-base { flex: 1; font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--text-tertiary); margin-left: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-acts { display: flex; gap: 6px; flex-shrink: 0; }
.pm-select {
  width: 100%; appearance: none; background: var(--surface); color: var(--text-primary);
  border: 0.5px solid var(--border-light); border-radius: 10px; padding: 9px 11px;
  font-family: var(--mono); font-size: 13px; outline: none; text-transform: none; letter-spacing: 0; cursor: pointer;
}
.pm-select:focus { border-color: rgba(97,121,255,0.4); }
#pmErr:empty { display: none; }
#pmErr { text-align: left; margin-bottom: 12px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px;
  background: var(--bg-tertiary); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 2px solid var(--bg-primary); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg-primary);
  background: var(--accent); cursor: pointer;
}

main {
  position: relative; flex: 1; overflow-y: auto; display: flex; flex-direction: column;
}
.thread { width: 100%; max-width: 780px; margin: 0 auto; padding: 26px 20px 20px; display: flex; flex-direction: column; gap: 20px; }

/* empty state */
.empty { position: relative; margin: auto; text-align: center; color: var(--text-tertiary); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 16px; }
.empty::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 320px; height: 320px;
  transform: translate(-50%, -54%); pointer-events: none; z-index: -1;
  background: url("/seer-emblem.png") center / contain no-repeat;
  opacity: 0.05; filter: saturate(0) blur(1px);
}
.empty .wordmark { height: 26px; }
.empty p { font-size: 13px; font-weight: 300; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 520px; margin-top: 6px; }
.chip {
  background: rgba(255,255,255,0.035); border: 0.5px solid var(--border); color: var(--text-secondary);
  border-radius: 999px; padding: 9px 14px; font-size: 12.5px; cursor: pointer; font-family: var(--font);
  box-shadow: var(--hl);
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.15s var(--ease);
}
.chip:hover { background: var(--accent-soft); color: var(--text-primary); border-color: rgba(97,121,255,0.3); transform: translateY(-1px); }

/* ---------- Messages ---------- */
.msg { display: flex; animation: rise 0.24s var(--ease) backwards; }
.msg.user { justify-content: flex-end; }
.col { max-width: 88%; min-width: 0; }
.role { font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-tertiary); margin: 0 4px 5px; }
.msg.user .role { text-align: right; }
.bubble { padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.6; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user .bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  border-bottom-right-radius: 6px; white-space: pre-wrap;
  box-shadow: 0 6px 20px -8px rgba(97,121,255,0.5), inset 0 1px 0 rgba(255,255,255,0.16);
}
.msg.assistant .bubble {
  background: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 42%), var(--surface);
  border: 0.5px solid var(--border); color: var(--text-primary); border-bottom-left-radius: 6px;
  box-shadow: var(--hl), var(--shadow-sm);
}
.bubble.plain { white-space: pre-wrap; }

/* markdown inside assistant bubbles */
.bubble > *:first-child { margin-top: 0; }
.bubble > *:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: 1em 0 0.5em; line-height: 1.3; font-weight: 600; }
.bubble h1 { font-size: 1.4em; } .bubble h2 { font-size: 1.25em; } .bubble h3 { font-size: 1.1em; }
.bubble p { margin: 0.6em 0; }
.bubble ul, .bubble ol { margin: 0.6em 0; padding-left: 1.4em; }
.bubble li { margin: 0.25em 0; }
.bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble blockquote { margin: 0.6em 0; padding: 4px 0 4px 14px; border-left: 2.5px solid var(--accent); color: var(--text-secondary); }
.bubble hr { border: none; border-top: 0.5px solid var(--border); margin: 1em 0; }
.bubble code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-tertiary); padding: 1.5px 5px; border-radius: 5px; }
.bubble pre { margin: 0.7em 0; border-radius: 12px; background: var(--surface-2); border: 0.5px solid var(--border); overflow: hidden; position: relative; }
.bubble pre code { display: block; padding: 14px 16px; background: none; font-size: 12.5px; line-height: 1.55; overflow-x: auto; border-radius: 0; }
.bubble table { border-collapse: collapse; margin: 0.7em 0; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 0.5px solid var(--border); padding: 6px 10px; text-align: left; font-size: 13.5px; }
.bubble th { background: var(--bg-tertiary); }

/* model-generated visuals */
.diagram { margin: 0.8em 0; padding: 14px; background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: 12px; overflow-x: auto; text-align: center; }
.diagram svg { max-width: 100%; height: auto; }
.chart-box { position: relative; margin: 0.8em 0; padding: 14px; background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: 12px; height: 320px; }
.diagram-err { margin: 0.8em 0; padding: 10px 12px; border: 0.5px solid var(--danger); border-radius: 10px; color: var(--danger); font-size: 12px; font-family: var(--mono); white-space: pre-wrap; }
.code-actions { position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.bubble pre:hover .code-actions { opacity: 1; }
.copy-btn, .run-btn, .save-btn {
  background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 0.5px solid var(--border);
  border-radius: 7px; padding: 4px 9px; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; font-family: var(--font);
}
.copy-btn:hover, .run-btn:hover, .save-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }
.copy-btn.ok, .save-btn.ok { color: var(--success); }
.run-btn { color: var(--accent); }
.run-btn:disabled { color: var(--text-tertiary); cursor: default; }

/* saved code library */
.sn-list { display: flex; flex-direction: column; gap: 12px; }
.sn-empty { font-size: 12px; color: var(--text-tertiary); }
.sn-item { border: 0.5px solid var(--border); border-radius: 12px; overflow: hidden; }
.sn-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-bottom: 0.5px solid var(--border); flex-wrap: wrap; }
.sn-title { font-size: 12.5px; color: var(--text-primary); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42%; }
.sn-badge { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); border: 0.5px solid var(--border-light); border-radius: 999px; padding: 2px 7px; }
.sn-acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.sn-btn { background: var(--accent-soft); color: var(--accent); border: none; border-radius: 7px; padding: 4px 9px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; font-family: var(--font); }
.sn-btn:hover { background: rgba(97,121,255,0.18); }
.sn-ghost { background: transparent; color: var(--text-tertiary); }
.sn-ghost:hover { background: var(--surface); color: var(--text-primary); }
.sn-del:hover { color: var(--danger); }
.sn-item pre { margin: 0; background: var(--surface-2); position: relative; }
.sn-item pre code { display: block; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.5; overflow-x: auto; max-height: 240px; }
.sn-item .run-output { margin: 0; border-radius: 0; border-left: none; border-right: none; border-bottom: none; }

/* code execution output */
.run-output { margin: -2px 0 0.9em; border: 0.5px solid var(--border); border-radius: 10px; background: var(--bg-primary); font-family: var(--mono); font-size: 12px; overflow: hidden; }
.ro-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--surface-2); border-bottom: 0.5px solid var(--border); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-tertiary); }
.ro-status { letter-spacing: 0.08em; color: var(--text-secondary); text-transform: none; }
.ro-body { padding: 8px 12px; max-height: 280px; overflow-y: auto; }
.ro-line { white-space: pre-wrap; word-break: break-word; line-height: 1.5; color: var(--text-primary); }
.ro-error { color: var(--danger); }
.ro-warn { color: #ffb454; }
.ro-result { color: var(--accent); }
.ro-muted { color: var(--text-tertiary); }
.ro-stdin { color: var(--accent); }
.ro-input { padding: 3px 0; }
.ro-input input { width: 100%; background: var(--surface); color: var(--text-primary); border: 0.5px solid rgba(97,121,255,0.45); border-radius: 7px; padding: 6px 9px; font-family: var(--mono); font-size: 12px; outline: none; }

/* thinking block */
details.thinking {
  margin-bottom: 8px; background: rgba(97,121,255,0.05); border: 0.5px solid rgba(97,121,255,0.16);
  border-radius: 12px; overflow: hidden;
}
details.thinking > summary {
  list-style: none; cursor: pointer; padding: 9px 14px; display: flex; align-items: center; gap: 8px;
  font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-secondary);
}
details.thinking > summary::-webkit-details-marker { display: none; }
details.thinking > summary::before {
  content: "›"; font-size: 14px; transform: rotate(90deg); transition: transform .15s; color: var(--accent);
}
details.thinking:not([open]) > summary::before { transform: rotate(0deg); }
.think-body { padding: 0 14px 12px; font-size: 13px; line-height: 1.55; color: var(--text-secondary); white-space: pre-wrap; }

/* typing dots */
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.4; animation: dot 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dot { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

/* message actions + stats */
.actions { display: flex; gap: 4px; margin: 6px 4px 0; opacity: 0; transition: opacity .15s; }
.msg:hover .actions, .actions.show { opacity: 1; }
.act-btn {
  background: none; border: none; color: var(--text-tertiary); cursor: pointer;
  font-size: 11px; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 7px; font-family: var(--font);
}
.act-btn:hover { color: var(--accent); background: rgba(255,255,255,0.05); }
.act-btn.ok { color: var(--success); }
.stats { font-size: 10px; color: var(--text-tertiary); margin: 4px 4px 0; letter-spacing: 0.03em; }
.stats, .conv-time, .gh-file-size, .pj-file-size, .sp-label span:last-child { font-variant-numeric: tabular-nums; }

/* ---------- Composer ---------- */
footer {
  position: relative; border-top: 0.5px solid var(--border);
  background: rgba(6,6,8,0.62);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
/* soft fade so messages dissolve into the composer instead of clipping */
footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: -28px; height: 28px;
  background: linear-gradient(180deg, transparent, rgba(6,6,8,0.5)); pointer-events: none;
}
.err { max-width: 780px; margin: 0 auto 8px; color: var(--danger); font-size: 12px; text-align: center; }
.composer { width: 100%; max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; }
textarea#input {
  flex: 1; resize: none; background: rgba(255,255,255,0.045); color: var(--text-primary);
  border: 0.5px solid var(--border-light); border-radius: var(--radius);
  padding: 13px 18px; font-family: var(--font); font-size: 15px; line-height: 1.4; max-height: 180px; outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
  transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
textarea#input::placeholder { color: var(--text-tertiary); }
textarea#input:focus { border-color: rgba(97,121,255,0.45); box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), var(--ring); }
#send {
  width: 46px; height: 46px; flex: 0 0 46px; border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 18px; display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(97,121,255,0.5), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.15s;
}
#send:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 10px 26px -6px rgba(97,121,255,0.65), inset 0 1px 0 rgba(255,255,255,0.18); }
#send:not(:disabled):active { transform: scale(0.95); }
#send:disabled { background: var(--bg-tertiary); color: var(--text-tertiary); cursor: default; box-shadow: none; }
#send.stopping { background: var(--danger); font-size: 15px; }
.composer-attach {
  width: 46px; height: 46px; flex: 0 0 46px; border: 0.5px solid var(--border-light); border-radius: 999px; cursor: pointer;
  background: var(--bg-secondary); color: var(--text-secondary); font-size: 17px; display: grid; place-items: center; transition: color .15s, border-color .15s;
}
.composer-attach:hover { color: var(--accent); border-color: rgba(97,121,255,0.4); }
.attach-bar { width: 100%; max-width: 780px; margin: 0 auto 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 0.5px solid var(--border-light); border-radius: 999px; padding: 6px 10px 6px 12px; font-size: 12px; color: var(--text-primary); max-width: 260px; }
.attach-chip .ac-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .ac-meta { color: var(--text-tertiary); font-size: 11px; flex-shrink: 0; }
.attach-chip.err { border-color: var(--danger); }
.attach-chip.err .ac-meta { color: var(--danger); }
.attach-chip button { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 12px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.attach-chip button:hover { color: var(--danger); }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg-att { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.06); border: 0.5px solid var(--border); border-radius: 8px; padding: 4px 9px; font-size: 11.5px; color: var(--text-secondary); }

.scroll-btn {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  width: 38px; height: 38px; border-radius: 999px; border: 0.5px solid var(--border-light); cursor: pointer;
  background: var(--surface); color: var(--text-primary); font-size: 16px; display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4); z-index: 5;
}
.scroll-btn:hover { background: var(--bg-tertiary); }

/* ---------- Responsive (mobile drawer) ---------- */
@media (max-width: 760px) {
  .drawer-only { display: grid; }
  #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 15;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.5); padding-left: env(safe-area-inset-left);
  }
  body.drawer-open #sidebar { transform: translateX(0); }
  .col { max-width: 94%; }
}

/* Touch devices: no hover, so reveal hover-only controls and stop iOS
   zoom-on-focus by keeping interactive inputs at >=16px. */
@media (hover: none) {
  .conv-actions { display: flex; }
  .code-actions { opacity: 1; }
  .actions { opacity: 1; }
  textarea#input, .card input, .mm-add input, .mm-search { font-size: 16px; }
  .conv-act { width: 30px; height: 30px; }
  .act-btn { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .typing span, .cursor::after { animation: none; }
  #sidebar { transition: none; }
  .aurora i, #gate > *, .msg, .modal-card { animation: none; }
  .btn-primary::after { display: none; }
}
