:root {
  color-scheme: dark;
  --bg: #1c1c1c;
  --workspace: #202020;
  --sidebar: #181818;
  --panel: #262626;
  --surface: #2b2b2b;
  --surface-hover: #333333;
  --input: #2b2b2b;
  --text: #f3f3f3;
  --text-soft: #dddddd;
  --muted: #aaaaaa;
  --faint: #909090;
  --line: #363636;
  --line-strong: #484848;
  --on-accent: #10291d;
  --green: #46ce96;
  --green-strong: #67dfa9;
  --green-deep: #173e2e;
  --green-wash: rgba(70, 206, 150, .11);
  --green-focus: rgba(70, 206, 150, .18);
  --amber: #c3a16c;
  --red: #d48682;
  --shadow: 0 28px 80px rgba(0, 0, 0, .36);
  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-bottom: max(10px, env(safe-area-inset-bottom));
  font-family: Onest, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3f3;
  --workspace: #fafafa;
  --sidebar: #eeeeee;
  --panel: #ffffff;
  --surface: #f2f2f2;
  --surface-hover: #e7e7e7;
  --input: #f0f0f0;
  --text: #232323;
  --text-soft: #404040;
  --muted: #6b6b6b;
  --faint: #787878;
  --line: #dedede;
  --line-strong: #c8c8c8;
  --on-accent: #ffffff;
  --green: #087e51;
  --green-strong: #066b44;
  --green-deep: #dce9e0;
  --green-wash: rgba(8, 126, 81, .09);
  --green-focus: rgba(8, 126, 81, .14);
  --amber: #8a6e40;
  --red: #9f514e;
  --shadow: 0 24px 70px rgba(28, 39, 31, .13);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f3f3;
    --workspace: #fafafa;
    --sidebar: #eeeeee;
    --panel: #ffffff;
    --surface: #f2f2f2;
    --surface-hover: #e7e7e7;
    --input: #f0f0f0;
    --text: #232323;
    --text-soft: #404040;
    --muted: #6b6b6b;
    --faint: #787878;
    --line: #dedede;
    --line-strong: #c8c8c8;
    --on-accent: #ffffff;
  --green: #087e51;
    --green-strong: #066b44;
    --green-deep: #dce9e0;
    --green-wash: rgba(8, 126, 81, .09);
    --green-focus: rgba(8, 126, 81, .14);
    --amber: #8a6e40;
    --red: #9f514e;
    --shadow: 0 24px 70px rgba(28, 39, 31, .13);
  }
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(.975); }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.ambient { display: none; }
h1, h2, h3, p { margin-top: 0; }

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  max-width: 1920px;
  margin: 0 auto;
}

.sidebar {
  position: relative;
  z-index: 3;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 20px 12px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}
.brand { display: inline-flex; width: max-content; align-items: center; gap: 10px; padding: 0 8px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; background: var(--green-wash); }
.brand-mark img { width: 25px; height: 25px; }
.brand-word { font-size: 12px; font-weight: 700; letter-spacing: .105em; }
.brand-word span { color: var(--green-strong); }

.new-chat-button, .new-chat-inline {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  color: var(--on-accent);
  background: var(--green);
  font-size: 13px;
  font-weight: 650;
  transition: background .16s ease, transform .12s ease;
}
.new-chat-button { margin: 22px 2px 0; color: var(--text); background: var(--surface); }
.new-chat-button svg { color: var(--green); }
.new-chat-button:hover { background: var(--surface-hover); }
.new-chat-inline { min-width: 132px; margin-bottom: 2px; }
.new-chat-inline:hover { background: var(--green-strong); }
.new-chat-button svg, .new-chat-inline svg { width: 17px; height: 17px; stroke-width: 2; }

.search-box {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  margin: 9px 2px 0;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--faint);
  background: var(--surface);
  transition: border-color .16s ease, background .16s ease;
}
.search-box:focus-within { border-color: var(--line-strong); background: var(--panel); }
.search-box svg { width: 16px; height: 16px; }
.search-box input { width: 100%; border: 0; outline: 0; background: none; font-size: 12px; }
.search-box input::placeholder { color: var(--faint); }
.sidebar-label { margin: 22px 10px 7px; color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.chat-list { min-height: 0; overflow: auto; scrollbar-width: none; }
.chat-list::-webkit-scrollbar { display: none; }
.chat-item {
  position: relative;
  width: 100%;
  min-height: 54px;
  padding: 10px 11px;
  border-radius: 9px;
  color: var(--text-soft);
  background: transparent;
  text-align: left;
  transition: background .14s ease, color .14s ease;
}
.chat-item:hover { background: var(--surface); }
.chat-item.active { color: var(--text); background: var(--surface-hover); }
.chat-item strong, .chat-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item strong { font-size: 12px; font-weight: 550; }
.chat-item small { margin-top: 4px; color: var(--faint); font-size: 10px; }
.chat-item .item-meta { display: none; }

.desktop-nav { display: grid; gap: 2px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.desktop-nav button {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  background: none;
  font-size: 12px;
  text-align: left;
  transition: background .14s ease, color .14s ease;
}
.desktop-nav button svg { width: 17px; height: 17px; }
.desktop-nav button:hover, .desktop-nav button.active { color: var(--text); background: var(--surface); }
.desktop-nav button.active svg { color: var(--green-strong); }
.preview-note { display: flex; align-items: center; gap: 9px; margin: 12px 9px 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.preview-note i, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.preview-note b { color: var(--text-soft); font-weight: 550; }
.preview-note small { color: var(--faint); }

.workspace { position: relative; min-width: 0; overflow: hidden; background: var(--workspace); }
.screen { display: none; height: 100%; overflow: auto; padding: clamp(42px, 7vw, 88px) clamp(32px, 8vw, 110px) 92px; }
.screen.active { display: block; animation: screen-in .2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(4px); } }
.screen-heading { display: flex; max-width: 860px; align-items: flex-end; justify-content: space-between; gap: 30px; margin: 0 auto 42px; }
.screen-heading.narrow { justify-content: flex-start; margin-bottom: 28px; }
.eyebrow { margin: 0 0 9px; color: var(--green-strong); font-size: 10px; font-weight: 650; letter-spacing: .055em; text-transform: uppercase; }
h1 { margin-bottom: 0; font: 500 clamp(36px, 4.6vw, 58px)/1.06 Lora, Georgia, serif; letter-spacing: -.04em; }
.heading-copy { max-width: 520px; margin: 13px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mobile-search, .mobile-header { display: none; }
.section-line { display: flex; max-width: 860px; align-items: center; justify-content: space-between; gap: 16px; margin: 0 auto 8px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.section-line span { color: var(--text-soft); font-size: 12px; font-weight: 600; }
.section-line small { color: var(--faint); font-size: 10px; }
.mobile-chat-list { display: grid; max-width: 860px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 auto; }
.chat-card {
  position: relative;
  display: flex;
  min-height: 142px;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.chat-card:hover { border-color: var(--line-strong); background: var(--surface); transform: translateY(-1px); }
.chat-card .card-model { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .035em; text-transform: uppercase; }
.chat-card .card-model i { width: 6px; height: 6px; border-radius: 50%; background: var(--model-accent, var(--green)); }
.chat-card strong { margin: 17px 0 5px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.chat-card p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.chat-card time { margin-top: auto; padding-top: 12px; color: var(--faint); font-size: 9px; }
.empty-copy { color: var(--muted); font-size: 12px; }

.conversation-screen { padding: 0; overflow: hidden; }
.conversation-screen.active { display: flex; flex-direction: column; }
.conversation-header {
  display: grid;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--workspace) 91%, transparent);
  backdrop-filter: blur(18px);
}
.back-button { display: none; }
.conversation-title { min-width: 0; }
.conversation-title h2 { overflow: hidden; margin: 0 0 2px; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title span { color: var(--faint); font-size: 9px; }
.model-pill {
  display: flex;
  min-height: 37px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--panel);
  font-size: 11px;
  font-weight: 600;
  transition: border-color .16s ease, background .16s ease;
}
.model-pill:hover { border-color: var(--line-strong); background: var(--surface); }
.model-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--pill-accent, var(--green)); }
.model-pill svg { width: 14px; height: 14px; color: var(--faint); }
.more-button, .back-button { place-items: center; width: 38px; height: 38px; border-radius: 9px; color: var(--muted); background: transparent; }
.more-button { display: grid; }
.more-button:hover, .back-button:hover { color: var(--text); background: var(--surface); }
.preview-banner {
  display: flex;
  width: max-content;
  min-height: 28px;
  max-width: calc(100% - 24px);
  align-items: center;
  align-self: center;
  gap: 6px;
  margin: 10px auto 0;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}
.preview-banner:hover { color: var(--text-soft); background: var(--surface); }
.preview-banner svg { width: 13px; height: 13px; color: var(--green-strong); }
.preview-banner b { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.preview-banner span { color: var(--green-strong); }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 29px clamp(24px, 8vw, 120px) 20px; scroll-behavior: smooth; }
.message-row { display: flex; max-width: 780px; margin: 0 auto 24px; }
.message-row.user { justify-content: flex-end; }
.message-bubble { max-width: min(82%, 650px); color: var(--text-soft); font-size: 14px; line-height: 1.68; }
.message-row.user .message-bubble { padding: 11px 15px; border-radius: 14px 14px 4px 14px; background: var(--surface); }
.message-row.assistant .message-bubble { width: min(100%, 720px); }
.message-bubble p { margin-bottom: 0; }
.message-privacy { display: block; width: max-content; margin-top: 7px; color: var(--faint); font-size: 8px; }
.message-privacy.local_only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.message-privacy.shareable { color: var(--green-strong); }
.message-privacy.restricted { color: var(--amber); }
.message-row.user .message-privacy { margin-left: auto; }
.model-spine-divider { display: flex; max-width: 780px; align-items: center; gap: 9px; margin: 2px auto 18px; color: var(--faint); font-size: 9px; }
.model-spine-divider::before { width: 7px; height: 7px; border-radius: 50%; background: var(--model-accent, var(--green)); content: ""; }
.model-spine-divider::after { flex: 1; height: 1px; background: var(--line); content: ""; }
.empty-conversation { max-width: 410px; margin: 16vh auto 0; color: var(--muted); text-align: center; }
.empty-conversation img { width: 58px; height: 58px; margin: 0 auto 13px; opacity: .92; }
.empty-conversation h3 { margin: 0 0 7px; color: var(--text-soft); font: 500 25px/1.2 Lora, Georgia, serif; }
.empty-conversation p { font-size: 12px; line-height: 1.55; }
.attachment-chip { display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-soft); background: var(--panel); font-size: 11px; }
.attachment-chip i { color: var(--green-strong); font-style: normal; }

.composer-wrap { position: relative; padding: 10px clamp(24px, 8vw, 120px) max(15px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--workspace) 24%); }
.composer { display: flex; max-width: 780px; min-height: 58px; align-items: flex-end; gap: 8px; margin: 0 auto; padding: 9px; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--input); box-shadow: 0 12px 32px rgba(0,0,0,.14); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.composer:focus-within { border-color: var(--green); background: var(--panel); box-shadow: 0 0 0 3px var(--green-focus), 0 16px 36px rgba(0,0,0,.16); }
.composer textarea { flex: 1; max-height: 156px; min-height: 39px; resize: none; border: 0; outline: 0; padding: 9px 3px 7px; background: transparent; font-size: 14px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--faint); }
.attach-button, .send-button { display: grid; flex: 0 0 auto; width: 39px; height: 39px; place-items: center; border-radius: 10px; transition: color .14s ease, background .14s ease, transform .12s ease; }
.attach-button { color: var(--muted); background: transparent; }
.attach-button:hover { color: var(--text); background: var(--surface-hover); }
.send-button { color: var(--on-accent); background: var(--green); }
.send-button:hover { background: var(--green-strong); }
.send-button svg { width: 18px; height: 18px; }
.send-button:disabled { cursor: wait; opacity: .55; }
.composer-meta { display: flex; max-width: 756px; justify-content: space-between; margin: 6px auto 0; color: var(--faint); font-size: 8px; }
.composer-meta span { display: flex; align-items: center; gap: 5px; }
.composer-meta svg { width: 11px; height: 11px; color: var(--green); }
.eden-pet { position: absolute; z-index: 2; top: -45px; right: max(clamp(24px, 8vw, 120px), calc((100% - 780px) / 2 + 12px)); width: 68px; height: 60px; pointer-events: none; }
@keyframes pet-breathe { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-2px) rotate(1deg); } }
.thinking-dots { display: inline-flex; gap: 5px; padding: 8px 2px; }
.thinking-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: eden-pulse 1s infinite ease-in-out; }
.thinking-dots i:nth-child(2) { animation-delay: .14s; }
.thinking-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes eden-pulse { 0%,70%,100% { opacity: .28; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
.message-row.failed .message-bubble { opacity: .55; }
.message-row.failed .message-privacy { color: var(--red); }
.message-row.pending .message-bubble { opacity: .72; }

.context-rail { display: none; }
.switch { position: relative; display: inline-flex; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: relative; width: 35px; height: 21px; border-radius: 20px; background: var(--line-strong); transition: background .18s ease; }
.switch i::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--muted); transition: left .18s ease, background .18s ease; content: ""; }
.switch input:checked + i { background: var(--green-deep); }
.switch input:checked + i::after { left: 17px; background: var(--green); }

.memory-screen, .profile-screen { max-width: 1120px; margin: 0 auto; }
.memory-intro { display: flex; max-width: 860px; align-items: center; gap: 15px; margin: 0 auto 27px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.memory-orbit { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border-radius: 10px; color: var(--green-strong); background: var(--green-wash); }
.memory-orbit svg { width: 19px; height: 19px; }
.memory-intro strong { display: block; margin-bottom: 3px; font-size: 12px; }
.memory-intro p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.memory-columns { display: grid; max-width: 860px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 0 auto; }
.memory-list { display: grid; gap: 7px; }
.memory-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); transition: opacity .16s ease, background .16s ease; }
.memory-card:hover { background: var(--surface); }
.memory-card.disabled { opacity: .52; }
.memory-card strong, .memory-card small { display: block; }
.memory-card strong { font-size: 12px; }
.memory-card small { margin-top: 4px; color: var(--faint); font-size: 8px; }
.memory-card p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.memory-actions { display: flex; max-width: 860px; justify-content: flex-end; gap: 8px; margin: 21px auto 0; }
.memory-actions button { min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--panel); font-size: 11px; }
.memory-actions button:hover { color: var(--text); background: var(--surface); }
.memory-actions .danger-quiet { color: var(--red); }

.profile-hero { display: flex; max-width: 860px; align-items: center; gap: 18px; margin: 0 auto 29px; }
.profile-hero .avatar { display: grid; flex: 0 0 62px; width: 62px; height: 62px; place-items: center; border-radius: 18px 18px 18px 6px; color: var(--green-strong); background: var(--green-wash); font-size: 22px; font-weight: 600; }
.profile-hero h1 { font-size: clamp(31px, 4vw, 44px); }
.profile-hero p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.profile-grid { display: grid; max-width: 860px; grid-template-columns: 1.08fr .92fr; gap: 12px; margin: 0 auto; }
.plan-card, .settings-card { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.plan-card { padding: 21px; }
.plan-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.plan-top b { padding: 4px 7px; border-radius: 6px; color: var(--green-strong); background: var(--green-wash); font-size: 9px; }
.plan-card h2 { margin: 23px 0 5px; font-size: 20px; font-weight: 600; }
.plan-card > p { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.plan-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 19px 0; }
.plan-stats span { min-height: 48px; padding: 9px 10px; border-radius: 9px; color: var(--muted); background: var(--surface); font-size: 9px; line-height: 1.35; }
.plan-stats b { display: block; margin-bottom: 3px; color: var(--text); font-size: 12px; font-weight: 600; }
.plan-card button { display: flex; width: 100%; min-height: 43px; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; color: var(--on-accent); background: var(--green); font-size: 11px; font-weight: 650; }
.plan-card button:hover { background: var(--green-strong); }
.plan-card button svg { width: 15px; height: 15px; }
.billing-note { display: block; margin-top: 9px; color: var(--faint); font-size: 9px; line-height: 1.4; text-align: center; }
.settings-card { overflow: hidden; }
.settings-card button, .settings-row { display: flex; width: 100%; min-height: 55px; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--text-soft); background: transparent; font-size: 11px; text-align: left; }
.settings-card button:last-child { border-bottom: 0; }
.settings-card button:hover { background: var(--surface); }
.settings-card span { display: flex; align-items: center; gap: 8px; }
.settings-card b { display: flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; }
.settings-card b svg { width: 13px; height: 13px; }

.bottom-nav { display: none; }
.sheet-backdrop { position: fixed; z-index: 20; inset: 0; background: transparent; }
@keyframes fade-in { from { opacity: 0; } }
.model-sheet {
  position: fixed; z-index: 21; width: min(372px, calc(100vw - 24px));
  max-height: calc(100dvh - 110px); overflow: auto; overscroll-behavior: contain;
  padding: 14px; border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--panel); box-shadow: 0 12px 48px #0003, 0 2px 8px #0002;
  transform-origin: top right; animation: sheet-in .16s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
.model-sheet[hidden], .sheet-backdrop[hidden] { display: none; }
.model-sheet header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.model-sheet h2 { margin: 0; font-size: 15px; font-weight: 600; }
.model-sheet header button { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 8px; color: var(--muted); background: transparent; font-size: 22px; }
.model-sheet header button:hover { background: var(--surface-hover); }
.model-library { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.model-library button { min-height: 38px; padding: 0 10px; color: var(--muted); background: transparent; border-bottom: 2px solid transparent; font-size: 12px; }
.model-library button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--green); }
.provider-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.provider-tabs[hidden] { display: none; }
.provider-tab { min-height: 38px; padding: 0 5px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; }
.provider-tab:hover { color: var(--text); background: var(--surface-hover); }
.provider-tab.active { color: var(--text); background: var(--surface-hover); border-color: var(--green); }
.provider-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 1px 7px; }
.provider-heading strong { font-size: 11px; font-weight: 500; color: var(--muted); }
.provider-heading span { color: var(--muted); font-size: 10px; }
.model-options { display: grid; gap: 4px; }
.model-option { display: flex; min-width: 0; align-items: center; border-radius: 10px; background: var(--surface); }
.model-option:hover { background: var(--surface-hover); }
.model-select { display: flex; flex: 1; min-width: 0; min-height: 64px; align-items: center; gap: 9px; padding: 10px; color: var(--text); background: transparent; text-align: left; border-radius: 10px; }
.model-select:disabled { cursor: default; }
.model-copy { flex: 1; min-width: 0; }
.model-copy strong, .model-copy small { display: block; }
.model-copy strong { font-size: 13px; font-weight: 600; }
.model-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.model-check { color: var(--green); font-size: 15px; }
.availability { display: inline-flex; font-size: 10px; font-weight: 500; white-space: nowrap; }
.availability.available { color: var(--green-strong); }
.availability.beta { color: var(--amber); }
.availability.soon { color: var(--muted); }
.favorite-star { flex: 0 0 40px; min-height: 44px; padding: 0; color: var(--muted); background: none; font-size: 20px; border-radius: 8px; }
.favorite-star.active { color: var(--amber); }
.model-empty { margin: 10px 4px 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.context-policy { margin-top: 12px; border-top: 1px solid var(--line); }
.context-policy-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 2px 0; cursor: pointer; list-style: none; }
.context-policy-heading::-webkit-details-marker { display: none; }
.context-policy-heading strong, .context-policy-heading small { display: block; }
.context-policy-heading strong { color: var(--text-soft); font-size: 11px; font-weight: 500; }
.context-policy-heading small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.context-policy-heading svg { width: 14px; height: 14px; color: var(--muted); transition: transform .16s ease; }
.context-policy[open] .context-policy-heading svg { transform: rotate(180deg); }
.context-modes { display: grid; gap: 4px; margin-top: 12px; }
.context-mode { position: relative; min-height: 48px; padding: 8px 10px 8px 29px; border: 1px solid transparent; border-radius: 8px; color: var(--text-soft); background: transparent; text-align: left; }
.context-mode::before { position: absolute; left: 10px; top: 14px; width: 10px; height: 10px; border: 1px solid var(--muted); border-radius: 50%; content: ""; }
.context-mode:hover { background: var(--surface); }
.context-mode strong, .context-mode small { display: block; }
.context-mode strong { font-size: 11px; font-weight: 500; }
.context-mode small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.context-mode.active { background: var(--surface-hover); }
.context-mode.active::before { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 2px var(--surface-hover); }
.context-policy > p { margin: 9px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.model-pill[aria-expanded="true"] { border-color: var(--green); }
.model-pill[aria-expanded="true"] svg { transform: rotate(180deg); }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 23px; max-width: calc(100vw - 30px); padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: var(--surface-hover); box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 9px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { position: fixed; z-index: 50; inset: 0; display: grid; place-content: center; justify-items: center; gap: 11px; background: var(--bg); transition: opacity .25s ease; }
.loading-copy { display: grid; max-width: 350px; justify-items: center; padding: 0 24px; text-align: center; }
.loading-copy h1 { margin: 5px 0 8px; font-family: Onest, sans-serif; font-size: 17px; font-weight: 700; letter-spacing: .11em; }
.loading-copy h1 span { color: var(--green-strong); }
.loading-copy p { margin: 0; color: var(--muted); font-size: 11px; }
.loading-copy a { display: flex; min-height: 43px; align-items: center; gap: 7px; margin-top: 21px; padding: 0 16px; border-radius: 9px; color: var(--on-accent); background: var(--green); font-size: 12px; font-weight: 650; text-decoration: none; }
.loading-copy a[hidden], .loading-copy small[hidden] { display: none; }
.loading-copy a svg { width: 15px; height: 15px; }
.loading-copy small { max-width: 290px; margin-top: 12px; color: var(--faint); font-size: 9px; line-height: 1.5; }
.loading.auth-gate .brand-mark { width: 49px; height: 49px; border-radius: 14px; }
.loading.auth-gate .brand-mark img { width: 40px; height: 40px; }
.loading.auth-gate .loading-copy p { color: var(--text-soft); font: 500 23px/1.3 Lora, Georgia, serif; }
.loading.done { opacity: 0; pointer-events: none; }
.loading[hidden] { display: none; }

@media (max-width: 760px) {
  body { overflow: hidden; }
  .app-shell { display: block; height: 100dvh; }
  .sidebar, .context-rail { display: none; }
  .workspace { height: 100%; }
  .mobile-header { display: flex; min-height: calc(57px + var(--safe-top)); align-items: center; justify-content: space-between; padding: var(--safe-top) 15px 8px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--workspace) 92%, transparent); backdrop-filter: blur(18px); }
  .brand.compact { gap: 8px; padding: 0; }
  .brand.compact .brand-mark { width: 29px; height: 29px; }
  .brand.compact .brand-mark img { width: 23px; height: 23px; }
  .brand.compact .brand-word { font-size: 10px; }
  .round-button { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 9px; color: var(--on-accent); background: var(--green); }
  .round-button svg { width: 18px; height: 18px; }
  .screen { height: calc(100% - 57px - var(--safe-top)); padding: 26px 15px calc(82px + var(--safe-bottom)); }
  .screen-heading { display: block; margin: 0 0 24px; }
  .screen-heading h1 { font-size: clamp(32px, 10vw, 43px); }
  .heading-copy { margin-top: 9px; font-size: 11px; }
  .new-chat-inline { display: none; }
  .mobile-search { display: flex; margin: 0 0 23px; }
  .mobile-chat-list { grid-template-columns: 1fr; gap: 7px; }
  .chat-card { min-height: 118px; padding: 14px; }
  .chat-card strong { margin-top: 13px; }
  .chat-card time { padding-top: 9px; }
  .bottom-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: grid; height: calc(62px + var(--safe-bottom)); grid-template-columns: repeat(4, 1fr); padding: 6px 7px var(--safe-bottom); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sidebar) 94%, transparent); backdrop-filter: blur(18px); }
  .bottom-nav button { display: grid; place-content: center; justify-items: center; gap: 3px; color: var(--faint); background: none; }
  .bottom-nav button > svg { width: 19px; height: 19px; }
  .bottom-nav button b { font-size: 8px; font-weight: 550; }
  .bottom-nav button.active { color: var(--green-strong); }
  .bottom-nav .create-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; color: var(--on-accent); background: var(--green); }
  .bottom-nav .create-icon svg { width: 17px; height: 17px; }
  .conversation-screen { position: fixed; z-index: 12; inset: 0; height: 100dvh; padding: 0; background: var(--workspace); }
  .conversation-header { min-height: calc(60px + var(--safe-top)); grid-template-columns: 37px minmax(0, 1fr) auto; padding: var(--safe-top) 9px 7px; }
  .back-button { display: grid; }
  .conversation-title h2 { font-size: 11px; }
  .conversation-title span { font-size: 8px; }
  .model-pill { min-height: 35px; max-width: 142px; padding: 0 9px; font-size: 9px; }
  .model-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .more-button { display: none; }
  .preview-banner { min-height: 26px; margin-top: 7px; font-size: 8px; }
  .messages { padding: 24px 14px 12px; }
  .message-row { margin-bottom: 19px; }
  .message-bubble { max-width: 89%; font-size: 13px; line-height: 1.62; }
  .message-row.assistant .message-bubble { width: 100%; }
  .empty-conversation { margin-top: 13vh; }
  .composer-wrap { padding: 7px 10px max(9px, env(safe-area-inset-bottom)); }
  .composer { min-height: 55px; border-radius: 14px; }
  .composer textarea { font-size: 16px; }
  .composer-meta { display: none; }
  .eden-pet { top: -42px; right: 23px; width: 62px; height: 55px; }
  .memory-screen, .profile-screen { margin: 0; }
  .memory-intro { align-items: flex-start; padding: 13px; }
  .memory-columns, .profile-grid { grid-template-columns: 1fr; gap: 18px; }
  .memory-actions { justify-content: stretch; }
  .memory-actions button { flex: 1; padding: 0 8px; }
  .profile-hero { align-items: flex-start; gap: 13px; }
  .profile-hero .avatar { flex-basis: 52px; width: 52px; height: 52px; border-radius: 15px 15px 15px 5px; font-size: 18px; }
  .profile-hero p:last-child { font-size: 10px; }
  .plan-stats { grid-template-columns: 1fr 1fr; }
  .toast { bottom: calc(70px + var(--safe-bottom)); }
}

@media (max-width: 390px) {
  .screen-heading h1 { font-size: 31px; }
  .model-pill { max-width: 122px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
