/* ─── Google Fonts ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Lora:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════════════════════════════════
   THEME TOKENS  —  Penguin Sunset (default) | bw | natural
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Fonts */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Lora', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Penguin Sunset palette */
  --bg-start: #eef2ff;
  --bg-end: #fdf2f8;
  --bg-mid: #f5f0ff;

  --surface-glass: rgba(255, 255, 255, 0.60);
  --surface-solid: rgba(255, 255, 255, 0.92);
  --surface-hover: rgba(255, 255, 255, 0.80);
  --surface-sidebar: rgba(248, 246, 255, 0.85);

  --accent: #4f46e5;
  --accent-dim: #6366f1;
  --accent-light: #a5b4fc;
  --accent-bg: #eef2ff;
  --accent-hover: #4338ca;

  --secondary: #ec4899;
  --secondary-bg: #fdf2f8;
  --secondary-light: #fbcfe8;

  --green: #10b981;
  --green-bg: #d1fae5;
  --amber: #f59e0b;
  --amber-bg: #fef3c7;
  --red: #ef4444;
  --red-bg: #fee2e2;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border: rgba(255, 255, 255, 0.75);
  --border-subtle: rgba(0, 0, 0, 0.055);
  --border-medium: rgba(0, 0, 0, 0.10);

  --shadow-xs: 0 1px 3px rgba(79, 70, 229, 0.05);
  --shadow-sm: 0 2px 10px rgba(79, 70, 229, 0.08);
  --shadow-md: 0 8px 28px rgba(79, 70, 229, 0.12);
  --shadow-lg: 0 20px 50px rgba(79, 70, 229, 0.16);
  --shadow-glow: 0 0 0 3px rgba(79, 70, 229, 0.18);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  --sidebar-w: 256px;
  --transition: 0.2s ease;
}

/* ── Black & White ──────────────────────────────────────────────────────── */
html[data-theme="bw"] {
  --bg-start: #f7f7f7;
  --bg-end: #ffffff;
  --bg-mid: #f0f0f0;

  --surface-glass: rgba(255, 255, 255, 0.80);
  --surface-solid: rgba(255, 255, 255, 0.97);
  --surface-hover: rgba(245, 245, 245, 0.90);
  --surface-sidebar: rgba(250, 250, 250, 0.95);

  --accent: #111111;
  --accent-dim: #333333;
  --accent-light: #777777;
  --accent-bg: #f0f0f0;
  --accent-hover: #000000;

  --secondary: #444444;
  --secondary-bg: #f5f5f5;
  --secondary-light: #e0e0e0;

  --green: #1a1a1a;
  --green-bg: #e8e8e8;
  --amber: #333333;
  --amber-bg: #ebebeb;
  --red: #1a1a1a;
  --red-bg: #f0f0f0;

  --text-primary: #0a0a0a;
  --text-secondary: #333333;
  --text-muted: #888888;

  --border: rgba(0, 0, 0, 0.10);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.14);

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.14);
  --shadow-glow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

/* ── Natural ────────────────────────────────────────────────────────────── */
html[data-theme="natural"] {
  --bg-start: #f5ede0;
  --bg-end: #e8f0df;
  --bg-mid: #ede8d8;

  --surface-glass: rgba(252, 246, 238, 0.72);
  --surface-solid: rgba(253, 249, 243, 0.95);
  --surface-hover: rgba(248, 242, 232, 0.88);
  --surface-sidebar: rgba(248, 242, 230, 0.90);

  --accent: #4a7c59;
  --accent-dim: #5a8f6a;
  --accent-light: #8fbf9f;
  --accent-bg: #e8f3eb;
  --accent-hover: #3a6347;

  --secondary: #b5651d;
  --secondary-bg: #faeee0;
  --secondary-light: #f5d5b0;

  --green: #4a7c59;
  --green-bg: #e8f3eb;
  --amber: #b5651d;
  --amber-bg: #faeee0;
  --red: #9b3a3a;
  --red-bg: #fce8e8;

  --text-primary: #2c1810;
  --text-secondary: #5c4b3a;
  --text-muted: #9c8a78;

  --border: rgba(255, 252, 245, 0.70);
  --border-subtle: rgba(74, 60, 40, 0.08);
  --border-medium: rgba(74, 60, 40, 0.14);

  --shadow-xs: 0 1px 3px rgba(44, 24, 16, 0.05);
  --shadow-sm: 0 2px 10px rgba(44, 24, 16, 0.08);
  --shadow-md: 0 8px 28px rgba(44, 24, 16, 0.11);
  --shadow-lg: 0 20px 50px rgba(44, 24, 16, 0.15);
  --shadow-glow: 0 0 0 3px rgba(74, 124, 89, 0.20);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: linear-gradient(145deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-sans); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--font-sans); }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
.app-shell { display: flex; min-height: 100vh; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-sidebar);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
  z-index: 100;
  transition: width 0.25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .hide-collapsed { display: none !important; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-badge { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; font-size: 9px; }
.sidebar.collapsed .nav-group-item { justify-content: center; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 10px; }

/* Sidebar logo row */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  color: white;
}

.logo-text {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.logo-pill {
  font-size: 8px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 6px; border-radius: var(--r-full);
  white-space: nowrap;
}

/* Sidebar toggle button */
.sidebar-toggle {
  margin-left: auto;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-hover); color: var(--text-primary); }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; }

/* Nav */
.sidebar-nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto; overflow-x: hidden;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 13.5px; font-weight: 500;
  transition: all var(--transition);
  position: relative; cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent); font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0; color: var(--text-muted);
  transition: color var(--transition);
}
.nav-item:hover .nav-icon { color: var(--text-primary); }

.nav-badge {
  background: var(--accent); color: white;
  font-size: 9.5px; font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1; margin-left: auto;
}
.nav-badge.pink { background: var(--secondary); }
.nav-badge.green { background: var(--green); }

.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--text-muted);
  padding: 10px 10px 5px;
}

.nav-group-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-md);
  color: var(--text-secondary); font-size: 12.5px; font-weight: 500;
  transition: all var(--transition); cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.nav-group-item:hover { background: var(--surface-hover); color: var(--text-primary); }

.nav-group-dot {
  width: 8px; height: 8px; border-radius: var(--r-full); flex-shrink: 0;
}

/* Sidebar user footer */
.sidebar-user {
  padding: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 9px;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; color: var(--text-primary);
}

.sidebar-user-handle {
  font-size: 11px; color: var(--text-muted); display: block;
}

.sidebar-action {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition); flex-shrink: 0;
}
.sidebar-action:hover { background: var(--red-bg); color: var(--red); }
.sidebar-action.settings-btn:hover { background: var(--accent-bg); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════════════════════════════════ */
.avatar {
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; flex-shrink: 0;
  letter-spacing: -0.5px; position: relative;
  font-family: var(--font-sans);
}
.avatar-2xs { width: 20px; height: 20px; font-size: 8px; }
.avatar-xs  { width: 26px; height: 26px; font-size: 9px; }
.avatar-sm  { width: 34px; height: 34px; font-size: 12px; }
.avatar-md  { width: 42px; height: 42px; font-size: 15px; }
.avatar-lg  { width: 54px; height: 54px; font-size: 19px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 24px; }
.avatar-2xl { width: 96px; height: 96px; font-size: 32px; }

.avatar-online::after {
  content: ''; position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; background: var(--green);
  border-radius: var(--r-full); border: 2px solid white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed ~ .main-content { margin-left: 64px; }

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */
.page-header {
  padding: 26px 30px 0;
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}

.page-title {
  font-size: 21px; font-weight: 800; letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 12.5px; color: var(--text-muted); margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLASS CARD
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
}

.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600; font-size: 13.5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 13px; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer; border: none;
  text-decoration: none; white-space: nowrap; line-height: 1;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 5px 16px rgba(79, 70, 229, 0.38);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
  box-shadow: 0 3px 10px rgba(236, 72, 153, 0.26);
}
.btn-secondary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-medium);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-glass {
  background: var(--surface-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.btn-glass:hover { background: var(--surface-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--red-bg); color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.18);
}
.btn-danger:hover { background: var(--red); color: white; }

.btn-success {
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.18);
}
.btn-success:hover { background: var(--green); color: white; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14.5px; }
.btn-icon { padding: 7px; border-radius: var(--r-sm); }
.btn-icon-round { padding: 7px; border-radius: var(--r-full); }

/* ═══════════════════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-secondary); letter-spacing: 0.3px;
}

.form-input {
  width: 100%; padding: 9px 13px;
  background: rgba(255, 255, 255, 0.65);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-md);
  font-size: 13.5px; color: var(--text-primary);
  transition: all var(--transition); outline: none;
  backdrop-filter: blur(8px);
}
.form-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.90);
  box-shadow: var(--shadow-glow);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: none; line-height: 1.5; }
.form-hint { font-size: 11px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════════════════════════════════════════════════ */
.flash-stack {
  position: fixed; top: 16px; right: 16px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px; pointer-events: none;
}

.flash {
  padding: 11px 15px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(20px);
  border: 1px solid transparent;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  animation: slideInRight 0.28s ease;
  pointer-events: all;
}
.flash svg { flex-shrink: 0; }
.flash-success { background: var(--green-bg); color: #065f46; border-color: rgba(16,185,129,.22); }
.flash-error   { background: var(--red-bg);   color: #991b1b; border-color: rgba(239,68,68,.22);  }
.flash-warning { background: var(--amber-bg); color: #92400e; border-color: rgba(245,158,11,.22); }
.flash-info    { background: var(--accent-bg);color: var(--accent); border-color: rgba(79,70,229,.22); }

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PUBLIC SQUARE
   ═══════════════════════════════════════════════════════════════════════════ */
.square-layout {
  display: grid;
  grid-template-columns: 1fr 288px;
  gap: 20px;
  padding: 22px 28px 48px;
  max-width: 1080px;
}

/* Compose box */
.compose-box {
  padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.compose-inner { flex: 1; display: flex; flex-direction: column; gap: 10px; }

.compose-textarea {
  width: 100%;
  background: rgba(255,255,255,0.5);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-size: 13.5px; line-height: 1.55;
  resize: none; outline: none;
  transition: all var(--transition);
  min-height: 78px; color: var(--text-primary);
  font-family: var(--font-sans);
}
.compose-textarea:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-glow);
}
.compose-textarea::placeholder { color: var(--text-muted); }

.compose-toolbar {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}

.compose-tool-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  transition: all var(--transition); cursor: pointer;
  border: 1px solid transparent;
}
.compose-tool-btn:hover {
  background: var(--accent-bg); color: var(--accent);
  border-color: rgba(79,70,229,.15);
}

.compose-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.char-counter { font-size: 11px; color: var(--text-muted); }
.char-counter.warn { color: var(--amber); }
.char-counter.over { color: var(--red); }

/* Image preview */
.compose-image-preview {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  max-height: 220px;
  display: none;
}
.compose-image-preview.visible { display: block; }
.compose-image-preview img { width: 100%; height: auto; display: block; object-fit: cover; }
.compose-image-remove {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.5); color: white;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
}

/* Post card */
.post-card {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { background: rgba(255,255,255,.22); }

.post-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.post-author-name { font-size: 13.5px; font-weight: 600; }
.post-author-handle { font-size: 11.5px; color: var(--text-muted); }
.post-time { font-size: 11px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

.post-content {
  font-size: 14px; line-height: 1.65;
  color: var(--text-primary); margin-bottom: 12px;
  white-space: pre-wrap; word-break: break-word;
}

/* Markdown post content */
.post-content.markdown { white-space: normal; }
.post-content.markdown h1 { font-size: 1.5em; font-weight: 800; margin: 0.5em 0; }
.post-content.markdown h2 { font-size: 1.25em; font-weight: 700; margin: 0.4em 0; }
.post-content.markdown h3 { font-size: 1.1em; font-weight: 600; margin: 0.3em 0; }
.post-content.markdown p { margin-bottom: 0.6em; }
.post-content.markdown strong { font-weight: 700; }
.post-content.markdown em { font-style: italic; }
.post-content.markdown del { text-decoration: line-through; opacity: 0.7; }
.post-content.markdown code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
}
.post-content.markdown pre {
  background: var(--text-primary);
  color: #e2e8f0;
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.post-content.markdown pre code { background: none; color: inherit; padding: 0; }
.post-content.markdown blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 6px 0;
}
.post-content.markdown ul, .post-content.markdown ol {
  padding-left: 20px; margin: 4px 0;
}
.post-content.markdown mark {
  background: #fef08a;
  color: #713f12;
  border-radius: 3px;
  padding: 0 3px;
}
.post-content.markdown table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.post-content.markdown th, .post-content.markdown td {
  border: 1px solid var(--border-medium); padding: 6px 10px; font-size: 0.9em;
}
.post-content.markdown th { background: var(--accent-bg); font-weight: 600; }

/* Post image */
.post-image {
  border-radius: var(--r-md); overflow: hidden; margin-bottom: 12px;
}
.post-image img {
  width: 100%; height: auto; display: block;
  max-height: 400px; object-fit: cover;
}

/* Post actions */
.post-actions {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
}

.reaction-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition); border: none; background: none;
  font-family: var(--font-sans);
}
.reaction-btn:hover { background: var(--accent-bg); color: var(--accent); }
.reaction-btn.active-like { background: var(--accent-bg); color: var(--accent); }
.reaction-btn.active-heart { background: var(--secondary-bg); color: var(--secondary); }
.reaction-btn svg { width: 14px; height: 14px; }

.post-delete-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
  border: none; background: none;
}
.post-delete-btn:hover { background: var(--red-bg); color: var(--red); }

/* Comments */
.comments-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); display: none; }
.comments-section.open { display: block; }

.comment-item {
  display: flex; gap: 9px; margin-bottom: 8px;
  padding: 9px 12px;
  background: rgba(255,255,255,.42);
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  position: relative;
}
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.comment-text { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.comment-edited { font-size: 10px; color: var(--text-muted); font-style: italic; }

.comment-actions {
  display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition);
  flex-shrink: 0;
}
.comment-item:hover .comment-actions { opacity: 1; }

.comment-action-btn {
  width: 22px; height: 22px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; transition: all var(--transition);
  border: none; background: none;
}
.comment-action-btn:hover { background: var(--accent-bg); color: var(--accent); }
.comment-action-btn.delete:hover { background: var(--red-bg); color: var(--red); }

/* Inline comment edit */
.comment-edit-form { display: none; margin-top: 6px; }
.comment-edit-form.open { display: flex; gap: 6px; }
.comment-edit-input {
  flex: 1; padding: 6px 10px;
  background: rgba(255,255,255,.7);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-md);
  font-size: 12.5px; outline: none;
  transition: border-color var(--transition);
  color: var(--text-primary);
}
.comment-edit-input:focus { border-color: var(--accent); }

.comment-compose { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.comment-input {
  flex: 1; padding: 7px 13px;
  background: rgba(255,255,255,.6);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-full);
  font-size: 12.5px; outline: none;
  transition: all var(--transition);
  color: var(--text-primary);
  font-family: var(--font-sans);
}
.comment-input:focus { border-color: var(--accent); background: rgba(255,255,255,.9); }
.comment-input::placeholder { color: var(--text-muted); }

/* ─ Sidebar widget ─ */
.widget-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-muted);
  padding: 14px 16px 8px;
}
.suggest-user {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; transition: background var(--transition); cursor: pointer;
}
.suggest-user:hover { background: rgba(255,255,255,.38); }
.suggest-user-info { flex: 1; min-width: 0; }
.suggest-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-user-handle { font-size: 11px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   GROUPS
   ═══════════════════════════════════════════════════════════════════════════ */
.groups-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px; padding: 22px 28px;
}

.group-card {
  padding: 18px; display: flex; flex-direction: column; gap: 11px;
  cursor: pointer; transition: all 0.22s ease;
  text-decoration: none; color: inherit;
}
.group-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.group-card-header { display: flex; align-items: flex-start; gap: 11px; }

.group-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: white; flex-shrink: 0;
}

.group-card-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.3px; }
.group-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-card-meta { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-muted); }

.invite-card {
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.invite-info { flex: 1; }
.invite-group-name { font-size: 13.5px; font-weight: 600; }
.invite-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   GROUP CHAT SPLIT VIEW
   ═══════════════════════════════════════════════════════════════════════════ */
.group-shell {
  height: 100vh; display: grid;
  grid-template-columns: 1fr 268px;
  gap: 0; padding: 18px 22px 18px 26px; overflow: hidden;
}

.chat-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; margin-right: 14px; }
.chat-header {
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.chat-group-info { flex: 1; }
.chat-group-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.3px; }
.chat-group-meta { font-size: 11.5px; color: var(--text-muted); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 3px; scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: var(--r-full); }

.message-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 1px; animation: msgIn 0.18s ease; }
.message-row.own { flex-direction: row-reverse; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-bubble-wrap {
  max-width: 68%; display: flex; flex-direction: column; gap: 3px; position: relative;
}
.message-row.own .message-bubble-wrap { align-items: flex-end; }

.message-sender { font-size: 10.5px; font-weight: 600; color: var(--text-muted); padding: 0 4px; }

.message-bubble {
  padding: 9px 13px; border-radius: 16px;
  font-size: 13.5px; line-height: 1.5; word-break: break-word;
}
.message-row:not(.own) .message-bubble {
  background: var(--surface-solid); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; color: var(--text-primary);
}
.message-row.own .message-bubble {
  background: var(--accent); color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(79,70,229,.28);
}

.message-time { font-size: 10px; color: var(--text-muted); padding: 0 4px; }

.message-reactions { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 4px; }
.msg-reaction-pill {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px;
  padding: 2px 7px; border-radius: var(--r-full);
  background: rgba(255,255,255,.7); border: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition); font-family: var(--font-sans);
}
.msg-reaction-pill:hover { background: var(--accent-bg); border-color: var(--accent); }
.msg-reaction-pill svg { width: 11px; height: 11px; }

/* Hover react bar */
.message-react-bar {
  opacity: 0; display: flex; gap: 2px;
  padding: 3px 6px; background: var(--surface-solid);
  border-radius: var(--r-full); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: opacity var(--transition);
  margin-top: 2px;
}
.message-bubble-wrap:hover .message-react-bar { opacity: 1; }

.message-react-btn {
  background: none; border: none; cursor: pointer;
  padding: 2px 4px; border-radius: var(--r-xs);
  transition: transform var(--transition); display: flex; align-items: center;
}
.message-react-btn:hover { transform: scale(1.3); }
.message-react-btn svg { width: 13px; height: 13px; }

.msg-delete-btn {
  opacity: 0; transition: opacity var(--transition);
  background: none; border: none; cursor: pointer;
  padding: 2px; color: var(--text-muted); display: flex; align-items: center;
}
.message-bubble-wrap:hover .msg-delete-btn { opacity: 1; }
.msg-delete-btn:hover { color: var(--red); }
.msg-delete-btn svg { width: 12px; height: 12px; }

/* Chat input */
.chat-input-bar { padding: 10px 14px; border-top: 1px solid var(--border-subtle); flex-shrink: 0; }
.chat-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.62);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-full);
  padding: 5px 5px 5px 15px; transition: all var(--transition);
}
.chat-input-wrap:focus-within { border-color: var(--accent); background: rgba(255,255,255,.9); box-shadow: var(--shadow-glow); }
.chat-input { flex: 1; background: none; border: none; outline: none; font-size: 13.5px; color: var(--text-primary); font-family: var(--font-sans); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 34px; height: 34px; border-radius: var(--r-full);
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(79,70,229,.28);
}
.chat-send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(79,70,229,.4); }
.chat-send-btn svg { width: 15px; height: 15px; }

/* Members panel */
.members-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.members-header { padding: 14px 14px 10px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.members-title { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); }
.members-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.members-list { flex: 1; overflow-y: auto; padding: 6px; }

.member-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-md);
  transition: background var(--transition); cursor: pointer;
}
.member-row:hover { background: rgba(255,255,255,.48); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-handle { font-size: 11px; color: var(--text-muted); }
.member-badge { font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; padding: 2px 6px; border-radius: var(--r-full); }
.badge-admin { background: var(--accent-bg); color: var(--accent); }

.invite-form-section { padding: 10px; border-top: 1px solid var(--border-subtle); flex-shrink: 0; }
.invite-select {
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,.65);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-md); font-size: 12.5px; outline: none;
  transition: border-color var(--transition); cursor: pointer; margin-bottom: 7px;
  color: var(--text-primary); font-family: var(--font-sans);
}
.invite-select:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   DM VIEW
   ═══════════════════════════════════════════════════════════════════════════ */
.dm-shell {
  height: 100vh; display: grid; grid-template-columns: 272px 1fr;
  overflow: hidden; padding: 18px 22px 18px 26px; gap: 14px;
}

.dm-sidebar { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.dm-sidebar-header {
  padding: 14px 14px 11px; border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
}
.dm-title { font-size: 14.5px; font-weight: 700; }
.dm-conversation-list { flex: 1; overflow-y: auto; padding: 6px; }

.dm-conversation-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 9px; border-radius: var(--r-md);
  cursor: pointer; transition: background var(--transition);
  text-decoration: none; color: inherit;
}
.dm-conversation-item:hover { background: rgba(255,255,255,.52); }
.dm-conversation-item.active { background: var(--accent-bg); }

.dm-convo-info { flex: 1; min-width: 0; }
.dm-convo-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-convo-preview { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.dm-convo-time { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

.dm-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; color: var(--text-muted);
}
.dm-empty-icon {
  width: 56px; height: 56px; background: var(--accent-bg);
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════════════════════════════════════ */
.profile-layout {
  display: grid; grid-template-columns: 300px 1fr;
  gap: 20px; padding: 22px 28px 48px; max-width: 1060px;
}

.profile-card { display: flex; flex-direction: column; align-items: center; padding: 28px 22px; text-align: center; gap: 10px; }
.profile-name { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; }
.profile-handle { font-size: 12.5px; color: var(--text-muted); margin-top: -6px; }
.profile-bio { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.profile-stats { display: flex; gap: 20px; margin-top: 4px; }
.stat-item { text-align: center; }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.stat-label { font-size: 10.5px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  background-attachment: fixed;
}
.auth-card { width: 100%; max-width: 408px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo-mark {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  border-radius: var(--r-lg);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 10px; box-shadow: var(--shadow-md); color: white;
}
.auth-title {
  font-size: 24px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.auth-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.auth-form { padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-footer { text-align: center; font-size: 12.5px; color: var(--text-muted); padding-bottom: 24px; }
.auth-link { color: var(--accent); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-medium); }

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════════════════════ */
.settings-layout { max-width: 600px; padding: 22px 28px 48px; }

.settings-section { margin-bottom: 28px; }
.settings-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.theme-option { cursor: pointer; }
.theme-option input[type="radio"] { display: none; }

.theme-swatch {
  border-radius: var(--r-md);
  border: 2px solid var(--border-medium);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.theme-option input:checked + .theme-swatch {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.theme-option:hover .theme-swatch { border-color: var(--accent-light); }

.theme-preview {
  height: 80px; display: flex; overflow: hidden;
  position: relative;
}
.theme-sidebar-preview {
  width: 28%;
  display: flex; flex-direction: column; gap: 5px; padding: 8px 5px;
}
.theme-sidebar-dot { height: 5px; border-radius: 3px; margin-bottom: 2px; }
.theme-main-preview { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.theme-card-preview { border-radius: 5px; flex: 1; }
.theme-card-line { height: 4px; border-radius: 3px; margin-bottom: 3px; }

.theme-label {
  padding: 8px 10px; font-size: 12px; font-weight: 600; text-align: center;
  color: var(--text-secondary);
}
.theme-option input:checked + .theme-swatch .theme-label { color: var(--accent); }

/* Toggle switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255,255,255,.5);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--r-md);
}
.toggle-info { flex: 1; }
.toggle-label { font-size: 13.5px; font-weight: 600; }
.toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border-medium); border-radius: var(--r-full);
  transition: background var(--transition);
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: white;
  border-radius: var(--r-full); transition: left var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { left: 22px; }

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.notifications-list { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); transition: background var(--transition); }
.notif-item.unread { background: rgba(79,70,229,.04); }
.notif-icon { width: 34px; height: 34px; border-radius: var(--r-full); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-icon svg { width: 16px; height: 16px; }
.notif-body { flex: 1; }
.notif-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-dot { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--accent); flex-shrink: 0; margin-top: 5px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MARKDOWN EDITOR (EasyMDE overrides)
   ═══════════════════════════════════════════════════════════════════════════ */
.EasyMDEContainer { font-family: var(--font-sans); }
.EasyMDEContainer .CodeMirror {
  border-radius: 0 0 var(--r-md) var(--r-md) !important;
  font-family: var(--font-mono);
  font-size: 13.5px;
  background: rgba(255,255,255,.75) !important;
  color: var(--text-primary) !important;
  border: none !important;
  min-height: 140px;
}
.EasyMDEContainer .editor-toolbar {
  border-radius: var(--r-md) var(--r-md) 0 0 !important;
  background: rgba(255,255,255,.65) !important;
  border-color: var(--border-medium) !important;
  backdrop-filter: blur(8px);
}
.EasyMDEContainer .editor-toolbar button {
  color: var(--text-secondary) !important;
  border-radius: var(--r-sm) !important;
}
.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
  background: var(--accent-bg) !important;
  color: var(--accent) !important;
  border-color: transparent !important;
}
.EasyMDEContainer .editor-toolbar i.separator { border-color: var(--border-medium) !important; }
.editor-preview { background: var(--surface-solid) !important; color: var(--text-primary) !important; }
.editor-preview-side { border-color: var(--border-medium) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  padding: 44px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 11px;
}
.empty-icon {
  width: 60px; height: 60px; background: var(--accent-bg);
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.empty-title { font-size: 15px; font-weight: 700; }
.empty-desc { font-size: 12.5px; color: var(--text-muted); max-width: 250px; line-height: 1.5; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: 10.5px; font-weight: 600;
}
.tag-accent { background: var(--accent-bg); color: var(--accent); }
.tag-pink   { background: var(--secondary-bg); color: var(--secondary); }
.tag-green  { background: var(--green-bg); color: var(--green); }
.tag-amber  { background: var(--amber-bg); color: var(--amber); }

.divider { height: 1px; background: var(--border-subtle); margin: 8px 0; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: var(--r-full); }

/* ─── Sidebar collapse button ────────────────────────────────────────────── */
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition);
  position: absolute; top: 16px; right: 12px;
  z-index: 10;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.sidebar { position: relative; }

/* ─── Theme option (JS-class-based, no radio) ────────────────────────────── */
.theme-option {
  border: 2px solid var(--border-medium);
  border-radius: var(--r-md);
  padding: 14px 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: rgba(255,255,255,.5);
}
.theme-option:hover { border-color: var(--accent-light); background: rgba(255,255,255,.75); }
.theme-option.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.theme-swatch { height: 52px; border-radius: var(--r-sm); overflow: hidden; margin-bottom: 10px; }
.theme-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.theme-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.theme-check {
  display: none;
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: white;
  align-items: center; justify-content: center;
}
.theme-option.active .theme-check { display: flex; }

/* ─── Compose image row ──────────────────────────────────────────────────── */
.compose-image-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .group-shell { grid-template-columns: 1fr; }
  .members-panel { display: none; }
  .square-layout { grid-template-columns: 1fr; }
  .dm-shell { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr; }
}
