/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --bg2: #18181f;
  --bg3: #22222d;
  --border: #2e2e3d;
  --text: #e8e8f0;
  --text2: #9898b0;
  --accent: #7c6af7;
  --accent-hover: #6b5ae0;
  --danger: #e05555;
  --danger-hover: #c94444;
  --radius: 12px;
  --radius-sm: 8px;
  /* Настройки отображения (переопределяются из JS) */
  --msg-max-width: min(560px, 92%);
  --msg-font-size: 14px;
  --msg-gap: 16px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid transparent; }
.btn-danger-ghost:hover:not(:disabled) { background: #3a1a1a; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ─── Inputs ───────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }
.textarea { resize: vertical; font-family: inherit; }

/* ─── Header (index) ───────────────────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 0 24px 48px; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #a99df5, #6b5ae0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Agents Grid ──────────────────────────────────────────────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.agent-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px 16px 16px;
  gap: 12px;
  cursor: pointer;
}
.agent-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.agent-card-avatar {
  flex-shrink: 0;
}

.agent-card-body {
  width: 100%;
  flex: 1;
  min-width: 0;
}
.agent-card-name {
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0 6px;
}
.agent-card-desc {
  font-size: 12px;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
/* compat alias */
.agent-card-prompt {
  font-size: 12px;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-card-footer {
  display: flex;
  gap: 8px;
  width: 100%;
}
.agent-card-footer .btn { flex: 1; font-size: 13px; }
.agent-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }

/* ─── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 500px;
}
.modal-sm { max-width: 380px; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }

/* Импорт карточки персонажа */
.card-import-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.card-import-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
.card-import-hint {
  font-size: 12px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-text { color: var(--text2); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 7px;
}
.hint { font-weight: 400; color: var(--text2); opacity: 0.7; }

.emoji-row { display: flex; gap: 10px; align-items: flex-start; }
.emoji-input { width: 56px; text-align: center; font-size: 22px; padding: 6px; }
.emoji-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.emoji-btn:hover { background: var(--border); }

/* ─── Chat Layout ──────────────────────────────────────────────────────────── */
body.chat-page { height: 100vh; overflow: hidden; }

.chat-layout {
  display: flex;
  height: 100vh;
}

/* ─── Chat Header ──────────────────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-avatar { font-size: 22px; }
.chat-header-name { font-weight: 600; font-size: 15px; }

/* ─── Context bar ──────────────────────────────────────────────────────────── */
.context-bar {
  font-size: 11px;
  color: var(--text2);
  padding: 4px 20px 0;
  background: var(--bg);
  min-height: 18px;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}

.back-link {
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}
.agent-name-lg { font-weight: 600; font-size: 15px; }

.chats-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  gap: 6px;
}
.chat-item:hover { background: var(--bg3); }
.chat-item.active { background: var(--bg3); border: 1px solid var(--border); }
.chat-item-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}
.chat-item-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.chat-owner-tag,
.chat-deleted-tag {
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
  white-space: nowrap;
}
.chat-owner-tag {
  color: var(--accent);
  background: rgba(124, 106, 247, 0.12);
  border: 1px solid rgba(124, 106, 247, 0.25);
}
.chat-deleted-tag {
  color: var(--danger);
  background: rgba(224, 85, 85, 0.1);
  border: 1px solid rgba(224, 85, 85, 0.25);
}
.chat-item-deleted {
  opacity: 0.5;
}
.chat-item-deleted .chat-item-title {
  text-decoration: line-through;
}
.chat-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.chat-item:hover .chat-item-actions { opacity: 1; }
.chat-item-actions .msg-btn { width: 20px; height: 20px; font-size: 11px; }
.chat-rename-btn:hover { color: var(--accent); }
.chat-delete-btn:hover { color: var(--danger); }

/* Переименование чата */
.chat-item.renaming .chat-item-actions { opacity: 0; pointer-events: none; }
.rename-input {
  flex: 1;
  min-width: 0;
  background: var(--bg3);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  padding: 2px 6px;
  outline: none;
}

.no-chats {
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  padding: 20px 0;
}

/* Main chat area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--msg-gap);
}

/* ── Format picker ──────────────────────────────────────────────────────────── */
.format-picker {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 12px;
}

.format-picker-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text1);
  text-align: center;
}

.format-picker-subtitle {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  margin-bottom: 8px;
}

.format-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 820px;
}

.format-card {
  flex: 1 1 220px;
  max-width: 260px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  color: var(--text1);
}

.format-card:hover {
  border-color: var(--accent);
  background: var(--bg3);
  transform: translateY(-2px);
}

.format-card:active {
  transform: translateY(0);
}

.format-card-icon {
  font-size: 26px;
  line-height: 1;
}

.format-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text1);
}

.format-card-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
}

.format-card-example {
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--bg1);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
  font-style: normal;
}

.format-card-example em {
  color: var(--accent);
  font-style: italic;
}

.format-skip-btn {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}

.format-skip-btn:hover {
  color: var(--text1);
}

.empty-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 14px;
}

/* Messages */
.message {
  display: flex;
  flex-direction: column;
  max-width: var(--msg-max-width);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.message.visible { opacity: 1; transform: translateY(0); }
.message-user { align-self: flex-end; }
.message-assistant { align-self: flex-start; }

.message-content {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: var(--msg-font-size);
  line-height: 1.6;
  word-break: break-word;
}
.message-user .message-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message-assistant .message-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.message-error .message-content {
  background: #2a1010;
  border-color: var(--danger);
  color: #f08080;
}

.message-assistant.streaming .message-content::after {
  content: '▋';
  display: inline-block;
  animation: blink 0.8s step-end infinite;
  margin-left: 2px;
  color: var(--accent);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.message-content code {
  background: rgba(255,255,255,0.1);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}

/* Message meta (time + copy) */
.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.message:hover .message-meta { opacity: 1; }
.message-user .message-meta { justify-content: flex-end; }

.message-time {
  font-size: 11px;
  color: var(--text2);
}

/* Компактные кнопки сообщений */
.msg-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.msg-btn:hover { color: var(--text); background: var(--bg3); }
.del-msg-btn:hover { color: var(--danger); background: #2a1010; }

/* Удаление сообщения */
.message.msg-removing {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Удалённое сообщение — видит только админ */
.message-deleted-admin {
  opacity: 0.4;
  filter: grayscale(0.4);
}
.message-deleted-admin .message-content {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.3);
}
.msg-deleted-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  background: rgba(224, 85, 85, 0.12);
  border: 1px solid rgba(224, 85, 85, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
  align-self: center;
}

/* Строка под последним ответом: варианты + регенерация */
.regen-row {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: -4px;
  margin-bottom: 4px;
}

.regen-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.regen-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124, 106, 247, 0.08);
}

/* Навигация по вариантам */
.variant-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 4px;
}
.var-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 15px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s;
}
.var-btn:hover:not(:disabled) { color: var(--text); }
.var-btn:disabled { opacity: 0.3; cursor: default; }
.var-counter { font-size: 12px; color: var(--text2); min-width: 30px; text-align: center; }

/* Редактирование сообщения */
.message.editing .message-content { display: none; }

.edit-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  resize: none;
  min-height: 60px;
}

.edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 6px;
  margin-bottom: 4px;
}

/* Chat input */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.chat-input {
  flex: 1;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.5;
  max-height: 160px;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input:disabled { opacity: 0.5; }

.send-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}

/* Кнопка прикрепления фото */
.attach-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.attach-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(124,106,247,0.06); }
.attach-btn:disabled { opacity: 0.4; pointer-events: none; }
.attach-btn-active { color: var(--accent); border-color: var(--accent); background: rgba(124,106,247,0.1); }

/* Превью прикреплённого изображения */
.attach-preview {
  position: relative;
  padding: 10px 20px 0;
  background: var(--bg);
}
.attach-preview img {
  max-height: 120px;
  max-width: 220px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  object-fit: contain;
}
.attach-remove-btn {
  position: absolute;
  top: 14px;
  left: 174px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.attach-remove-btn:hover { color: var(--danger); border-color: var(--danger); }

/* Изображение в пузыре сообщения */
.msg-image-wrap {
  margin-bottom: 8px;
}
.msg-image {
  max-width: min(300px, 100%);
  max-height: 300px;
  border-radius: var(--radius-sm);
  display: block;
  cursor: zoom-in;
  object-fit: contain;
  border: 1px solid var(--border);
}
.msg-image:hover { opacity: 0.92; }

/* Лайтбокс */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  animation: fadeIn 0.15s ease;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 8px 60px rgba(0,0,0,0.6);
}

/* ─── Right Panel (Персонаж + Настройки) ────────────────────────────────────── */
.right-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.right-panel.hidden { display: none; }

/* Вкладки */
.panel-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 4px;
  gap: 0;
}
.panel-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.panel-tab:hover { color: var(--text); }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-close-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: auto;
  transition: color 0.1s, background 0.1s;
}
.panel-close-btn:hover { color: var(--text); background: var(--bg3); }

/* Вкладки-панели */
.panel-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.panel-pane.active { display: flex; flex-direction: column; }

/* ── Вкладка Персонаж ───── */
.agent-panel-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
/* Карточка агента — аватар с отступом снизу */
.avatar-circle.agent-card-avatar { margin-bottom: 12px; }
.agent-panel-name {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}
.agent-panel-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  padding: 14px 16px 6px;
}
.agent-panel-prompt {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  padding: 0 16px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Вкладка Настройки ───── */
.settings-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Обратная совместимость — оставляем старый селектор для settings-panel */
.settings-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-panel.hidden { display: none; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}
.icon-btn:hover { color: var(--text); background: var(--bg3); }

.settings-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-of-type { border-bottom: none; margin-bottom: 8px; }

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-bottom: 10px;
}

.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 7px;
}
.settings-hint {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  margin-left: 4px;
}
.settings-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-left: 6px;
}
.settings-textarea { font-size: 13px; }

/* Context info */
.context-info {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.context-stat {
  font-size: 13px;
  color: var(--text);
}
.context-stat span {
  font-weight: 600;
  color: var(--accent);
}

/* Range input */
.range-input {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin-bottom: 4px;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text2);
}

.btn-full { width: 100%; margin-top: 4px; }

.settings-saved {
  text-align: center;
  font-size: 13px;
  color: #6bcf7f;
  margin-top: 8px;
  transition: opacity 0.3s;
}
.settings-saved.hidden { display: none; }

/* ─── Misc ─────────────────────────────────────────────────────────────────── */
.loading, .empty, .error { color: var(--text2); font-size: 14px; padding: 20px 0; }
.error { color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ─── Login page ────────────────────────────────────────────────────────────── */
body.login-page,
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box,
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text2);
}
.login-footer a {
  color: var(--accent);
  text-decoration: none;
}
.login-footer a:hover { text-decoration: underline; }
.login-logo {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #a99df5, #6b5ae0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-sub {
  text-align: center;
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 28px;
}
.login-error {
  background: #2a1010;
  color: #f08080;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.login-error.hidden { display: none; }
.btn-full { width: 100%; }

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-username {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.topbar-link {
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.topbar-link:hover { color: var(--accent); }
.topbar-logout { color: var(--danger); }
.topbar-logout:hover { color: var(--danger-hover); }

/* Sidebar topbar */
.sidebar-topbar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--text2);
}
.sidebar-topbar .topbar-link { font-size: 12px; }

/* ─── Visibility badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge-public {
  background: rgba(107, 207, 127, 0.15);
  color: #6bcf7f;
  border: 1px solid rgba(107, 207, 127, 0.3);
}
.badge-private {
  background: rgba(152, 152, 176, 0.1);
  color: var(--text2);
  border: 1px solid var(--border);
}
.badge-owner {
  background: rgba(124, 106, 247, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 106, 247, 0.25);
}
.badge-deleted {
  background: rgba(224, 85, 85, 0.12);
  color: var(--danger);
  border: 1px solid rgba(224, 85, 85, 0.25);
}
.badge-nsfw {
  background: rgba(224, 85, 85, 0.15);
  color: #f07070;
  border: 1px solid rgba(224, 85, 85, 0.3);
  font-weight: 700;
}
.badge-active {
  background: rgba(107, 207, 127, 0.1);
  color: #6bcf7f;
  border: 1px solid rgba(107, 207, 127, 0.2);
}
.agent-card-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* ─── Visibility radio ───────────────────────────────────────────────────────── */
.visibility-radio {
  display: flex;
  gap: 20px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.radio-label input { accent-color: var(--accent); }

/* ─── NSFW toggle ────────────────────────────────────────────────────────────── */
.nsfw-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.nsfw-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nsfw-toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.nsfw-toggle-hint {
  font-size: 12px;
  color: var(--text2);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text2);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(224, 85, 85, 0.2);
  border-color: rgba(224, 85, 85, 0.5);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translate(20px, -50%);
  background: #f07070;
}

/* ─── Универсальный аватар-контейнер ─────────────────────────────────────────── */
/* Контейнер сам клипирует содержимое, img/span просто заполняют его */
.avatar-circle {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 2px solid var(--border);
}
.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-circle .agent-initials {
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Размеры контейнеров */
.avatar-80  { width: 80px;  height: 80px; }
.avatar-64  { width: 64px;  height: 64px; }
.avatar-48  { width: 48px;  height: 48px; }
.avatar-36  { width: 36px;  height: 36px; }
.avatar-28  { width: 28px;  height: 28px; }
.avatar-80  .agent-initials { font-size: 28px; }

/* Размеры шрифта инициалей по размеру контейнера */
.avatar-64  .agent-initials { font-size: 22px; }
.avatar-48  .agent-initials { font-size: 17px; }
.avatar-36  .agent-initials { font-size: 13px; }
.avatar-28  .agent-initials { font-size: 10px; }

/* Превью в модалке (72px — особый случай) */
.agent-image-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.agent-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.agent-image-preview .agent-initials {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

/* Легаси (карточки агентов на главной) */
.agent-avatar-card-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 2px solid var(--border);
  margin-bottom: 12px;
}
.agent-avatar-card-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.agent-avatar-card-wrap .agent-initials {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

/* Инициали — отдельный спан */
.agent-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Старые классы для совместимости */
.agent-avatar-img {
  width: 56px; height: 56px;
  border-radius: 50%; object-fit: cover;
  margin-bottom: 12px; display: block;
  border: 2px solid var(--border);
}

/* ─── Agent image upload in modal ────────────────────────────────────────────── */
.agent-image-group {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.agent-image-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  overflow: hidden;
  flex-shrink: 0;
}
.agent-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.agent-image-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

/* Generate prompt row */
.generate-prompt-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.generate-prompt-row .input { flex: 1; }

/* ─── Agent sprite ───────────────────────────────────────────────────────────── */
.agent-sprite {
  position: absolute;
  bottom: 90px;
  right: 316px; /* right of chat area, left of settings panel if open */
  width: 160px;
  height: 220px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom center;
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s;
}
.agent-sprite.hidden { display: none; }
.chat-main { position: relative; }

/* ─── Profile page ───────────────────────────────────────────────────────────── */
.profile-page {
  max-width: 520px;
  margin: 40px auto;
  padding: 0 20px;
}
.profile-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.profile-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.profile-role {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 28px;
}
.profile-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.profile-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.profile-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.form-error {
  background: #2a1010;
  color: #f08080;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.form-success {
  color: #6bcf7f;
  font-size: 13px;
  margin-bottom: 12px;
}
.form-error.hidden, .form-success.hidden { display: none; }

/* ─── Admin page ─────────────────────────────────────────────────────────────── */
.admin-page {
  padding: 0 0 48px;
}
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-weight: 500;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.admin-panel-header h2 { font-size: 18px; font-weight: 600; }

.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg2); }

.btn-xs { padding: 3px 9px; font-size: 12px; }

/* Role badge */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.role-admin {
  background: rgba(124, 106, 247, 0.15);
  color: var(--accent);
  border: 1px solid rgba(124, 106, 247, 0.3);
}
.role-user {
  background: rgba(152, 152, 176, 0.1);
  color: var(--text2);
  border: 1px solid var(--border);
}

/* Логи */
.logs-stats {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
}
.logs-pagination {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Permissions grid */
.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.perm-item label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.perm-item input { accent-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════════
   MOBILE & RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Элементы только для мобиле (скрыты на десктопе) ────────────────────── */
.mobile-sidebar-btn { display: none; }
.mobile-bottom-nav  { display: none; }
.settings-toggle .toggle-icon { display: none; }

/* ── Backdrop ────────────────────────────────────────────────────────────── */
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.mobile-backdrop.active { display: block; }

/* ── Планшет ≤ 900px ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .right-panel { width: 260px; min-width: 260px; }
  .sidebar     { width: 230px; min-width: 230px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   МОБИЛЬНЫЙ ≤ 768px
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Viewport height fix (iOS Safari) ── */
  .chat-page, .chat-page body { height: 100%; }

  /* ── Index page ── */
  .page { padding: 0 12px 100px; }

  .header {
    padding: 14px 0 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .logo { font-size: 20px; }

  .topbar { gap: 6px; flex-wrap: wrap; }
  .topbar-link { font-size: 12px; }

  /* Карточки агентов — 1 колонка */
  .agents-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Карточка агента — горизонтальная компактная */
  .agent-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
  }
  .avatar-circle.agent-card-avatar {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px;
    margin-bottom: 0 !important;
    flex-shrink: 0;
  }
  .agent-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .agent-card-badges { flex-wrap: wrap; }
  .agent-card-name { font-size: 15px; margin: 0; }
  .agent-card-desc {
    font-size: 12px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .agent-card-footer {
    flex-direction: row;
    gap: 8px;
    margin-top: 2px;
  }
  .agent-card-footer .btn { flex: 1; padding: 7px 10px; font-size: 13px; }

  /* ── Модалки — bottom sheet ── */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90dvh;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px 32px;
    animation: slideUp 0.25s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
  }
  .modal-sm { border-radius: 20px 20px 0 0; }
  .modal-title { font-size: 17px; }

  /* ══════════════════════════════════════════════════════════
     CHAT PAGE — мобильный layout
     ══════════════════════════════════════════════════════════ */
  .chat-layout {
    position: relative;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    flex-direction: column;
  }

  /* Сайдбар — фиксированный оверлей слева */
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 85vw;
    max-width: 320px;
    min-width: unset;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    z-index: 200;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* Правая панель — фиксированный оверлей снизу (sheet) */
  .right-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    min-width: unset;
    max-height: 85dvh;
    max-height: 85vh;
    z-index: 200;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  }
  .right-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
  }
  .right-panel.hidden {
    display: flex !important;
    transform: translateY(105%);
  }
  .right-panel.mobile-open {
    transform: translateY(0) !important;
  }

  /* Панель внутри — скролл */
  .panel-pane.active { overflow-y: auto; }

  /* chat-main занимает весь экран (кроме bottom nav) */
  .chat-main {
    width: 100%;
    height: 100%;
    padding-bottom: 60px; /* высота bottom nav */
  }

  /* Заголовок чата */
  .chat-header {
    padding: 10px 14px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .chat-header-name { font-size: 15px; font-weight: 600; }

  /* Гамбургер виден */
  .mobile-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    padding: 6px;
    margin-right: 4px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
  }
  .mobile-sidebar-btn:active { color: var(--text); background: var(--bg3); }

  /* Кнопка панели — только иконка */
  .settings-toggle .toggle-label { display: none; }
  .settings-toggle .toggle-icon { display: block; }
  .settings-toggle { padding: 6px 8px; }

  /* Сообщения */
  :root { --msg-max-width: min(90vw, 480px); }
  .chat-messages { padding: 12px 10px 8px; }

  /* Инпут */
  .chat-input-area { padding: 8px 10px 10px; gap: 6px; }
  .chat-input { font-size: 15px; padding: 10px 12px; border-radius: 20px; }
  .send-btn {
    width: 42px; height: 42px; min-width: 42px;
    border-radius: 50%; padding: 0; font-size: 18px;
  }
  .attach-btn { padding: 8px; color: var(--text2); }

  /* Превью фото */
  .attach-preview { padding: 6px 10px; }
  .attach-preview img { max-height: 64px; border-radius: 8px; }

  /* Пузырь сообщения */
  .message-bubble { padding: 10px 13px; }
  .message-meta { font-size: 10px; }
  .msg-action-btn { padding: 3px 7px; font-size: 11px; }

  /* Context bar */
  .context-bar { font-size: 10px; padding: 3px 12px 0; }

  /* Кнопки чатов — всегда видны */
  .chat-item { padding: 11px 10px; }
  .chat-item-actions {
    opacity: 1 !important;
    gap: 6px;
  }
  .chat-item-actions .msg-btn {
    width: 34px; height: 34px;
    font-size: 15px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
  }
  .chat-rename-btn { color: var(--text2); }
  .chat-delete-btn  { color: var(--text2); }
  .chat-rename-btn:active { color: var(--accent); }
  .chat-delete-btn:active  { color: var(--danger); }
  .chat-item-title { font-size: 14px; }

  /* Format picker */
  .format-cards { flex-direction: column; gap: 10px; }
  .format-card { flex: none; max-width: 100%; padding: 14px 16px; }

  /* Спрайт */
  .char-sprite { max-height: 30vh; bottom: 70px; }

  /* ── Bottom navigation bar ── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 100;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mob-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    padding: 6px 20px;
    border-radius: 12px;
    transition: color 0.15s, background 0.15s;
    font-size: 11px;
    font-weight: 500;
    min-width: 60px;
  }
  .mob-nav-btn:active,
  .mob-nav-btn.active { color: var(--accent); }
  .mob-nav-btn span { line-height: 1; }

  /* Кнопка + новый чат — круглая акцентная */
  .mob-nav-new {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    padding: 0;
    min-width: unset;
    box-shadow: 0 4px 16px rgba(124,106,247,0.4);
  }
  .mob-nav-new:active { background: var(--accent-hover); }

  /* ── Admin page ── */
  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab { white-space: nowrap; padding: 10px 14px; font-size: 13px; }
  .admin-panel-header { flex-wrap: wrap; gap: 10px; }
  .perm-grid { grid-template-columns: 1fr; }
}
