/* ============ Токены темы ============ */
:root {
  --font-display: -apple-system, "SF Pro Display", "Segoe UI Semibold", "Inter", sans-serif;
  --font-body: -apple-system, "SF Pro Text", "Segoe UI", "Inter", sans-serif;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-glass: 0 8px 32px rgba(31, 38, 90, 0.14), inset 0 1px 0 rgba(255,255,255,0.35);
  --shadow-soft: 0 4px 18px rgba(31, 38, 90, 0.10);
}

[data-theme="light"] {
  --bg-a: #dbe6f7;
  --bg-b: #f1e9fb;
  --bg-c: #eef7f4;

  --orb-1: #ffd3b0;
  --orb-2: #cdb8ff;
  --orb-3: #b6ecdd;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.55);

  --text-primary: #1b1d29;
  --text-secondary: #565a72;
  --text-tertiary: #8388a3;

  --accent: #4f7cf6;
  --accent-strong: #3660e0;
  --accent-contrast: #ffffff;

  --danger: #e0546b;
  --success: #34b892;

  --input-bg: rgba(255, 255, 255, 0.55);
  --input-border: rgba(27, 29, 41, 0.12);
  --hairline: rgba(27, 29, 41, 0.08);
}

[data-theme="dark"] {
  --bg-a: #0c0e18;
  --bg-b: #161a2c;
  --bg-c: #10141f;

  --orb-1: #4c3fae;
  --orb-2: #1f6f8b;
  --orb-3: #a63b7f;

  --glass-bg: rgba(28, 30, 45, 0.55);
  --glass-bg-strong: rgba(28, 30, 45, 0.78);
  --glass-border: rgba(255, 255, 255, 0.10);

  --text-primary: #f3f4fb;
  --text-secondary: #b7bbd4;
  --text-tertiary: #7d81a0;

  --accent: #7d9dff;
  --accent-strong: #93aeff;
  --accent-contrast: #0c0e18;

  --danger: #ff7a90;
  --success: #4fd6ab;

  --input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, 0.14);
  --hairline: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: linear-gradient(160deg, var(--bg-a), var(--bg-b) 55%, var(--bg-c));
  transition: background 0.5s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============ Атмосфера: плавающие световые пятна ============ */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 26s ease-in-out infinite;
}
.orb-a { width: 42vw; height: 42vw; background: var(--orb-1); top: -10%; left: -8%; animation-duration: 30s; }
.orb-b { width: 36vw; height: 36vw; background: var(--orb-2); bottom: -12%; right: -6%; animation-duration: 34s; animation-delay: -8s; }
.orb-c { width: 28vw; height: 28vw; background: var(--orb-3); top: 40%; left: 55%; animation-duration: 24s; animation-delay: -14s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4%, 6%) scale(1.06); }
  66% { transform: translate(-5%, -3%) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
}

/* ============ Стеклянная поверхность ============ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
}
.panel { border-radius: var(--radius-lg); }

/* ============ Иконки (Lucide-style inline SVG) ============ */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.icon.icon-sm { width: 15px; height: 15px; }
.icon.icon-lg { width: 22px; height: 22px; }

/* ============ Типографика ============ */
h1, h2, h3, .brand-mark, .nav-item, .btn {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
h1 { font-size: 28px; font-weight: 700; margin: 0; }
h2.view-title { font-size: 22px; font-weight: 700; margin: 4px 0 18px; }
h3 { font-size: 18px; font-weight: 700; margin: 0 0 14px; }
p { color: var(--text-secondary); line-height: 1.5; }

/* ============ Кнопки, инпуты ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: var(--accent-contrast); box-shadow: 0 6px 18px rgba(79, 124, 246, 0.35); }
.btn.primary:hover { box-shadow: 0 8px 22px rgba(79, 124, 246, 0.45); }
.btn.ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--input-border); }
.btn.ghost:hover { color: var(--text-primary); border-color: var(--accent); }
.btn.danger { background: var(--danger); color: white; }
.btn.small { padding: 8px 16px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }

input[type="text"], input[type="password"], textarea, .search-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 124, 246, 0.18); }
textarea { resize: vertical; min-height: 64px; font-family: var(--font-body); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; font-weight: 600; }

/* ============ Экран входа ============ */
.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; padding: 36px 32px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand.small { margin-bottom: 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orb-1), var(--orb-2));
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.6), 0 4px 10px rgba(0,0,0,0.15);
}
.brand.small .brand-mark { width: 22px; height: 22px; border-radius: 7px; }
.brand.small span:last-child { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.brand-sub { margin: 6px 0 24px; font-size: 13px; color: var(--text-tertiary); }

.tabs { display: flex; gap: 6px; background: var(--input-bg); border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.tab-btn {
  flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--text-secondary); cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.tab-btn.active { background: var(--glass-bg-strong); color: var(--text-primary); box-shadow: var(--shadow-soft); }

.auth-form label { margin-bottom: 14px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 16px; margin: -4px 0 10px; }

/* ============ Приложение ============ */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; padding: 22px; gap: 22px; }

.sidebar {
  width: 268px;
  flex-shrink: 0;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  position: sticky;
  top: 22px;
}

.me-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: var(--radius-md); padding: 10px; margin: 14px 0 18px;
  cursor: pointer; text-align: left; width: 100%; color: inherit; font: inherit;
  transition: background 0.2s ease;
}
.me-card:hover { background: var(--glass-bg-strong); }
.me-info { display: flex; flex-direction: column; overflow: hidden; }
.me-name { font-weight: 700; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-username { font-size: 12px; color: var(--text-tertiary); }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--orb-1), var(--orb-3));
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: white; font-size: 15px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4);
}
.avatar.small { width: 32px; height: 32px; font-size: 12px; }
.avatar.large { width: 84px; height: 84px; font-size: 26px; }

.avatar-stack { position: relative; display: inline-flex; flex-shrink: 0; }
.online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--glass-bg-strong); box-sizing: content-box;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--text-secondary); cursor: pointer; text-align: left;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; flex-shrink: 0; }
.nav-icon .icon { width: 17px; height: 17px; }
.nav-item:hover { background: var(--input-bg); color: var(--text-primary); }
.nav-item.active { background: var(--glass-bg-strong); color: var(--accent-strong); box-shadow: var(--shadow-soft); }
.badge {
  margin-left: auto; background: var(--accent); color: var(--accent-contrast);
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-left: 4px; }
.dot:empty { display: none; }

.sidebar-footer { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.theme-toggle {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--input-border); background: var(--input-bg);
  color: var(--text-secondary); border-radius: 999px; padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.theme-toggle:hover { color: var(--text-primary); }

.content { flex: 1; min-width: 0; padding-bottom: 40px; }
.view { max-width: 720px; margin: 0 auto; }
.view.view-wide { max-width: 900px; }
.view.view-extra-wide { max-width: 1180px; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 16px; }
.icon-btn .icon { width: 17px; height: 17px; }

/* ============ Профиль / стена ============ */
.profile-header { padding: 28px; display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.profile-header .info { flex: 1; min-width: 0; }
.profile-header .info h2 { margin: 0 0 2px; font-size: 22px; }
.profile-header .username { color: var(--text-tertiary); font-size: 13px; margin-bottom: 8px; }
.profile-header .status { color: var(--text-secondary); font-size: 14px; margin: 0 0 10px; }
.profile-header .bio { font-size: 13px; color: var(--text-tertiary); margin: 0; white-space: pre-wrap; }
.profile-header .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.composer { padding: 18px; margin-bottom: 18px; }
.composer-row { display: flex; justify-content: flex-end; margin-top: 10px; }

.posts-list { display: flex; flex-direction: column; gap: 14px; }
.post {
  padding: 18px; border-radius: var(--radius-md); background: var(--glass-bg);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-soft);
}
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-author { font-weight: 700; font-size: 14px; }
.post-time { font-size: 12px; color: var(--text-tertiary); margin-left: auto; }
.post-content { font-size: 14px; white-space: pre-wrap; line-height: 1.55; }
.post-delete { border: none; background: transparent; color: var(--text-tertiary); cursor: pointer; font-size: 16px; padding: 2px 6px; }
.post-delete:hover { color: var(--danger); }
.empty-state { text-align: center; color: var(--text-tertiary); padding: 40px 20px; font-size: 14px; }

/* ------ Лайки / комментарии ------ */
.post-actions { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.post-action-btn {
  display: flex; align-items: center; gap: 6px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 10px; border-radius: 999px; transition: background 0.15s ease, color 0.15s ease;
}
.post-action-btn:hover { background: var(--input-bg); color: var(--text-primary); }
.post-action-btn.liked { color: var(--danger); }
.post-action-btn .icon { font-size: 14px; }

.comments-block { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.comments-preview, .comments-remaining { display: flex; flex-direction: column; gap: 8px; }
.comments-remaining { max-height: 260px; overflow-y: auto; padding-right: 4px; }
.comment-item { display: flex; gap: 8px; align-items: flex-start; }
.comment-item.is-reply { margin-left: 32px; }
.comment-bubble { flex: 1; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 14px; padding: 8px 12px; }
.comment-reply-to { font-size: 11px; color: var(--text-tertiary); margin-bottom: 2px; }
.comment-author { font-weight: 700; font-size: 12.5px; margin-right: 6px; }
.comment-text { font-size: 13px; color: var(--text-primary); white-space: pre-wrap; }
.comment-mention { color: var(--accent-strong); font-weight: 600; }
.comment-time { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }
.comment-actions { display: flex; gap: 12px; margin-top: 5px; }
.comment-action-btn {
  display: inline-flex; align-items: center; gap: 4px; border: none; background: none;
  color: var(--text-tertiary); font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 0;
}
.comment-action-btn:hover { color: var(--text-primary); }
.comment-action-btn.liked { color: var(--danger); }
.comment-form { display: flex; gap: 8px; margin-top: 4px; }
.comment-form input { flex: 1; padding: 9px 12px; font-size: 13px; }
.comment-reply-banner {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary);
  background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 10px;
  padding: 6px 10px; margin-bottom: 4px;
}
.comment-reply-banner button { margin-left: auto; border: none; background: none; color: var(--text-tertiary); cursor: pointer; display: flex; }
.show-more-comments-btn {
  align-self: flex-start; border: none; background: transparent; color: var(--accent-strong);
  font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 4px 2px;
}
.show-more-comments-btn:hover { text-decoration: underline; }

/* ============ Люди (друзья/поиск) ============ */
.subtabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.subtab-btn {
  border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-secondary);
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-display);
}
.subtab-btn.active { background: var(--glass-bg-strong); color: var(--accent-strong); border-color: var(--accent); }

.people-list { display: flex; flex-direction: column; padding: 6px; margin-bottom: 18px; }
.people-list:empty { display: none; }
.person-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: var(--radius-sm); transition: background 0.15s ease;
}
.person-row + .person-row { border-top: 1px solid var(--hairline); }
.person-row:hover { background: var(--input-bg); }
.person-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.person-text { min-width: 0; }
.person-name { font-weight: 700; font-size: 14px; }
.person-username { font-size: 12px; color: var(--text-tertiary); }
.person-mutual { font-size: 11.5px; color: var(--text-tertiary); margin-top: 1px; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.person-actions .btn { padding: 8px 14px; }

.section-label { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--text-tertiary); margin: 4px 2px 8px; text-transform: uppercase; letter-spacing: 0.03em; }

#suggestions-block { margin-bottom: 22px; }
.person-mutual-icon { display: inline-flex; vertical-align: -2px; margin-right: 3px; }

.search-input { margin-bottom: 0; }
.search-row { display: flex; gap: 8px; margin-bottom: 18px; }
.search-row input { flex: 1; }

/* ============ Скроллбары ============ */
.chat-scroll-wrap, .conversations, .comments-remaining {
  scrollbar-width: thin;
  scrollbar-color: var(--input-border) transparent;
}
.chat-scroll-wrap::-webkit-scrollbar, .conversations::-webkit-scrollbar, .comments-remaining::-webkit-scrollbar {
  width: 7px;
}
.chat-scroll-wrap::-webkit-scrollbar-track, .conversations::-webkit-scrollbar-track, .comments-remaining::-webkit-scrollbar-track {
  background: transparent;
}
.chat-scroll-wrap::-webkit-scrollbar-thumb, .conversations::-webkit-scrollbar-thumb, .comments-remaining::-webkit-scrollbar-thumb {
  background-color: var(--input-border);
  border-radius: 999px;
}
.chat-scroll-wrap:hover::-webkit-scrollbar-thumb, .conversations:hover::-webkit-scrollbar-thumb, .comments-remaining:hover::-webkit-scrollbar-thumb {
  background-color: var(--text-tertiary);
}

/* ============ Мессенджер ============ */
.messenger { display: flex; height: calc(100vh - 88px); overflow: hidden; padding: 0; }
.conversations { width: 280px; flex-shrink: 0; border-right: 1px solid var(--hairline); overflow-y: auto; }
.conversations-header { padding: 18px 16px 10px; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.conversation-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer;
  border-left: 3px solid transparent; transition: background 0.15s ease;
}
.conversation-item:hover { background: var(--input-bg); }
.conversation-item.active { background: var(--glass-bg-strong); border-left-color: var(--accent); }
.conv-name { font-weight: 700; font-size: 13px; }
.conv-preview { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 165px; }
.conv-meta { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-unread { background: var(--accent); color: var(--accent-contrast); font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }

.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); font-size: 14px; }
.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 10px; font-weight: 700; flex-shrink: 0; }
.chat-header-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chat-header-name { font-size: 14px; font-weight: 700; }
.chat-header-status { font-size: 12px; font-weight: 500; color: var(--text-tertiary); }
.chat-header-status.online { color: var(--success); }
.chat-scroll-wrap { flex: 1; overflow-y: auto; position: relative; }
.chat-sticky-date {
  position: sticky; top: 10px; z-index: 5; display: flex; justify-content: center;
  pointer-events: none; margin-bottom: -40px; opacity: 0; transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.chat-sticky-date.visible { opacity: 1; transform: translateY(0); }
.chat-sticky-date span {
  pointer-events: auto; background: var(--glass-bg-strong); backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%); border: 1px solid var(--glass-border);
  padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.3;
  white-space: nowrap; color: var(--text-secondary); box-shadow: var(--shadow-soft);
}
.chat-messages { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.chat-date-divider { display: flex; justify-content: center; margin: 10px 0 4px; }
.chat-date-divider span {
  background: var(--input-bg); border: 1px solid var(--input-border); padding: 4px 13px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--text-tertiary);
}
.msg-bubble { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.4; }
.msg-bubble.mine { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: var(--accent-contrast); border-bottom-right-radius: 4px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--input-bg); border: 1px solid var(--input-border); border-bottom-left-radius: 4px; }
.msg-time { display: block; font-size: 10px; opacity: 0.65; margin-top: 4px; }
.chat-input-row { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--hairline); flex-shrink: 0; }
.chat-input-row input { flex: 1; }

/* ============ Модалка ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 20, 0.35); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal { width: 100%; max-width: 420px; padding: 28px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.confirm-modal p { margin: 0 0 20px; }
.profile-link { cursor: pointer; }
.profile-link:hover .person-name, .profile-link:hover .comment-author, .profile-link:hover .chat-header-name { text-decoration: underline; }

/* ============ Уведомления (тосты) ============ */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: 340px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  cursor: pointer;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.leaving { opacity: 0; transform: translateX(12px); }
.toast-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; background: var(--input-bg); border: 1px solid var(--input-border);
  background-size: cover; background-position: center;
}
.toast-icon.kind-like { color: var(--danger); }
.toast-icon.kind-comment { color: var(--accent-strong); }
.toast-icon.kind-friend { color: var(--success); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.toast-text { font-size: 13px; color: var(--text-secondary); line-height: 1.4; overflow-wrap: anywhere; }
.toast-close {
  flex-shrink: 0; border: none; background: transparent; color: var(--text-tertiary);
  font-size: 14px; cursor: pointer; padding: 2px; line-height: 1;
}
.toast-close:hover { color: var(--text-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

@media (max-width: 480px) {
  .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ============ Уведомления (вкладка) ============ */
.notif-list { display: flex; flex-direction: column; padding: 6px; }
.notif-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s ease; position: relative;
}
.notif-item:hover { background: var(--input-bg); }
.notif-item + .notif-item { border-top: 1px solid var(--hairline); }
.notif-item.unread::before {
  content: ""; position: absolute; left: 3px; top: 16px; bottom: 16px; width: 3px;
  border-radius: 2px; background: var(--accent);
}
.notif-icon {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--input-bg); border: 1px solid var(--input-border);
  background-size: cover; background-position: center;
}
.notif-icon.kind-like { color: var(--danger); }
.notif-icon.kind-comment, .notif-icon.kind-comment_reply { color: var(--accent-strong); }
.notif-icon.kind-friend { color: var(--success); }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13.5px; line-height: 1.4; }
.notif-text b { font-weight: 700; }
.notif-excerpt { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.notif-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }

/* ============ Страница редактирования профиля ============ */
.edit-page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.back-btn {
  border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-secondary);
  border-radius: 999px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.back-btn:hover { color: var(--text-primary); border-color: var(--accent); }

.edit-section { padding: 22px; margin-bottom: 18px; }
.edit-section h3 { display: flex; align-items: center; gap: 8px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.edit-grid label { grid-column: span 1; }
.edit-grid label.full { grid-column: 1 / -1; }

.file-picker-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-picker-btn { display: inline-flex; }

.avatar-editor { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; margin-top: 4px; }
.avatar-crop-box {
  width: 220px; height: 220px; border-radius: 20px; overflow: hidden; position: relative;
  background: var(--input-bg); border: 1px solid var(--input-border); cursor: grab;
  background-repeat: no-repeat; background-size: cover; flex-shrink: 0; touch-action: none;
  user-select: none;
}
.avatar-crop-box.dragging { cursor: grabbing; }
.avatar-crop-box .crop-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); font-size: 12.5px; text-align: center; padding: 24px; pointer-events: none;
}
.avatar-crop-ring {
  position: absolute; inset: 14px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.85);
  pointer-events: none; box-shadow: 0 0 0 2000px rgba(10, 12, 20, 0.4);
}
.avatar-crop-caption { font-size: 12px; color: var(--text-tertiary); margin-top: 8px; text-align: center; width: 220px; }

.avatar-preview-col { display: flex; flex-direction: column; gap: 16px; }
.avatar-preview-row { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.avatar-preview-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.avatar-preview-circle {
  border-radius: 50%; background-size: cover; background-repeat: no-repeat;
  border: 1px solid var(--input-border); background-color: var(--input-bg);
}
.avatar-preview-label { font-size: 11px; color: var(--text-tertiary); }

/* ============ Уведомления (вкладка) конец ============ */


@media (max-width: 860px) {
  .app { flex-direction: column; padding: 12px; gap: 12px; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .sidebar .brand.small { margin: 0 10px 0 0; }
  .me-card { width: auto; margin: 0 10px 0 0; }
  .nav { flex-direction: row; flex: unset; }
  .nav-item span:not(.nav-icon) { display: none; }
  .badge { display: none; }
  .sidebar-footer { flex-direction: row; margin-left: auto; border-top: none; padding-top: 0; }
  .theme-toggle span:last-child { display: none; }
  .messenger { height: calc(100vh - 220px); }
  .conversations { width: 220px; }
}
