/* Gusten AI. Same design language as Founders AI OS: open white canvas, charcoal dark mode, Geist, 1px hairlines,
   ink actions, sentence case, no shadows. */
/* Gusten AI. Gusten Sun brand: ivory paper, forest-green ink, sage details, Makira throughout.
   Square corners on surfaces, pills only for chips, hairlines instead of shadows. */
@font-face { font-family: "Makira"; src: url("/fonts/makira-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Makira"; src: url("/fonts/makira-medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Makira"; src: url("/fonts/makira-semibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
:root, [data-theme="light"] {
  --ground: #FAF7EF; --surface: #FAF7EF; --side: #F2EFE4; --raised: #EDEADF; --active: #E5E9DD; --tile: #E5E9DD;
  --border: rgba(11, 36, 24, .12); --rule: rgba(11, 36, 24, .10); --control: rgba(11, 36, 24, .22);
  --text: #0B2418; --muted: #4F5A4D; --faint: #61685C;
  --accent: #668168; --sage: #4E6A50; --primary: #0B2418; --primary-ink: #FAF7EF;
  --positive: #4E6A50; --negative: #0B2418; --warning: #61685C;
  --pill-positive-bg: #E5E9DD; --pill-positive-ink: #2F4A32;
  --pill-warning-bg: #F2EFE4; --pill-warning-ink: #4F5A4D;
  --pill-negative-bg: #F2EFE4; --pill-negative-ink: #0B2418;
  --pill-neutral-bg: #F2EFE4; --pill-neutral-ink: #4F5A4D;
  --dots: rgba(11, 36, 24, .12);
  --scrim: rgba(11, 36, 24, .38);
  color-scheme: light;
}
[data-theme="dark"] {
  --ground: #0B1C13; --surface: #0E2218; --side: #091710; --raised: #13291E; --active: #183225; --tile: #13291E;
  --border: rgba(250, 247, 239, .11); --rule: rgba(250, 247, 239, .09); --control: rgba(250, 247, 239, .22);
  --text: #FAF7EF; --muted: rgba(250, 247, 239, .78); --faint: rgba(250, 247, 239, .64);
  --accent: #B9C9B8; --sage: #B9C9B8; --primary: #FAF7EF; --primary-ink: #0B2418;
  --positive: #B9C9B8; --negative: #FAF7EF; --warning: #E8DDBF;
  --pill-positive-bg: #183225; --pill-positive-ink: #C9D8C7;
  --pill-warning-bg: #2A2A1C; --pill-warning-ink: #E8DDBF;
  --pill-negative-bg: #13291E; --pill-negative-ink: #FAF7EF;
  --pill-neutral-bg: #13291E; --pill-neutral-ink: rgba(250, 247, 239, .78);
  --dots: rgba(250, 247, 239, .08);
  --scrim: rgba(3, 10, 6, .62);
  color-scheme: dark;
}
:root {
  --font: "Makira", "Plus Jakarta Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar: 268px; --radius: 4px; --radius-c: 3px; --h: 40px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1); --t: 160ms;
  --read: 740px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 14.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wordmark { font-family: var(--font); font-size: 19px; line-height: 1; letter-spacing: -0.035em; font-weight: 600; display: inline-flex; align-items: center; gap: 9px; color: var(--text); }
.wordmark .mk { width: 22px; height: 22px; background: var(--text); color: var(--ground); display: inline-grid; place-items: center; font-size: 13px; letter-spacing: -0.02em; flex: none; }
.wordmark .ai { color: var(--sage); font-weight: 500; }
.boot { height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 14px; border-radius: var(--radius-c); border: 1px solid var(--control); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background var(--t), border-color var(--t), transform 120ms; }
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--raised); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.danger { color: var(--negative); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-c); color: var(--muted); transition: background var(--t), color var(--t); }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn.on { color: var(--text); background: var(--active); }

/* Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 14px 18px; }
.side-new { margin: 0 12px 10px; }
.side-new .btn { width: 100%; justify-content: flex-start; }
.side-scroll { overflow-y: auto; flex: 1; min-height: 0; padding: 4px 8px 12px; }
.side-label { font-size: 12px; color: var(--faint); padding: 14px 10px 6px; font-weight: 500; }
.nav-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-align: left; text-decoration: none; transition: background var(--t), color var(--t); }
.nav-row:hover { background: var(--raised); color: var(--text); }
.nav-row.on { background: var(--active); color: var(--text); font-weight: 500; }
.nav-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row .glyph { width: 18px; height: 18px; display: grid; place-items: center; flex: none; }
.nav-row .del { opacity: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--faint); }
.nav-row:hover .del, .nav-row:focus-within .del { opacity: 1; }
.nav-row .del:hover { color: var(--negative); background: var(--ground); }
.thread-row { font-size: 13.5px; min-height: 32px; }
.side-empty { font-size: 13px; color: var(--faint); padding: 4px 10px; }
.side-foot { border-top: 1px solid var(--border); padding: 8px; position: relative; }
.me-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.me-row:hover { background: var(--raised); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--active); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.me-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius); padding: 6px; z-index: 30; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; text-decoration: none; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--raised); }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 6px 4px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.top { height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.top .menu-btn { display: none; }
.top h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; margin: 0; white-space: nowrap; }
.top .sub { color: var(--faint); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: auto; }
.col { width: 100%; max-width: var(--read); margin: 0 auto; padding: 0 24px; }

/* Empty state */
.hello { min-height: calc(100% - 10px); display: flex; flex-direction: column; justify-content: center; padding: 40px 0 24px; }
.hello h2 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.15; margin: 0 0 8px; text-wrap: balance; }
.hello p.lead { color: var(--muted); margin: 0 0 26px; font-size: 15px; max-width: 54ch; }
.starters { margin-top: 22px; border-top: 1px solid var(--rule); }
.starter { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 4px; border-bottom: 1px solid var(--rule); text-align: left; color: var(--muted); transition: color var(--t); }
.starter:hover { color: var(--text); }
.starter svg { margin-left: auto; opacity: .55; }

/* Composer */
.composer-wrap { flex: none; padding: 10px 0 18px; background: var(--ground); }
.composer { border: 1px solid var(--control); border-radius: 16px; background: var(--surface); padding: 10px 10px 8px 14px; transition: border-color var(--t); }
.composer:focus-within { border-color: var(--text); }
.composer.drag { border-style: dashed; border-color: var(--text); background: var(--raised); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 15px; line-height: 1.5; max-height: 220px; min-height: 26px; padding: 4px 0; }
.composer textarea::placeholder { color: var(--faint); }
.composer .row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.composer .row .grow { flex: 1; }
.send { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; transition: opacity var(--t); }
.send[disabled] { opacity: .25; cursor: default; }
.send.stop { background: var(--text); }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.file { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; height: 32px; padding: 0 6px 0 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--raised); }
.file img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; color: var(--faint); }
.file button:hover { color: var(--text); background: var(--active); }
.hint { font-size: 12px; color: var(--faint); text-align: center; margin-top: 8px; }

/* Conversation */
.thread { padding: 28px 0 8px; }
.turn { padding: 6px 0 30px; }
.turn + .turn { border-top: 1px solid var(--rule); padding-top: 30px; }
.q { font-size: 21px; font-weight: 550; letter-spacing: -0.03em; line-height: 1.35; margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.q-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.q-files .file { background: transparent; }
.label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 18px 0 10px; color: var(--text); }
.label svg { width: 16px; height: 16px; }
.label .by { font-weight: 400; color: var(--faint); margin-left: auto; font-size: 12px; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.src { display: flex; flex-direction: column; gap: 4px; min-height: 74px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; text-align: left; transition: background var(--t), border-color var(--t); min-width: 0; }
a.src:hover, button.src:hover { background: var(--raised); }
.src.flash { border-color: var(--text); }
.src .k { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.src .n { width: 18px; height: 18px; border-radius: 5px; background: var(--active); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.src .tt { font-size: 13px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.src-more { font-size: 13px; color: var(--muted); border: 1px dashed var(--control); border-radius: 10px; min-height: 74px; }
.answer { font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.answer p { margin: 0 0 14px; }
.answer h2, .answer h3, .answer h4 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; margin: 22px 0 8px; line-height: 1.35; }
.answer ul, .answer ol { margin: 0 0 14px; padding-left: 22px; }
.answer li { margin: 4px 0; padding-left: 2px; }
.answer li::marker { color: var(--faint); }
.answer blockquote { margin: 0 0 14px; padding: 2px 0 2px 14px; border-left: 2px solid var(--control); color: var(--muted); }
.answer code { font-family: var(--mono); font-size: 13px; background: var(--raised); padding: 1px 5px; border-radius: 5px; }
.answer pre { background: var(--raised); border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: 0 0 14px; }
.answer pre code { background: none; padding: 0; }
.answer hr { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }
.answer a { text-underline-offset: 3px; }
.answer strong { font-weight: 600; }
.answer > :last-child { margin-bottom: 0; }
.cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px 0 3px; border-radius: 5px; background: var(--active); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: 2px; line-height: 1; font-variant-numeric: tabular-nums; transition: background var(--t), color var(--t); }
.cite:hover { background: var(--text); color: var(--ground); }
.caret { display: inline-block; width: 7px; height: 16px; background: var(--text); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 4px 0; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite var(--ease); }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.actions { display: flex; align-items: center; gap: 2px; margin-top: 12px; color: var(--faint); }
.actions .icon-btn { width: 32px; height: 32px; }
.related { margin-top: 18px; }
.related button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 2px; border-top: 1px solid var(--rule); color: var(--text); font-size: 14.5px; transition: color var(--t); }
.related button:last-child { border-bottom: 1px solid var(--rule); }
.related button:hover { color: var(--accent); }
.related button svg { margin-left: auto; color: var(--faint); }
.err { border: 1px solid var(--border); border-left: 2px solid var(--negative); border-radius: 10px; padding: 12px 14px; margin: 6px 0; font-size: 14px; }
.err p { margin: 0 0 8px; }
.err .btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sheets (library, my business) */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade var(--t) var(--ease); }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 41; display: flex; flex-direction: column; animation: slide 220ms var(--ease); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px 22px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 16px; font-weight: 600; margin: 0; flex: 1; letter-spacing: -0.015em; }
.sheet-body { padding: 18px 22px 28px; overflow-y: auto; flex: 1; }
.sheet-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field small { display: block; font-size: 12px; color: var(--faint); margin-top: 5px; }
.input, .textarea, select.input { width: 100%; height: var(--h); border: 1px solid var(--control); border-radius: var(--radius-c); padding: 0 12px; background: var(--surface); outline: 0; transition: border-color var(--t); }
.textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus { border-color: var(--text); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.search .input { padding-left: 36px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { height: 30px; padding: 0 11px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.tab:hover { background: var(--raised); color: var(--text); }
.tab.on { background: var(--active); color: var(--text); font-weight: 500; }
.lib-item { padding: 13px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; }
.lib-item .tt { font-weight: 500; overflow-wrap: anywhere; }
.lib-item .meta { font-size: 12px; color: var(--faint); grid-column: 1; }
.lib-item .pv { font-size: 13px; color: var(--muted); grid-column: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-item .go { grid-row: 1 / span 3; grid-column: 2; }

/* Voice */
.voice { position: fixed; inset: 0; z-index: 50; background: var(--ground); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; animation: fade 200ms var(--ease); padding: 24px; }
.voice .who { text-align: center; }
.voice .who .wordmark { font-size: 30px; }
.voice .who p { margin: 8px 0 0; color: var(--muted); }
.orb { width: 168px; height: 168px; border-radius: 50%; background: var(--text); position: relative; transform: scale(calc(1 + var(--lv, 0) * .14)); transition: transform 90ms linear; }
.orb::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 1px solid var(--control); transform: scale(calc(1 + var(--lv, 0) * .3)); transition: transform 90ms linear; }
.orb.thinking { animation: breathe 1.6s infinite var(--ease); }
.orb.connecting { opacity: .35; animation: breathe 1.6s infinite var(--ease); }
@keyframes breathe { 50% { transform: scale(.94); } }
.voice .state { font-size: 15px; font-weight: 500; min-height: 22px; }
.voice .controls { display: flex; gap: 12px; }
.voice .controls .round { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--control); display: grid; place-items: center; background: var(--surface); }
.voice .controls .round:hover { background: var(--raised); }
.voice .controls .round.on { background: var(--text); color: var(--ground); border-color: var(--text); }
.voice .controls .end { background: var(--negative); border-color: var(--negative); color: #fff; }
.voice .controls .end:hover { background: var(--negative); opacity: .9; }
.voice .note { font-size: 13px; color: var(--faint); max-width: 40ch; text-align: center; }

/* Auth and gate */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { border-right: 1px solid var(--border); padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: clamp(34px, 4vw, 52px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.04; margin: 0 0 18px; max-width: 13ch; }
.auth-side p { color: var(--muted); font-size: 15px; max-width: 46ch; margin: 0; }
.auth-chans { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 26px; max-width: 520px; }
.chip { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form, .gate { width: 100%; max-width: 360px; }
.auth-form h2, .gate h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 6px; }
.auth-form .sub, .gate .sub { color: var(--muted); margin: 0 0 22px; }
.auth-form .btn.primary { width: 100%; height: 42px; margin-top: 4px; }
.auth-alt { margin-top: 16px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-alt button { text-decoration: underline; text-underline-offset: 3px; color: var(--text); }
.form-msg { font-size: 13px; margin: 0 0 14px; padding: 10px 12px; border-radius: 9px; background: var(--raised); }
.form-msg.bad { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.form-msg a { font-weight: 500; }
.gate-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate .wordmark { display: block; margin-bottom: 28px; }
.gate .steps { margin: 18px 0 24px; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.gate .steps li { padding: 11px 0; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 14px; display: flex; gap: 10px; }
.gate .steps li b { color: var(--text); font-weight: 500; }

/* Admin */
.admin { padding: 28px 0 60px; }
.admin h2 { font-size: 25px; font-weight: 600; letter-spacing: -0.035em; margin: 0 0 4px; }
.admin h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; margin: 34px 0 10px; }
.admin .lead { color: var(--muted); margin: 0 0 8px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 22px; }
.stat { padding: 14px 0 14px 16px; border-left: 1px solid var(--rule); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat b { display: block; font-size: 26px; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--faint); }
.member { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.member .who { min-width: 0; }
.member .who b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .who span { font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.member .use { font-size: 12px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.member .btns { display: flex; gap: 6px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.wait { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill.no { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.setting { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.setting .l b { display: block; font-weight: 500; }
.setting .l span { font-size: 12px; color: var(--faint); }
.setting .r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.setting .r .input { flex: 1; min-width: 180px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--control); flex: none; }
.dot.ok { background: var(--positive); }
.dot.no { background: var(--negative); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--ground); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms var(--ease); z-index: 60; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mobile */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 45; transform: translateX(-100%); transition: transform 240ms var(--ease); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 44; }
  .top { padding: 0 12px; }
  .top .menu-btn { display: inline-grid; }
  .top .sub { display: none; } .top h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .col { padding: 0 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { border-right: 0; border-bottom: 1px solid var(--border); padding: 28px 20px; gap: 24px; }
  .auth-side h1 { font-size: 32px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .member { grid-template-columns: minmax(0, 1fr) auto; }
  .member .use { grid-column: 1; text-align: left; }
  .member .btns { grid-column: 2; grid-row: 1 / span 2; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .q { font-size: 19px; }
  .sources { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .orb, .orb::after { transform: none !important; }
}

/* ---------- Brand layer ---------- */
.side { background: var(--side); }
.side-new { margin: 0 8px 6px; }
.side-new .btn { height: 36px; padding: 0 10px; gap: 10px; background: transparent; color: var(--text); border: 1px solid var(--rule); border-radius: 3px; font-weight: 500; box-shadow: none; }
.side-new .btn svg { color: var(--sage); }
.side-new .btn:hover { background: var(--raised); border-color: var(--rule); opacity: 1; }
.nav-row { border-radius: 3px; }
.nav-row.on { background: var(--active); }
.nav-row .num { width: 18px; font-size: 11.5px; font-weight: 500; color: var(--sage); font-variant-numeric: tabular-nums; flex: none; text-align: left; letter-spacing: 0; }
.nav-row.on .num { color: var(--text); }
.me-row { border-radius: 3px; }
.avatar { border-radius: 50%; background: var(--text); color: var(--ground); }
.menu { border-radius: 4px; background: var(--ground); }
.menu button, .menu a { border-radius: 3px; }
.top { background: var(--ground); }
.top h1 { font-weight: 600; letter-spacing: -0.025em; }
.btn { border-radius: 999px; background: transparent; }
.btn.primary { border-radius: 2px; }
.btn.danger { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { border-radius: 3px; }
/* Empty channel: a quiet dot grid behind the greeting */
.scroll.is-hello { background-image: radial-gradient(circle, var(--dots) 1px, transparent 1.6px); background-size: 22px 22px; background-position: center top; }
.hello h2 { font-size: clamp(32px, 3.6vw, 46px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.07; margin: 0 0 14px; }
.hello p.lead { font-size: 16px; color: var(--muted); }
.starters { border-top: 1px solid var(--rule); background: var(--ground); }
.starter { color: var(--text); padding: 15px 4px; gap: 16px; font-size: 15px; }
.starter:hover { color: var(--sage); }
.starter .num { font-size: 12px; color: var(--sage); font-weight: 500; width: 20px; flex: none; font-variant-numeric: tabular-nums; }
/* Composer */
.composer { border-radius: 4px; border-color: var(--control); background: var(--surface); }
.composer:focus-within { border-color: var(--text); }
.send { border-radius: 2px; }
.file { border-radius: 3px; }
/* Answer */
.q { font-weight: 500; font-size: 25px; letter-spacing: -0.035em; line-height: 1.2; }
.label { font-weight: 500; }
.label svg { color: var(--sage); }
.src { background: var(--tile); border-color: transparent; border-radius: 2px; }
a.src:hover, button.src:hover { background: var(--active); border-color: var(--control); }
.src.flash { border-color: var(--text); }
.src .n { background: var(--text); color: var(--ground); border-radius: 2px; }
.src-more { border-radius: 2px; }
.answer { font-size: 16px; line-height: 1.72; }
.answer h2, .answer h3, .answer h4 { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.answer li::marker { color: var(--sage); font-weight: 500; }
.answer blockquote { border-left-color: var(--sage); }
.answer code, .answer pre { border-radius: 3px; }
.cite { background: var(--tile); color: var(--sage); border-radius: 2px; }
.cite:hover { background: var(--text); color: var(--ground); }
.related button:hover { color: var(--sage); }
.err { border-radius: 3px; border-left: 2px solid var(--text); background: var(--side); }
/* Dialogs open in the middle of the page, never as a side panel */
.sheet { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(640px, calc(100vw - 32px)); max-height: min(86vh, 860px); border: 1px solid var(--border); border-radius: 4px; background: var(--ground); animation: pop 200ms var(--ease); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); } }
.input, .textarea, select.input { border-radius: 3px; background: var(--surface); }
.tab { border-radius: 999px; }
.tab.on { background: var(--text); color: var(--ground); }
/* Voice: a full forest-green room in both modes */
.voice { background: #0B2418; color: #FAF7EF; --control: rgba(250, 247, 239, .25); }
.voice .who .wordmark { font-size: 24px; color: #FAF7EF; }
.voice .who .wordmark .mk { background: #FAF7EF; color: #0B2418; }
.voice .who .wordmark .ai { color: #B9C9B8; }
.voice .who p { color: rgba(250, 247, 239, .7); }
.voice .orb { background: #FAF7EF; }
.voice .orb::after { border-color: rgba(250, 247, 239, .28); }
.voice .controls .round { background: transparent; color: #FAF7EF; border-color: rgba(250, 247, 239, .3); }
.voice .controls .round:hover { background: rgba(250, 247, 239, .08); }
.voice .controls .round.on { background: #FAF7EF; color: #0B2418; }
.voice .controls .end { background: #FAF7EF; color: #0B2418; border-color: #FAF7EF; }
.voice .controls .end:hover { background: #FAF7EF; opacity: .88; }
.voice .note { color: rgba(250, 247, 239, .64); }
/* Sign in: forest panel with the dot grid */
.auth-side { background: #0B2418; color: #FAF7EF; border-right: 0; background-image: radial-gradient(circle, rgba(250, 247, 239, .09) 1px, transparent 1.6px); background-size: 22px 22px; }
.auth-side .wordmark { color: #FAF7EF; } .auth-side .wordmark .mk { background: #FAF7EF; color: #0B2418; } .auth-side .wordmark .ai { color: #B9C9B8; }
.auth-side h1 { font-size: clamp(40px, 4.8vw, 64px); letter-spacing: -0.045em; line-height: 1.04; }
.auth-side p { color: rgba(250, 247, 239, .78); font-size: 16px; }
.auth-side .chip { border-color: rgba(250, 247, 239, .2); color: rgba(250, 247, 239, .85); }
.auth-side .foot { color: rgba(250, 247, 239, .62); }
.auth-alt button { color: var(--text); }
.form-msg { border-radius: 3px; }
.stat b { font-size: 34px; letter-spacing: -0.04em; }
.pill { border-radius: 999px; }
.dot.no { background: transparent; border: 1.5px solid var(--faint); }
#toast { border-radius: 3px; }
@media (max-width: 860px) {
  .auth-side { border-bottom: 0; }
  .sheet { top: auto; bottom: 0; left: 0; transform: none; width: 100vw; max-height: 90vh; border-radius: 6px 6px 0 0; animation: rise 220ms var(--ease); }
  .hello h2 { font-size: 32px; }
  .q { font-size: 21px; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* AI keys */
.keyrow { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px dashed var(--rule); }
.keyrow:last-of-type { border-bottom: 0; }
.keyrow .r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.keyrow .r .input { flex: 1; min-width: 180px; }
.key-err { margin: 0; font-size: 13px; color: var(--text); }
.key-err a { text-decoration: underline; }

/* Demo and accounts */
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; color: var(--faint); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.demo-btn { width: 100%; height: 42px; justify-content: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.auth-form a.btn.primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.demo-note { display: flex; flex-direction: column; gap: 6px; padding: 12px; margin: 0 0 10px; background: var(--tile); border-radius: var(--radius); font-size: 12px; color: var(--muted); }
.demo-note b { color: var(--text); font-size: 13px; font-weight: 600; }
.demo-note .btn { align-self: flex-start; margin-top: 4px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }

/* Admin entry in the sidebar */
.admin-row { margin: 0 0 8px; color: var(--text); }
.admin-row svg { width: 16px; height: 16px; color: var(--sage); flex: none; }
.admin-row .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: var(--primary-ink); font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.admin-row .count[hidden] { display: none; }
