/* ChatGPT-aligned UI — dark / light themes */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #212121;
  --bg-sidebar: #181818;
  --bg-sidebar-hover: #212121;
  --bg-elevated: #2f2f2f;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active: rgba(255, 255, 255, 0.1);
  --bg-input: #303030;
  --bg-composer: #303030;
  --bg-modal: #2f2f2f;
  --bg-code: #0d0d0d;
  --bg-code-header: #2f2f2f;
  --bg-toast: #2f2f2f;
  --bg-avatar-ai: #000000;
  --bg-avatar-user: #ab68ff;
  --bg-send: #ffffff;
  --bg-send-hover: #e8e8e8;
  --fg-send: #0d0d0d;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #8f8f8f;
  --text-code: #e6e6e6;
  --accent: #10a37f;
  --link: #7dd3c0;
  --danger: #ef4444;
  --user-bubble: #2f2f2f;
  --shadow-composer: 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-composer-focus: 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 28px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.5);
  --scrollbar: #444;
  --sidebar-w: 260px;
  --content-max: 48rem;
  --font: "Söhne", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-sidebar-hover: #ececec;
  --bg-elevated: #f4f4f4;
  --bg-hover: rgba(0, 0, 0, 0.05);
  --bg-active: rgba(0, 0, 0, 0.08);
  --bg-input: #f4f4f4;
  --bg-composer: #f4f4f4;
  --bg-modal: #ffffff;
  --bg-code: #f6f6f6;
  --bg-code-header: #ececec;
  --bg-toast: #ffffff;
  --bg-avatar-ai: #000000;
  --bg-avatar-user: #ab68ff;
  --bg-send: #0d0d0d;
  --bg-send-hover: #2a2a2a;
  --fg-send: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #0d0d0d;
  --text-secondary: #5d5d5d;
  --text-muted: #8e8e8e;
  --text-code: #1a1a1a;
  --accent: #10a37f;
  --link: #0d9488;
  --danger: #dc2626;
  --user-bubble: #f4f4f4;
  --shadow-composer: 0 0 0 1px rgba(0, 0, 0, 0.08),
    0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-composer-focus: 0 0 0 1px rgba(0, 0, 0, 0.14),
    0 4px 28px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.15);
  --scrollbar: #cfcfcf;
}

html,
body {
  transition: background-color 0.2s ease, color 0.15s ease;
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ========== Login (OpenAI-like) ========== */
.login-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  color: #0d0d0d;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 24px 8px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.login-logo svg {
  width: 36px;
  height: 36px;
}

.login-logo h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0d0d0d;
}

.login-logo p {
  color: #6e6e80;
  font-size: 0.95rem;
  text-align: center;
  margin-top: -8px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: #0d0d0d;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #c5c5d2;
  background: #fff;
  color: #0d0d0d;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: #0d0d0d;
  box-shadow: 0 0 0 1px #0d0d0d;
}

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  background: #0d0d0d;
  color: #fff;
  font-weight: 500;
  transition: background 0.15s;
  margin-top: 10px;
}

.btn-primary:hover {
  background: #2a2a2a;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-error {
  color: #c00;
  font-size: 0.875rem;
  min-height: 1.25rem;
  margin-top: 14px;
  text-align: center;
}

.login-hint {
  margin-top: 28px;
  font-size: 0.75rem;
  color: #8e8ea0;
  text-align: center;
  line-height: 1.6;
}

/* ========== App shell ========== */
.app {
  display: flex;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, transform 0.2s ease, margin 0.2s ease;
  z-index: 30;
}

.sidebar.collapsed {
  width: 0;
  overflow: hidden;
  margin: 0;
  border: none;
}

.sidebar-top {
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 8px;
}

.sidebar-brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
}

.sidebar-brand-left svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.btn-sidebar-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.12s;
}

.btn-sidebar-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.9rem;
  transition: background 0.12s;
}

.btn-new-chat:hover {
  background: var(--bg-hover);
}

.btn-new-chat .icon-box {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-new-chat svg {
  width: 18px;
  height: 18px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 2px 2px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  border: 1px solid transparent;
}

.sidebar-search:focus-within {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.sidebar-search svg {
  flex-shrink: 0;
  opacity: 0.55;
  color: var(--text-muted);
}

.sidebar-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-history-actions {
  padding: 4px 12px 0;
  display: flex;
  justify-content: flex-end;
}

.sidebar-mini-btn {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
}

.sidebar-mini-btn:hover {
  background: var(--bg-hover);
  color: var(--danger);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.conv-list-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.conv-list::-webkit-scrollbar {
  width: 6px;
}

.conv-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 3px;
}

.conv-group-label {
  padding: 12px 12px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.conv-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 10px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.conv-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.conv-item.active {
  background: var(--bg-active);
  color: var(--text);
}

.conv-item .conv-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item .title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.35;
  font-weight: 500;
  color: inherit;
}

.conv-item .preview {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.conv-item .meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.conv-item .actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s;
}

.conv-item .act.pin.active { color: var(--accent); }

.conv-item:hover .actions,
.conv-item.active .actions {
  opacity: 1;
}

.conv-item .act {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.conv-item .act:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.conv-item .act.del:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.conv-item .title-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.85rem;
  outline: none;
}

.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.sidebar-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-top: 2px;
}

.user-row:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-avatar-user);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-meta .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}

.user-meta .model {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 4px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(var(--bg) 60%, transparent);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-icon.mobile-only {
  display: none;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 6px 14px;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: background 0.12s;
  user-select: none;
}

.model-pill:hover {
  background: var(--bg-hover);
}

.model-pill .chevron {
  color: var(--text-muted);
  display: flex;
}

.model-pill .sub {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.topbar-spacer {
  flex: 1;
}

.model-menu {
  position: absolute;
  top: 52px;
  left: 16px;
  z-index: 70;
  width: min(340px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--bg-modal);
  box-shadow: var(--shadow-modal);
  animation: menu-in .14s ease-out;
}

.model-menu[hidden] { display: none; }
.model-menu-title { padding: 8px 10px 6px; color: var(--text-muted); font-size: .75rem; font-weight: 600; }
.model-option { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 11px; text-align: left; color: var(--text); }
.model-option:hover { background: var(--bg-hover); }
.model-option span:first-child { display: flex; flex-direction: column; gap: 3px; }
.model-option strong { font-size: .9rem; font-weight: 600; }
.model-option small { color: var(--text-muted); font-size: .76rem; }
.model-check { opacity: 0; color: var(--accent); font-weight: 700; }
.model-option.active .model-check { opacity: 1; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  padding-bottom: 8px;
}

.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

.empty-state {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 48px 20px 120px;
  color: var(--text);
}

.empty-state .logo-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: transparent;
}

.empty-state .logo-ring svg {
  width: 40px;
  height: 40px;
}

.empty-state h2 {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 28px;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 560px;
  width: 100%;
}

.suggestion {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.suggestion:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.suggestion strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
  font-weight: 500;
  font-size: 0.875rem;
}

.suggestion span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Message rows — ChatGPT style */
.msg-row {
  display: flex;
  justify-content: center;
  padding: 0 16px;
  animation: msg-in 0.18s ease-out;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg-inner {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  flex-direction: column;
  padding: 12px 0 4px;
}

.msg-row.user .msg-inner {
  align-items: flex-end;
}

.msg-row.assistant .msg-inner {
  align-items: stretch;
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  min-height: 28px;
}

.msg-row.user .msg-head {
  display: none;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  overflow: hidden;
}

.avatar.assistant {
  background: var(--bg-avatar-ai);
  border: 1px solid var(--border-strong);
  color: #fff;
}

.avatar.assistant svg {
  width: 16px;
  height: 16px;
}

html[data-theme="light"] .avatar.assistant {
  color: #fff;
}

.avatar.user {
  background: var(--bg-avatar-user);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.role-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.msg-body {
  min-width: 0;
  font-size: 1rem;
  line-height: 1.7;
  word-break: break-word;
  color: var(--text);
}

.msg-row.user .msg-body {
  background: var(--user-bubble);
  padding: 10px 16px;
  border-radius: 22px;
  max-width: min(100%, 70%);
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.975rem;
}

.msg-row.user .msg-body:has(.msg-atts) {
  white-space: normal;
}

.msg-row.assistant .msg-shell {
  padding: 0 0 0 38px;
  margin-top: -28px;
  min-width: 0;
  width: 100%;
}

.msg-row.assistant .msg-body {
  padding: 0;
  margin-top: 0;
  max-width: 100%;
}

.msg-row.assistant .msg-body > * { max-width: 100%; }
.msg-row.assistant .msg-body pre { scrollbar-width: thin; }
.msg-row.assistant .msg-body img { max-width: 100%; height: auto; border-radius: 12px; }
.msg-body :first-child { margin-top: 0; }

@media (max-width: 768px) {
  .msg-row.assistant .msg-shell {
    padding-left: 0;
    margin-top: 0;
  }
}

.msg-actions {
  display: flex;
  gap: 2px;
  padding: 4px 0 8px 38px;
  opacity: 0;
  transition: opacity 0.15s;
}

.msg-row:hover .msg-actions,
.msg-row:focus-within .msg-actions {
  opacity: 1;
}

.msg-row.user .msg-actions {
  padding-left: 0;
  justify-content: flex-end;
}

.msg-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}

.msg-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.msg-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Markdown */
.msg-body p {
  margin-bottom: 0.85em;
}

.msg-body p:last-child {
  margin-bottom: 0;
}

.msg-body .code-block {
  margin: 14px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-code);
}

.msg-body .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-code-header);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font);
}

.msg-body .code-header .lang {
  text-transform: lowercase;
  opacity: 0.9;
}

.msg-body .code-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  transition: background 0.12s, color 0.12s;
}

.msg-body .code-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.msg-body pre {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}

.msg-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.msg-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: var(--text-code);
}

.msg-body ul,
.msg-body ol {
  margin: 0.5em 0 0.85em 1.4em;
}

.msg-body li {
  margin-bottom: 0.35em;
}

.msg-body li::marker {
  color: var(--text-muted);
}

.msg-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg-body h1,
.msg-body h2,
.msg-body h3 {
  margin: 1.1em 0 0.5em;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.msg-body h1 {
  font-size: 1.4em;
}
.msg-body h2 {
  font-size: 1.2em;
}
.msg-body h3 {
  font-size: 1.05em;
}

.msg-body blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  padding-left: 14px;
  color: var(--text-secondary);
  margin: 0.85em 0;
}

.msg-body table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-size: 0.9em;
  display: block;
  overflow-x: auto;
}

.msg-body th,
.msg-body td {
  border: 1px solid var(--border-strong);
  padding: 8px 12px;
  text-align: left;
}

.msg-body th {
  background: var(--bg-elevated);
  font-weight: 600;
}

.msg-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}

.cursor-blink::after {
  content: "●";
  display: inline-block;
  margin-left: 3px;
  font-size: 0.65em;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
  color: var(--text);
  opacity: 0.7;
}

/* Reasoning / thinking panel (LibreChat / DeepSeek style) */
.think-block {
  margin: 0 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.think-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.think-summary::-webkit-details-marker {
  display: none;
}

.think-summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.think-block[open] .think-summary::before {
  transform: rotate(90deg);
}

.think-summary .think-label {
  color: var(--text);
}

.think-summary .think-status {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.think-summary .think-status.live {
  color: var(--accent);
}

.think-body {
  padding: 0 14px 12px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-wrap;
  border-top: 1px solid var(--border);
  max-height: 360px;
  overflow-y: auto;
}

.think-body p {
  margin-bottom: 0.6em;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Attachment preview (above composer) */
.attach-preview {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px 10px;
}

.attach-preview[hidden] {
  display: none !important;
}

.attach-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px 10px 6px 6px;
  max-width: 220px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.attach-chip.image {
  padding: 0;
  overflow: hidden;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  max-width: none;
}

.attach-chip.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attach-chip .file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
}

.attach-chip .file-meta {
  min-width: 0;
  flex: 1;
}

.attach-chip .file-meta .fn {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.8rem;
}

.attach-chip .file-meta .fs {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.attach-chip .rm {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s;
}

.attach-chip:hover .rm,
.attach-chip .rm:focus {
  opacity: 1;
}

.attach-chip:not(.image) .rm {
  position: static;
  background: transparent;
  color: var(--text-muted);
  opacity: 1;
  width: 24px;
  height: 24px;
}

/* In-message attachments */
.msg-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.msg-att-img {
  max-width: min(280px, 70vw);
  max-height: 240px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  display: block;
}

.msg-row.user .msg-att-img {
  border-radius: 14px;
}

.msg-att-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.msg-att-file .ext {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox.show {
  display: flex;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

/* Composer — ChatGPT style */
.composer-wrap {
  flex-shrink: 0;
  padding: 0 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(transparent, var(--bg) 28%);
  position: relative;
  z-index: 5;
}

.composer {
  width: 100%;
  max-width: var(--content-max);
  background: var(--bg-composer);
  border: 1px solid transparent;
  border-radius: 28px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 10px 10px 8px;
  box-shadow: var(--shadow-composer);
  transition: box-shadow 0.15s, background 0.15s;
}

.composer:focus-within {
  box-shadow: var(--shadow-composer-focus);
}

.btn-attach {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}

.btn-attach:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.composer textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  max-height: 200px;
  min-height: 28px;
  line-height: 1.5;
  padding: 6px 4px;
  color: var(--text);
}

.composer textarea::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-send);
  color: var(--fg-send);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
  margin-bottom: 1px;
}

.btn-send:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: var(--bg-send);
}

.btn-send:not(:disabled):hover {
  background: var(--bg-send-hover);
}

.btn-send:not(:disabled):active {
  transform: scale(0.96);
}

.btn-send.streaming {
  background: var(--bg-send);
  color: var(--fg-send);
  opacity: 1;
}

.btn-send.streaming:hover {
  background: var(--bg-send-hover);
}

.composer-hint {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  backdrop-filter: blur(2px);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    width: min(280px, 86vw);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: min(280px, 86vw);
    transform: translateX(-100%);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .btn-icon.mobile-only {
    display: flex;
  }

  .btn-icon.desktop-only {
    display: none;
  }

  .suggestions {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .msg-row.user .msg-body {
    max-width: 88%;
  }

  .msg-row.assistant .msg-body {
    padding-left: 0;
    margin-top: 0;
  }

  .msg-actions {
    padding-left: 0;
    opacity: 1;
  }

  .empty-state h2 {
    font-size: 1.5rem;
  }

  .empty-state {
    padding-bottom: 100px;
  }
}

@media (min-width: 769px) {
  .btn-icon.desktop-only {
    display: flex;
  }
}

/* Settings modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-modal);
}

.modal h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.modal-heading .sub { margin-bottom: 0; }
.modal-close { width: 34px; height: 34px; border-radius: 50%; color: var(--text-secondary); font-size: 1.4rem; line-height: 1; }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.settings-simple { max-width: 520px; padding: 22px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 2px; border-top: 1px solid var(--border); }
.setting-row > div { display: flex; flex-direction: column; gap: 4px; }
.setting-row strong { font-size: .9rem; font-weight: 550; }
.setting-row span { color: var(--text-muted); font-size: .78rem; }
.setting-action { padding: 8px 13px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text); white-space: nowrap; }
.setting-action:hover { background: var(--bg-hover); }
.status-badge { padding: 5px 9px; border-radius: 999px; background: rgba(16,163,127,.12); color: #63d6b7 !important; white-space: nowrap; }

.confirm-dialog { width: min(430px, 100%); padding: 22px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--bg-modal); box-shadow: var(--shadow-modal); display: grid; grid-template-columns: 42px 1fr; gap: 14px; animation: confirm-in .16s ease-out; }
.confirm-danger-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: rgba(220,38,38,.1); color: var(--danger); }
.confirm-danger-icon svg { width: 20px; height: 20px; }
.confirm-copy h2 { margin: 1px 0 6px; font-size: 1.05rem; font-weight: 600; }
.confirm-copy p { color: var(--text-secondary); font-size: .86rem; line-height: 1.55; }
.confirm-actions { grid-column: 1/-1; display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
.confirm-actions button { min-width: 82px; padding: 9px 15px; border-radius: 999px; font-size: .86rem; font-weight: 550; }
#confirmCancel { border: 1px solid var(--border-strong); color: var(--text); }
#confirmCancel:hover { background: var(--bg-hover); }
#confirmAccept { background: var(--danger); color: #fff; }
#confirmAccept:hover { filter: brightness(.92); }
@keyframes confirm-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }

.user-admin { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.user-admin h3 { margin-bottom: 10px; font-size: .95rem; }
.user-create { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.user-create input { padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--bg-input); }
.user-create button, .user-admin-row button { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; }
.user-list { margin-top: 10px; }
.user-admin-row { display: flex; align-items: center; gap: 8px; padding: 10px 2px; border-top: 1px solid var(--border); }
.user-admin-row > div { flex: 1; display: flex; flex-direction: column; }
.user-admin-row small { color: var(--text-muted); }
@media (max-width: 700px) { .user-create { grid-template-columns: 1fr; } }

.modal .sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal .sub a {
  color: var(--link);
}

.modal label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-top: 12px;
  font-weight: 500;
}

.modal select,
.modal input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  outline: none;
  transition: border-color 0.15s;
}

.modal select:focus,
.modal input:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-modal-primary {
  background: var(--bg-send);
  color: var(--fg-send);
}

.btn-modal-primary:hover {
  background: var(--bg-send-hover);
}

.btn-modal-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-modal-secondary:hover {
  background: var(--bg-hover);
}

.btn-modal-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-modal-ghost:hover {
  color: var(--text);
}

.modal-status {
  margin-top: 12px;
  font-size: 0.82rem;
  min-height: 1.2em;
  color: var(--text-secondary);
  line-height: 1.45;
}

.modal-status.ok {
  color: #6ee7b7;
}

.modal-status.err {
  color: #fca5a5;
}

.free-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(16, 163, 127, 0.2);
  color: #6ee7b7;
  margin-left: 6px;
  vertical-align: middle;
}

/* Theme toggle icons */
.theme-icon-sun,
.theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

html[data-theme="light"] .theme-icon-moon {
  display: block;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg-toast);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 90%;
  box-shadow: var(--shadow-modal);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: #7f1d1d;
  background: #3f1f1f;
  color: #fecaca;
}

/* Polished assistant output */
.msg-row.assistant .msg-inner { padding-top: 18px; }
.msg-row.assistant .msg-head { display: none; }
.msg-row.assistant .msg-shell { padding: 0; margin-top: 0; }
.msg-row.assistant .msg-actions { padding-left: 0; }

.msg-row.assistant .msg-body.message-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(220, 38, 38, .22);
  border-radius: 14px;
  background: rgba(220, 38, 38, .055);
  color: var(--text);
  font-size: .9rem;
  line-height: 1.45;
}
.message-error .error-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
}
.message-error strong { display: block; margin-bottom: 2px; font-size: .88rem; }
.message-error p { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; }

.msg-row.assistant .think-block {
  margin: 0 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.msg-row.assistant .think-summary {
  width: max-content;
  max-width: 100%;
  padding: 5px 8px;
  margin-left: -8px;
  border-radius: 8px;
  gap: 7px;
  font-size: .82rem;
  color: var(--text-secondary);
}
.msg-row.assistant .think-summary:hover { background: var(--bg-hover); }
.msg-row.assistant .think-summary::before { font-size: .85rem; }
.msg-row.assistant .think-summary .think-label { color: var(--text-secondary); font-weight: 500; }
.msg-row.assistant .think-summary .think-status { margin-left: 6px; font-size: .72rem; }
.msg-row.assistant .think-body {
  margin-top: 7px;
  padding: 2px 0 2px 13px;
  font-size: .84rem;
  line-height: 1.62;
  color: var(--text-muted);
  border: 0;
  border-left: 2px solid var(--border-strong);
  max-height: 260px;
}

/* Mobile-first finishing pass */
@supports (height: 100dvh) {
  .app { height: 100dvh; }
  .login-page { min-height: 100dvh; }
}

@media (max-width: 768px) {
  html, body { overflow: hidden; overscroll-behavior: none; }
  .app { width: 100%; min-height: 100%; }
  .main { width: 100%; }
  .topbar {
    height: 52px;
    padding: env(safe-area-inset-top) 8px 0;
    min-height: calc(52px + env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(12px);
  }
  .btn-icon { width: 40px; height: 40px; border-radius: 10px; }
  .model-pill { min-width: 0; max-width: calc(100vw - 104px); padding: 7px 8px; font-size: .98rem; }
  .model-pill #topModel { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .model-menu { top: calc(50px + env(safe-area-inset-top)); left: 8px; width: calc(100vw - 16px); border-radius: 15px; }
  .model-option { min-height: 54px; padding: 10px 12px; }

  .sidebar {
    width: min(310px, 88vw);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { width: min(310px, 88vw); }
  .sidebar.collapsed { width: min(310px, 88vw); }
  .sidebar-overlay { touch-action: none; }
  .sidebar-nav-btn, .btn-new-chat { min-height: 44px; }
  .conv-item { padding: 10px; min-height: 54px; }
  .conv-item .actions { opacity: 1; flex-direction: row; align-self: center; }
  .conv-item .act { width: 30px; height: 30px; }
  .conv-item .preview, .conv-item .meta-row { display: none; }

  .messages { scrollbar-gutter: auto; padding-bottom: 4px; overscroll-behavior-y: contain; }
  .msg-row { padding: 0 12px; }
  .msg-inner { padding-top: 10px; }
  .msg-row.assistant .msg-inner { padding-top: 16px; }
  .msg-row.user .msg-body { max-width: 92%; padding: 9px 13px; border-radius: 18px; font-size: .94rem; }
  .msg-body { font-size: .96rem; line-height: 1.65; }
  .msg-body .code-block { margin-left: 0; margin-right: 0; border-radius: 10px; }
  .msg-body pre { font-size: .79rem; padding: 12px; }
  .msg-body table { width: 100%; }
  .msg-att-img { max-width: min(260px, 78vw); max-height: 260px; }
  .msg-actions { opacity: 1; padding-bottom: 2px; }
  .msg-action-btn { width: 38px; height: 38px; }

  .empty-state { justify-content: flex-start; padding: 18vh 16px 90px; }
  .empty-state .logo-ring { width: 54px; height: 54px; margin-bottom: 14px; }
  .empty-state h2 { margin-bottom: 20px; font-size: 1.38rem; }
  .suggestions { display: flex; overflow-x: auto; gap: 8px; padding: 2px 1px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .suggestions::-webkit-scrollbar { display: none; }
  .suggestion { flex: 0 0 78%; min-height: 68px; padding: 12px 14px; scroll-snap-align: start; }

  .composer-wrap { padding: 6px 10px max(8px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 18%); }
  .attach-preview { padding: 0 0 8px; flex-wrap: nowrap; overflow-x: auto; }
  .composer { border-radius: 24px; padding: 7px 7px 7px 6px; gap: 3px; }
  .composer textarea { max-height: 128px; padding: 7px 3px; font-size: 16px; }
  .btn-attach, .btn-send { width: 38px; height: 38px; }
  .composer-hint { display: none; }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .settings-simple {
    max-width: none;
    width: 100%;
    max-height: min(88dvh, 760px);
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .modal-heading { position: sticky; top: -18px; z-index: 2; margin: -18px -16px 8px; padding: 18px 16px 10px; background: var(--bg-modal); }
  .setting-row { padding: 14px 2px; gap: 12px; }
  .confirm-dialog { width: 100%; grid-template-columns: 38px 1fr; padding: 20px 16px max(18px, env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-bottom: 0; }
  .confirm-danger-icon { width: 38px; height: 38px; }
  .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .confirm-actions button { min-height: 44px; }

  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 28px); text-align: center; }
  .lightbox { padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .login-page { align-items: flex-start; padding: max(64px, 12vh) 20px 24px; }
  .login-card { padding: 0; }
  .login-logo { margin-bottom: 24px; gap: 14px; }
  .login-logo h1 { font-size: 1.72rem; }
  .form-group input, .btn-primary { min-height: 48px; font-size: 16px; }
  .user-create { grid-template-columns: 1fr; }
  .user-admin-row { flex-wrap: wrap; }
}

/* Cleaner ChatGPT-like mobile home */
@media (max-width: 768px) {
  .sidebar { box-shadow: none; }
  .sidebar.open { box-shadow: 12px 0 36px rgba(0, 0, 0, .2); }

  .topbar {
    border-bottom: 0;
    box-shadow: none;
  }
  .model-pill { font-size: 1rem; font-weight: 600; }

  .empty-state {
    min-height: 100%;
    justify-content: center;
    padding: 0 20px clamp(110px, 18vh, 180px);
  }
  .empty-state .logo-ring { display: none; }
  .empty-state h2 {
    margin: 0;
    font-size: clamp(1.55rem, 6vw, 1.85rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.035em;
  }
  .empty-state .suggestions { display: none; }

  .composer-wrap {
    padding-left: 12px;
    padding-right: 12px;
    background: var(--bg);
  }
  .composer {
    min-height: 54px;
    border: 1px solid var(--border-strong);
    border-radius: 27px;
    background: var(--bg-composer);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
  }
  .composer:focus-within {
    border-color: color-mix(in srgb, var(--text) 18%, transparent);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  .btn-attach { color: var(--text-secondary); }
  .btn-send { width: 36px; height: 36px; }
}
