:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-w: 280px;
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --composer-h: 80px;
}

[data-theme='light'] {
  --bg: #ffffff;
  --bg-elevated: #f7f6f3;
  --bg-sidebar: #f5f4ef;
  --bg-hover: #ecebe4;
  --bg-active: #e4e2d8;
  --bg-input: #ffffff;
  --bg-assistant: transparent;
  --bg-user: #f0eee6;
  --bg-code: #f5f4ef;
  --text: #1f1e1b;
  --text-secondary: #5c5a52;
  --text-tertiary: #8a877c;
  --text-on-accent: #ffffff;
  --border: #e6e4da;
  --border-strong: #d4d1c5;
  --accent: #c96442;
  --accent-hover: #b5553a;
  --accent-soft: #f5e6df;
  --danger: #c0392b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

[data-theme='dark'] {
  --bg: #1a1a1a;
  --bg-elevated: #252525;
  --bg-sidebar: #1a1a1a;
  --bg-hover: #2e2e2e;
  --bg-active: #383838;
  --bg-input: #252525;
  --bg-assistant: transparent;
  --bg-user: #2a2a2a;
  --bg-code: #141414;
  --text: #f5f4ef;
  --text-secondary: #b4b2a7;
  --text-tertiary: #84827a;
  --text-on-accent: #ffffff;
  --border: #333333;
  --border-strong: #444444;
  --accent: #d97757;
  --accent-hover: #e08a6e;
  --accent-soft: #3a2e29;
  --danger: #e57373;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; height: 100dvh; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  height: 100%;
  height: 100dvh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); background-clip: content-box; }

.layout { display: flex; height: 100vh; height: 100dvh; width: 100%; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-header { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; }

.brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand-logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.brand-logo svg { width: 17px; height: 17px; }


.new-chat-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: background var(--transition), border-color var(--transition);
}
.new-chat-btn:hover { background: var(--bg-hover); border-color: var(--text-tertiary); }
.new-chat-btn svg { width: 16px; height: 16px; }

.search-box { position: relative; margin: 0 14px 8px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-tertiary); pointer-events: none; }
.search-box input { width: 100%; padding: 9px 10px 9px 32px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; outline: none; transition: border-color var(--transition); }
.search-box input:focus { border-color: var(--accent); }

.conversations { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.conv-group-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); padding: 12px 8px 4px; }
.conv-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); position: relative; }
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-active); }
.conv-title { flex: 1; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.conv-title-input { flex: 1; font-size: 13.5px; padding: 2px 4px; background: var(--bg-input); border: 1px solid var(--accent); border-radius: 4px; outline: none; }
.conv-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--transition); }
.conv-item:hover .conv-actions, .conv-item.active .conv-actions { opacity: 1; }

.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-tertiary); transition: background var(--transition), color var(--transition); }
.icon-btn:hover { background: var(--bg-active); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; }

.sidebar-footer { padding: 10px 12px; padding-bottom: max(10px, var(--safe-bottom)); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.config-pill { font-size: 11px; padding: 3px 8px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.config-pill.ok { background: rgba(46, 160, 67, 0.14); color: #2ea043; }
.config-pill.warn { background: rgba(201, 100, 66, 0.14); color: var(--accent); }
.config-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.empty-convs { text-align: center; color: var(--text-tertiary); font-size: 13px; padding: 24px 12px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; overflow: hidden; }

.topbar {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg);
  position: relative; z-index: 10;
}
/* Default desktop: hamburger hidden, expand button only visible when collapsed */
.topbar .menu-toggle { display: none; }

/* Make sure the topbar buttons can never get pushed off-screen */
.topbar {
  min-width: 0;
  overflow: visible;
}
.topbar .model-selector {
  min-width: 0;
  flex-shrink: 1;
}
.topbar .topbar-spacer {
  flex: 1 1 0;
  min-width: 0;
}
.topbar .topbar-actions {
  flex-shrink: 0;
}
.topbar .icon-btn {
  flex-shrink: 0;
}



.model-selector { position: relative; }
.model-selector-btn {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg); font-size: 14px; font-weight: 500; max-width: 340px;
  transition: background var(--transition), border-color var(--transition);
}
.model-selector-btn:hover { background: var(--bg-hover); }
.model-selector-btn .model-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-selector-btn .chev { width: 15px; height: 15px; color: var(--text-tertiary); flex-shrink: 0; }
.model-provider-tag { font-size: 11px; color: var(--text-tertiary); background: var(--bg-elevated); padding: 2px 7px; border-radius: 20px; }

.model-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; width: 420px;
  max-width: calc(100vw - 32px); max-height: 70vh;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); z-index: 50; display: flex; flex-direction: column; overflow: hidden;
}
.model-dropdown-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 0; }
.model-dropdown-close { display: none; }
.model-dropdown-search { padding: 10px; border-bottom: 1px solid var(--border); }
.model-dropdown-search input { width: 100%; padding: 9px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; outline: none; }
.model-dropdown-search input:focus { border-color: var(--accent); }

.model-list { overflow-y: auto; padding: 6px; }
.model-option { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); }
.model-option:hover { background: var(--bg-hover); }
.model-option.selected { background: var(--accent-soft); }
.model-option-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.model-option-name { font-weight: 600; font-size: 14px; }
.model-option-provider { font-size: 11px; color: var(--text-tertiary); background: var(--bg); padding: 2px 8px; border-radius: 20px; flex-shrink: 0; }
.model-option-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.model-option-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.meta-chip { font-size: 11px; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; }
.meta-chip svg { width: 12px; height: 12px; opacity: 0.7; }
.cap-chip { font-size: 10px; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.model-list-status { padding: 18px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

.model-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-tertiary); padding: 10px 12px 4px; pointer-events: none;
}

.fav-btn {
  background: none; border: none; cursor: pointer; color: var(--text-tertiary);
  font-size: 14px; line-height: 1; padding: 0 2px; transition: color var(--transition);
}
.fav-btn.active { color: #f5a623; }
.fav-btn:hover { color: #f5a623; }

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.messages-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--composer-h) + max(16px, var(--safe-bottom)));
}
.messages-inner { max-width: 760px; margin: 0 auto; padding: 24px 20px 0; }

.message { display: flex; gap: 14px; padding: 18px 0; animation: fadeInUp 0.25s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message .avatar { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.message.user .avatar { background: var(--bg-active); color: var(--text); }
.message.assistant .avatar { background: var(--accent); color: #fff; }
.message.assistant .avatar svg { width: 18px; height: 18px; }
.message-body { flex: 1; min-width: 0; }
.message-role { font-size: 13px; font-weight: 600; margin-bottom: 2px; color: var(--text); }
.message-content { font-size: 15px; color: var(--text); word-wrap: break-word; overflow-wrap: break-word; }
.message-footer { display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; margin-top: 8px; min-width: 0; overflow: hidden; opacity: 0; transition: opacity var(--transition); }
.message:hover .message-footer, .message-footer:focus-within { opacity: 1; }
.message-stat { font-size: 11px; color: var(--text-tertiary); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; flex-shrink: 0; }
.message-stat svg { width: 12px; height: 12px; }
.copy-msg-btn { font-size: 11px; color: var(--text-tertiary); display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; flex-shrink: 0; transition: background var(--transition), color var(--transition); }
.copy-msg-btn:hover { background: var(--bg-hover); color: var(--text); }
.copy-msg-btn svg { width: 13px; height: 13px; }

.message-content p { margin: 0 0 12px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h1, .message-content h2, .message-content h3 { margin: 18px 0 10px; line-height: 1.3; }
.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.25em; }
.message-content h3 { font-size: 1.1em; }
.message-content ul, .message-content ol { margin: 0 0 12px; padding-left: 24px; }
.message-content li { margin: 4px 0; }
.message-content blockquote { border-left: 3px solid var(--border-strong); padding-left: 14px; margin: 0 0 12px; color: var(--text-secondary); }
.message-content a { color: var(--accent); text-decoration: underline; }
.message-content code:not(pre code) { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-code); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); }
.message-content pre { position: relative; margin: 0 0 14px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--bg-code); border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--text-tertiary); font-family: var(--font-mono); }
.code-copy { display: inline-flex; align-items: center; gap: 5px; color: var(--text-tertiary); padding: 2px 6px; border-radius: 5px; transition: background var(--transition), color var(--transition); }
.code-copy:hover { background: var(--bg-hover); color: var(--text); }
.code-copy svg { width: 13px; height: 13px; }
.message-content pre code { display: block; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; padding: 14px; overflow-x: auto; background: var(--bg-code); }
.message-content table { border-collapse: collapse; width: 100%; margin: 0 0 14px; font-size: 14px; }
.message-content th, .message-content td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.message-content th { background: var(--bg-elevated); font-weight: 600; }

.cursor-blink::after { content: '\25CB'; display: inline-block; margin-left: 2px; animation: blink 1s step-start infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 40px 20px; }
.welcome-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); display: grid; place-items: center; color: #fff; margin-bottom: 20px; }
.welcome-logo svg { width: 32px; height: 32px; }
.welcome h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
.welcome p { color: var(--text-secondary); font-size: 15px; max-width: 440px; margin-bottom: 28px; }
.suggestions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; max-width: 560px; }
.suggestion { text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); transition: background var(--transition), border-color var(--transition); }
.suggestion:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.suggestion strong { display: block; font-size: 14px; font-weight: 600; }
.suggestion span { font-size: 13px; color: var(--text-tertiary); }

.reasoning { margin: 4px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-sidebar); overflow: hidden; }
.reasoning-summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-secondary); list-style: none; user-select: none; }
.reasoning-summary::-webkit-details-marker { display: none; }
.reasoning-summary:hover { background: var(--bg-hover); }
.reasoning-brain { display: inline-flex; color: var(--accent); }
.reasoning-brain svg { width: 15px; height: 15px; }
.reasoning-label { flex: 1; }
.reasoning-chev { display: inline-flex; color: var(--text-tertiary); transition: transform var(--transition); }
.reasoning-chev svg { width: 15px; height: 15px; }
.reasoning[open] .reasoning-chev { transform: rotate(180deg); }
.reasoning-content {
  padding: 10px 14px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  text-align: left;
}
.reasoning-content p:first-child { margin-top: 0; }
.reasoning-content p { margin: 0 0 8px; }
.reasoning-content p:last-child { margin-bottom: 0; }
.reasoning-content ol,
.reasoning-content ul {
  margin: 6px 0;
  padding-left: 22px;
}
.reasoning-content li { margin: 2px 0; }
.reasoning.streaming .reasoning-brain { animation: reasoning-pulse 1.4s ease-in-out infinite; }
@keyframes reasoning-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.composer-wrap {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  padding: 0 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  z-index: 20;
  transition: left var(--transition), bottom var(--transition);
}



.composer {
  max-width: 760px; margin: 0 auto; background: var(--bg-input);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 8px; box-shadow: var(--shadow); transition: border-color var(--transition);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea { width: 100%; border: none; outline: none; background: transparent; resize: none; font-size: 15px; line-height: 1.5; padding: 8px 10px; max-height: 220px; color: var(--text); }
.composer textarea::placeholder { color: var(--text-tertiary); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 2px; }
.composer-hint { font-size: 11.5px; color: var(--text-tertiary); }
.send-btn { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; transition: background var(--transition), opacity var(--transition); }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn svg { width: 17px; height: 17px; }
.send-btn.stop { background: var(--text); }
[data-theme='dark'] .send-btn.stop { background: var(--bg-active); }

.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); font-size: 14px; text-align: left; transition: background var(--transition); }
.menu-item:hover { background: var(--bg-hover); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 16px; height: 16px; }
.menu-divider { height: 1px; background: var(--border); margin: 5px 4px; }

.toast-container {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  margin-bottom: max(0px, env(safe-area-inset-bottom, 0px));
}
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--radius-md); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn 0.2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.backdrop { display: none; }

.model-bottom-sheet-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 70;
  animation: fadeIn 0.2s ease;
}
.model-bottom-sheet-overlay.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.model-bottom-sheet {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  max-height: 70dvh;
  background: var(--bg-elevated); border-top-left-radius: 20px; border-top-right-radius: 20px;
  box-shadow: var(--shadow-lg); z-index: 71;
  flex-direction: column; overflow: hidden;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}
.model-bottom-sheet.active { display: flex; animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.bottom-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 10px auto 6px; flex-shrink: 0; }
.bottom-sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 16px 8px; flex-shrink: 0; }
.bottom-sheet-header h3 { font-size: 16px; font-weight: 600; }
.bottom-sheet-close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-tertiary); transition: background var(--transition); background: var(--bg-hover); }
.bottom-sheet-close:hover { background: var(--bg-active); color: var(--text); }
.bottom-sheet-close svg { width: 18px; height: 18px; }
.bottom-sheet-search { padding: 0 12px 10px; flex-shrink: 0; }
.bottom-sheet-search input { width: 100%; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; outline: none; }
.bottom-sheet-search input:focus { border-color: var(--accent); }
.bottom-sheet-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; -webkit-overflow-scrolling: touch; }

.bottom-sheet-list .model-option { padding: 8px 10px; }
.bottom-sheet-list .model-option-name { font-size: 13px; }
.bottom-sheet-list .model-option-provider { font-size: 10px; padding: 1px 6px; }
.bottom-sheet-list .model-option-desc { font-size: 11.5px; -webkit-line-clamp: 2; }
.bottom-sheet-list .model-option-meta { margin-top: 5px; gap: 4px; }
.bottom-sheet-list .meta-chip { font-size: 10px; padding: 1px 6px; }
.bottom-sheet-list .cap-chip { font-size: 9px; padding: 1px 5px; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    box-shadow: var(--shadow-lg); margin-left: calc(-1 * var(--sidebar-w) - 4px);
    width: var(--sidebar-w) !important;
  }
  .layout.sidebar-open .sidebar { margin-left: 0; }
  .layout.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 55; }
  .topbar .menu-toggle { display: grid; }

  .model-selector-btn { max-width: 200px; }
  .model-provider-tag { display: none; }
  .suggestions { grid-template-columns: 1fr; }
  .messages-inner { padding-left: 14px; padding-right: 14px; }
  .composer { margin-left: 0; margin-right: 0; }
  .composer-wrap { left: 0; padding: 0 12px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }

}

@media (max-width: 640px) {
  .model-dropdown { display: none !important; }
  .composer-hint { display: none; }
  .topbar { gap: 6px; padding: 0 10px; }
}

[hidden] { display: none !important; }


