:root {
  --base: #ffffff;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-2: rgba(245, 245, 245, 0.7);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #0a0a0a;
  --text-muted: #525252;
  --text-dim: #737373;
  --accent: #2563EB;
  --accent-text: #1D4ED8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --success: #16a34a;
  --error: #dc2626;

  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --glass-blur: 16px;
  --glass-saturate: 180%;

  --f-display: 'Satoshi', 'DM Sans', system-ui, -apple-system, sans-serif;
  --f-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --base: #0a0a0a;
  --surface: rgba(20, 20, 20, 0.6);
  --surface-2: rgba(30, 30, 30, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #3B82F6;
  --accent-text: #60A5FA;
  --accent-soft: rgba(59, 130, 246, 0.1);
  --success: #22c55e;
  --error: #ef4444;

  --glass-bg: rgba(20, 20, 20, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ─── Mode accent colors ─────────────────────────────────────────────── */
[data-mode="chat"] {
  --accent: #2563EB;
  --accent-text: #1D4ED8;
  --accent-soft: rgba(37, 99, 235, 0.08);
}
[data-theme="dark"][data-mode="chat"] {
  --accent: #3B82F6;
  --accent-text: #60A5FA;
  --accent-soft: rgba(59, 130, 246, 0.1);
}

[data-mode="office-hours"] {
  --accent: #D97706;
  --accent-text: #B45309;
  --accent-soft: rgba(217, 119, 6, 0.08);
}
[data-theme="dark"][data-mode="office-hours"] {
  --accent: #F59E0B;
  --accent-text: #FBBF24;
  --accent-soft: rgba(245, 158, 11, 0.1);
}

[data-mode="investor"] {
  --accent: #059669;
  --accent-text: #047857;
  --accent-soft: rgba(5, 150, 105, 0.08);
}
[data-theme="dark"][data-mode="investor"] {
  --accent: #10B981;
  --accent-text: #34D399;
  --accent-soft: rgba(16, 185, 129, 0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--base); color-scheme: light dark; }
body {
  font-family: var(--f-body);
  color: var(--text);
  background: var(--base);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  transition: background 300ms, color 300ms;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: 0.018;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ─── Glass effect ─────────────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.2),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .glass {
  box-shadow: var(--glass-shadow),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.06),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.2);
}

/* ─── Topbar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.topbar__inner {
  max-width: 1040px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand__mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--f-mono); font-weight: 700; color: var(--accent-text);
  font-size: 14px; line-height: 1;
}
.brand__name { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.02em; color: var(--text-muted); }
.topbar__links { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-mono); font-size: 12px; color: var(--text-muted); }
.topbar__links a { color: var(--text-muted); text-decoration: none; transition: color 150ms; }
.topbar__links a:hover { color: var(--text); }
.dot { width: 3px; height: 3px; background: var(--border-strong); border-radius: 50%; }

.iconbtn {
  appearance: none; cursor: pointer;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 0;
  transition: color 150ms, background 150ms, border-color 150ms;
}
.iconbtn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.usage-pill {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  font: 500 12px/1 var(--f-mono);
  letter-spacing: 0.02em;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.usage-pill:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.usage-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.usage-pill.is-low { color: var(--accent-text); border-color: var(--accent); }
.usage-pill.is-empty { color: var(--error); border-color: var(--error); }
.usage-pill.is-unlocked #usageAction { color: var(--accent-text); }
.usage-pill.is-unlocked #usageLabel { display: none; }
.usage-pill.is-unlocked .dot { display: none; }

.modal__desc { margin: -4px 0 6px; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.modal__error { margin: 0; color: var(--error); font-size: 13px; }
.modal__success { margin: 0; color: var(--success); font-size: 13px; }

/* ─── Page layout ──────────────────────────────────────────────────────── */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* ─── Hero ─────────────────────────────────────────────────────────────── */
.hero { display: grid; gap: 12px; }
.hero__row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.hero__left {
  display: flex; align-items: center; gap: 12px;
}
.hero__meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 7px; border-radius: 9999px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent-text);
  font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
}
.tag__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); animation: pulse 2s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.mono { font-family: var(--f-mono); font-size: 12px; color: var(--text-dim); letter-spacing: 0.01em; }

.hero__title {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--text);
}
.accent { color: var(--accent-text); }
.hero__sub {
  color: var(--text-muted);
  font-size: 13px; line-height: 1.55;
  margin: 0;
  display: grid; gap: 4px;
}
.hero__sub p { margin: 0; }
.hero__sub strong { color: var(--text); font-weight: 600; }
.hero__sub a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.hero__sub a:hover { border-bottom-color: var(--accent-text); }

.hero__prompts { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

.mode-selector { display: flex; gap: 4px; }
.mode-pill {
  appearance: none; border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  padding: 5px 12px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.mode-pill:hover { color: var(--text-muted); border-color: var(--border-strong); }
.mode-pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-text);
  color: var(--accent-text);
  font-weight: 600;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  appearance: none; border: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-muted);
  padding: 6px 11px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms, background 150ms, transform 150ms var(--ease-out);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.chip:active { transform: translateY(0); }

/* ─── Chat panel (liquid glass) ────────────────────────────────────────── */
.chat {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: min(520px, 60dvh);
  box-shadow: var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
}

.chat__model {
  padding: 10px 16px 0;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

[data-theme="dark"] .chat {
  box-shadow: var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat__log {
  padding: 24px;
  display: grid;
  gap: 22px;
  max-height: 62dvh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.chat__log::-webkit-scrollbar { width: 10px; }
.chat__log::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.chat__log::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: padding-box; }

.msg { display: grid; gap: 6px; max-width: 92%; }
.msg__who {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
}
.msg__body {
  padding: 14px 16px; border-radius: var(--radius-lg);
  line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;
  font-size: 15.5px;
}
.msg--user { justify-self: end; text-align: right; }
.msg--user .msg__who { color: var(--text-muted); }
.msg--user .msg__body {
  background: var(--text);
  color: var(--base);
  border: none;
  text-align: left;
}
.msg--assistant .msg__body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.msg--intro .msg__body { background: transparent; border-color: transparent; padding-left: 0; padding-right: 0; color: var(--text-muted); }

.msg__body .cursor {
  display: inline-block; width: 8px; height: 1.1em;
  vertical-align: -2px; background: var(--accent);
  margin-left: 2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.msg__body a {
  color: var(--accent-text); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.msg__body a:hover { text-decoration-thickness: 2px; }
.msg__body .msg__img {
  display: block; max-width: 100%; max-height: 320px;
  border-radius: var(--radius-md); margin: 8px 0;
}

/* ─── Composer ─────────────────────────────────────────────────────────── */
.composer {
  display: grid; grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 8px 10px;
  padding: 14px 14px 10px;
  border-top: 1px solid var(--border);
}
.composer textarea {
  grid-column: 1 / -1;
  appearance: none; resize: none;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--f-body);
  font-size: 15px; line-height: 1.5;
  max-height: 240px;
  min-height: 44px;
  transition: border-color 150ms, box-shadow 150ms;
}
.composer textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .composer textarea:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}
.send {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  align-self: end;
  background: var(--text); color: var(--base);
  border: none;
  padding: 0 16px; min-height: 44px;
  border-radius: var(--radius-md);
  font-family: var(--f-mono); font-weight: 500; font-size: 13px;
  letter-spacing: 0.02em;
  transition: opacity 150ms, transform 150ms var(--ease-out);
}
.send:hover:not(:disabled) { opacity: 0.85; }
.send:active:not(:disabled) { transform: scale(0.98); }
.send:disabled { opacity: 0.4; cursor: not-allowed; }

.composer__toolbar {
  display: flex; align-items: center; gap: 4px;
  grid-column: 1;
}
.composer__toolbar .iconbtn {
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color 150ms, background 150ms;
}
.composer__toolbar .iconbtn:hover { color: var(--text); background: var(--surface-2); }

.composer__attachments {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 0;
}
.composer__attachments[hidden] { display: none; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--f-mono); font-size: 11px;
  color: var(--text-muted);
  max-width: 200px;
}
.attachment-chip__name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attachment-chip__remove {
  appearance: none; border: none; background: none;
  cursor: pointer; padding: 0; line-height: 1;
  color: var(--text-dim); font-size: 14px;
}
.attachment-chip__remove:hover { color: var(--error); }
.attachment-chip img {
  width: 24px; height: 24px; object-fit: cover; border-radius: 3px;
}

.composer__hint {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 4px 16px 14px;
  color: var(--text-dim);
  font-size: 11px;
}
kbd {
  font-family: var(--f-mono); font-size: 10.5px;
  padding: 1px 5px; border-radius: 3px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted);
}
.status { color: var(--text-dim); }
.status.active { color: var(--accent-text); }
.status.error  { color: var(--error); }
.status.ok     { color: var(--success); }

/* ─── Footer ──────────────────────────────────────────────────────────── */
.foot {
  display: flex; flex-wrap: wrap; gap: 8px;
  color: var(--text-dim);
  font-size: 11.5px;
  justify-content: center;
  text-align: center;
}
.foot a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border); transition: color 150ms, border-color 150ms; }
.foot a:hover { color: var(--text); border-bottom-color: var(--text-dim); }
.foot__sep { opacity: 0.4; }

/* ─── Modal (liquid glass) ─────────────────────────────────────────────── */
.modal {
  padding: 0; border: none; background: transparent;
  max-width: 520px; width: calc(100% - 32px);
  color: var(--text);
}
.modal::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); }
.modal[open] { animation: modalIn 200ms var(--ease-out); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 22px 22px 18px;
  display: grid; gap: 16px;
  box-shadow: var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .modal__panel {
  box-shadow: var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__title {
  font-family: var(--f-display); font-weight: 700;
  font-size: 22px; letter-spacing: -0.015em; margin: 0;
}
.modal__lede { margin: -4px 0 2px; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.field { display: grid; gap: 6px; }
.field--status { padding-top: 2px; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 10px; min-height: 18px; }
.field__label {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
}
.field__hint { color: var(--text-dim); font-size: 11px; margin: 0; }
.field__hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); }
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="password"] {
  appearance: none;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: var(--f-mono); font-size: 13px;
  width: 100%;
  transition: border-color 150ms;
}
.field input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .field input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}
.segmented label {
  display: grid; place-items: center;
  padding: 8px 10px;
  border-radius: calc(var(--radius-md) - 2px);
  font-family: var(--f-mono); font-size: 12px; color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.segmented label:has(input:checked) { background: var(--base); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.ghostbtn {
  appearance: none; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 9px 14px; min-height: 38px;
  border-radius: var(--radius-md);
  font-family: var(--f-mono); font-size: 12px;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.ghostbtn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.send--sm { min-height: 38px; padding: 0 14px; font-size: 12px; }

/* ─── Voice toggle button ──────────────────────────────────────────────── */
.voice-toggle {
  appearance: none; cursor: pointer;
  display: inline-grid; place-items: center;
  width: 32px; min-height: 32px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms, border-color 150ms, transform 150ms var(--ease-out);
}
.voice-toggle:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.voice-toggle:disabled { opacity: 0.4; cursor: not-allowed; }
.voice-toggle.is-on {
  color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.voice-toggle.is-listening {
  color: var(--base); background: var(--accent); border-color: var(--accent);
  animation: voice-pulse 1.3s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50%     { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.msg__speak {
  justify-self: end;
  margin-top: 2px;
  width: 26px; height: 26px;
  color: var(--text-dim);
}
.msg--user .msg__speak { display: none; }

/* ─── Voice settings ───────────────────────────────────────────────────── */
.field--voice { display: grid; gap: 10px; }
.voice-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 10px;
}
.voice-grid select {
  appearance: none;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px; font-family: var(--f-mono); font-size: 12px;
}
.voice-grid select:focus { outline: none; border-color: var(--border-strong); }
.voice-slider {
  display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 11px; color: var(--text-dim);
}
.voice-slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 12px; color: var(--text-muted);
  cursor: pointer;
}
.checkbox input { accent-color: var(--accent); }

/* ─── Theme toggle ─────────────────────────────────────────────────────── */
.theme-toggle {
  appearance: none; cursor: pointer;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 0;
  transition: color 150ms, background 150ms, border-color 150ms;
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ─── Responsive: tablet ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page { padding: 16px 16px 40px; gap: 14px; }
  .topbar__inner { padding: 12px 16px; }
  .topbar__links a { display: none; }
  .topbar__links .dot:nth-child(-n+4) { display: none; }
  .chat { min-height: 400px; border-radius: var(--radius-lg); }
  .chat__log { padding: 18px; max-height: 60vh; }
  .hero__title { font-size: clamp(24px, 6vw, 34px); }
}

/* ─── Responsive: phone ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .page { padding: 10px 10px 24px; gap: 10px; }
  .topbar__inner { padding: 10px 12px; }
  .brand__name { display: none; }
  .brand__mark { width: 26px; height: 26px; font-size: 13px; }

  .hero { gap: 8px; }
  .hero__row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hero__left { gap: 8px; }
  .hero__title { font-size: 24px; }
  .hero__sub { font-size: 12px; }
  .hero__prompts { gap: 8px; }
  .mode-pill { padding: 4px 9px; font-size: 11px; }
  .chip-row { gap: 5px; }
  .chip { padding: 5px 9px; font-size: 11px; }

  .chat { min-height: 0; border-radius: var(--radius-md); }
  .chat__log { padding: 12px; max-height: 52vh; gap: 16px; }
  .msg { max-width: 98%; }
  .msg__body { padding: 10px 12px; font-size: 14.5px; border-radius: var(--radius-md); }
  .msg__who { font-size: 10px; }

  .composer { padding: 10px; gap: 8px; grid-template-columns: 1fr auto; }
  .composer textarea { padding: 10px 12px; font-size: 14px; min-height: 40px; border-radius: var(--radius-sm); }
  .send__label { display: none; }
  .send { padding: 0 12px; min-height: 40px; border-radius: var(--radius-sm); }
  .voice-toggle { width: 32px; min-height: 32px; border-radius: var(--radius-sm); }
  .composer__hint { padding: 2px 12px 10px; font-size: 10px; }
  .composer__hint kbd { font-size: 9.5px; }

  .foot { font-size: 10px; padding: 0 8px; }
  .foot__sep { display: none; }
  .foot { flex-direction: column; gap: 2px; }

  .modal { width: calc(100% - 16px); max-width: none; }
  .modal__panel { padding: 16px 14px; gap: 12px; border-radius: var(--radius-lg); }
  .modal__title { font-size: 18px; }
  .modal__lede { font-size: 12px; }
  .field input[type="text"],
  .field input[type="url"],
  .field input[type="email"],
  .field input[type="password"] { padding: 9px 10px; font-size: 12px; }
  .segmented label { padding: 7px 8px; font-size: 11px; }
  .ghostbtn { padding: 8px 12px; min-height: 36px; font-size: 11px; }
  .send--sm { min-height: 36px; padding: 0 12px; font-size: 11px; }

  .usage-pill { height: 26px; padding: 0 8px; font-size: 11px; gap: 5px; }
  .iconbtn { width: 26px; height: 26px; }
  .theme-toggle { width: 26px; height: 26px; }
  .topbar__links { gap: 6px; }
}

/* ─── Safe area (notch / home indicator) ─────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .page { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ─── Touch: larger hit targets on coarse pointers ───────────────────── */
@media (pointer: coarse) {
  .chip { padding: 8px 12px; font-size: 12px; }
  .iconbtn { width: 36px; height: 36px; }
  .theme-toggle { width: 36px; height: 36px; }
  .voice-toggle { width: 36px; min-height: 36px; }
  .send { min-height: 46px; }
  .composer textarea { min-height: 46px; }
}
