:root {
  --bg: #0e1014;
  --bg-2: #141821;
  --bg-3: #12151b;
  --bg-4: #1a1f29;
  --border: #232833;
  --border-soft: #1b202a;
  --text: #e8ecf1;
  --muted: #9aa4b2;
  --muted-2: #6b7280;
  --accent: #4D6BFE;
  --accent-hover: #3b5bfa;
  --accent-soft: rgba(77,107,254,.12);
  --danger: #f87171;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.5);
}
[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f7f8fa;
  --bg-3: #f2f4f8;
  --bg-4: #eef1f6;
  --border: #e5e7eb;
  --border-soft: #eef1f5;
  --text: #0e1014;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --accent-soft: rgba(77,107,254,.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, textarea, select {
  font: inherit; color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder { color: var(--muted-2); }
.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-name {
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600; font-size: 20px;
  color: var(--accent); letter-spacing: -0.5px;
}
.brand.big .brand-name { font-size: 28px; }

/* AUTH */
.auth-body { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding: 32px 28px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }
#loginForm, #signupForm { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.field { position: relative; display: block; }
.field input { width: 100%; padding-right: 44px; font-size: 15px; }
.field .eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--muted); padding: 8px; border-radius: 8px;
}
.field .eye:hover { background: var(--bg-3); color: var(--text); }
.terms { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.row-between:last-child { border-bottom: none; }
.link { font-size: 13px; color: var(--accent); }
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 15px; font-size: 13px;
}
.btn-ghost:hover { background: var(--bg-3); }
.btn-danger-outline {
  border: 1px solid var(--danger); color: var(--danger);
  border-radius: 999px; padding: 7px 15px; font-size: 13px;
}
.btn-danger-outline:hover { background: rgba(248,113,113,.1); }
.error { color: var(--danger); font-size: 13px; margin: 4px 0 0; min-height: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.alt { display: flex; gap: 16px; justify-content: center; }

/* APP */
.app-body { height: 100dvh; overflow: hidden; }
.app {
  display: flex; height: 100dvh;
  padding-top: env(safe-area-inset-top);
  gap: 10px; padding-left: 10px; padding-right: 10px;
}
.sidebar {
  width: 270px; flex: 0 0 auto;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin: 10px 0;
  display: flex; flex-direction: column;
  transition: width .22s ease; overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .newchat span,
.sidebar.collapsed .newchat kbd,
.sidebar.collapsed .convos,
.sidebar.collapsed .uname,
.sidebar.collapsed .user-btn .ico { display: none; }
.sidebar.collapsed .newchat { justify-content: center; padding: 12px; }
.sidebar.collapsed .side-top { flex-direction: column; gap: 8px; }
.sidebar.collapsed .side-top-actions { flex-direction: column; }

.side-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 8px; }
.side-top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); }

.newchat {
  margin: 8px 14px 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font-weight: 500; font-size: 14px;
}
.newchat:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.newchat kbd {
  margin-left: auto; font-size: 11px; color: var(--muted);
  font-family: ui-monospace, monospace;
  background: var(--bg-3); padding: 2px 6px; border-radius: 5px;
}

.convos { flex: 1; overflow-y: auto; padding: 0 10px 10px; min-height: 0; }
.convos .group-label {
  padding: 14px 10px 6px;
  font-size: 11px; font-weight: 600;
  color: var(--muted-2); text-transform: uppercase;
  letter-spacing: .06em;
}
.convo {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
  cursor: pointer; white-space: nowrap;
  margin-bottom: 2px;
}
.convo:hover { background: var(--bg-2); }
.convo.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.convo .t { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.convo .row-act {
  opacity: 0; color: var(--muted);
  padding: 4px 6px; border-radius: 6px;
  font-size: 15px; line-height: 1;
}
.convo:hover .row-act { opacity: 1; }
.convo .row-act:hover { background: var(--bg-4); color: var(--text); }

.side-bottom { padding: 12px 14px 14px; border-top: 1px solid var(--border-soft); }
.user-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px; border-radius: var(--radius-sm);
}
.user-btn:hover { background: var(--bg-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c8fff);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(77,107,254,.35);
}
.uname { flex: 1; text-align: left; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; margin: 10px 0;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; position: relative;
}
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-3); flex: 0 0 auto;
}
.topbar .title {
  font-size: 15px; font-weight: 500; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-actions { margin-left: auto; }
.only-mobile { display: none; }

/* ===== STAGE (center → dock) ===== */
.main .stage {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; position: relative;
}
.main:not(.chatting) .stage { justify-content: center; }
.main:not(.chatting) .messages {
  flex: 0 0 auto; overflow: visible; padding-bottom: 8px;
}
.main:not(.chatting) .empty { min-height: auto; padding-bottom: 24px; }
.main:not(.chatting) .composer-wrap { padding-bottom: 0; }

.messages {
  flex: 1; overflow-y: auto;
  padding: 32px 24px 24px;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
  transition: padding .3s cubic-bezier(.2,.8,.2,1);
}
.empty { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 40vh; }
.empty-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-inner h2 { font-size: 30px; font-weight: 500; margin: 0; text-align: center; letter-spacing: -0.5px; }
.empty-inner img { filter: drop-shadow(0 8px 24px rgba(77,107,254,.35)); }

.msg-row {
  display: flex; flex-direction: column;
  max-width: 780px; width: 100%; margin: 0 auto;
  animation: msgIn .22s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-row.user { align-items: flex-end; }
.msg-row.assistant { align-items: flex-start; }
.bubble {
  background: var(--accent); color: #fff;
  padding: 12px 16px;
  border-radius: 18px 18px 4px 18px;
  max-width: 85%;
  white-space: pre-wrap; word-wrap: break-word;
  font-size: 15px; line-height: 1.5;
  box-shadow: 0 2px 8px rgba(77,107,254,.2);
}
.msg-row.assistant .bubble { background: transparent; color: var(--text); padding: 0; box-shadow: none; }

.md { width: 100%; font-size: 15px; line-height: 1.65; }
.md h1, .md h2, .md h3 { margin: 14px 0 8px; font-weight: 600; }
.md h1 { font-size: 20px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 24px; }
.md li { margin: 5px 0; }
.md code {
  background: var(--bg-2); padding: 2px 7px; border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px; border: 1px solid var(--border-soft);
}
.md pre {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  overflow-x: auto; margin: 12px 0;
}
.md pre code { background: transparent; padding: 0; font-size: 13px; line-height: 1.6; border: none; }
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 14px; margin-top: 12px;
  font-size: 12px; color: var(--muted);
}
.code-head + pre { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.code-actions { display: flex; gap: 14px; }
.code-actions button {
  color: var(--muted); font-size: 12px;
  display: inline-flex; align-items: center; gap: 5px;
}
.code-actions button:hover { color: var(--text); }

.dots { display: inline-flex; gap: 5px; padding: 8px 0; }
.dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: dotpulse 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dotpulse {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

.msg-actions {
  display: flex; gap: 4px; margin-top: 8px;
  opacity: 0; transition: opacity .18s;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-actions .icon-btn { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.msg-actions .icon-btn .ico { width: 16px; height: 16px; }
.msg-actions .icon-btn:hover { background: var(--bg-2); color: var(--text); }

.composer-wrap {
  padding: 0 24px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center;
  flex: 0 0 auto;
}
.composer {
  width: 100%; max-width: 780px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.composer textarea {
  border: none; padding: 6px 8px;
  font-size: 15px; resize: none; max-height: 180px;
  width: 100%; background: transparent; line-height: 1.5;
}
.composer textarea:focus { outline: none; box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.left-pills { display: flex; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; color: var(--muted);
}
.pill .ico { width: 15px; height: 15px; }
.pill:hover { color: var(--text); border-color: var(--muted-2); }
.pill[data-on="true"] {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-soft); font-weight: 500;
}
.right-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(77,107,254,.4);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:active:not(:disabled) { transform: scale(.94); }
.send-btn:disabled { background: var(--bg-3); color: var(--muted-2); cursor: not-allowed; box-shadow: none; }
.send-btn .ico { width: 19px; height: 19px; }
.send-btn .stop-icon { display: none; }
.send-btn.streaming { background: var(--bg-4); color: var(--text); box-shadow: none; }
.send-btn.streaming .send-icon { display: none; }
.send-btn.streaming .stop-icon { display: block; }

.foot-note { text-align: center; color: var(--muted-2); font-size: 11px; margin: 10px 0 0; }

.attachments { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 4px 8px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px;
  font-size: 12px; max-width: 220px;
}
.attach-chip .thumb {
  width: 30px; height: 30px; border-radius: 7px;
  object-fit: cover; background: var(--bg-2);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.attach-chip .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.attach-chip .rm { color: var(--muted); font-size: 16px; line-height: 1; }
.attach-chip .rm:hover { color: var(--danger); }

/* MENU */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  z-index: 40;
}
.menu {
  position: fixed; z-index: 100; min-width: 220px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  box-shadow: var(--shadow-lg); animation: pop .14s ease;
}
.menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px 12px; border-radius: 8px;
  font-size: 14px; color: var(--text); text-align: left;
}
.menu button:hover { background: var(--bg-3); }

/* MODAL */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fade .18s ease;
}
.modal-panel {
  width: min(560px, 92vw); max-height: 90vh;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 24px;
  position: relative; animation: pop .2s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.settings-panel { width: min(760px, 94vw); }
.modal-title { margin: 0 0 12px; font-size: 19px; font-weight: 600; }
.modal-body { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.55; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-input {
  width: 100%; margin-bottom: 20px;
  border-radius: var(--radius-sm); padding: 13px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-btn {
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); background: transparent; color: var(--text);
}
.modal-btn:hover { background: var(--bg-3); }
.modal-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-btn.primary:hover { background: var(--accent-hover); }
.modal-btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.modal-btn.danger:hover { background: rgba(248,113,113,.1); }

/* SETTINGS LAYOUT */
.settings-grid {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 20px; min-height: 0; flex: 1; overflow: hidden;
}
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav .tab {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; text-align: left;
  transition: background .12s, color .12s;
}
.settings-nav .tab .ico { width: 18px; height: 18px; }
.settings-nav .tab:hover { background: var(--bg-3); color: var(--text); }
.settings-nav .tab.active { background: var(--bg-3); color: var(--text); font-weight: 500; }
.settings-content { overflow-y: auto; padding-right: 4px; min-height: 0; }
.panel h4 { margin: 0 0 10px; font-size: 14px; font-weight: 500; }
.panel h4 + h4, .panel .theme-grid + h4 { margin-top: 20px; }

.theme-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.theme-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}
.theme-card .ico { width: 22px; height: 22px; }
.theme-card:hover { color: var(--text); border-color: var(--muted-2); }
.theme-card.active {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); font-weight: 500;
}

.about-hero {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}
.about-hero img { filter: drop-shadow(0 4px 12px rgba(77,107,254,.4)); }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .2s; }
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.file-panel {
  width: min(900px, 96vw); max-height: 90vh;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden;
  display: flex; flex-direction: column;
  animation: pop .2s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-lg);
}
.file-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.file-head > div { display: flex; gap: 6px; }
.file-body {
  flex: 1; overflow: auto; background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
}
.file-body img { max-width: 100%; max-height: 70vh; display: block; }
.file-body iframe { width: 100%; height: 70vh; border: none; background: #fff; }
.file-body pre { padding: 20px; color: var(--text); width: 100%; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  font-size: 13px; z-index: 90; box-shadow: var(--shadow-lg);
  animation: fade .15s ease;
}

/* INSTALL BANNER */
.install-banner {
  position: fixed; left: 20px; bottom: 20px; right: auto;
  z-index: 200;
  display: flex; align-items: center; gap: 14px;
  max-width: 420px; padding: 14px 16px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: installIn .28s cubic-bezier(.2,.8,.2,1);
}
.install-banner[hidden] { display: none !important; }
@keyframes installIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.install-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.install-text { flex: 1; display: flex; flex-direction: column; font-size: 13px; line-height: 1.4; }
.install-text strong { font-size: 14px; font-weight: 600; }
.install-text span { color: var(--muted); }
.install-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.install-later { padding: 7px 13px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.install-later:hover { background: var(--bg-3); color: var(--text); }
.install-now {
  padding: 7px 15px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  background: var(--accent); color: #fff;
}
.install-now:hover { background: var(--accent-hover); }

@media (max-width: 768px) {
  .app { padding: 0; gap: 0; }
  .main { margin: 0; border-radius: 0; border-left: none; border-right: none; }
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 82vw; max-width: 320px; margin: 0;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.8,.2,1);
    z-index: 45; padding-top: env(safe-area-inset-top);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 80px rgba(0,0,0,.7); }
  .sidebar.collapsed { width: 82vw; }
  .sidebar.collapsed .brand-name,
  .sidebar.collapsed .newchat span,
  .sidebar.collapsed .newchat kbd,
  .sidebar.collapsed .convos,
  .sidebar.collapsed .uname,
  .sidebar.collapsed .user-btn .ico { display: initial; }
  .sidebar.collapsed .convos { display: block; }
  .sidebar.collapsed .newchat { justify-content: flex-start; padding: 12px 14px; }
  .messages { padding: 16px 12px 8px; }
  .composer-wrap { padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
  .composer { border-radius: var(--radius-lg); }
  .empty-inner h2 { font-size: 22px; }
  .bubble { max-width: 90%; }
  .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .settings-nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav .tab { white-space: nowrap; flex: 0 0 auto; }
  .install-banner {
    left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: none; flex-wrap: wrap;
  }
  .install-actions { width: 100%; justify-content: flex-end; margin-top: 4px; }
}