/* ============================================================
   OMC³ Agent — design system
   Dark, premium, sober. IBM Plex Sans/Mono. CERN-themed accents.
   Themes (visual directions) swap the --accent-* vars via [data-theme].
   ============================================================ */

:root {
  /* surfaces — cool near-neutral slate, very low chroma */
  --bg:           oklch(0.155 0.012 256);
  --bg-2:         oklch(0.185 0.012 256);
  --surface:      oklch(0.205 0.013 256);
  --surface-2:    oklch(0.235 0.014 256);
  --surface-3:    oklch(0.275 0.015 256);
  --border:       oklch(0.305 0.013 256);
  --border-soft:  oklch(0.265 0.012 256);

  /* text */
  --text:         oklch(0.955 0.004 256);
  --text-2:       oklch(0.74 0.012 256);
  --text-3:       oklch(0.585 0.013 256);

  /* accent — overridden per theme below */
  --accent:       oklch(0.74 0.13 236);
  --accent-soft:  oklch(0.74 0.13 236 / 0.14);
  --accent-line:  oklch(0.74 0.13 236 / 0.32);
  --accent-text:  oklch(0.80 0.10 236);

  --radius:   14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --sidebar-w: 264px;
  --rail-w: 60px;
  --col: 740px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35);
}

/* visual directions */
[data-theme="beamline"]  { --accent: oklch(0.74 0.13 236); --accent-soft: oklch(0.74 0.13 236/.14); --accent-line: oklch(0.74 0.13 236/.34); --accent-text: oklch(0.81 0.10 236); }
[data-theme="antimatter"]{ --accent: oklch(0.72 0.15 318); --accent-soft: oklch(0.72 0.15 318/.15); --accent-line: oklch(0.72 0.15 318/.34); --accent-text: oklch(0.80 0.11 318); }
[data-theme="cryostat"]  { --accent: oklch(0.78 0.12 197); --accent-soft: oklch(0.78 0.12 197/.15); --accent-line: oklch(0.78 0.12 197/.34); --accent-text: oklch(0.84 0.10 197); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); }

/* subtle vignette + grain under the bg canvas */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
}
.app::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 70% -10%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 55%),
    radial-gradient(90% 70% at 0% 110%, oklch(0.22 0.02 256 / .6), transparent 60%);
}

/* ============================================================ SHELL */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  transition: grid-template-columns .32s var(--ease);
}
.app[data-sidebar="collapsed"] { grid-template-columns: var(--rail-w) 1fr; }

/* ============================================================ SIDEBAR */
.sidebar {
  position: relative; z-index: 3;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg-2) 86%, transparent);
  backdrop-filter: blur(18px);
  min-width: 0; overflow: hidden;
}
.side-head {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 16px 12px;
}
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, color-mix(in oklab, var(--accent) 30%, var(--surface-2)), var(--surface));
  border: 1px solid var(--accent-line);
  box-shadow: inset 0 0 12px color-mix(in oklab, var(--accent) 22%, transparent);
}
.brand-mark::after {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px 1px var(--accent);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name b { font-weight: 600; }
.brand-name span { color: var(--text-3); font-weight: 500; }
.collapse-btn {
  margin-left: auto; width: 30px; height: 30px; flex: none;
  display: grid; place-items: center; border-radius: 8px;
  background: transparent; border: 1px solid transparent; color: var(--text-3);
  transition: .18s;
}
.collapse-btn:hover { background: var(--surface); color: var(--text); }

.new-chat {
  margin: 4px 12px 14px; padding: 10px 12px;
  display: flex; align-items: center; gap: 9px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  transition: .18s;
}
.new-chat:hover { background: var(--surface-2); border-color: var(--accent-line); }
.new-chat svg { color: var(--accent-text); }

.conv-scroll { flex: 1; overflow-y: auto; padding: 0 8px; min-height: 0; }
.conv-group-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 10px 6px;
}
.conv-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 9px; margin-bottom: 1px;
  font-size: 13px; color: var(--text-2); border: 1px solid transparent;
  background: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: .14s;
}
.conv-item:hover { background: var(--surface); color: var(--text); }
.conv-item[aria-current="true"] { background: var(--surface-2); color: var(--text); border-color: var(--border-soft); }

.side-foot { border-top: 1px solid var(--border-soft); padding: 10px 12px 12px; }
.repo-chip {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border-soft);
  font-size: 11.5px; margin-bottom: 8px;
}
.repo-dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.78 0.15 150); box-shadow: 0 0 8px oklch(0.78 0.15 150/.7); flex: none; }
.repo-chip .mono { font-family: var(--mono); color: var(--text-2); font-size: 11px; line-height: 1.3; min-width: 0; }
.repo-chip .mono b { color: var(--text); font-weight: 500; }
.repo-chip .mono span { color: var(--text-3); }
.foot-row { display: flex; align-items: center; gap: 8px; }
.foot-btn {
  flex: 1; display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: 10px; background: transparent; border: 1px solid transparent;
  color: var(--text-2); font-size: 13px; transition: .15s;
}
.foot-btn:hover { background: var(--surface); color: var(--text); }
.foot-btn svg { color: var(--text-3); }

/* rail (collapsed) hides labels */
[data-sidebar="collapsed"] .brand-name,
[data-sidebar="collapsed"] .new-chat span,
[data-sidebar="collapsed"] .conv-scroll,
[data-sidebar="collapsed"] .repo-chip .mono,
[data-sidebar="collapsed"] .foot-btn span { display: none; }
[data-sidebar="collapsed"] .new-chat { justify-content: center; padding: 10px; }
[data-sidebar="collapsed"] .repo-chip { justify-content: center; }
[data-sidebar="collapsed"] .side-head { padding: 16px 0; justify-content: center; }
[data-sidebar="collapsed"] .collapse-btn { position: absolute; top: 16px; right: -14px; background: var(--surface-2); border-color: var(--border); z-index: 5; }

/* ============================================================ MAIN */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100dvh; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; min-height: 58px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg) 60%, transparent);
  backdrop-filter: blur(14px);
  z-index: 2;
}
.icon-btn {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: transparent; border: 1px solid transparent; color: var(--text-2);
  transition: .15s;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.menu-btn { display: none; }
.topbar-title { font-size: 14px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .sub { color: var(--text-3); font-weight: 400; }
.topbar-spacer { flex: 1; }

.model-pill {
  display: flex; align-items: center; gap: 7px; padding: 6px 11px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 11px; color: var(--text-2); white-space: nowrap;
}
.model-pill b { color: var(--text); font-weight: 500; }

/* state pill — hosts the compact 3D orb */
.state-pill {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-2); transition: border-color .3s;
}
.state-orb { width: 26px; height: 26px; flex: none; position: relative; }
.state-label { white-space: nowrap; font-weight: 500; }
.state-label .mono { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.app[data-state="reasoning"] .state-pill,
.app[data-state="answering"] .state-pill { border-color: var(--accent-line); }

/* ============================================================ CONVERSATION */
.conversation { flex: 1; overflow-y: auto; scroll-behavior: smooth; min-height: 0; }
.conversation-inner { max-width: var(--col); margin: 0 auto; padding: 30px 28px 16px; }

/* welcome / empty state */
.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(18px, 6vh, 70px); }
.hero-orb { width: clamp(180px, 34vh, 280px); height: clamp(180px, 34vh, 280px); position: relative; }
.welcome h1 {
  font-size: clamp(24px, 3.4vw, 33px); font-weight: 500; letter-spacing: -0.025em;
  margin: 8px 0 6px; text-wrap: balance;
}
.welcome h1 em { font-style: normal; color: var(--accent-text); }
.welcome p { color: var(--text-2); font-size: 15px; margin: 0 0 26px; max-width: 460px; text-wrap: pretty; line-height: 1.55; }

.suggests { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 600px; }
.suggest {
  text-align: left; padding: 14px 15px; border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--surface) 70%, transparent); border: 1px solid var(--border-soft);
  transition: .16s; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.suggest:hover { background: var(--surface-2); border-color: var(--accent-line); transform: translateY(-1px); }
.suggest .s-cat { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.suggest .s-text { font-size: 13.5px; color: var(--text); line-height: 1.4; }

/* messages */
.msg { display: flex; gap: 14px; margin: 26px 0; }
.msg.anim { animation: rise .4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg-avatar { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; margin-top: 1px; }
.msg.user .msg-avatar { background: var(--surface-3); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); }
.msg.assistant .msg-avatar {
  background: radial-gradient(circle at 50% 40%, color-mix(in oklab, var(--accent) 60%, transparent), var(--surface) 75%);
  border: 1px solid var(--accent-line);
  box-shadow: 0 0 14px color-mix(in oklab, var(--accent) 25%, transparent);
}
.msg.assistant .msg-avatar::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.msg-body { min-width: 0; flex: 1; padding-top: 3px; }
.msg-role { font-size: 12px; color: var(--text-3); margin-bottom: 5px; font-weight: 500; }
.msg.user .msg-content { color: var(--text); }

.msg-content { font-size: 15px; line-height: 1.68; color: var(--text); }
.msg-content p { margin: 0 0 13px; text-wrap: pretty; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content h3 { font-size: 15px; font-weight: 600; margin: 20px 0 9px; letter-spacing: -0.01em; }
.msg-content ul, .msg-content ol { margin: 0 0 13px; padding-left: 22px; }
.msg-content li { margin: 5px 0; }
.msg-content strong { font-weight: 600; color: var(--text); }
.msg-content code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--border-soft); padding: 1px 6px; border-radius: 6px; color: var(--accent-text); }
.msg-content pre {
  background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; margin: 0 0 14px; position: relative;
}
.msg-content pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 12.5px; line-height: 1.6; }
.code-head { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.tok-kw { color: var(--accent-text); }
.tok-str { color: oklch(0.78 0.11 150); }
.tok-com { color: var(--text-3); font-style: italic; }
.tok-fn { color: oklch(0.82 0.10 80); }

/* reasoning trace */
.trace { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: color-mix(in oklab, var(--surface) 55%, transparent); margin-bottom: 16px; overflow: hidden; }
.trace-head { display: flex; align-items: center; gap: 9px; padding: 10px 13px; font-size: 12.5px; color: var(--text-2); width: 100%; background: none; border: none; }
.trace-head .chev { margin-left: auto; transition: transform .25s; color: var(--text-3); }
.trace[open] .trace-head .chev, .trace.expanded .trace-head .chev { transform: rotate(90deg); }
.trace-spark { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex: none; }
.trace-body { padding: 0 13px 12px 30px; display: none; }
.trace.expanded .trace-body { display: block; }
.trace-step { font-size: 12.5px; color: var(--text-2); padding: 5px 0; display: flex; gap: 9px; align-items: baseline; }
.trace-step::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); flex: none; transform: translateY(-2px); }
.trace-step .mono { font-family: var(--mono); color: var(--text-3); font-size: 11.5px; }
/* live ReAct steps (Thought + Action streamed in real time) */
.trace-step .ts-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.trace-step .ts-act { font-family: var(--mono); font-size: 11.5px; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 1px 7px; border-radius: 6px; align-self: flex-start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-step .ts-thought { color: var(--text-3); font-size: 12px; line-height: 1.45; }
.trace.live .trace-spark { animation: spark-pulse 1.1s ease-in-out infinite; }
@keyframes spark-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.7); } }

/* login gate (demo-account access) */
#auth-overlay { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
  background: color-mix(in oklab, var(--bg, #0e0d0b) 75%, transparent); backdrop-filter: blur(10px); }
#auth-overlay .auth-card { width: min(92vw, 360px); background: var(--surface, #1a1916); border: 1px solid var(--border-soft, #2a2823);
  border-radius: 16px; padding: 30px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.5); text-align: center; }
#auth-overlay .auth-logo { font-size: 22px; font-weight: 700; color: var(--accent-text, #d97757); margin-bottom: 14px; }
#auth-overlay h2 { font-size: 18px; color: var(--text-1, #ece7dd); margin-bottom: 6px; }
#auth-overlay .auth-sub { font-size: 13px; color: var(--text-3, #8a857c); margin-bottom: 20px; line-height: 1.5; }
#auth-overlay form { display: flex; flex-direction: column; gap: 10px; }
#auth-overlay input, #auth-overlay textarea { width: 100%; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border-soft, #2a2823);
  background: var(--bg, #13120f); color: var(--text-1, #ece7dd); font-size: 14px; font-family: inherit; resize: vertical; }
#auth-overlay input:focus, #auth-overlay textarea:focus { outline: none; border-color: var(--accent, #d97757); }
#auth-overlay .auth-link { margin-top: 14px; background: none; border: none; color: var(--text-3, #8a857c); font-size: 12.5px; cursor: pointer; text-decoration: underline; }
#auth-overlay .auth-link:hover { color: var(--text-1, #ece7dd); }
#auth-overlay button { margin-top: 4px; padding: 11px; border-radius: 9px; border: none; cursor: pointer;
  background: var(--accent, #d97757); color: #fff; font-size: 14px; font-weight: 600; }
#auth-overlay button:disabled { opacity: .6; cursor: default; }
#auth-overlay .auth-err { min-height: 16px; font-size: 12.5px; color: #ff8a80; }

/* live retrieval indicator (while reasoning) */
.thinking { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13.5px; margin: 6px 0; }
.thinking .src { font-family: var(--mono); font-size: 11px; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 2px 8px; border-radius: 7px; animation: rise .3s var(--ease) both; }
.dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); margin: 0 1px; animation: blink 1.2s infinite both; }
.dots span:nth-child(2){ animation-delay: .2s; } .dots span:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{ opacity:.25 } 40%{ opacity:1 } }

/* citations */
.cites { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.cite {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px;
  border-radius: 8px; background: var(--surface); border: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 11px; color: var(--text-2); transition: .15s;
}
.cite:hover { border-color: var(--accent-line); color: var(--text); }
.cite .cnum { color: var(--accent-text); }
.cite .cline { color: var(--text-3); }
.source-card {
  margin-top: 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--bg-2); overflow: hidden; animation: rise .25s var(--ease) both;
}
.source-card .sc-head { display: flex; align-items: center; gap: 8px; padding: 9px 13px; font-family: var(--mono); font-size: 11px; color: var(--text-2); border-bottom: 1px solid var(--border-soft); }
.source-card .sc-head .cnum { color: var(--accent-text); }
.source-card pre { margin: 0; border: none; border-radius: 0; background: none; }

.answer-actions { display: flex; gap: 4px; margin-top: 12px; opacity: 0; transition: opacity .2s; }
.msg.assistant:hover .answer-actions { opacity: 1; }
.act-btn { display: flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--text-3); font-size: 12px; transition: .14s; }
.act-btn:hover { background: var(--surface); color: var(--text-2); }

/* ============================================================ COMPOSER */
.composer-wrap {
  padding: 8px 20px 18px; position: relative; z-index: 2;
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.composer {
  max-width: var(--col); margin: 0 auto; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
.composer textarea {
  width: 100%; border: none; background: none; resize: none; outline: none;
  font-family: inherit; font-size: 15px; line-height: 1.55; color: var(--text);
  padding: 15px 16px 4px; max-height: 200px; min-height: 26px; display: block;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 10px; }
.tool-btn { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 9px; background: transparent; border: 1px solid var(--border-soft); color: var(--text-2); font-size: 12.5px; transition: .15s; }
.tool-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.tool-btn.active { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.composer-bar .spacer { flex: 1; }
.send-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px;
  background: var(--accent); border: none; color: oklch(0.16 0.02 256); transition: .15s;
}
.send-btn:hover { filter: brightness(1.08); }
.send-btn:disabled { background: var(--surface-3); color: var(--text-3); cursor: default; filter: none; }
.send-btn.stop { background: var(--surface-3); color: var(--text); }
.composer-hint { max-width: var(--col); margin: 9px auto 0; text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }
.composer-hint kbd { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 4px; padding: 0 5px; font-family: inherit; }

/* ============================================================ SETTINGS */
.scrim { position: fixed; inset: 0; z-index: 40; background: oklch(0.1 0.01 256 / .55); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: .25s; }
.scrim.open { opacity: 1; visibility: visible; }
.settings {
  position: fixed; top: 0; right: 0; z-index: 41; height: 100dvh; width: 400px; max-width: 92vw;
  background: var(--bg-2); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .32s var(--ease);
  display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.4);
}
.settings.open { transform: none; }
.settings-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border-soft); }
.settings-head h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.settings-head .icon-btn { margin-left: auto; }
.settings-scroll { flex: 1; overflow-y: auto; padding: 8px 20px 30px; }
.set-group { padding: 18px 0; border-bottom: 1px solid var(--border-soft); }
.set-group:last-child { border: none; }
.set-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 13px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.set-row:last-child { margin-bottom: 0; }
.set-row .rl { font-size: 13.5px; color: var(--text); }
.set-row .rl small { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; font-weight: 400; }

/* theme swatches */
.themes { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.theme-opt { position: relative; padding: 12px 10px 10px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border-soft); text-align: center; transition: .16s; }
.theme-opt:hover { border-color: var(--border); }
.theme-opt[aria-pressed="true"] { border-color: var(--sw); box-shadow: 0 0 0 1px var(--sw); }
.theme-sw { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 9px; background: radial-gradient(circle at 40% 35%, color-mix(in oklab, var(--sw) 90%, white 15%), var(--sw) 70%, color-mix(in oklab,var(--sw) 30%, black)); box-shadow: 0 0 14px color-mix(in oklab, var(--sw) 50%, transparent); }
.theme-opt .tn { font-size: 11.5px; color: var(--text-2); display: block; }
.theme-opt .td { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); }

/* segmented + state demo */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { padding: 6px 12px; border-radius: 7px; background: transparent; border: none; font-size: 12.5px; color: var(--text-2); transition: .14s; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.state-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.state-demo { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-soft); font-size: 13px; color: var(--text-2); transition: .15s; }
.state-demo:hover { border-color: var(--border); color: var(--text); }
.state-demo[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.state-demo .sd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.state-demo[data-state="idle"] .sd-dot { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.state-demo[data-state="reasoning"] .sd-dot { background: oklch(0.8 0.13 80); box-shadow: 0 0 7px oklch(0.8 0.13 80); }
.state-demo[data-state="answering"] .sd-dot { background: oklch(0.8 0.15 150); box-shadow: 0 0 7px oklch(0.8 0.15 150); }

/* sliders + inputs */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 130px; height: 4px; border-radius: 4px; background: var(--surface-3); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 0 8px color-mix(in oklab,var(--accent) 60%, transparent); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }
.txt-in, .sel-in { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; color: var(--text); font-family: var(--mono); font-size: 12px; padding: 8px 10px; outline: none; transition: .15s; width: 100%; }
.txt-in:focus, .sel-in:focus { border-color: var(--accent-line); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.field.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* toggle */
.toggle { width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-soft); position: relative; transition: .2s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--text-2); transition: .2s; }
.toggle[aria-pressed="true"] { background: var(--accent); border-color: transparent; }
.toggle[aria-pressed="true"]::after { left: 19px; background: oklch(0.18 0.02 256); }

.set-note { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin-top: 10px; }
.set-note code { font-family: var(--mono); color: var(--accent-text); }

/* ============================================================ RESPONSIVE */
.density-compact .conversation-inner { padding-top: 18px; }
.density-compact .msg { margin: 18px 0; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr !important; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 282px; z-index: 50;
    transform: translateX(-100%); transition: transform .3s var(--ease);
  }
  .app[data-mobilenav="open"] .sidebar { transform: none; }
  .collapse-btn { display: none; }
  .menu-btn { display: grid; }
  .conversation-inner { padding: 22px 16px 12px; }
  .composer-wrap { padding: 8px 12px 14px; }
  .suggests { grid-template-columns: 1fr; }
  .model-pill { display: none; }
  .topbar { padding: 10px 14px; }
  .mobile-scrim { position: fixed; inset: 0; z-index: 49; background: oklch(0.1 0.01 256/.5); opacity: 0; visibility: hidden; transition: .25s; }
  .app[data-mobilenav="open"] .mobile-scrim { opacity: 1; visibility: visible; }
}
@media (min-width: 821px) { .mobile-scrim { display: none; } }

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; scroll-behavior: auto; }
}
