/* ============================================================
   Sarath AI — Design System
   Command Center (dark nav) + Canvas (white workspace)
   Signature gradient: cyan → violet → coral (brand moments only)
   ============================================================ */

:root {
  --canvas: #ffffff;
  --surface: #fafafa;
  --surface-low: #f4f4f5;
  --surface-mid: #eeeef0;
  --surface-high: #e6e6e9;
  --line: #ecebe9;
  --line-strong: #dedcd8;
  --ink: #16181a;
  --ink-soft: #4a4d51;
  --ink-mute: #85888d;
  --ink-faint: #a9acb1;

  --command: #121316;
  --command-hi: #1a1c20;
  --command-hover: #22252a;
  --command-line: #26292e;
  --command-ink: #eceef1;
  --command-mute: #8b9097;

  --cyan: #22d3ee;
  --violet: #7c3aed;
  --coral: #fb7185;
  --brand: #6d3bea;
  --brand-ink: #5b2fd1;
  --brand-wash: #f2edff;
  --brand-line: #d9c8ff;
  --cyan-wash: #e6fbff;

  --danger: #dc2626;
  --danger-wash: #fee7e5;
  --ok: #0f9268;
  --ok-wash: #e2f7ef;
  --warn: #b45309;
  --warn-wash: #fef3d6;

  --grad: linear-gradient(135deg, #22d3ee 0%, #6d3bea 52%, #fb7185 100%);
  --grad-soft: linear-gradient(135deg, #e6fbff 0%, #f2edff 55%, #fff0f3 100%);

  --r-sm: 6px; --r: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-full: 9999px;
  --nav-w: 272px;
  --content-w: 800px;

  --shadow-pop: 0 12px 40px rgba(18, 14, 34, .12), 0 2px 8px rgba(18, 14, 34, .05);
  --shadow-soft: 0 1px 2px rgba(18, 14, 34, .05);
  --shadow-lift: 0 4px 16px rgba(18, 14, 34, .07);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bottom-nav: 0px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--canvas);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overscroll-behavior: none;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: #ddd0ff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #d8d6d1 transparent; }
.scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-thumb { background: #dcdad5; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: #c3c0b9; background-clip: content-box; }
.scroll-dark { scrollbar-color: #35383d transparent; }
.scroll-dark::-webkit-scrollbar-thumb { background: #303338; background-clip: content-box; }

/* ============================================================
   SPLASH
   ============================================================ */
.splash {
  position: fixed; inset: 0; z-index: 999; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  background: radial-gradient(760px 520px at 50% 38%, #1c1836 0%, #0a0a0f 72%);
  transition: opacity .4s ease, visibility .4s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash-mark { width: 108px; height: 108px; animation: pop .7s cubic-bezier(.22,1,.36,1), floaty 3.2s 0.7s ease-in-out infinite; filter: drop-shadow(0 0 26px rgba(34,211,238,.42)); }
.splash-name { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: #f2f3f7; }
.splash-tag { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #6f7480; margin-top: -12px; }
.splash-bar { width: 148px; height: 3px; border-radius: 99px; background: #23252c; overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 42%; border-radius: 99px; background: var(--grad); animation: slide 1.15s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%);} 100% { transform: translateX(340%);} }
@keyframes floaty { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-8px);} }
@keyframes pop { from { opacity:0; transform: scale(.82);} to { opacity:1; transform: scale(1);} }
@keyframes rise { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   AUTH
   ============================================================ */
.auth-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(880px 520px at 8% -12%, #e4f9ff 0%, transparent 58%),
              radial-gradient(760px 500px at 104% 108%, #f6ecff 0%, transparent 60%), #f5f5f6;
}
.auth-card { width: 100%; max-width: 430px; background: #fff; border-radius: 22px; box-shadow: 0 26px 74px rgba(22,14,44,.13), 0 2px 6px rgba(22,14,44,.05); overflow: hidden; animation: rise .4s cubic-bezier(.22,1,.36,1); }
.auth-body { padding: 36px 34px 30px; }
.auth-mark { width: 68px; height: 68px; display: block; margin: 0 auto 16px; filter: drop-shadow(0 8px 20px rgba(109,59,234,.24)); }
.auth-title { font-size: 26px; font-weight: 700; letter-spacing: -0.024em; text-align: center; margin: 0 0 6px; }
.auth-sub { font-size: 14px; color: var(--ink-mute); text-align: center; margin: 0 0 26px; }

.field { margin-bottom: 11px; position: relative; }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: #fff; font-size: 14.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #a8a6a3; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px rgba(109,59,234,.11); }
.field .peek { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); padding: 5px; }
.field .peek:hover { color: var(--ink); }
.field-lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.auth-links { display: flex; justify-content: flex-end; margin: 2px 0 15px; }
.auth-links button { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.auth-links button:hover { color: var(--brand); }

.btn-primary {
  width: 100%; padding: 13px; border-radius: 12px; background: #111315; color: #fff;
  font-size: 14.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: #2a2d31; }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-grad { background: var(--grad); }
.btn-grad:hover { filter: brightness(1.07); background: var(--grad); }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 15px; color: var(--ink-mute); font-size: 12.5px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-oauth { width: 100%; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; transition: all .15s; }
.btn-oauth:hover { border-color: #b8b5af; background: #fbfbfa; }
.auth-foot { padding: 17px; background: var(--surface); border-top: 1px solid var(--line); text-align: center; font-size: 13.5px; color: var(--ink-soft); }
.auth-foot button { font-weight: 600; color: var(--ink); margin-left: 4px; }
.auth-foot button:hover { color: var(--brand); }

.alert { border-radius: 11px; padding: 11px 13px; font-size: 13px; margin-bottom: 14px; display: flex; gap: 9px; align-items: flex-start; line-height: 1.5; }
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-err { background: var(--danger-wash); color: #9c1c1c; }
.alert-ok { background: var(--ok-wash); color: #0b6b4d; }
.alert-warn { background: var(--warn-wash); color: #8a4408; }

/* ============================================================
   ONBOARDING
   ============================================================ */
.onb-wrap { min-height: 100%; display: flex; flex-direction: column; background: var(--grad-soft); }
.onb-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; }
.onb-dots { display: flex; gap: 7px; }
.onb-dot { width: 26px; height: 4px; border-radius: 99px; background: #d8d5e4; transition: all .25s; }
.onb-dot.on { background: var(--brand); width: 34px; }
.onb-skip { font-size: 13.5px; color: var(--ink-mute); font-weight: 500; }
.onb-skip:hover { color: var(--ink); }
.onb-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 26px; text-align: center; }
.onb-inner { width: 100%; max-width: 560px; animation: rise .32s cubic-bezier(.22,1,.36,1); }
.onb-mark { width: 82px; height: 82px; margin: 0 auto 22px; display: block; filter: drop-shadow(0 10px 26px rgba(109,59,234,.22)); }
.onb-h { font-size: 29px; font-weight: 700; letter-spacing: -0.028em; margin: 0 0 10px; }
.onb-p { font-size: 15px; line-height: 1.62; color: var(--ink-soft); margin: 0 auto 28px; max-width: 460px; }
.onb-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px,1fr)); gap: 11px; text-align: left; }
.onb-feat { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.onb-feat i { font-size: 16px; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--brand-wash); color: var(--brand); flex-shrink: 0; }
.onb-feat b { display: block; font-size: 13.5px; font-weight: 620; margin-bottom: 3px; }
.onb-feat small { font-size: 12px; color: var(--ink-mute); line-height: 1.45; }
.onb-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; text-align: left; }
.onb-pick { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 15px; display: flex; gap: 11px; align-items: center; transition: all .16s; }
.onb-pick:hover { border-color: var(--brand-line); }
.onb-pick.on { border-color: var(--brand); background: #fbf9ff; box-shadow: 0 0 0 3px rgba(109,59,234,.09); }
.onb-pick i { font-size: 15px; color: var(--brand); width: 20px; text-align: center; }
.onb-pick b { font-size: 13.5px; font-weight: 600; display: block; }
.onb-pick small { font-size: 11.5px; color: var(--ink-mute); }
.onb-foot { padding: 20px 26px 30px; display: flex; justify-content: center; }
.onb-foot .btn-primary { max-width: 320px; }

/* ============================================================
   APP SHELL — nav + canvas
   ============================================================ */
.shell { display: flex; height: 100%; overflow: hidden; background: var(--canvas); }

.nav { width: var(--nav-w); flex-shrink: 0; display: flex; flex-direction: column; background: var(--command); color: var(--command-ink); z-index: 60; }
.nav-head { display: flex; align-items: center; gap: 11px; padding: 16px 16px 13px; }
.nav-mark { width: 32px; height: 32px; flex-shrink: 0; }
.nav-name { font-size: 16px; font-weight: 650; letter-spacing: -0.018em; }
.nav-name small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .13em; color: var(--command-mute); font-weight: 500; margin-top: 1px; }
.nav-x { margin-left: auto; display: none; color: var(--command-mute); padding: 7px; }

.nav-new { margin: 0 12px 14px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 11px; border-radius: 12px; background: var(--grad); color: #fff; font-size: 13.5px; font-weight: 600; transition: filter .15s, transform .1s; }
.nav-new:hover { filter: brightness(1.09); }
.nav-new:active { transform: scale(.985); }

.nav-links { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9.5px 12px; border-radius: 10px; font-size: 13.5px; color: #b4b8be; transition: all .13s; text-align: left; width: 100%; position: relative; }
.nav-link i { width: 16px; text-align: center; font-size: 13.5px; }
.nav-link:hover { background: var(--command-hi); color: #fff; }
.nav-link.on { background: var(--command-hover); color: #fff; font-weight: 550; }
.nav-link.on::before { content: ''; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 99px; background: var(--grad); }
.nav-link .cnt { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--command-mute); }

.nav-lbl { padding: 16px 16px 7px; font-size: 10px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: #6b7079; }
.nav-list { flex: 1; min-height: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-chat { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8.5px 8px 8.5px 12px; border-radius: 10px; font-size: 12.8px; color: #b0b4ba; transition: all .13s; text-align: left; }
.nav-chat i.ci { font-size: 11.5px; color: #676c74; flex-shrink: 0; }
.nav-chat .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-chat:hover { background: var(--command-hi); color: #fff; }
.nav-chat.on { background: var(--command-hover); color: #fff; }
.nav-chat.on::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 99px; background: var(--grad); }
.nav-empty { padding: 12px 14px; font-size: 12.3px; color: #6b7079; line-height: 1.55; }
.nav-see { display: block; width: 100%; text-align: left; padding: 8px 12px; font-size: 12.5px; color: var(--cyan); font-weight: 550; border-radius: 9px; }
.nav-see:hover { background: var(--command-hi); }

.nav-foot { border-top: 1px solid var(--command-line); padding: 11px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 33px; height: 33px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 650; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-user { flex: 1; min-width: 0; }
.nav-user .nm { font-size: 12.8px; font-weight: 550; color: #e2e4e8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user .pl { font-family: var(--mono); font-size: 9.5px; color: var(--cyan); letter-spacing: .06em; }
.nav-out { color: #767b83; padding: 7px; border-radius: 8px; }
.nav-out:hover { color: #fff; background: var(--command-hi); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); position: relative; }

/* Bottom nav (mobile) */
.bnav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 70; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 7px 4px calc(7px + env(safe-area-inset-bottom)); }
.bnav-in { display: flex; }
.bnav-i { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; color: var(--ink-mute); font-size: 10px; font-weight: 550; }
.bnav-i i { font-size: 17px; }
.bnav-i.on { color: var(--brand); }
.bnav-i.mid i { width: 42px; height: 30px; border-radius: 99px; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.bnav-i.mid.on i { filter: brightness(1.06); }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; gap: 11px; padding: 11px 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); flex-shrink: 0; min-height: 58px; z-index: 20; }
.burger, .backb { display: none; padding: 7px; border-radius: 9px; color: var(--ink-soft); }
.backb { display: flex; align-items: center; }
.burger:hover, .backb:hover { background: var(--surface-low); }
.tb-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-title h2 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -0.014em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stamp { font-family: var(--mono); font-size: 10.5px; color: var(--ink-mute); background: var(--surface-mid); padding: 3.5px 8px; border-radius: 5px; white-space: nowrap; flex-shrink: 0; }
.tb-acts { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); transition: all .14s; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-low); color: var(--ink); }
.icon-btn.on { background: var(--brand-wash); color: var(--brand); }

.tool-chip { display: flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: var(--r-full); background: var(--brand-wash); color: var(--brand-ink); font-size: 11.5px; font-weight: 650; font-family: var(--mono); letter-spacing: .02em; white-space: nowrap; }
.tool-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .3; transform: scale(.65);} }

/* ---------- Mode pills ---------- */
.modes { display: flex; gap: 6px; padding: 10px 20px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.modes::-webkit-scrollbar { display: none; }
.modes.bordered { border-bottom: 1px solid var(--line); }
.mode { display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--r-full); border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 550; color: var(--ink-soft); white-space: nowrap; transition: all .15s; background: #fff; }
.mode i { font-size: 11.5px; }
.mode:hover { border-color: #bfbcb6; background: var(--surface); }
.mode.on { background: #111315; border-color: #111315; color: #fff; }
.mode.on.grad { background: var(--grad); border-color: transparent; }

/* ---------- Stream / messages ---------- */
.stream { flex: 1; min-height: 0; overflow-y: auto; }
.stream-in { max-width: var(--content-w); margin: 0 auto; padding: 24px 24px 12px; display: flex; flex-direction: column; gap: 21px; }

.row-user { display: flex; justify-content: flex-end; }
.bubble-user { max-width: 78%; background: var(--surface-mid); border-radius: 17px 17px 5px 17px; padding: 12px 16px; font-size: 14.5px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; }

.row-ai { display: flex; gap: 12px; }
.ai-mark { width: 29px; height: 29px; flex-shrink: 0; margin-top: 1px; }
.ai-body { flex: 1; min-width: 0; }
.ai-name { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 620; color: var(--ink-soft); margin-bottom: 8px; }
.ai-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.ai-card > .gtop { height: 2.5px; background: var(--grad); }
.ai-card.err { border-color: #f3c8c5; }
.ai-card.err > .gtop { background: var(--danger); }
.ai-in { padding: 15px 18px; }
.meta-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 0 18px 13px; }
.tag { font-family: var(--mono); font-size: 10.3px; font-weight: 620; letter-spacing: .04em; padding: 3px 7px; border-radius: 5px; background: var(--surface-mid); color: var(--ink-soft); }
.tag.brand { background: var(--brand-wash); color: var(--brand-ink); }
.tag.cyan { background: var(--cyan-wash); color: #0e7490; }
.tag.err { background: var(--danger-wash); color: #9c1c1c; }
.copy-btn { margin-left: auto; font-size: 11.5px; color: var(--ink-mute); display: flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 6px; }
.copy-btn:hover { color: var(--ink); background: var(--surface-low); }
.retry-btn { font-size: 11.5px; color: var(--danger); display: flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; font-weight: 600; background: var(--danger-wash); }
.retry-btn:hover { filter: brightness(.97); }

.thinking { display: flex; gap: 12px; align-items: flex-start; }
.think-b { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-mute); padding-top: 5px; }
.dots { display: flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); display: block; animation: bounce 1.15s infinite; }
.dots i:nth-child(2) { animation-delay: .16s; } .dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .3;} 30% { transform: translateY(-5px); opacity: 1;} }

/* Markdown */
.md { font-size: 14.5px; line-height: 1.72; word-break: break-word; }
.md > *:first-child { margin-top: 0; } .md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17.5px; } .md h3 { font-size: 15.5px; }
.md h1,.md h2,.md h3,.md h4 { font-weight: 650; letter-spacing: -0.016em; margin: 20px 0 9px; }
.md ul,.md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin-bottom: 5px; } .md li::marker { color: var(--ink-mute); }
.md a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.md strong { font-weight: 650; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-mid); padding: 2px 5px; border-radius: 4px; }
.md pre { background: #fafaf9; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; overflow-x: auto; margin: 0 0 13px; }
.md pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.62; }
.md blockquote { margin: 0 0 13px; padding: 3px 0 3px 14px; border-left: 3px solid var(--brand-line); color: var(--ink-soft); }
.md table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0 0 13px; display: block; overflow-x: auto; }
.md th,.md td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; }
.md th { background: var(--surface-low); font-weight: 620; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md img { max-width: 100%; border-radius: 9px; }

/* ---------- Composer ---------- */
.comp-wrap { flex-shrink: 0; padding: 8px 24px 16px; background: linear-gradient(to top, #fff 60%, rgba(255,255,255,0)); }
.comp-in { max-width: var(--content-w); margin: 0 auto; }
.tray { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }
.chip-file { display: flex; align-items: center; gap: 8px; padding: 6px 9px 6px 11px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12.5px; }
.chip-file i.fi { color: var(--ink-mute); font-size: 12px; }
.chip-file span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-file .rm { color: var(--ink-mute); padding: 2px 4px; border-radius: 5px; }
.chip-file .rm:hover { color: var(--danger); background: #fbe9e8; }
.chip-file img { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; }

.composer { display: flex; align-items: flex-end; gap: 5px; padding: 7px 8px 7px 10px; border: 1px solid var(--line-strong); border-radius: 25px; background: #fff; box-shadow: var(--shadow-soft); transition: all .16s; }
.composer:focus-within { border-color: #c0a6ff; box-shadow: 0 0 0 3.5px rgba(109,59,234,.08); }
.composer textarea { flex: 1; min-width: 0; resize: none; border: none; outline: none; background: transparent; font-size: 14.5px; line-height: 1.55; padding: 9px 4px; max-height: 190px; min-height: 22px; }
.composer textarea::placeholder { color: var(--ink-faint); }
.cbtn { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ink-mute); flex-shrink: 0; transition: all .14s; }
.cbtn:hover { background: var(--surface-low); color: var(--ink); }
.cbtn.rec { color: #fff; background: var(--danger); animation: pulse 1.1s infinite; }
.sendb { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.sendb:hover:not(:disabled) { filter: brightness(1.09); transform: scale(1.05); }
.sendb:disabled { opacity: .25; cursor: not-allowed; background: #111315; }
.sendb.stop { background: var(--danger); }
.disc { text-align: center; font-size: 10.8px; color: var(--ink-faint); margin: 9px 0 0; font-family: var(--mono); }

/* ---------- Home ---------- */
.home-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.home-in { max-width: var(--content-w); margin: 0 auto; padding: 40px 24px 20px; }
.greet { text-align: center; margin-bottom: 26px; }
.greet img { width: 66px; height: 66px; margin: 0 auto 16px; display: block; filter: drop-shadow(0 8px 22px rgba(109,59,234,.2)); animation: floaty 3.6s ease-in-out infinite; }
.greet h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 7px; }
.greet h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.greet p { font-size: 14.5px; color: var(--ink-mute); margin: 0; line-height: 1.55; }

.sec { margin-top: 30px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sec-h h3 { margin: 0; font-size: 12.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.sec-h button { font-size: 12.5px; font-weight: 600; color: var(--brand); display: flex; align-items: center; gap: 5px; }
.sec-h button:hover { text-decoration: underline; }

.sug-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(224px,1fr)); gap: 10px; }
.sug { display: flex; align-items: flex-start; gap: 12px; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--line); background: #fff; text-align: left; transition: all .16s; }
.sug:hover { border-color: var(--brand-line); background: #fdfcff; transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.sug i { font-size: 14px; width: 32px; height: 32px; border-radius: 10px; background: var(--brand-wash); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sug b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.sug small { font-size: 12px; color: var(--ink-mute); line-height: 1.45; display: block; }

.rc-list { display: flex; flex-direction: column; gap: 7px; }
.rc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; text-align: left; transition: all .15s; width: 100%; }
.rc:hover { border-color: var(--brand-line); background: #fdfcff; }
.rc .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-low); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; font-size: 12.5px; flex-shrink: 0; }
.rc .bd { flex: 1; min-width: 0; }
.rc .bd b { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc .bd small { font-size: 11.5px; color: var(--ink-mute); font-family: var(--mono); }
.rc .go { color: var(--ink-faint); font-size: 12px; }

/* ---------- Generic page / list ---------- */
.page { flex: 1; min-height: 0; overflow-y: auto; }
.page-in { max-width: var(--content-w); margin: 0 auto; padding: 26px 24px 30px; }
.page-h { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.page-p { margin: 0 0 22px; font-size: 14px; color: var(--ink-mute); line-height: 1.6; }

.searchbar { position: relative; margin-bottom: 16px; }
.searchbar input { width: 100%; padding: 12px 15px 12px 40px; border: 1px solid var(--line-strong); border-radius: 12px; font-size: 14px; outline: none; background: #fff; transition: all .15s; }
.searchbar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px rgba(109,59,234,.09); }
.searchbar i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 13px; }

.lrow { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; margin-bottom: 8px; transition: all .15s; }
.lrow:hover { border-color: var(--brand-line); background: #fdfcff; }
.lrow .lic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-low); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.lrow .lbd { flex: 1; min-width: 0; cursor: pointer; }
.lrow .lbd b { display: block; font-size: 14px; font-weight: 550; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .lbd small { font-size: 11.5px; color: var(--ink-mute); font-family: var(--mono); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.lrow .lac { display: flex; gap: 3px; flex-shrink: 0; }
.lrow .lac button { width: 30px; height: 30px; border-radius: 8px; color: var(--ink-mute); display: flex; align-items: center; justify-content: center; font-size: 12.5px; }
.lrow .lac button:hover { background: var(--surface-low); color: var(--ink); }
.lrow .lac button.dgr:hover { background: var(--danger-wash); color: var(--danger); }

/* Empty states */
.empty { text-align: center; padding: 56px 24px; }
.empty .eic { width: 62px; height: 62px; border-radius: 18px; background: var(--grad-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 23px; margin: 0 auto 17px; }
.empty h4 { margin: 0 0 7px; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.empty p { margin: 0 auto 20px; font-size: 13.5px; color: var(--ink-mute); line-height: 1.6; max-width: 340px; }
.empty .btn-primary { max-width: 240px; margin: 0 auto; }
.skel { height: 62px; border-radius: 13px; background: linear-gradient(90deg,#f3f3f4 25%,#eaeaec 50%,#f3f3f4 75%); background-size: 200% 100%; animation: shim 1.3s infinite; margin-bottom: 8px; }
@keyframes shim { 0% { background-position: 200% 0;} 100% { background-position: -200% 0;} }

/* ---------- Image gen ---------- */
.ig-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.ig-opts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.ig-opt { padding: 7px 13px; border-radius: var(--r-full); border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 550; color: var(--ink-soft); background: #fff; transition: all .15s; display: flex; align-items: center; gap: 7px; }
.ig-opt:hover { border-color: #bfbcb6; }
.ig-opt.on { background: var(--brand-wash); border-color: var(--brand-line); color: var(--brand-ink); }
.ig-opt .ar { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .75; }
.gen-img { width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; background: var(--surface-low); }
.gen-wrap { max-width: 520px; }
.img-acts { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.mini-btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--r-full); border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 550; color: var(--ink-soft); background: #fff; transition: all .15s; }
.mini-btn:hover { border-color: #b8b5af; background: var(--surface); color: var(--ink); }
.img-skel { width: 100%; aspect-ratio: 1; border-radius: 14px; background: linear-gradient(90deg,#f3f3f4 25%,#eaeaec 50%,#f3f3f4 75%); background-size: 200% 100%; animation: shim 1.3s infinite; display: flex; align-items: center; justify-content: center; color: var(--ink-mute); font-size: 13px; gap: 9px; }

/* ---------- Voice ---------- */
.voice { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: radial-gradient(840px 620px at 50% 32%, #201b3d 0%, #0a0a0f 74%); color: #eceef1; }
.v-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; }
.v-back { color: #a7abb4; padding: 8px; border-radius: 9px; }
.v-back:hover { color: #fff; background: rgba(255,255,255,.07); }
.v-state { font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: #8b90a0; display: flex; align-items: center; gap: 8px; }
.v-state .d { width: 7px; height: 7px; border-radius: 50%; background: #4b5563; }
.v-state.live .d { background: #22d3ee; animation: pulse 1.2s infinite; }
.v-state.speak .d { background: #fb7185; animation: pulse .9s infinite; }
.v-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 24px; min-height: 0; }
.v-orb { position: relative; width: 172px; height: 172px; display: flex; align-items: center; justify-content: center; margin-bottom: 26px; }
.v-orb img { width: 104px; height: 104px; z-index: 2; filter: drop-shadow(0 0 30px rgba(34,211,238,.45)); }
.v-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(34,211,238,.28); }
.v-ring.a { animation: ripple 2.4s ease-out infinite; }
.v-ring.b { animation: ripple 2.4s .8s ease-out infinite; }
.v-ring.c { animation: ripple 2.4s 1.6s ease-out infinite; }
@keyframes ripple { 0% { transform: scale(.72); opacity: .85; } 100% { transform: scale(1.32); opacity: 0; } }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 46px; margin-bottom: 22px; }
.wave i { width: 4px; border-radius: 99px; background: linear-gradient(180deg,#22d3ee,#7c3aed); height: 8px; transition: height .09s linear; display: block; }
.v-tx { max-width: 620px; width: 100%; text-align: center; }
.v-live { font-size: 19px; line-height: 1.55; font-weight: 500; min-height: 30px; color: #f0f1f4; }
.v-live.dim { color: #7c828f; font-size: 15px; font-weight: 400; }
.v-reply { margin-top: 18px; font-size: 14.5px; line-height: 1.66; color: #b9bdc7; max-height: 190px; overflow-y: auto; text-align: left; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 14px 16px; }
.v-reply .who { font-family: var(--mono); font-size: 9.5px; letter-spacing: .13em; color: #22d3ee; display: block; margin-bottom: 7px; }
.v-bot { padding: 20px 24px calc(30px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 22px; }
.v-btn { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.09); color: #dfe2e8; display: flex; align-items: center; justify-content: center; font-size: 17px; transition: all .16s; }
.v-btn:hover { background: rgba(255,255,255,.16); }
.v-mic { width: 78px; height: 78px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 25px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 34px rgba(109,59,234,.48); transition: all .18s; }
.v-mic:hover { transform: scale(1.05); }
.v-mic.live { background: #dc2626; box-shadow: 0 8px 34px rgba(220,38,38,.5); animation: pulse 1.5s infinite; }
.v-end { background: rgba(220,38,38,.16); color: #fca5a5; }
.v-end:hover { background: rgba(220,38,38,.28); }
.v-note { text-align: center; font-family: var(--mono); font-size: 10px; color: #5d626d; letter-spacing: .05em; padding: 0 24px 16px; }

/* ---------- Memory ---------- */
.mem { border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; background: #fff; margin-bottom: 9px; transition: all .15s; }
.mem:hover { border-color: var(--brand-line); }
.mem-h { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 8px; }
.mem-k { font-family: var(--mono); font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--brand-ink); background: var(--brand-wash); padding: 3.5px 8px; border-radius: 5px; }
.mem-a { margin-left: auto; display: flex; gap: 3px; }
.mem-a button { width: 28px; height: 28px; border-radius: 7px; color: var(--ink-mute); display: flex; align-items: center; justify-content: center; font-size: 11.5px; }
.mem-a button:hover { background: var(--surface-low); color: var(--ink); }
.mem-a button.dgr:hover { background: var(--danger-wash); color: var(--danger); }
.mem-v { font-size: 14px; line-height: 1.6; color: var(--ink); }
.mem-v textarea { width: 100%; border: 1px solid var(--brand); border-radius: 9px; padding: 9px 11px; font-size: 14px; line-height: 1.55; resize: vertical; outline: none; min-height: 62px; }
.mem-src { margin-top: 9px; font-size: 11.5px; color: var(--ink-mute); display: flex; align-items: center; gap: 6px; }
.mem-src a, .mem-src button { color: var(--brand); font-weight: 550; }
.mem-src a:hover, .mem-src button:hover { text-decoration: underline; }

/* ---------- Settings ---------- */
.set-card { border: 1px solid var(--line); border-radius: 15px; background: #fff; margin-bottom: 14px; overflow: hidden; }
.set-hd { padding: 13px 17px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 17px; border-bottom: 1px solid var(--line); font-size: 14px; }
.set-row:last-child { border-bottom: none; }
.set-row .k { color: var(--ink-soft); flex-shrink: 0; }
.set-row .k small { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; font-weight: 400; }
.set-row .v { font-family: var(--mono); font-size: 12px; color: var(--ink); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.set-row select, .set-row input { padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 13px; outline: none; background: #fff; max-width: 230px; }
.set-row select:focus, .set-row input:focus { border-color: var(--brand); }
.set-row.dgr .k { color: var(--danger); font-weight: 550; }
.pill-ok { font-family: var(--mono); font-size: 10.3px; font-weight: 650; padding: 4px 9px; border-radius: 6px; background: var(--ok-wash); color: var(--ok); letter-spacing: .04em; }
.pill-off { background: var(--surface-mid); color: var(--ink-mute); }
.pill-warn { background: var(--warn-wash); color: var(--warn); }

/* ---------- Popover / modal / toast ---------- */
.pop { position: absolute; right: 0; top: calc(100% + 7px); min-width: 214px; background: #fff; border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 5px; z-index: 80; animation: rise .16s ease; }
.pop button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border-radius: 9px; font-size: 13.5px; text-align: left; color: var(--ink-soft); }
.pop button i { width: 15px; text-align: center; font-size: 12.5px; }
.pop button:hover { background: var(--surface-low); color: var(--ink); }
.pop button.dgr:hover { background: var(--danger-wash); color: var(--danger); }
.pop-sep { height: 1px; background: var(--line); margin: 4px 6px; }

.overlay { position: fixed; inset: 0; background: rgba(14,10,26,.44); backdrop-filter: blur(3px); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 22px; animation: fade .18s ease; }
.modal { width: 100%; max-width: 470px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; animation: rise .22s cubic-bezier(.22,1,.36,1); max-height: 88vh; display: flex; flex-direction: column; }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.modal-hd h3 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -0.014em; }
.modal-bd { padding: 20px; overflow-y: auto; }
.modal-ft { padding: 14px 20px; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; flex-shrink: 0; }
.btn-ghost { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-strong); font-size: 13.5px; font-weight: 550; background: #fff; }
.btn-ghost:hover { background: var(--surface-low); }
.btn-solid { padding: 9px 16px; border-radius: 10px; background: #111315; color: #fff; font-size: 13.5px; font-weight: 600; }
.btn-solid:hover { background: #2a2d31; }
.btn-solid.dgr { background: var(--danger); }
.btn-solid.dgr:hover { background: #b91c1c; }

.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; min-width: 0; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; font-family: var(--mono); font-size: 11.5px; background: var(--surface); outline: none; }

.switch { width: 42px; height: 24px; border-radius: 99px; background: #d4d2cd; position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }

.toast-zone { position: fixed; bottom: calc(22px + var(--bottom-nav)); left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1a1c20; color: #fff; padding: 10px 17px; border-radius: var(--r-full); font-size: 13px; box-shadow: var(--shadow-pop); animation: rise .2s ease; display: flex; align-items: center; gap: 9px; max-width: 92vw; }
.toast.bad { background: var(--danger); }

/* Offline banner */
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 400; background: var(--warn); color: #fff; padding: 9px 16px; font-size: 13px; font-weight: 550; display: flex; align-items: center; justify-content: center; gap: 11px; animation: rise .22s ease; }
.offline button { background: rgba(255,255,255,.22); padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; color: #fff; }
.offline button:hover { background: rgba(255,255,255,.32); }

/* Tool cards */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px,1fr)); gap: 11px; }
.dcard { border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; background: #fff; }
.dc-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.dc-sym { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.dc-sub { font-size: 12.5px; color: var(--ink-mute); margin-bottom: 11px; font-family: var(--mono); }
.dc-rows { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.dc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; }
.dc-row span { color: var(--ink-soft); }
.dc-row b { font-family: var(--mono); font-weight: 620; font-size: 12.5px; }
.up { color: var(--ok); } .down { color: var(--danger); }

.src-list { display: flex; flex-direction: column; gap: 9px; }
.src { display: flex; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; transition: all .14s; background: #fff; }
.src:hover { border-color: var(--brand-line); background: #fdfcff; }
.src .num { font-family: var(--mono); font-size: 10.5px; font-weight: 650; color: var(--brand-ink); background: var(--brand-wash); width: 21px; height: 21px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.src .sb { min-width: 0; flex: 1; }
.src .st { font-size: 13.5px; font-weight: 550; margin-bottom: 3px; line-height: 1.42; }
.src .su { font-size: 11.3px; color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.src .sx { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.wx-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 13px; }
.wx-temp { font-size: 41px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; }
.wx-ico { font-size: 34px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wx-place { font-size: 14.5px; font-weight: 620; }
.wx-desc { font-size: 12.5px; color: var(--ink-mute); text-transform: capitalize; }

.news-i { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.news-i:last-child { border-bottom: none; padding-bottom: 0; }
.news-i:hover .nt { color: var(--brand); }
.news-i img { width: 78px; height: 58px; object-fit: cover; border-radius: 9px; flex-shrink: 0; background: var(--surface-mid); }
.nb { min-width: 0; flex: 1; }
.nt { font-size: 13.5px; font-weight: 550; line-height: 1.42; margin-bottom: 4px; transition: color .14s; }
.nm { font-family: var(--mono); font-size: 10.3px; color: var(--ink-mute); letter-spacing: .02em; }

.scrim { position: fixed; inset: 0; background: rgba(9,7,16,.46); z-index: 55; animation: fade .2s ease; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --bottom-nav: 62px; }
  .nav { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .26s cubic-bezier(.22,1,.36,1); box-shadow: 0 0 46px rgba(0,0,0,.34); width: 284px; }
  .nav.open { transform: none; }
  .nav-x { display: block; }
  .burger { display: flex; }
  .bnav { display: block; }
  .main { padding-bottom: var(--bottom-nav); }
  .comp-wrap { padding: 8px 14px 12px; }
  .stream-in { padding: 20px 16px 10px; }
  .topbar { padding: 10px 14px; min-height: 55px; }
  .modes { padding: 9px 14px; }
  .home-in, .page-in { padding: 26px 16px 20px; }
  .greet h1 { font-size: 25px; }
  .bubble-user { max-width: 88%; }
  .auth-body { padding: 30px 22px 24px; }
  .sug-grid { grid-template-columns: 1fr; }
  .onb-h { font-size: 24px; }
  .voice { padding-bottom: 0; }
}
@media (max-width: 480px) {
  .stamp { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .v-orb { width: 140px; height: 140px; }
  .v-orb img { width: 84px; height: 84px; }
  .v-mic { width: 68px; height: 68px; font-size: 22px; }
  .v-btn { width: 48px; height: 48px; }
  .set-row { flex-wrap: wrap; }
  .set-row .v { text-align: left; max-width: 100%; }
}
@media (min-width: 901px) { .backb { display: none !important; } }

/* ============================================================
   CONTAINER-DRIVEN LAYOUT (squeeze fix)
   Viewport media queries fail inside embedded/webview frames
   where the reported width doesn't match the real shell width.
   app.js measures the shell and sets .cw-sm / .cw-xs on <html>,
   so layout responds to ACTUAL available width. Any rule below
   must mirror the @media block above it.
   ============================================================ */
html.cw-sm .nav { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%);
  transition: transform .26s cubic-bezier(.22,1,.36,1); box-shadow: 0 0 46px rgba(0,0,0,.34); width: 284px; }
html.cw-sm .nav.open { transform: none; }
html.cw-sm .nav-x { display: block; }
html.cw-sm .burger { display: flex; }
html.cw-sm .bnav { display: block; }
html.cw-sm .main { padding-bottom: 62px; }
html.cw-sm .comp-wrap { padding: 8px 14px 12px; }
html.cw-sm .stream-in { padding: 20px 16px 10px; }
html.cw-sm .topbar { padding: 10px 14px; min-height: 55px; }
html.cw-sm .modes { padding: 9px 14px; }
html.cw-sm .home-in, html.cw-sm .page-in { padding: 26px 16px 20px; }
html.cw-sm .greet h1 { font-size: 25px; }
html.cw-sm .bubble-user { max-width: 88%; }
html.cw-sm .auth-body { padding: 30px 22px 24px; }
html.cw-sm .sug-grid { grid-template-columns: 1fr; }
html.cw-sm .onb-h { font-size: 24px; }
html.cw-sm .voice { padding-bottom: 0; }
html.cw-sm .backb { display: inline-flex !important; }

html.cw-xs .stamp { display: none; }
html.cw-xs .grid-2 { grid-template-columns: 1fr; }
html.cw-xs .v-orb { width: 140px; height: 140px; }
html.cw-xs .v-orb img { width: 84px; height: 84px; }
html.cw-xs .v-mic { width: 68px; height: 68px; font-size: 22px; }
html.cw-xs .v-btn { width: 48px; height: 48px; }
html.cw-xs .set-row { flex-wrap: wrap; }
html.cw-xs .set-row .v { text-align: left; max-width: 100%; }

/* Never let the suggestion grid collapse into a text column */
.sug-grid { grid-template-columns: repeat(auto-fit, minmax(min(224px, 100%), 1fr)); }

/* Hard floor: text must never wrap one-character-per-line */
.bubble-user, .ai-in, .md { overflow-wrap: break-word; word-break: normal; hyphens: none; }
.stream-in, .home-in, .page-in { width: 100%; box-sizing: border-box; }
.main, .shell { max-width: 100%; }

/* ============================================================
   SKILLS
   ============================================================ */
.sk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px,100%),1fr)); gap: 12px; }
.sk { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 15px 16px; text-align: left; position: relative; transition: all .16s; }
.sk:hover { border-color: var(--brand-line); box-shadow: var(--shadow-lift); }
.sk.on { border-color: var(--brand); background: var(--brand-wash); }
.sk-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sk-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-wash); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.sk.on .sk-ic { background: #fff; }
.sk-nm { font-size: 14px; font-weight: 620; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-desc { font-size: 12.5px; color: var(--ink-mute); line-height: 1.5; margin-bottom: 10px; word-break: break-word; }
.sk-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.sk-badge { position: absolute; top: 12px; right: 12px; font-family: var(--mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: var(--brand); }

/* Collaborators */
.collab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.collab .av { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 650; flex-shrink: 0; }
.collab .cb { flex: 1; min-width: 0; }
.collab .cb b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collab .cb small { font-size: 11.5px; color: var(--ink-mute); }
.role-pill { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 4px 8px; border-radius: 99px; background: var(--surface-mid); color: var(--ink-mute); }
.role-pill.edit { background: var(--brand-wash); color: var(--brand); }

/* Legal documents in modals */
.legal h4 { font-size: 13.5px; font-weight: 650; color: var(--ink); margin: 18px 0 6px; }
.legal h4:first-of-type { margin-top: 0; }
.legal p { margin: 0 0 10px; color: var(--ink-soft); }
.legal ul { margin: 0 0 10px; padding-left: 20px; }
.legal li { margin-bottom: 6px; color: var(--ink-soft); }
.legal b { color: var(--ink); font-weight: 600; }

/* Password strength meter (create-new-password) */
.pw-meter { display: flex; align-items: center; gap: 10px; margin: -4px 0 10px; }
.pw-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-mid); overflow: hidden; }
.pw-bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--danger); transition: width .22s ease, background .22s ease; }
.pw-lbl { font-family: var(--mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); min-width: 62px; text-align: right; }
.pw-reqs { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.pw-reqs li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-mute); transition: color .15s; }
.pw-reqs li i { font-size: 11px; width: 13px; color: var(--line-strong); transition: color .15s; }
.pw-reqs li.ok { color: var(--ink-soft); }
.pw-reqs li.ok i { color: #3aa76d; }

/* Segmented control (Chat / Tools) — from the uploaded design */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 99px;
  background: var(--surface-mid); border: 1px solid var(--line); }
.seg button { padding: 6px 16px; border-radius: 99px; font-size: 13px; font-weight: 550;
  color: var(--ink-mute); transition: all .15s; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16,12,32,.09); }
.seg button:hover:not(.on) { color: var(--ink); }

/* Home hero — centered, matching the uploaded layout */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 8px 0 26px; }
.hero-mark { width: 62px; height: 62px; border-radius: 18px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
  box-shadow: 0 10px 28px rgba(109,59,234,.26); }
.hero-mark img { width: 40px; height: 40px; }
.hero h1 { font-size: 27px; font-weight: 650; letter-spacing: -0.03em; margin: 0 0 8px; }
.hero h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 14px; color: var(--ink-mute); margin: 0; line-height: 1.55; max-width: 460px; }
html.cw-sm .hero h1 { font-size: 23px; }
html.cw-sm .hero-mark { width: 54px; height: 54px; border-radius: 16px; }
html.cw-sm .hero-mark img { width: 34px; height: 34px; }
