@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
/* Hi! messenger — базовые токены (светлая тема по умолчанию; тёплая «минеральная» палитра) */
:root {
  --auth-link: #4f3fb5;
  --figma-surface: #3d3d3d;
  --figma-surface-soft: #5a5a5a;
  --bg-page: #d9d9d9;
  --bg-sidebar: #e3e3e3;
  --bg-card: #e3e3e3;
  --bg-hover: #d2d2d2;
  --bg-active: #c9c9c9;
  --border: #8a8a8a;
  --accent: #000000;
  --accent-hover: #000000;
  --text-primary: #111111;
  --text-secondary: #2a2a2a;
  --text-muted: #525252;
  --message-out-bg: #7e7e7e;
  --message-in-bg: #969696;
  --message-out-text: #101010;
  --message-in-text: #111111;
  /* Профиль / вторичные экраны */
  --profile-topbar-bg: #101a2f;
  --profile-topbar-fg: #ecf3ff;
  --profile-subtext: #8fa6d1;
  --profile-avatar-border: rgba(125, 169, 255, 0.18);
  --profile-card-shadow: 0 10px 28px rgba(6, 13, 26, 0.4);
  --danger: #ef4444;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --font-body: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

body[data-theme="dark"] {
  --profile-topbar-bg: #1a1714;
  --profile-topbar-fg: #f2ede6;
  --profile-subtext: #9a9288;
  --profile-avatar-border: rgba(224, 112, 44, 0.22);
  --profile-card-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --bg-page: #0f0d0b;
  --bg-sidebar: #141110;
  --bg-card: #1a1714;
  --bg-hover: #252220;
  --bg-active: #322c27;
  --border: #3d3832;
  --accent: #e0702c;
  --accent-hover: #f08845;
  --text-primary: #f2ede6;
  --text-secondary: #d4cdc4;
  --text-muted: #9a9288;
  --message-out-bg: #a84312;
  --message-in-bg: #252220;
  --message-out-text: #fffaf6;
  --message-in-text: #f2ede6;
}

body[data-theme="midnight"] {
  --profile-topbar-bg: #12100e;
  --profile-topbar-fg: #ebe6df;
  --profile-subtext: #8a8278;
  --profile-avatar-border: #3a332c;
  --profile-card-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  --bg-page: #080706;
  --bg-sidebar: #0c0b0a;
  --bg-card: #12100e;
  --bg-hover: #1a1816;
  --bg-active: #252018;
  --border: #2a2622;
  --accent: #d96a28;
  --accent-hover: #e88240;
  --text-primary: #ebe6df;
  --text-secondary: #cec7be;
  --text-muted: #8a8278;
  --message-out-bg: #8f3d10;
  --message-in-bg: #1a1816;
  --message-out-text: #fffaf6;
  --message-in-text: #ebe6df;
}

body[data-theme="graphite"] {
  --profile-topbar-bg: #1c1f24;
  --profile-topbar-fg: #eceff4;
  --profile-subtext: #8f96a3;
  --profile-avatar-border: #3a3f47;
  --profile-card-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  --bg-page: #111214;
  --bg-sidebar: #181a1d;
  --bg-card: #1c1f24;
  --bg-hover: #25282e;
  --bg-active: #353a42;
  --border: #3a3f47;
  --accent: #c9a227;
  --accent-hover: #dbb53a;
  --text-primary: #eceff4;
  --text-secondary: #c5cad3;
  --text-muted: #8f96a3;
  --message-out-bg: #6d5a1a;
  --message-in-bg: #25282e;
  --message-out-text: #fffdf5;
  --message-in-text: #eceff4;
}

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

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

button,
input[type="button"],
input[type="submit"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 600;
}

body.page-entered {
  opacity: 1;
  transform: translateY(0);
}

body.page-transitioning {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.mobile-bottom-nav {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.24s ease;
}

.mobile-bottom-nav.nav-entered,
body.page-entered .mobile-bottom-nav {
  opacity: 1;
  transform: translateY(0);
}

.mobile-bottom-nav.nav-exit,
body.page-transitioning .mobile-bottom-nav {
  opacity: 0;
  transform: translateY(12px);
}

@media (hover: hover) and (pointer: fine) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

@keyframes surface-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Явно: светлая тема (наследуется в профиле, настройках, админке) */
body[data-theme="light"] {
  --profile-topbar-bg: rgba(255, 255, 255, 0.86);
  --profile-topbar-fg: #1f2f5d;
  --profile-subtext: #5e6f98;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Layout */
.app {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Sidebar — поверх правой колонки при любом перекрытии (stacking) */
.sidebar {
  width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  animation: surface-in 0.4s ease both;
}

.sidebar-header {
  padding: var(--spacing-xl) var(--spacing-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-small,
.logo {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.logo-small {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 26px;
  height: 33px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 32px;
  height: 32px;
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.icon-btn:active {
  transform: scale(0.96);
}

/* Search */
.search-container {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border);
}

#searchInput {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

#searchInput:focus {
  border-color: var(--accent);
}

.search-results {
  margin-top: var(--spacing-md);
  max-height: 280px;
  overflow-y: auto;
}

.search-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 10px 0 6px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

/* Conversations list */
.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-sm) 0;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: 12px var(--spacing-lg);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.16s ease;
}

.conv-item:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

.conv-item.active {
  background: var(--bg-active);
  border-left: 3px solid var(--accent);
}

.conv-avatar {
  width: 48px;
  height: 48px;
  background: #d0d0d0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-title {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 0;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  vertical-align: middle;
}

.verified-check.verified-check-verify {
  width: 16px;
  height: 16px;
  background: center / contain no-repeat url('/static/img/VerifyIcon.svg');
  color: transparent;
  font-size: 0;
}

.verified-check.verified-check-scam {
  width: 26px;
  height: 26px;
  background: center / contain no-repeat url('/static/img/SCAM-BADGE.svg');
  color: transparent;
  font-size: 0;
}

.verified-check.verified-check-fake {
  width: 26px;
  height: 26px;
  background: center / contain no-repeat url('/static/img/FAKE-BADGE.svg');
  color: transparent;
  font-size: 0;
}

.conv-type {
  font-size: 12px;
  color: var(--text-muted);
}

/* Chat area */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  animation: surface-in 0.44s ease both;
}

.chat-header {
  padding: var(--spacing-md) var(--spacing-xl);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  background: var(--bg-card);
}

.chat-avatar {
  width: 44px;
  height: 44px;
  background: #d0d0d0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-info {
  flex: 1;
}

.chat-name {
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.1s;
}

.chat-name:hover {
  opacity: 0.8;
}

.chat-status {
  font-size: 13px;
  line-height: 1.25;
  color: var(--text-muted);
  -webkit-font-smoothing: antialiased;
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: block;
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
}

/* В ленте чата сообщение живёт внутри .message-shell — только блоковая вёрстка */
.message-shell .message {
  max-width: 100%;
}

.message-own {
  align-self: flex-end;
}

.message-bubble {
  background: var(--message-in-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 9px 15px;
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.message:hover .message-bubble {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.message-own .message-bubble {
  background: var(--message-out-bg);
  border-color: #c7c7c7;
}

.message-sender {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.message-text {
  font-size: 15px;
  line-height: 1.42;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}

.message-text img,
.message-text video {
  max-width: 100%;
  height: auto;
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-left: 8px;
}

/* Message actions (edit/delete/reply) */
.message-menu {
  position: absolute;
  right: -32px;
  top: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.message:hover .message-menu {
  opacity: 1;
}

.message-menu button {
  background: #f1f1f1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 28px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-menu button:hover {
  background: var(--bg-hover);
}

/* Typing indicator */
.typing-indicator {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px var(--spacing-xl);
  font-style: italic;
}

/* Input area */
.input-area {
  padding: var(--spacing-md) var(--spacing-xl);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.attach-btn,
.emoji-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 30px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.attach-btn:hover,
.emoji-btn:hover {
  background: var(--bg-hover);
}

.attach-btn:active,
.emoji-btn:active {
  transform: scale(0.96);
}

#messageInput {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

#messageInput:focus {
  border-color: var(--accent);
}

#sendBtn {
  background: var(--accent);
  border: none;
  border-radius: 30px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  color: white;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#sendBtn:hover {
  background: var(--accent-hover);
}

#sendBtn:active {
  transform: scale(0.96);
}

/* User menu */
.user-menu {
  margin-top: auto;
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  cursor: pointer;
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: #404040;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
}

.user-name {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
}

.dropdown {
  position: absolute;
  bottom: 56px;
  left: var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 180px;
  z-index: 10;
  animation: surface-in 0.22s ease both;
}

.dropdown-item {
  padding: 10px var(--spacing-md);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  width: 360px;
  max-width: 90%;
  animation: surface-in 0.24s ease both;
}

.modal-content h3 {
  font-size: 18px;
  margin-bottom: var(--spacing-lg);
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  width: 100%;
  margin: var(--spacing-sm) 0;
  padding: 10px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.modal-content input:focus {
  border-color: var(--accent);
}

.flex-btns {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

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

.hidden {
  display: none;
}

/* Auth — плоский минеральный фон, без «tech» градиентов */
body.auth-page {
  background: var(--bg-page) !important;
  color: var(--text-primary);
  overflow: auto;
}

body.auth-page[data-theme="dark"],
body.auth-page[data-theme="midnight"],
body.auth-page[data-theme="graphite"] {
  background: var(--bg-page) !important;
  color: var(--text-primary);
}

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 20px;
}

.auth-card {
  width: min(440px, 100%);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 24px;
  box-shadow: none;
  backdrop-filter: none;
}

body.auth-page[data-theme="dark"] .auth-card,
body.auth-page[data-theme="midnight"] .auth-card,
body.auth-page[data-theme="graphite"] .auth-card {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
}

.auth-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

body.auth-page[data-theme="dark"] .auth-subtitle,
body.auth-page[data-theme="midnight"] .auth-subtitle,
body.auth-page[data-theme="graphite"] .auth-subtitle {
  color: var(--text-muted);
}

.brand-icon {
  width: 74px;
  height: 92px;
  object-fit: contain;
  margin-bottom: 2px;
}

.field-group {
  position: relative;
  margin-top: 12px;
}

.field-icon {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #2f2f2f;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  z-index: 1;
  user-select: none;
}

.field-icon.key {
  font-size: 22px;
}

.auth-card h2 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 6px;
  text-align: center;
  color: inherit;
  letter-spacing: -0.02em;
}

.auth-card input {
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 14px 0 50px;
  background: #666666;
  border: 1px solid #666666;
  border-radius: 999px;
  color: #f2f2f2;
  font-size: 15px;
}

body.auth-page[data-theme="dark"] .auth-card input,
body.auth-page[data-theme="midnight"] .auth-card input,
body.auth-page[data-theme="graphite"] .auth-card input {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.auth-card input::placeholder {
  color: #d2d2d2;
  font-style: italic;
}

.auth-card button {
  width: 100%;
  margin-top: 16px;
  background: #000000;
  border: none;
  border-radius: 999px;
  min-height: 50px;
  font-weight: 800;
  font-size: 15px;
  color: #ffffff;
  cursor: pointer;
  box-shadow: none;
}

body.auth-page[data-theme="dark"] .auth-card button,
body.auth-page[data-theme="midnight"] .auth-card button,
body.auth-page[data-theme="graphite"] .auth-card button {
  box-shadow: 0 8px 22px rgba(224, 112, 44, 0.2);
}

.auth-card p {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
  color: inherit;
}

.auth-card a {
  color: var(--auth-link, var(--accent));
  font-weight: 700;
  text-decoration: none;
}

.auth-card a:hover {
  text-decoration: underline;
}

.error {
  color: #cb284e;
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
}
/* Stories */
.stories-container {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    background: var(--bg-sidebar);
}
.story-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-right: 16px;
    cursor: pointer;
    transition: transform 0.16s ease;
}
.story-item:hover { transform: translateY(-2px); }
.story-item:active { transform: scale(0.96); }
.story-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.story-avatar.add-story {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-avatar div {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.story-name { font-size: 11px; color: var(--text-secondary); max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
.story-viewer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: black; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.story-viewer-content { max-width: 90vw; max-height: 90vh; }
.story-viewer-content img, .story-viewer-content video {
    max-width: 100%; max-height: 90vh; border-radius: 16px;
}
.story-viewer-text {
    background: rgba(0,0,0,0.7); padding: 16px; border-radius: 16px;
    color: white; font-size: 24px; text-align: center;
}
.story-progress {
    position: absolute; top: 10px; left: 0; right: 0;
    display: flex; gap: 4px; padding: 8px;
}
.story-progress-bar {
    flex: 1; height: 3px; background: rgba(255,255,255,0.3);
    border-radius: 2px; overflow: hidden;
}
.story-progress-fill { width: 0%; height: 100%; background: white; transition: width 0.1s linear; }
.floating-input {
    background: transparent;
    border-top: none;
    margin: 0 var(--spacing-xl) var(--spacing-xl) var(--spacing-xl);
    border-radius: 48px;
    border: none;
    box-shadow: none;
}

.settings-nav-item,
.theme-option,
.button-group button,
.profile-actions button,
.mobile-bottom-nav button,
.icon-btn,
#sendBtn,
.attach-btn,
.emoji-btn {
  transition: transform 0.16s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.settings-nav-item:hover,
.theme-option:hover,
.button-group button:hover,
.profile-actions button:hover,
.mobile-bottom-nav button:hover {
  transform: translateY(-1px);
}

.settings-nav-item:active,
.theme-option:active,
.button-group button:active,
.profile-actions button:active,
.mobile-bottom-nav button:active {
  transform: scale(0.98);
}

/* ——— Адаптив: телефоны и узкие окна ——— */
@media (max-width: 768px) {
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .app:not(.app--show-chat) .chat {
    display: none !important;
  }

  .app.app--show-chat .sidebar {
    display: none !important;
  }

  .app.app--show-chat .chat {
    display: flex !important;
    flex: 1;
    width: 100%;
    min-height: 0;
  }

  .sidebar {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-right: none;
  }

  .chat-back-mobile {
    display: inline-flex !important;
  }

  .message {
    max-width: 88%;
  }

  .messages-container {
    padding: 12px 14px;
  }

  .floating-input {
    margin: 0 12px max(12px, env(safe-area-inset-bottom));
    padding: 10px 12px;
  }

  .input-area {
    padding: 10px 12px;
  }

  #messageInput {
    font-size: 16px;
  }

  .sidebar-header {
    padding: 14px 16px;
  }

  .auth-card {
    width: min(360px, calc(100vw - 32px));
    margin: 0 16px;
  }
}

@media (min-width: 769px) {
  .app .sidebar,
  .app .chat {
    display: flex !important;
  }

  .sidebar {
    width: 320px;
    border-right: 1px solid var(--border);
  }

  .chat-back-mobile {
    display: none !important;
  }

  .app--show-chat .sidebar {
    display: flex !important;
  }

  .app--show-chat .chat {
    display: flex !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  body {
    opacity: 1;
    transform: none;
  }
  .mobile-bottom-nav {
    opacity: 1;
    transform: none;
  }
}