/* ═══════════════════════════════════════════════════════════════
   News Feed — Cabinet-style Design System
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Variables ──────────────────────────────────────────────── */
:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface2:    #f8f9fa;
  --accent:      #3390ec;
  --accent-dark: #2478d4;
  --accent-rgb:  51,144,236;
  --text:        #000000;
  --text2:       #52606d;
  --text3:       #9aa5b4;
  --divider:     #e8eaed;
  --hover:       #f1f3f5;
  --active-bg:   rgba(51,144,236,0.08);
  --danger:      #e53935;
  --danger-bg:   rgba(229,57,53,0.08);
  --success:     #2e7d32;
  --success-bg:  #e8f5e9;
  --shadow-xs:   0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.13);
  --r-sm:        8px;
  --r-md:        12px;
  --r-lg:        16px;
  --r-xl:        20px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease:        cubic-bezier(0.4,0,0.2,1);
  --t:           0.15s;
}

[data-theme="dark"] {
  --bg:          #1a1a1a;
  --surface:     #252525;
  --surface2:    #2d2d2d;
  --text:        #ffffff;
  --text2:       #9aa5b4;
  --text3:       #5a6474;
  --divider:     rgba(255,255,255,0.08);
  --hover:       rgba(255,255,255,0.05);
  --active-bg:   rgba(51,144,236,0.12);
  --shadow-xs:   0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  --success-bg:  #1b3a1e;
  --danger-bg:   rgba(229,57,53,0.12);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── App Shell ──────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
  width: 360px;
  min-width: 280px;
  max-width: 600px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

/* Header */
.sidebar-header {
  height: 56px;
  padding: 0 10px 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}
.sidebar-header-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* Body split */
.sidebar-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ─── Folders column ─────────────────────────────────────────── */
.folders-list-vertical {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  border-right: 1px solid var(--divider);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  background: var(--surface2);
  gap: 1px;
}

.folder-item-sidebar {
  width: 56px;
  min-height: 60px;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
  position: relative;
  padding: 6px 4px 5px;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.folder-item-sidebar:hover { background: var(--hover); }
.folder-item-sidebar:active { transform: scale(0.93); }
.folder-item-sidebar.active { background: var(--active-bg); }
.folder-item-sidebar.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.folder-item-sidebar.drag-over {
  background: var(--active-bg);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.folder-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease);
}
.folder-item-sidebar:hover .folder-icon { transform: scale(1.06); }
.folder-icon svg { width: 18px; height: 18px; }

.folder-title-small {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.folder-item-sidebar.active .folder-title-small { color: var(--accent); font-weight: 600; }

.folder-count-badge {
  position: absolute;
  top: 3px; right: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  border: 1.5px solid var(--surface2);
}

/* ─── Channels column ────────────────────────────────────────── */
.channels-column { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Channel filter buttons */
.channel-filters {
  display: flex;
  gap: 6px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.filter-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1.5px solid var(--divider);
  border-radius: 20px;
  color: var(--text2);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.sidebar-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}
.sidebar-search input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--divider);
  border-radius: 20px;
  padding: 7px 14px 7px 36px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--t), background var(--t);
}
.sidebar-search input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.sidebar-search input::placeholder { color: var(--text3); }

.channel-list { flex: 1; overflow-y: auto; padding: 4px 0; }

/* ─── Channel Item ───────────────────────────────────────────── */
.channel-item {
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 12px;
  margin: 1px 6px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t) var(--ease);
  gap: 10px;
  position: relative;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.channel-item:hover { background: var(--hover); }
.channel-item.active {
  background: var(--active-bg);
}
.channel-item.active .channel-name { color: var(--accent); font-weight: 600; }
.channel-item.pinned {
  background: rgba(51,144,236,0.04);
}
.channel-item.pinned::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ─── Avatar ─────────────────────────────────────────────────── */
.ch-av {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ch-av img {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.ch-av .avatar-placeholder {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-placeholder {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}
.avatar-placeholder.size36,
.avatar-placeholder.size-36 { width: 36px !important; height: 36px !important; font-size: 13px; }

/* ─── Channel Info ───────────────────────────────────────────── */
.ch-row { display: contents; }
.ch-info { flex: 1; min-width: 0; }
.ch-info-main { display: flex; align-items: center; gap: 5px; min-width: 0; }
.channel-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.folder-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.channel-last-post {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.new-posts-badge {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}

/* ─── Channel ⋮ Menu ─────────────────────────────────────────── */
.ch-actions-menu { flex-shrink: 0; position: relative; }

.ch-menu-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  transition: background var(--t), color var(--t), transform 0.1s;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.channel-item:hover .ch-menu-btn,
.channel-item.active .ch-menu-btn { opacity: 1; pointer-events: auto; }
.ch-menu-btn:hover { background: var(--divider); color: var(--text2); }
.ch-menu-btn:active { transform: scale(0.86); }
.ch-menu-btn svg { pointer-events: none; }

.ch-actions-dropdown {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 185px;
  z-index: 2000;
}
.ch-actions-dropdown.show { display: block; animation: dropDown 0.13s var(--ease); }

@keyframes dropDown {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ch-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ch-dropdown-item:hover { background: var(--hover); }
.ch-dropdown-item.danger { color: var(--danger); }
.ch-dropdown-item.danger:hover { background: var(--danger-bg); }
.ch-dropdown-item svg { flex-shrink: 0; color: var(--text2); }
.ch-dropdown-item.danger svg { color: var(--danger); }
.ch-dropdown-item span { flex: 1; }
.ch-dropdown-divider { height: 1px; background: var(--divider); margin: 3px 8px; }

/* ─── Sidebar User ───────────────────────────────────────────── */
.sidebar-user {
  padding: 10px 12px;
  border-top: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface);
}
.sidebar-user-info { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════
   MAIN AREA
   ═══════════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); min-width: 0; }

/* Resize handle */
.main-resize-handle {
  width: 4px;
  cursor: col-resize;
  flex-shrink: 0;
  background: transparent;
  transition: background var(--t);
  position: relative;
  z-index: 10;
}
.main-resize-handle:hover,
.main-resize-handle.resizing { background: rgba(var(--accent-rgb),0.3); }

/* Header */
.main-header {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.main-header-info { flex: 1; min-width: 0; }
.main-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-header-subtitle { font-size: 12px; color: var(--text2); margin-top: 1px; }
.header-actions { display: flex; gap: 2px; align-items: center; }

/* ─── Icon Button ─────────────────────────────────────────────── */
.btn-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: background var(--t), color var(--t), transform 0.1s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.btn-icon:hover { background: var(--hover); color: var(--accent); }
.btn-icon:active { transform: scale(0.88); }
.btn-icon svg { width: 18px; height: 18px; pointer-events: none; }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ─── Feed ────────────────────────────────────────────────────── */
.feed { flex: 1; overflow-y: auto; padding: 16px 0 24px; scroll-behavior: smooth; }
.feed-inner { max-width: 760px; margin: 0; padding: 0 20px 0 16px; }

/* Date dividers */
.date-divider { text-align: center; margin: 18px 0 12px; }
.date-divider span {
  background: var(--surface);
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 10px;
  display: inline-block;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--divider);
}

/* ─── Message / Post ──────────────────────────────────────────── */
.message-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
  animation: msgIn 0.18s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { background: rgba(51,144,236,0.3); }
  50% { background: rgba(51,144,236,0.1); }
  100% { background: transparent; }
}

.message-wrap.pinned { position: relative; }
.message-wrap.pinned::before { content: '📌'; position: absolute; left: -18px; top: 8px; font-size: 12px; }

.msg-av {
  flex-shrink: 0;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 2px;
}
.avatar { object-fit: cover; }
.avatar.size36,
.avatar-placeholder.size36,
.avatar-placeholder.size-36 {
  width: 34px !important;
  height: 34px !important;
  font-size: 13px;
  border-radius: 50%;
}

/* ─── Bubble (card style like cabinet) ───────────────────────── */
.bubble {
  max-width: min(580px, 82vw);
  background: var(--surface);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  word-break: break-word;
  overflow-wrap: anywhere;
  position: relative;
  transition: box-shadow var(--t), border-color var(--t);
}
.bubble:hover { box-shadow: var(--shadow-md); border-color: transparent; }
.bubble.has-media { padding: 8px 20px 8px; }

/* Channel badge */
.post-badge {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
  cursor: pointer;
  display: inline-block;
  line-height: 1.3;
}
.post-badge:hover { text-decoration: underline; }

/* Forward */
.forward-badge {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 8px;
  margin-bottom: 6px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  background: var(--active-bg);
  border-radius: 0 6px 6px 0;
}
.forward-badge svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.forward-link { color: var(--accent); text-decoration: none; font-weight: 600; transition: opacity var(--t); }
.forward-link:hover { opacity: 0.8; text-decoration: none; }

/* Text */
.bubble-text { font-size: 14px; line-height: 1.55; color: var(--text); }
.bubble.has-media .bubble-text { padding: 8px 0px 0px; }
.bubble-text p { margin: 0 0 4px; }
.bubble-text p:last-child { margin-bottom: 0; }
.bubble-text a { color: var(--accent); text-decoration: none; transition: opacity var(--t); }
.bubble-text a:hover { opacity: 0.8; text-decoration: none; }
.bubble-text b, .bubble-text strong { font-weight: 700; }
.bubble-text i, .bubble-text em { font-style: italic; }
.bubble-text u { text-decoration: underline; }
.bubble-text s, .bubble-text del { text-decoration: line-through; }
.bubble-text code {
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}
.bubble-text pre {
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}
.bubble-text blockquote {
  border-left: 3px solid var(--accent);
  padding: 5px 10px 5px 12px;
  margin: 4px 0 6px;
  color: var(--text2);
  background: var(--active-bg);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
}
.bubble-text blockquote a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--t);
}
.bubble-text blockquote a:hover {
  opacity: 0.8;
  text-decoration: none;
}
.spoiler { background: var(--text); color: var(--text); border-radius: 3px; padding: 0 2px; cursor: pointer; transition: all 0.2s; }
.spoiler.revealed { background: transparent; color: var(--text); }

/* Meta row */
.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 4px;
}
.bubble.has-media .bubble-meta { padding: 0 10px 2px; }
.meta-time { font-size: 11px; color: var(--text3); white-space: nowrap; margin-right: 3px; }

/* Post action buttons */
.post-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}
.post-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--text3);
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.post-action-btn:hover { background: var(--hover); color: var(--text); }
.post-action-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.post-action-btn.pinned { color: var(--accent); }
.post-action-btn svg { pointer-events: none; }

/* ─── Media ───────────────────────────────────────────────────── */
.media-grid { border-radius: 15px 15px 0 0; overflow: hidden; cursor: pointer; }
.media-grid.single img, .media-grid.single video { display: block; width: 100%; height: auto; max-height: 480px; object-fit: contain; }
.media-grid.two  { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.media-grid.three { display: grid; grid-template-columns: 2fr 1fr; gap: 2px; }
.media-grid.three .media-item:first-child { grid-row: span 2; }
.media-grid.four { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.media-grid .media-item { position: relative; overflow: hidden; background: var(--bg); cursor: pointer; }
.media-grid .media-item img { display: block; width: 100%; height: 200px; object-fit: cover; }
.media-grid.single .media-item img { height: 100%; max-height: 100%; object-fit: contain; }
.media-grid .media-item.video-item { height: 200px; background: #000; }
.media-grid .media-item.video-item video { width: 100%; height: 100%; object-fit: cover; }
.video-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3); transition: background var(--t); pointer-events: none;
}
.video-play-btn svg { width: 44px; height: 44px; fill: rgba(255,255,255,0.9); }
.media-more { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 700; pointer-events: none; }

/* Document */
.doc-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  margin: 6px 12px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.doc-wrap:hover { background: var(--hover); border-color: var(--accent); }
.doc-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon svg { fill: #fff; width: 18px; height: 18px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-size { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* Telegram Embed iframe */
.telegram-embed-wrap {
  margin: 8px 12px 12px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--divider);
}
.telegram-embed-wrap iframe {
  display: block;
  width: 100%;
  min-height: 500px;
  border: none;
}

/* VK Video iframe - responsive 16:9 */
.vk-video-wrap {
  position: relative;
  width: calc(100% + 40px); /* Compensate for bubble padding */
  margin-left: -20px;
  margin-right: -20px;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  margin-top: 12px;
  margin-bottom: 12px;
  background: #000;
  overflow: hidden;
}
.vk-video-wrap:first-child {
  margin-top: -8px;
  margin-left: -20px;
  width: calc(100% + 40px);
}
.vk-video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.95);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: fadeIn 0.16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-header {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
  z-index: 10;
}
.lightbox-close {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none; color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
#lbCounter { color: rgba(255,255,255,0.5); font-size: 13px; }
.lightbox-media { max-width: 90vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lightbox video { max-width: 90vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--t); font-size: 22px;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* ═══════════════════════════════════════════════════════════════
   MODALS  (cabinet card style)
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px 22px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.16s var(--ease);
  border: 1px solid var(--divider);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.modal input,
.modal select {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--divider);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--t), background var(--t);
  box-sizing: border-box;
}
.modal input:focus,
.modal select:focus { border-color: var(--accent); background: var(--surface); }
.modal-hint { font-size: 12px; color: var(--text3); margin-top: 6px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t), transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--hover);
  color: var(--text);
  border: 1px solid var(--divider);
}
.btn-secondary:hover { background: var(--divider); }

/* Avatar upload */
.avatar-upload-area {
  border: 1.5px dashed var(--divider);
  border-radius: var(--r-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  gap: 8px;
  color: var(--text3);
  font-size: 13px;
  background: var(--surface2);
}
.avatar-upload-area:hover { border-color: var(--accent); background: var(--active-bg); color: var(--accent); }

/* ─── Load more / Empty / Spinner ────────────────────────────── */
.load-more-wrap { text-align: center; padding: 20px 0 36px; }
.load-more-btn {
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  padding: 9px 28px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--t);
}
.load-more-btn:hover { background: var(--accent); color: #fff; }
.load-more-btn:active { transform: scale(0.97); }
.load-more-btn:disabled { opacity: 0.4; cursor: default; }

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 14px;
  color: var(--text2); padding: 40px; text-align: center;
}
.empty-state-icon { font-size: 56px; opacity: 0.35; }
.empty-state p { font-size: 14px; max-width: 260px; line-height: 1.5; }

.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--divider);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: var(--text);
  color: var(--surface);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  z-index: 9999; opacity: 0;
  transition: all 0.2s var(--ease);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.08);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Theme btn ───────────────────────────────────────────────── */
.theme-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ─── Context menu ────────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 172px;
  z-index: 3000;
  animation: dropDown 0.13s var(--ease);
}
.context-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text); transition: background var(--t);
  -webkit-tap-highlight-color: transparent;
}
.context-menu-item:hover { background: var(--hover); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: var(--danger-bg); }

/* ─── Auto-delete button styles ───────────────────────────────── */
.btn-sm {
  border: none;
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--t), transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn-sm:active { transform: scale(0.96); }
.btn-sm.btn-primary { background: var(--accent); color: #fff; }
.btn-sm.btn-primary:hover { background: var(--accent-dark); }
.btn-sm.btn-secondary { background: var(--hover); color: var(--text); border: 1px solid var(--divider); }
.btn-sm.btn-secondary:hover { background: var(--divider); }
.btn-sm.btn-danger { background: var(--danger); color: #fff; }
.btn-sm.btn-danger:hover { background: #c62828; }

/* ─── Refresh spin ────────────────────────────────────────────── */
@keyframes rotate { to { transform: rotate(360deg); } }
#refreshAllBtn.spinning svg { animation: rotate 0.75s linear infinite; }

/* ─── New post animation ──────────────────────────────────────── */
.new-post-marker { animation: newPost 0.25s var(--ease); }
@keyframes newPost {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Folder select modal ─────────────────────────────────────── */
#folderSelectList .folder-select-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--t);
  font-size: 14px; -webkit-tap-highlight-color: transparent;
}
#folderSelectList .folder-select-item:hover { background: var(--hover); }

/* ─── Search results ──────────────────────────────────────────── */
#searchResults { max-height: 50vh; overflow-y: auto; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════ */
.menu-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text2); display: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 700px) {
  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100dvh; z-index: 500;
    transform: translateX(-100%);
    width: 100vw !important; max-width: 100vw;
    transition: transform 0.22s var(--ease), box-shadow 0.22s;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.18); }
  .main { width: 100%; }
  .bubble { max-width: 90vw; }
  .feed-inner { padding: 0 10px; }
  .menu-btn { display: flex !important; }
  .main-resize-handle { display: none; }
  .lightbox-nav { display: none; }
  .ch-menu-btn { opacity: 1 !important; pointer-events: auto !important; }
  .channel-item { padding: 7px 8px; }
  .ch-av { width: 42px; height: 42px; }
  .ch-av img { width: 42px !important; height: 42px !important; }
  .ch-av .avatar-placeholder { width: 42px !important; height: 42px !important; font-size: 15px; }
  .folders-list-vertical { width: 60px; }
  .folder-item-sidebar { width: 52px; }
  .folder-icon { width: 32px; height: 32px; border-radius: 9px; }
  .post-actions { opacity: 1; }
  #channelAutoDeleteList { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 701px) {
  .menu-btn { display: none !important; }
}
@media (min-width: 601px) and (max-width: 900px) {
  #channelAutoDeleteList { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   LEGACY --tg-* ALIASES  (login.php / cabinet.php)
   ═══════════════════════════════════════════════════════════════ */
:root {
  --tg-bg:             var(--surface);
  --tg-bg-secondary:   var(--bg);
  --tg-surface:        var(--surface);
  --tg-sidebar-bg:     var(--surface);
  --tg-header-bg:      var(--surface);
  --tg-accent:         var(--accent);
  --tg-text:           var(--text);
  --tg-text-secondary: var(--text2);
  --tg-meta:           var(--text3);
  --tg-divider:        var(--divider);
  --tg-input-bg:       var(--surface2);/* ═══════════════════════════════════════════════════════════════
   News Feed — Cabinet-style Design System
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Variables ──────────────────────────────────────────────── */
:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface2:    #f8f9fa;
  --accent:      #3390ec;
  --accent-dark: #2478d4;
  --accent-rgb:  51,144,236;
  --text:        #000000;
  --text2:       #52606d;
  --text3:       #9aa5b4;
  --divider:     #e8eaed;
  --hover:       #f1f3f5;
  --active-bg:   rgba(51,144,236,0.08);
  --danger:      #e53935;
  --danger-bg:   rgba(229,57,53,0.08);
  --success:     #2e7d32;
  --success-bg:  #e8f5e9;
  --shadow-xs:   0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.13);
  --r-sm:        8px;
  --r-md:        12px;
  --r-lg:        16px;
  --r-xl:        20px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease:        cubic-bezier(0.4,0,0.2,1);
  --t:           0.15s;
}

[data-theme="dark"] {
  --bg:          #1a1a1a;
  --surface:     #252525;
  --surface2:    #2d2d2d;
  --text:        #ffffff;
  --text2:       #9aa5b4;
  --text3:       #5a6474;
  --divider:     rgba(255,255,255,0.08);
  --hover:       rgba(255,255,255,0.05);
  --active-bg:   rgba(51,144,236,0.12);
  --shadow-xs:   0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  --success-bg:  #1b3a1e;
  --danger-bg:   rgba(229,57,53,0.12);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── App Shell ──────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
  width: 360px;
  min-width: 280px;
  max-width: 600px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

/* Header */
.sidebar-header {
  height: 56px;
  padding: 0 10px 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}
.sidebar-header-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* Body split */
.sidebar-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ─── Folders column ─────────────────────────────────────────── */
.folders-list-vertical {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  border-right: 1px solid var(--divider);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  background: var(--surface2);
  gap: 1px;
}

.folder-item-sidebar {
  width: 56px;
  min-height: 60px;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
  position: relative;
  padding: 6px 4px 5px;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.folder-item-sidebar:hover { background: var(--hover); }
.folder-item-sidebar:active { transform: scale(0.93); }
.folder-item-sidebar.active { background: var(--active-bg); }
.folder-item-sidebar.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.folder-item-sidebar.drag-over {
  background: var(--active-bg);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.folder-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease);
}
.folder-item-sidebar:hover .folder-icon { transform: scale(1.06); }
.folder-icon svg { width: 18px; height: 18px; }

.folder-title-small {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.folder-item-sidebar.active .folder-title-small { color: var(--accent); font-weight: 600; }

.folder-count-badge {
  position: absolute;
  top: 3px; right: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  border: 1.5px solid var(--surface2);
}

/* ─── Channels column ────────────────────────────────────────── */
.channels-column { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Channel filter buttons */
.channel-filters {
  display: flex;
  gap: 6px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.filter-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1.5px solid var(--divider);
  border-radius: 20px;
  color: var(--text2);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.sidebar-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}
.sidebar-search input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--divider);
  border-radius: 20px;
  padding: 7px 14px 7px 36px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--t), background var(--t);
}
.sidebar-search input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.sidebar-search input::placeholder { color: var(--text3); }

.channel-list { flex: 1; overflow-y: auto; padding: 4px 0; }

/* ─── Channel Item ───────────────────────────────────────────── */
.channel-item {
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 12px;
  margin: 1px 6px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t) var(--ease);
  gap: 10px;
  position: relative;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.channel-item:hover { background: var(--hover); }
.channel-item.active {
  background: var(--active-bg);
}
.channel-item.active .channel-name { color: var(--accent); font-weight: 600; }
.channel-item.pinned {
  background: rgba(51,144,236,0.04);
}
.channel-item.pinned::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ─── Avatar ─────────────────────────────────────────────────── */
.ch-av {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ch-av img {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.ch-av .avatar-placeholder {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-placeholder {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}
.avatar-placeholder.size36,
.avatar-placeholder.size-36 { width: 36px !important; height: 36px !important; font-size: 13px; }

/* ─── Channel Info ───────────────────────────────────────────── */
.ch-row { display: contents; }
.ch-info { flex: 1; min-width: 0; }
.ch-info-main { display: flex; align-items: center; gap: 5px; min-width: 0; }
.channel-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.folder-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.channel-last-post {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.new-posts-badge {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}

/* ─── Channel ⋮ Menu ─────────────────────────────────────────── */
.ch-actions-menu { flex-shrink: 0; position: relative; }

.ch-menu-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  transition: background var(--t), color var(--t), transform 0.1s;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.channel-item:hover .ch-menu-btn,
.channel-item.active .ch-menu-btn { opacity: 1; pointer-events: auto; }
.ch-menu-btn:hover { background: var(--divider); color: var(--text2); }
.ch-menu-btn:active { transform: scale(0.86); }
.ch-menu-btn svg { pointer-events: none; }

.ch-actions-dropdown {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 185px;
  z-index: 2000;
}
.ch-actions-dropdown.show { display: block; animation: dropDown 0.13s var(--ease); }

@keyframes dropDown {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ch-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ch-dropdown-item:hover { background: var(--hover); }
.ch-dropdown-item.danger { color: var(--danger); }
.ch-dropdown-item.danger:hover { background: var(--danger-bg); }
.ch-dropdown-item svg { flex-shrink: 0; color: var(--text2); }
.ch-dropdown-item.danger svg { color: var(--danger); }
.ch-dropdown-item span { flex: 1; }
.ch-dropdown-divider { height: 1px; background: var(--divider); margin: 3px 8px; }

/* ─── Sidebar User ───────────────────────────────────────────── */
.sidebar-user {
  padding: 10px 12px;
  border-top: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface);
}
.sidebar-user-info { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════
   MAIN AREA
   ═══════════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); min-width: 0; }

/* Resize handle */
.main-resize-handle {
  width: 4px;
  cursor: col-resize;
  flex-shrink: 0;
  background: transparent;
  transition: background var(--t);
  position: relative;
  z-index: 10;
}
.main-resize-handle:hover,
.main-resize-handle.resizing { background: rgba(var(--accent-rgb),0.3); }

/* Header */
.main-header {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.main-header-info { flex: 1; min-width: 0; }
.main-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-header-subtitle { font-size: 12px; color: var(--text2); margin-top: 1px; }
.header-actions { display: flex; gap: 2px; align-items: center; }

/* ─── Icon Button ─────────────────────────────────────────────── */
.btn-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: background var(--t), color var(--t), transform 0.1s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.btn-icon:hover { background: var(--hover); color: var(--accent); }
.btn-icon:active { transform: scale(0.88); }
.btn-icon svg { width: 18px; height: 18px; pointer-events: none; }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ─── Feed ────────────────────────────────────────────────────── */
.feed { flex: 1; overflow-y: auto; padding: 16px 0 24px; scroll-behavior: smooth; }
.feed-inner { max-width: 760px; margin: 0; padding: 0 20px 0 16px; }

/* Date dividers */
.date-divider { text-align: center; margin: 18px 0 12px; }
.date-divider span {
  background: var(--surface);
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 10px;
  display: inline-block;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--divider);
}

/* ─── Message / Post ──────────────────────────────────────────── */
.message-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
  animation: msgIn 0.18s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { background: rgba(51,144,236,0.3); }
  50% { background: rgba(51,144,236,0.1); }
  100% { background: transparent; }
}

.message-wrap.pinned { position: relative; }
.message-wrap.pinned::before { content: '📌'; position: absolute; left: -18px; top: 8px; font-size: 12px; }

.msg-av {
  flex-shrink: 0;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 2px;
}
.avatar { object-fit: cover; }
.avatar.size36,
.avatar-placeholder.size36,
.avatar-placeholder.size-36 {
  width: 34px !important;
  height: 34px !important;
  font-size: 13px;
  border-radius: 50%;
}

/* ─── Bubble (card style like cabinet) ───────────────────────── */
.bubble {
  max-width: min(580px, 82vw);
  background: var(--surface);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  word-break: break-word;
  overflow-wrap: anywhere;
  position: relative;
  transition: box-shadow var(--t), border-color var(--t);
}
.bubble:hover { box-shadow: var(--shadow-md); border-color: transparent; }
.bubble.has-media { padding: 8px 20px 8px; }

/* Channel badge */
.post-badge {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
  cursor: pointer;
  display: inline-block;
  line-height: 1.3;
}
.post-badge:hover { text-decoration: underline; }

/* Forward */
.forward-badge {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 8px;
  margin-bottom: 6px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  background: var(--active-bg);
  border-radius: 0 6px 6px 0;
}
.forward-badge svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.forward-link { color: var(--accent); text-decoration: none; font-weight: 600; transition: opacity var(--t); }
.forward-link:hover { opacity: 0.8; text-decoration: none; }

/* Text */
.bubble-text { font-size: 14px; line-height: 1.55; color: var(--text); }
.bubble.has-media .bubble-text { padding: 8px 0px 0px; }
.bubble-text p { margin: 0 0 4px; }
.bubble-text p:last-child { margin-bottom: 0; }
.bubble-text a { color: var(--accent); text-decoration: none; transition: opacity var(--t); }
.bubble-text a:hover { opacity: 0.8; text-decoration: none; }
.bubble-text b, .bubble-text strong { font-weight: 700; }
.bubble-text i, .bubble-text em { font-style: italic; }
.bubble-text u { text-decoration: underline; }
.bubble-text s, .bubble-text del { text-decoration: line-through; }
.bubble-text code {
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}
.bubble-text pre {
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}
.bubble-text blockquote {
  border-left: 3px solid var(--accent);
  padding: 5px 10px 5px 12px;
  margin: 4px 0 6px;
  color: var(--text2);
  background: var(--active-bg);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
}
.bubble-text blockquote a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--t);
}
.bubble-text blockquote a:hover {
  opacity: 0.8;
  text-decoration: none;
}
.spoiler { background: var(--text); color: var(--text); border-radius: 3px; padding: 0 2px; cursor: pointer; transition: all 0.2s; }
.spoiler.revealed { background: transparent; color: var(--text); }

/* Meta row */
.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 4px;
}
.bubble.has-media .bubble-meta { padding: 0 10px 2px; }
.meta-time { font-size: 11px; color: var(--text3); white-space: nowrap; margin-right: 3px; }

/* Post action buttons */
.post-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}
.post-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--text3);
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.post-action-btn:hover { background: var(--hover); color: var(--text); }
.post-action-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.post-action-btn.pinned { color: var(--accent); }
.post-action-btn svg { pointer-events: none; }

/* ─── Media ───────────────────────────────────────────────────── */
.media-grid { border-radius: 15px 15px 0 0; overflow: hidden; cursor: pointer; }

/* Single photo or video — full bubble width */
.media-grid.single { display: block; }
.media-grid.single .media-item { height: auto; }
.media-grid.single img,
.media-grid.single video { display: block; width: 100%; height: auto; max-height: 480px; object-fit: contain; }

/* Two side by side */
.media-grid.two  { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }

/* Three: two equal on top + one full width on bottom */
.media-grid.three { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.media-grid.three .media-item:last-child { grid-column: 1 / -1; }
.media-grid.three .media-item:last-child img { height: 200px; }
.media-grid.three .media-item:last-child.video-item { height: 200px; }

/* Four: 2×2 */
.media-grid.four { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }

/* Multi (5–9): 2 columns, last item if odd spans full width */
.media-grid.multi { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.media-grid.multi .media-item.last-odd { grid-column: 1 / -1; }
.media-grid.multi .media-item.last-odd img { height: 200px; }
.media-grid.multi .media-item.last-odd.video-item { height: 200px; }

/* Common media items */
.media-grid .media-item { position: relative; overflow: hidden; background: var(--bg); cursor: pointer; }
.media-grid .media-item img { display: block; width: 100%; height: 200px; object-fit: cover; }
.media-grid.single .media-item img { height: auto; max-height: 480px; object-fit: contain; }
.media-grid .media-item.video-item { height: 200px; background: #000; }
.media-grid.single .media-item.video-item { height: auto; min-height: 200px; max-height: 480px; }
.media-grid.single .media-item.video-item video { height: auto; max-height: 480px; }
.media-grid .media-item.video-item video { width: 100%; height: 100%; object-fit: cover; }
.video-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3); transition: background var(--t); pointer-events: none;
}
.video-play-btn svg { width: 44px; height: 44px; fill: rgba(255,255,255,0.9); }
.media-more { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 700; pointer-events: none; }

/* Document */
.doc-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  margin: 6px 12px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.doc-wrap:hover { background: var(--hover); border-color: var(--accent); }
.doc-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon svg { fill: #fff; width: 18px; height: 18px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-size { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* Telegram Embed iframe */
.telegram-embed-wrap {
  margin: 8px 12px 12px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--divider);
}
.telegram-embed-wrap iframe {
  display: block;
  width: 100%;
  min-height: 500px;
  border: none;
}

/* VK Video iframe - responsive 16:9 */
.vk-video-wrap {
  position: relative;
  width: calc(100% + 40px); /* Compensate for bubble padding */
  margin-left: -20px;
  margin-right: -20px;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  margin-top: 12px;
  margin-bottom: 12px;
  background: #000;
  overflow: hidden;
}
.vk-video-wrap:first-child {
  margin-top: -8px;
  margin-left: -20px;
  width: calc(100% + 40px);
}
.vk-video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.95);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: fadeIn 0.16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-header {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
  z-index: 10;
}
.lightbox-close {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none; color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
#lbCounter { color: rgba(255,255,255,0.5); font-size: 13px; }
.lightbox-media { max-width: 90vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lightbox video { max-width: 90vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--t); font-size: 22px;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* ═══════════════════════════════════════════════════════════════
   MODALS  (cabinet card style)
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px 22px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.16s var(--ease);
  border: 1px solid var(--divider);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.modal input,
.modal select {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--divider);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--t), background var(--t);
  box-sizing: border-box;
}
.modal input:focus,
.modal select:focus { border-color: var(--accent); background: var(--surface); }
.modal-hint { font-size: 12px; color: var(--text3); margin-top: 6px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t), transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--hover);
  color: var(--text);
  border: 1px solid var(--divider);
}
.btn-secondary:hover { background: var(--divider); }

/* Avatar upload */
.avatar-upload-area {
  border: 1.5px dashed var(--divider);
  border-radius: var(--r-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  gap: 8px;
  color: var(--text3);
  font-size: 13px;
  background: var(--surface2);
}
.avatar-upload-area:hover { border-color: var(--accent); background: var(--active-bg); color: var(--accent); }

/* ─── Load more / Empty / Spinner ────────────────────────────── */
.load-more-wrap { text-align: center; padding: 20px 0 36px; }
.load-more-btn {
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  padding: 9px 28px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--t);
}
.load-more-btn:hover { background: var(--accent); color: #fff; }
.load-more-btn:active { transform: scale(0.97); }
.load-more-btn:disabled { opacity: 0.4; cursor: default; }

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 14px;
  color: var(--text2); padding: 40px; text-align: center;
}
.empty-state-icon { font-size: 56px; opacity: 0.35; }
.empty-state p { font-size: 14px; max-width: 260px; line-height: 1.5; }

.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--divider);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: var(--text);
  color: var(--surface);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  z-index: 9999; opacity: 0;
  transition: all 0.2s var(--ease);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.08);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Theme btn ───────────────────────────────────────────────── */
.theme-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ─── Context menu ────────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 172px;
  z-index: 3000;
  animation: dropDown 0.13s var(--ease);
}
.context-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text); transition: background var(--t);
  -webkit-tap-highlight-color: transparent;
}
.context-menu-item:hover { background: var(--hover); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: var(--danger-bg); }

/* ─── Auto-delete button styles ───────────────────────────────── */
.btn-sm {
  border: none;
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--t), transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn-sm:active { transform: scale(0.96); }
.btn-sm.btn-primary { background: var(--accent); color: #fff; }
.btn-sm.btn-primary:hover { background: var(--accent-dark); }
.btn-sm.btn-secondary { background: var(--hover); color: var(--text); border: 1px solid var(--divider); }
.btn-sm.btn-secondary:hover { background: var(--divider); }
.btn-sm.btn-danger { background: var(--danger); color: #fff; }
.btn-sm.btn-danger:hover { background: #c62828; }

/* ─── Refresh spin ────────────────────────────────────────────── */
@keyframes rotate { to { transform: rotate(360deg); } }
#refreshAllBtn.spinning svg { animation: rotate 0.75s linear infinite; }

/* ─── New post animation ──────────────────────────────────────── */
.new-post-marker { animation: newPost 0.25s var(--ease); }
@keyframes newPost {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Folder select modal ─────────────────────────────────────── */
#folderSelectList .folder-select-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--t);
  font-size: 14px; -webkit-tap-highlight-color: transparent;
}
#folderSelectList .folder-select-item:hover { background: var(--hover); }

/* ─── Search results ──────────────────────────────────────────── */
#searchResults { max-height: 50vh; overflow-y: auto; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════ */
.menu-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text2); display: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 700px) {
  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100dvh; z-index: 500;
    transform: translateX(-100%);
    width: 100vw !important; max-width: 100vw;
    transition: transform 0.22s var(--ease), box-shadow 0.22s;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.18); }
  .main { width: 100%; }
  .bubble { max-width: 90vw; }
  .feed-inner { padding: 0 10px; }
  .menu-btn { display: flex !important; }
  .main-resize-handle { display: none; }
  .lightbox-nav { display: none; }
  .ch-menu-btn { opacity: 1 !important; pointer-events: auto !important; }
  .channel-item { padding: 7px 8px; }
  .ch-av { width: 42px; height: 42px; }
  .ch-av img { width: 42px !important; height: 42px !important; }
  .ch-av .avatar-placeholder { width: 42px !important; height: 42px !important; font-size: 15px; }
  .folders-list-vertical { width: 60px; }
  .folder-item-sidebar { width: 52px; }
  .folder-icon { width: 32px; height: 32px; border-radius: 9px; }
  .post-actions { opacity: 1; }
  #channelAutoDeleteList { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 701px) {
  .menu-btn { display: none !important; }
}
@media (min-width: 601px) and (max-width: 900px) {
  #channelAutoDeleteList { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   LEGACY --tg-* ALIASES  (login.php / cabinet.php)
   ═══════════════════════════════════════════════════════════════ */
:root {
  --tg-bg:             var(--surface);
  --tg-bg-secondary:   var(--bg);
  --tg-surface:        var(--surface);
  --tg-sidebar-bg:     var(--surface);
  --tg-header-bg:      var(--surface);
  --tg-accent:         var(--accent);
  --tg-text:           var(--text);
  --tg-text-secondary: var(--text2);
  --tg-meta:           var(--text3);
  --tg-divider:        var(--divider);
  --tg-input-bg:       var(--surface2);
  --tg-hover:          var(--hover);
  --tg-danger:         var(--danger);
}
[data-theme="dark"] {
  --tg-bg:             var(--surface);
  --tg-bg-secondary:   var(--bg);
  --tg-surface:        var(--surface);
  --tg-sidebar-bg:     var(--surface);
  --tg-header-bg:      var(--surface);
  --tg-accent:         var(--accent);
  --tg-text:           var(--text);
  --tg-text-secondary: var(--text2);
  --tg-meta:           var(--text3);
  --tg-divider:        var(--divider);
  --tg-input-bg:       var(--surface2);
  --tg-hover:          var(--hover);
  --tg-danger:         var(--danger);
}