:root {
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-2: #1A1A1A;
  --border: #262626;
  --text: #EDEDED;
  --muted: #8A8A8A;
  --danger: #E06A6A;
  --ok: #9DCFB8;
  --accent: #7EC8C3;
  --link: #9FD0E8;
  --shadow: 0 24px 60px rgba(0, 0, 0, .35);
  --radius: 14px;
  --pill: 999px;
  --sidebar: 300px;
  --font: Inter, Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: 180ms ease;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #e1e4ea;
  --text: #16181d;
  --muted: #5e6673;
  --danger: #c64545;
  --ok: #1f7a4d;
  --link: #1d6f93;
  --shadow: 0 16px 40px rgba(20, 20, 20, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 80;
  background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 10px;
}
.skip:focus { top: 8px; }

#app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
}
#sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px 10px;
}
.side-top { display: flex; align-items: center; padding: 4px 8px 10px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 680; letter-spacing: -0.03em;
}
.mark { width: 28px; height: 28px; display: grid; }
.mark svg { width: 100%; height: 100%; display: block; }
.mark circle { fill: currentColor; }
.section-label {
  margin: 8px 8px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.chats-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.chats-head .section-label { margin-bottom: 0; }
#sidebar { overflow: auto; }
.agent-scroll, .chat-scroll { overflow: visible; flex: 0 0 auto; padding-bottom: 4px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.settings-btn { width: 100%; text-align: left; }
.model-status {
  font-size: 12px; line-height: 1.4; color: var(--muted);
  border-top: 1px solid var(--border); padding: 8px 6px 2px;
}

button, .btn {
  background: var(--text); color: var(--bg); border: 0; border-radius: 12px;
  padding: 10px 14px; font-weight: 600;
}
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.quiet {
  background: transparent; color: var(--text); border: 0;
  border-radius: 10px; padding: 6px 8px; font-weight: 550; font-size: 13px;
}
button.quiet:hover, .agent-row:hover, .chat-select:hover { background: var(--surface-2); }
button.danger {
  background: transparent; color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 50%, var(--border));
}
button:disabled { opacity: .45; cursor: not-allowed; }
.agent-row, .chat-select {
  background: transparent; color: var(--text); border: 0; font-weight: 560;
}
.agent-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; border-radius: 12px; padding: 4px 8px; margin: 1px 0;
}
.agent-row.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--agent, var(--accent)); }
.agent-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-row .fig { width: 40px; height: 44px; margin: 0; flex: 0 0 auto; overflow: hidden; }
.chat-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 2px; align-items: center; border-radius: 10px;
}
.chat-row.active { background: var(--bg); }
.chat-select {
  text-align: left; padding: 8px 8px; border-radius: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-row .quiet { color: var(--muted); padding: 6px; }

#chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100dvh; background: var(--bg); }
.chat-top {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); min-height: 64px;
}
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; font-weight: 650; }
.who .fig { width: 44px; margin: 0; }
.model-pill {
  margin: 2px 0 0; display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--pill);
  padding: 1px 8px; color: var(--muted); font-size: 12px;
}
.icon, .send, #menu-btn {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: var(--pill); border: 1px solid var(--border); background: transparent; color: var(--text);
}
#menu-btn { display: none; }
.scrim { display: none; }

#thread {
  flex: 1; overflow: auto; padding: 28px 20px 12px;
}
.column { width: min(720px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.composer .pill { width: min(720px, 100%); margin: 0 auto; }
.welcome { margin: auto; text-align: center; color: var(--muted); max-width: 28rem; }
.welcome h2 { color: var(--text); margin: 8px 0 6px; letter-spacing: -0.03em; }
.welcome .fig { width: 112px; margin: 0 auto; }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; max-width: 760px; }
.bubble-row.user { align-self: flex-end; flex-direction: row-reverse; }
.bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 6px;
  padding: 8px 12px;
  max-width: min(640px, 100%);
}
.bubble-row.user .bubble { border-radius: 16px 16px 6px 16px; background: var(--surface-2); }
.bubble-row.error .bubble { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.meta { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.text a { color: var(--link); }
.pending .meta::after {
  content: "";
  display: inline-block; width: 7px; height: 7px; margin-left: 6px;
  border-radius: 50%; background: var(--accent); vertical-align: middle;
}
.tool-line, .sys-line {
  max-width: 760px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--muted);
  font-size: 14px;
}
.sys-line p, .tool-line p { margin: 0; white-space: pre-wrap; }
.sources { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sources a { font-weight: 600; }
.snip, .src-label { display: block; color: var(--muted); font-size: 12px; }
.src-label { margin: 0; text-transform: uppercase; letter-spacing: .06em; }
.empty-note { margin: 8px; }

.composer { padding: 8px 8vw 18px; }
.pill {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow);
}
.pill textarea {
  flex: 1; border: 0; background: transparent; resize: none;
  max-height: 160px; min-height: 44px; padding: 10px 0; border-radius: 0;
}
.pill textarea:focus { outline: none; }
.pill:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.send { background: var(--text); color: var(--bg); border: 0; }
.send.stop { background: transparent; color: var(--text); border: 1px solid var(--border); }

label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 6px; }
input, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.warn-note {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2);
}
.settings-extra { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--border); }
.settings-extra h2, #settings-form h2 { font-size: 15px; margin: 16px 0 8px; }

.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; z-index: 70; padding: 18px;
}
.modal.hidden { display: none; }
.modal-box {
  width: min(560px, 100%); max-height: min(86dvh, 760px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; box-shadow: var(--shadow);
}
.modal-actions { margin-top: 16px; }
#toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 12px);
  background: var(--text); color: var(--bg); border-radius: 999px; padding: 10px 14px;
  width: max-content; max-width: min(420px, calc(100vw - 24px)); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity var(--ease), transform var(--ease); z-index: 75;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.fig { width: 96px; margin: 0; }
.fig-sm { width: 78px; }
.fig-lg { width: 120px; }
.fig svg { width: 100%; height: auto; display: block; overflow: visible; }
.fig-name, .fig-state { display: block; text-align: center; }
.fig-name { font-size: 13px; font-weight: 620; letter-spacing: -0.02em; }
.fig-state { color: var(--muted); font-size: 12px; }
.skin { fill: var(--agent, #c5b4e3); }
.torso > .skin, .head > .skin { stroke: rgba(0, 0, 0, .16); stroke-width: 1; }
.shadow { fill: #000; opacity: .22; }
:root[data-theme="light"] .shadow { opacity: .12; }
.mouth { display: none; }
.fig[data-state="idle"] .mouth-soft,
.fig[data-state="working"] .mouth-soft,
.fig[data-state="thinking"] .mouth-soft { display: block; }
.fig[data-state="done"] .mouth-happy { display: block; }
.fig[data-state="error"] .mouth-sad { display: block; }
.fig[data-state="approval"] .mouth-ask { display: block; }
.fig[data-state="paused"] .mouth-sleep { display: block; }
.thought, .zzz, .stars, .err-badge { display: none; }
.fig[data-state="thinking"] .thought,
.fig[data-state="paused"] .zzz,
.fig[data-state="done"] .stars,
.fig[data-state="error"] .err-badge { display: block; }
.bubble-fill { fill: var(--surface); stroke: var(--text); stroke-width: 1; }
.zzz text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.stars path { fill: #e2b34d; }
.err-badge circle { fill: var(--danger); }
.err-badge text { fill: #fff; font-size: 12px; text-anchor: middle; font-family: var(--font); font-weight: 700; }
.arm, .limb-pivot, .eye { transform-box: fill-box; }
.limb-pivot { transform-origin: 50% 0; }
.eye { transform-origin: center; }
.fig[data-state="paused"] .eye { transform: scaleY(0.16); }
.fig[data-state="paused"] .body-wrap { filter: grayscale(.85); }
.fig[data-state="approval"] .arm-r .limb-pivot { transform: rotate(-58deg); }

@media (prefers-reduced-motion: no-preference) {
  .fig[data-state="idle"] .body-wrap { animation: breathe 3.4s ease-in-out infinite; transform-origin: center bottom; }
  .fig[data-state="idle"] .eye,
  .fig[data-state="working"] .eye,
  .fig[data-state="thinking"] .eye { animation: blink 4.8s linear infinite; }
  .fig[data-state="working"] .head { animation: bob .7s ease-in-out infinite; transform-origin: 50% 80%; }
  .fig[data-state="working"] .arm-l .limb-pivot { animation: type-l .38s ease-in-out infinite; }
  .fig[data-state="working"] .arm-r .limb-pivot { animation: type-r .38s ease-in-out infinite; }
  .fig[data-state="thinking"] .pupil { animation: look 1.4s ease-in-out infinite; }
  .fig[data-state="thinking"] .d1 { animation: dot 1.2s infinite; }
  .fig[data-state="thinking"] .d2 { animation: dot 1.2s .2s infinite; }
  .fig[data-state="thinking"] .d3 { animation: dot 1.2s .4s infinite; }
  .fig[data-state="done"] .body-wrap { animation: hop .55s ease; }
  .fig[data-state="error"] .body-wrap { animation: shake .45s ease; }
  .fig.is-offscreen, .fig.is-offscreen * { animation-play-state: paused !important; }
  .pending .meta::after { animation: pulse 1s ease-in-out infinite; }
}
@keyframes breathe { 50% { transform: translateY(-2px) scale(1.03); } }
@keyframes blink { 0%, 42%, 48%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.12); } }
@keyframes bob { 50% { transform: rotate(-4deg); } }
@keyframes type-l { 50% { transform: rotate(22deg); } }
@keyframes type-r { 50% { transform: rotate(-22deg); } }
@keyframes look { 50% { transform: translateX(-1.7px); } }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes hop { 40% { transform: translateY(-8px); } }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes pulse { 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  .fig[data-state="approval"] .arm-r .limb-pivot { transform: rotate(-58deg); }
  .fig.is-offscreen { animation: none; }
}
.fig.is-offscreen { animation-play-state: paused; }

.create-btn { width: calc(100% - 8px); margin: 0 4px 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  flex: 0 0 auto; overflow: hidden; color: #141414;
}
.avatar.photo { object-fit: cover; background: var(--surface-2); }
.avatar.shape { background: var(--agent, var(--accent)); }
.avatar.lg { width: 64px; height: 64px; border-radius: 16px; }
.avatar.lg svg { width: 32px; height: 32px; }
.agent-row-wrap { display: flex; align-items: center; gap: 2px; }
.agent-row-wrap .agent-row { flex: 1; }
.tiny { padding: 4px 6px; color: var(--muted); }
.shape-grid, .color-row, .preview-row, .member-picks { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.shape-btn, .color-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: #141414; display: grid; place-items: center;
}
.shape-btn { background: var(--agent, var(--surface-2)); }
.shape-btn.selected, .color-btn.selected { outline: 2px solid var(--text); outline-offset: 2px; }
.color-btn { border-radius: 999px; }
.checkline { display: flex; align-items: center; gap: 8px; width: 100%; color: var(--text); }
.checkline input { width: auto; }
.face-stack { display: flex; }
.face-stack .avatar { width: 26px; height: 26px; margin-right: -6px; border: 2px solid var(--surface); }
.group-row, .agent-row { display: flex; align-items: center; gap: 8px; }
.empty-home, .welcome { margin: auto; text-align: center; max-width: 28rem; color: var(--muted); padding: 24px 8px; }
.empty-home h1, .welcome h2 { color: var(--text); letter-spacing: -0.03em; }
.composer { display: flex; flex-direction: column; align-items: center; }
.continue-btn { align-self: center; width: auto; height: 36px; margin: 0 0 8px; border: 1px solid var(--border); padding: 0 14px; color: var(--text); background: var(--surface); }
.who .quiet { margin-left: 4px; }
.connect-card, .connector-row {
  border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface); margin: 8px 0;
}
.connect-card input, .connector-row input { margin-top: 6px; }
.connector-row h2 { margin: 0; font-size: 16px; }
.connector-row ul { margin: 8px 0 0; padding-left: 18px; }

@media (max-width: 800px) {
  #app { display: block; }
  #menu-btn { display: grid; }
  #sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: min(88vw, 340px); transform: translateX(-105%);
    transition: transform var(--ease); box-shadow: var(--shadow);
  }
  body.nav-open #sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .48); z-index: 35; }
  #thread, .composer { padding-left: 14px; padding-right: 14px; }
  .chat-top { padding-left: 10px; }
  .icon, .send, #menu-btn, .agent-row, .chat-select, .quiet { min-height: 44px; }
  .pill textarea, input, textarea, select { font-size: 16px; }
}

/* ===== Agora v2 look: calm and minimal ===== */
:root {
  --bg: #0b0b0c;
  --surface: #121213;
  --surface-2: #1b1b1d;
  --surface-3: #232326;
  --border: #232325;
  --border-strong: #2e2e31;
  --text: #ececee;
  --muted: #8b8b92;
  --accent: #e8e8ea;
  --link: #9cc4ff;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .6);
  --radius: 16px;
  --sidebar: 272px;
  --ease: 200ms cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --surface-2: #efeff1;
  --surface-3: #e7e7ea;
  --border: #ececee;
  --border-strong: #dcdce0;
  --text: #111113;
  --muted: #6e6e76;
  --accent: #111113;
  --link: #2459d6;
  --shadow: 0 18px 44px -22px rgba(17, 17, 19, .22);
}
body { font-size: 15px; letter-spacing: -0.006em; }
::selection { background: color-mix(in srgb, var(--text) 22%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--text) 55%, transparent); outline-offset: 2px; }

/* buttons */
button, .btn { border-radius: 999px; padding: 9px 16px; font-weight: 560; font-size: 14px; transition: background var(--ease), opacity var(--ease), transform var(--ease), border-color var(--ease); }
button:not(:disabled):active { transform: scale(.98); }
button.ghost, .btn.ghost { border-color: var(--border-strong); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); }
button.quiet { border-radius: 10px; color: var(--muted); font-weight: 520; }
button.quiet:hover { color: var(--text); background: var(--surface-2); }
button.danger { border-radius: 999px; }

/* sidebar */
#sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 12px 12px; gap: 2px; }
.side-top { padding: 4px 8px 14px; }
.brand { font-weight: 640; font-size: 16px; letter-spacing: -0.02em; gap: 9px; }
.mark { width: 26px; height: 26px; }
.create-btn {
  width: 100%; margin: 0 0 10px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--text); color: var(--bg); padding: 10px 14px;
}
.create-btn::before { content: "+"; font-size: 18px; line-height: 1; font-weight: 400; margin-top: -2px; }
.create-btn:hover { opacity: .9; }
.section-label { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 560; margin: 14px 10px 4px; color: var(--muted); }
.chats-head { margin-top: 6px; }
.chats-head .quiet { font-size: 12px; padding: 4px 8px; }
.empty-note { margin: 4px 10px; font-size: 13px; }
.agent-row, .chat-select, .group-row { font-weight: 500; font-size: 14px; }
.agent-row { padding: 6px 8px; gap: 10px; border-radius: 12px; transition: background var(--ease); }
.agent-row.active { background: var(--surface-3); box-shadow: none; }
.agent-row-wrap .tiny { opacity: 0; transition: opacity var(--ease); font-size: 12px; }
.agent-row-wrap:hover .tiny, .agent-row-wrap.active .tiny, .agent-row-wrap .tiny:focus-visible { opacity: 1; }
.group-row {
  display: flex; width: 100%; text-align: left; background: transparent; color: var(--text);
  border: 0; border-radius: 12px; padding: 6px 8px; gap: 12px; margin: 1px 0;
}
.group-row:hover { background: var(--surface-2); }
.group-row.active { background: var(--surface-3); }
.chat-row { border-radius: 12px; }
.chat-row.active { background: var(--surface-3); }
.chat-select { font-size: 13.5px; padding: 7px 10px; color: var(--text); }
.chat-row .quiet { font-size: 12px; opacity: 0; transition: opacity var(--ease); }
.chat-row:hover .quiet, .chat-row.active .quiet, .chat-row .quiet:focus-visible { opacity: 1; }
.side-bottom { gap: 2px; border-top: 1px solid var(--border); margin-top: auto; padding-top: 10px; }
.settings-btn { display: flex; align-items: center; gap: 10px; color: var(--text) !important; padding: 9px 10px !important; font-size: 13.5px !important; }
.settings-btn::before {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor; opacity: .7;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
[data-act="open-connectors"].settings-btn { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M9 3v5M15 3v5M7 8h10v3a5 5 0 01-10 0zM12 16v5'/%3E%3C/svg%3E"); }
[data-act="open-settings"].settings-btn { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h4M12 17h8'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E"); }
.model-status { border-top: 0; padding: 8px 10px 0; font-size: 11.5px; display: flex; align-items: center; gap: 7px; }
.model-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3ecf8e; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, #3ecf8e 20%, transparent); }

/* agent avatars: soft round characters */
.avatar { width: 30px; height: 30px; border-radius: 50%; position: relative; }
.avatar.shape {
  background:
    radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, #fff 55%, var(--agent, var(--accent))) 0%, var(--agent, var(--accent)) 55%, color-mix(in srgb, #000 18%, var(--agent, var(--accent))) 100%);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .12), inset 0 1px 1px rgba(255, 255, 255, .5), 0 1px 2px rgba(0, 0, 0, .25);
  color: rgba(20, 20, 22, .82);
}
.avatar.shape svg { width: 56%; height: 56%; stroke-width: 2; }
.avatar.photo { border-radius: 50%; box-shadow: 0 0 0 1px var(--border-strong); }
.avatar.lg { width: 72px; height: 72px; border-radius: 50%; }
.avatar.lg svg { width: 34px; height: 34px; }
.face-stack .avatar { width: 24px; height: 24px; margin-right: -8px; border: 2px solid var(--surface); }
.face-stack { padding-right: 8px; }
.chat-top .face-stack .avatar { border-color: var(--bg); width: 28px; height: 28px; }
.shape-btn { border-radius: 50%; width: 44px; height: 44px; border: 0;
  background: radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, #fff 55%, var(--agent, var(--surface-2))) 0%, var(--agent, var(--surface-2)) 60%); }
.shape-btn.selected, .color-btn.selected { outline: 2px solid var(--text); outline-offset: 3px; }
.color-btn { width: 30px; height: 30px; border: 0; }

/* chat area */
#chat { background: var(--bg); }
.chat-top { border-bottom: 0; min-height: 60px; padding: 10px 20px; }
.who h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.model-pill { border: 0; padding: 0; font-size: 12px; background: none; }
.chat-top .who .quiet { font-size: 12.5px; }
#menu-btn, .icon { border: 0; }
#menu-btn:hover, .icon:hover { background: var(--surface-2); }
#thread { padding: 18px 24px 8px; }
.column { width: min(760px, 100%); gap: 22px; }

.empty-home, .welcome { max-width: 32rem; padding: 32px 12px; }
.empty-home h1, .welcome h2 { font-size: clamp(28px, 4vw, 38px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; margin: 0 0 12px; }
.empty-home p, .welcome p { font-size: 15px; line-height: 1.6; margin: 0 0 22px; }
.empty-home button { padding: 11px 22px; }
.welcome .avatar { width: 64px; height: 64px; margin: 0 auto 18px; }
.welcome .avatar svg { width: 30px; height: 30px; }

.bubble-row { gap: 12px; align-items: flex-start; max-width: 100%; }
.bubble-row > .avatar { margin-top: 2px; }
.bubble { background: transparent; border: 0; border-radius: 0; padding: 2px 0; max-width: 100%; line-height: 1.65; }
.bubble-row.user { max-width: min(80%, 600px); }
.bubble-row.user .bubble { background: var(--surface-2); border-radius: 22px 22px 6px 22px; padding: 10px 16px; }
.bubble-row.user .meta { display: none; }
.bubble-row.error .bubble { border: 0; color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.meta { font-size: 12.5px; font-weight: 560; color: var(--muted); margin-bottom: 4px; }
.text { font-size: 15px; }
.pending .meta::after { background: var(--muted); }
.tool-line, .sys-line { border: 0; background: var(--surface); border-radius: 14px; padding: 10px 14px; font-size: 13.5px; margin-left: 42px; }
.sys-line { margin-left: 0; align-self: center; text-align: center; background: transparent; padding: 2px 8px; font-size: 12.5px; }
.sources { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sources a { display: inline-block; font-weight: 500; font-size: 12.5px; text-decoration: none; background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 4px 10px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a:hover { background: var(--surface-3); }
.src-label { text-transform: none; letter-spacing: 0; font-weight: 560; }

/* composer */
.composer { padding: 6px 24px 22px; }
.pill {
  border-radius: 28px; padding: 8px 8px 8px 20px; background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  transition: border-color var(--ease), box-shadow var(--ease);
}
:root[data-theme="light"] .pill { background: #fff; }
.pill:focus-within { border-color: color-mix(in srgb, var(--text) 30%, var(--border-strong)); }
.pill textarea { font-size: 15px; padding: 11px 0; }
.pill textarea::placeholder { color: var(--muted); }
.send { width: 40px; height: 40px; background: var(--text); color: var(--bg); transition: opacity var(--ease), transform var(--ease); }
.send:hover { opacity: .88; }
.send:disabled { opacity: .25; }
.continue-btn { border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; }

/* forms */
label { font-size: 12.5px; font-weight: 520; }
input, textarea, select { background: var(--bg); border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; font-size: 14px; transition: border-color var(--ease); }
input:focus, textarea:focus, select:focus { outline: none; border-color: color-mix(in srgb, var(--text) 40%, var(--border-strong)); }
.warn-note { border: 0; border-radius: 14px; background: var(--surface-2); font-size: 13.5px; }

/* modal */
.modal { background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
:root[data-theme="light"] .modal { background: rgba(17, 17, 19, .28); }
.modal-box { border-radius: 24px; padding: 24px; border-color: var(--border-strong); background: var(--surface); }
:root[data-theme="light"] .modal-box { background: #fff; }
.modal-box h2#modal-title, #modal-title { font-size: 20px; letter-spacing: -0.02em; font-weight: 620; margin: 0 0 6px; }
.connect-card, .connector-row { border-radius: 18px; border-color: var(--border); padding: 16px; }
.connect-card { max-width: 520px; margin-left: 42px; background: var(--surface); }
.connector-row .model-pill { background: var(--surface-2); padding: 2px 10px; border-radius: 999px; }
.spread { justify-content: space-between; }
#toast { border-radius: 999px; font-size: 13.5px; box-shadow: var(--shadow); }

@media (max-width: 800px) {
  #sidebar { border-right: 0; border-radius: 0 20px 20px 0; }
  body.nav-open .scrim { backdrop-filter: blur(3px); }
  .chat-top { padding: 8px 10px; min-height: 56px; }
  #thread { padding: 12px 16px 6px; }
  .composer { padding: 4px 12px 14px; }
  .tool-line, .connect-card { margin-left: 0; }
  .agent-row-wrap .tiny, .chat-row .quiet { opacity: 1; }
  .bubble-row.user { max-width: 88%; }
}
.hero-faces { display: flex; justify-content: center; margin-bottom: 22px; }
.hero-faces .avatar { width: 52px; height: 52px; margin: 0 -6px; border: 3px solid var(--bg); }
.hero-faces .avatar:nth-child(2) { transform: translateY(-8px); z-index: 1; width: 60px; height: 60px; }
.hero-faces .avatar svg { width: 46%; height: 46%; }
@media (prefers-reduced-motion: no-preference) {
  .hero-faces .avatar { animation: face-float 5s ease-in-out infinite; }
  .hero-faces .avatar:nth-child(2) { animation-delay: -1.6s; }
  .hero-faces .avatar:nth-child(3) { animation-delay: -3.2s; }
}
@keyframes face-float { 50% { translate: 0 -4px; } }
.checkline { margin: 2px 0; padding: 6px 8px; border-radius: 12px; font-size: 14px; }
.checkline:hover { background: var(--surface-2); }
.member-picks { flex-direction: column; gap: 2px; }
