@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --c-bg:        #0d0d12;
  --c-surface:   #13131a;
  --c-elevated:  #1a1a24;
  --c-border:    rgba(255,255,255,0.07);
  --c-border-hi: rgba(255,255,255,0.13);
  --c-text:      #eeeef5;
  --c-sub:       #7a7a9a;
  --c-muted:     #3f3f5a;
  --c-accent:    #e8654a;
  --c-accent-lo: rgba(232,101,74,0.15);
  --c-accent-md: rgba(232,101,74,0.3);
  --c-green:     #3ecf8e;
  --c-green-lo:  rgba(62,207,142,0.12);
  --c-red:       #f06b6b;
  --c-red-lo:    rgba(240,107,107,0.12);
  --c-blue:      #5b9cf6;
  --c-yellow:    #f5c842;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 9999px;
  --t: 0.18s cubic-bezier(0.4,0,0.2,1);
  --shadow: 0 2px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --nav-h: 60px;
  --nav-mob-h: 56px;
  --font-ui: 'Instrument Sans', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-ui);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 900px 600px at 70% -100px, rgba(232,101,74,0.07) 0%, transparent 65%),
    radial-gradient(ellipse 600px 400px at -100px 80%, rgba(91,156,246,0.05) 0%, transparent 65%);
  pointer-events: none; z-index: 0;
}
body > * { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; }
input, textarea, select { font-family: inherit; }

.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: var(--nav-h) 1fr;
  min-height: 100vh;
}
.top-bar {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center;
  padding: 0 20px;
  background: rgba(13,13,18,0.9);
  backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--c-border);
  gap: 16px;
}
.sidebar {
  grid-row: 2;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  border-right: 1px solid var(--c-border);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.main-content {
  grid-row: 2;
  padding: 24px 20px 80px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.top-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  margin-right: auto;
}
.top-logo span { color: var(--c-accent); }

.top-search {
  flex: 1; max-width: 320px;
  position: relative;
}
.top-search input {
  width: 100%;
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 8px 16px 8px 38px;
  color: var(--c-text);
  font-size: 0.875rem;
  outline: none;
  transition: var(--t);
}
.top-search input:focus {
  border-color: var(--c-accent);
  background: rgba(232,101,74,0.04);
  box-shadow: 0 0 0 3px var(--c-accent-lo);
}
.top-search input::placeholder { color: var(--c-muted); }
.top-search .si {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted); font-size: 0.9rem;
  pointer-events: none;
}

.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  color: var(--c-sub);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: var(--t);
  position: relative;
}
.icon-btn:hover { background: var(--c-border-hi); color: var(--c-text); }
.icon-btn .badge {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--c-accent);
  border-radius: 50%;
  border: 2px solid var(--c-bg);
  display: none;
}
.icon-btn .badge.show { display: block; }

.top-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--c-accent);
  cursor: pointer;
  transition: var(--t);
}
.top-avatar:hover { transform: scale(1.05); }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--c-sub);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--t);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--c-elevated); color: var(--c-text); }
.nav-item.active { background: var(--c-accent-lo); color: var(--c-accent); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--c-accent);
}
.nav-icon { font-size: 1.1rem; width: 20px; flex-shrink: 0; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--c-accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 12px 12px 4px;
}
.nav-spacer { flex: 1; }
.nav-user-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  border: 1px solid var(--c-border);
  background: var(--c-elevated);
  transition: var(--t);
  margin-top: 4px;
}
.nav-user-mini:hover { border-color: var(--c-border-hi); }
.nav-user-mini img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--c-accent); }
.nav-user-mini .name { font-size: 0.85rem; font-weight: 600; color: var(--c-text); }
.nav-user-mini .handle { font-size: 0.72rem; color: var(--c-muted); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: border-color var(--t);
}
.card:hover { border-color: var(--c-border-hi); }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--c-border); }
.card-body { padding: 16px 18px; }
.card-footer { padding: 10px 18px; border-top: 1px solid var(--c-border); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: var(--t);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--c-accent);
  color: white;
  box-shadow: 0 4px 16px rgba(232,101,74,0.35);
}
.btn-primary:hover { background: #d4573e; box-shadow: 0 6px 24px rgba(232,101,74,0.45); transform: translateY(-1px); }
.btn-ghost {
  background: var(--c-elevated);
  color: var(--c-sub);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover { background: var(--c-border); color: var(--c-text); }
.btn-danger-ghost {
  background: var(--c-red-lo);
  color: var(--c-red);
  border: 1px solid rgba(240,107,107,0.25);
}
.btn-danger-ghost:hover { background: rgba(240,107,107,0.2); }
.btn-success-ghost {
  background: var(--c-green-lo);
  color: var(--c-green);
  border: 1px solid rgba(62,207,142,0.25);
}
.btn-success-ghost:hover { background: rgba(62,207,142,0.2); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 28px; font-size: 1rem; border-radius: var(--r-lg); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--r-md); }
.btn-round { border-radius: var(--r-full); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-sub);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.field input, .field textarea, .field select {
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--c-text);
  font-size: 0.9rem;
  outline: none;
  transition: var(--t);
  width: 100%;
}
.field input:focus, .field textarea:focus {
  border-color: var(--c-accent);
  background: rgba(232,101,74,0.03);
  box-shadow: 0 0 0 3px var(--c-accent-lo);
}
.field input::placeholder, .field textarea::placeholder { color: var(--c-muted); }
.field textarea { resize: vertical; min-height: 90px; }
.field .err { font-size: 0.78rem; color: var(--c-red); margin-top: 2px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.file-drop {
  border: 2px dashed var(--c-border);
  border-radius: var(--r-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--t);
  color: var(--c-muted);
  font-size: 0.875rem;
}
.file-drop:hover { border-color: var(--c-accent); color: var(--c-accent); background: var(--c-accent-lo); }
.file-drop input[type=file] { display: none; }

.toggle-field { display: flex; align-items: center; gap: 10px; }
.toggle-field label { font-size: 0.875rem; color: var(--c-sub); margin: 0; text-transform: none; letter-spacing: 0; font-weight: 500; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--c-muted);
  border-radius: var(--r-full);
  transition: var(--t);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--t);
}
.toggle input:checked + .toggle-slider { background: var(--c-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 0.875rem;
  animation: slideDown 0.25s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.flash-success { background: var(--c-green-lo); border: 1px solid rgba(62,207,142,0.25); color: var(--c-green); }
.flash-danger  { background: var(--c-red-lo);   border: 1px solid rgba(240,107,107,0.25); color: var(--c-red); }
.flash-warning { background: rgba(245,200,66,.1); border: 1px solid rgba(245,200,66,.25); color: var(--c-yellow); }
.flash-info    { background: rgba(91,156,246,.1); border: 1px solid rgba(91,156,246,.25); color: var(--c-blue); }
.flash-close { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.6; font-size: 1rem; cursor: pointer; }
.flash-close:hover { opacity: 1; }

.feed { display: flex; flex-direction: column; gap: 16px; }

.pub-card { border-radius: var(--r-xl); }
.pub-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
}
.pub-ava { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--c-accent); flex-shrink: 0; }
.pub-author { font-weight: 600; font-size: 0.9rem; color: var(--c-text); }
.pub-date { font-size: 0.72rem; color: var(--c-muted); margin-top: 1px; }
.pub-header-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.pub-media { position: relative; }
.pub-media-grid {
  display: grid;
  gap: 2px;
  background: var(--c-bg);
}
.pub-media-grid.n1 { grid-template-columns: 1fr; }
.pub-media-grid.n2 { grid-template-columns: 1fr 1fr; }
.pub-media-grid.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pub-media-grid.n3 .mi:first-child { grid-row: 1 / 3; }
.pub-media-grid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mi { position: relative; overflow: hidden; }
.mi img, .mi video {
  width: 100%; height: 100%; display: block;
  object-fit: cover; aspect-ratio: 1;
  transition: transform 0.4s ease;
}
.n1 .mi img, .n1 .mi video { aspect-ratio: 16/9; }
.mi:hover img, .mi:hover video { transform: scale(1.04); }

.pub-body { padding: 14px 18px; }
.pub-title { font-weight: 700; font-size: 0.95rem; color: var(--c-text); margin-bottom: 4px; }
.pub-content { font-size: 0.875rem; color: var(--c-sub); line-height: 1.65; }
.pub-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pub-tag { font-size: 0.75rem; color: var(--c-accent); background: var(--c-accent-lo); padding: 2px 8px; border-radius: var(--r-full); }

.pub-actions {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-top: 1px solid var(--c-border);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: none;
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  font-size: 0.8rem;
  font-family: var(--font-ui);
  font-weight: 500;
  transition: var(--t);
  cursor: pointer;
}
.action-btn:hover { border-color: var(--c-border-hi); color: var(--c-sub); background: var(--c-elevated); }
.action-btn.liked { border-color: rgba(240,107,107,0.35); color: var(--c-red); background: var(--c-red-lo); }
.action-btn.liked:hover { background: rgba(240,107,107,0.2); }
.action-stat { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.stat-pill { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--c-muted); }

.comments-box {
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  overflow: hidden;
  display: none;
}
.comments-box.open { display: block; }
.comments-inner { max-height: 320px; overflow-y: auto; padding: 12px 18px; scrollbar-width: thin; scrollbar-color: var(--c-border) transparent; }
.comment-item { margin-bottom: 12px; }
.comment-item:last-child { margin-bottom: 0; }
.c-author { font-weight: 600; font-size: 0.82rem; color: var(--c-text); }
.c-text { font-size: 0.85rem; color: var(--c-sub); margin-top: 2px; }
.c-time { font-size: 0.7rem; color: var(--c-muted); margin-top: 3px; }
.comment-form {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 18px;
  border-top: 1px solid var(--c-border);
}
.comment-form input {
  flex: 1; background: var(--c-elevated); border: 1px solid var(--c-border);
  border-radius: var(--r-full); padding: 8px 16px;
  color: var(--c-text); font-size: 0.875rem; outline: none; transition: var(--t);
}
.comment-form input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-lo); }
.comment-form button {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--c-accent); color: white; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0; transition: var(--t);
}
.comment-form button:hover { background: #d4573e; transform: scale(1.05); }

.profile-hero {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 20px;
}
.profile-top { display: flex; align-items: flex-start; gap: 20px; }
.profile-ava-wrap { position: relative; flex-shrink: 0; }
.profile-ava {
  width: 88px; height: 88px; border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--c-accent);
  box-shadow: 0 0 0 5px var(--c-accent-lo);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.profile-handle { color: var(--c-sub); font-size: 0.875rem; margin-top: 2px; }
.profile-bio { color: var(--c-sub); font-size: 0.875rem; margin-top: 8px; line-height: 1.5; }
.profile-stats { display: flex; gap: 24px; margin-top: 14px; }
.ps { text-align: center; cursor: pointer; }
.ps a { text-decoration: none; }
.ps-n { font-size: 1.2rem; font-weight: 800; color: var(--c-text); display: block; font-family: var(--font-display); }
.ps-l { font-size: 0.68rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.profile-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}
.chat-list-panel {
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 10px;
}
.chat-list-header h2 { font-size: 1rem; font-weight: 700; }
.chat-list-search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
}
.chat-list-search input {
  width: 100%; background: var(--c-elevated); border: 1px solid var(--c-border);
  border-radius: var(--r-full); padding: 7px 14px; color: var(--c-text); font-size: 0.85rem; outline: none; transition: var(--t);
}
.chat-list-search input:focus { border-color: var(--c-accent); }
.chat-list-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--c-border) transparent; }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; transition: var(--t);
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.chat-item:hover { background: var(--c-elevated); }
.chat-item.active { background: var(--c-accent-lo); }
.chat-item-ava { position: relative; flex-shrink: 0; }
.chat-item-ava img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--c-border); }
.online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  background: var(--c-green);
  border-radius: 50%;
  border: 2px solid var(--c-surface);
}
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-weight: 600; font-size: 0.875rem; color: var(--c-text); }
.chat-item-preview { font-size: 0.78rem; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-item-time { font-size: 0.7rem; color: var(--c-muted); }
.unread-badge { background: var(--c-accent); color: white; font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: var(--r-full); }

.chat-window { display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.chat-window-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 12px;
  background: rgba(19,19,26,0.8);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.chat-window-header img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--c-accent); }
.chat-win-name { font-weight: 700; font-size: 0.95rem; }
.chat-win-status { font-size: 0.75rem; margin-top: 1px; }
.status-online { color: var(--c-green); }
.status-offline { color: var(--c-muted); }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 3px;
  scrollbar-width: thin; scrollbar-color: var(--c-border) transparent;
}

.msg-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}
.msg-row.in  { justify-content: flex-start; }
.msg-row.out { justify-content: flex-end; }
.msg-ava { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.msg-row.out .msg-ava { display: none; }
.msg-wrap {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  min-width: 0;
}
.msg-row.out .msg-wrap { align-items: flex-end; }
.msg-row.in  .msg-wrap { align-items: flex-start; }
.msg-bubble {
  display: block;
  align-self: flex-start;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  width: fit-content;
  position: relative;
  animation: msgIn 0.18s ease;
}
.msg-row.out .msg-wrap { align-items: flex-end; }
.msg-row.in  .msg-wrap { align-items: flex-start; }
@keyframes msgIn { from { opacity:0; transform:scale(0.95) translateY(4px); } to { opacity:1; transform:scale(1) translateY(0); } }
.msg-row.in  .msg-bubble { background: var(--c-elevated); color: var(--c-text); border-bottom-left-radius: 4px; }
.msg-row.out .msg-bubble { background: var(--c-accent); color: white; border-bottom-right-radius: 4px; }
.msg-time { font-size: 0.65rem; color: var(--c-muted); margin-top: 4px; }
.msg-row.in  .msg-time { text-align: left;  margin-left: 2px; }
.msg-row.out .msg-time { text-align: right; margin-right: 2px; }
.msg-status { font-size: 0.65rem; margin-top: 2px; }
.msg-status.read { color: var(--c-blue); }
.msg-status.sent { color: var(--c-muted); }

.reply-to {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 10px;
  background: rgba(232,101,74,0.08);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--c-sub);
  cursor: pointer;
}
.reply-to strong { color: var(--c-accent); font-size: 0.75rem; }
.reply-preview-bar {
  background: var(--c-elevated);
  border-top: 1px solid var(--c-border);
  padding: 8px 16px;
  display: none;
  align-items: center; gap: 10px;
}
.reply-preview-bar.show { display: flex; }
.reply-preview-bar .rp-content { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--c-sub); }
.reply-preview-bar .rp-name { font-weight: 600; color: var(--c-accent); font-size: 0.78rem; margin-bottom: 1px; }
.reply-preview-bar .rp-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-preview-bar .rp-cancel { background: none; border: none; color: var(--c-muted); cursor: pointer; font-size: 1rem; padding: 2px; }
.reply-preview-bar .rp-cancel:hover { color: var(--c-text); }

.msg-bubble:hover .msg-actions { opacity: 1; }
.msg-actions {
  position: absolute;
  top: -30px; right: 0;
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  display: flex; gap: 2px; padding: 3px;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: var(--shadow);
  z-index: 10;
}
.msg-row.out .msg-actions { right: auto; left: 0; }
.msg-action-btn {
  background: none; border: none;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--c-sub); cursor: pointer; transition: var(--t);
}
.msg-action-btn:hover { background: var(--c-border); color: var(--c-text); }

.chat-input-area { flex-shrink: 0; }
.chat-input-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-border);
  background: rgba(13,13,18,0.95);
  backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 20;
}
.chat-input-bar textarea {
  flex: 1; background: var(--c-elevated); border: 1px solid var(--c-border);
  border-radius: 20px; padding: 10px 18px;
  color: var(--c-text); font-size: 0.875rem; outline: none; transition: var(--t);
  resize: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
  overflow-y: auto;
  font-family: var(--font-ui);
}
.chat-input-bar textarea:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-lo); }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--c-accent); border: none; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
  transition: var(--t);
  box-shadow: 0 4px 16px rgba(232,101,74,0.3);
}
.send-btn:hover { background: #d4573e; transform: scale(1.06); }

.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: var(--c-muted);
  text-align: center; padding: 40px;
}
.chat-empty-icon { font-size: 3rem; opacity: 0.3; }
.chat-empty p { font-size: 0.875rem; }

.notif-panel {
  position: fixed; top: var(--nav-h); right: 16px;
  width: 320px; max-height: 480px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: popDown 0.2s ease;
}
@keyframes popDown { from { opacity:0; transform:translateY(-8px) scale(0.97); } to { opacity:1; transform:translateY(0) scale(1); } }
.notif-panel.open { display: flex; }
.notif-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 8px;
}
.notif-panel-header h3 { font-size: 0.9rem; font-weight: 700; flex: 1; }
.notif-clear { background: none; border: none; font-size: 0.75rem; color: var(--c-accent); cursor: pointer; font-family: inherit; font-weight: 600; }
.notif-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer; transition: var(--t);
}
.notif-item:hover { background: var(--c-elevated); }
.notif-item.unread { background: var(--c-accent-lo); }
.notif-item img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.notif-icon-circle { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.notif-icon-circle.like { background: var(--c-red-lo); color: var(--c-red); }
.notif-icon-circle.comment { background: var(--c-green-lo); color: var(--c-green); }
.notif-icon-circle.follow { background: var(--c-accent-lo); color: var(--c-accent); }
.notif-text { flex: 1; min-width: 0; }
.notif-text p { font-size: 0.82rem; color: var(--c-sub); line-height: 1.4; }
.notif-text strong { color: var(--c-text); font-weight: 600; }
.notif-text time { font-size: 0.7rem; color: var(--c-muted); display: block; margin-top: 2px; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-visual {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
  position: relative; overflow: hidden;
}
.auth-visual::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(232,101,74,0.12) 0%, transparent 70%);
}
.auth-visual-logo {
  font-family: var(--font-display);
  font-size: 2.8rem; font-weight: 800;
  color: var(--c-text);
  text-align: center;
  position: relative;
}
.auth-visual-logo span { color: var(--c-accent); }
.auth-visual-tagline {
  color: var(--c-sub); font-size: 1rem; margin-top: 12px;
  text-align: center; position: relative;
}
.auth-visual-art {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(232,101,74,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(91,156,246,0.06) 0%, transparent 50%);
}
.auth-form-side {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 40px;
  overflow-y: auto;
}
.auth-form-box { width: 100%; max-width: 400px; }
.auth-form-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 4px; }
.auth-form-sub { color: var(--c-sub); font-size: 0.875rem; margin-bottom: 28px; }
.auth-form-link { color: var(--c-accent); font-weight: 600; }
.auth-form-link:hover { color: #d4573e; }
.auth-steps { display: flex; gap: 4px; margin-bottom: 24px; }
.auth-step { height: 4px; flex: 1; border-radius: 2px; background: var(--c-border); transition: background 0.3s; }
.auth-step.done { background: var(--c-accent); }
.auth-step.active { background: var(--c-accent); opacity: 0.5; }

.otp-group { display: flex; gap: 10px; justify-content: center; }
.otp-input {
  width: 52px; height: 60px;
  background: var(--c-elevated);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: 1.5rem; font-weight: 700;
  text-align: center; outline: none;
  transition: var(--t);
}
.otp-input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-lo); }
.otp-input.filled { border-color: var(--c-accent); }

.empty { text-align: center; padding: 60px 20px; color: var(--c-muted); }
.empty-icon { font-size: 2.8rem; opacity: 0.35; margin-bottom: 10px; }
.empty p { font-size: 0.875rem; margin-bottom: 16px; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: 6px;
  z-index: 200;
  display: none;
  animation: popDown 0.18s ease;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 0.875rem; color: var(--c-sub); cursor: pointer; transition: var(--t);
}
.dropdown-item:hover { background: var(--c-elevated); color: var(--c-text); }
.dropdown-item.danger { color: var(--c-red); }
.dropdown-item.danger:hover { background: var(--c-red-lo); }
.dropdown-divider { height: 1px; background: var(--c-border); margin: 4px 0; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-border-hi); }

.divider { height: 1px; background: var(--c-border); margin: 16px 0; }
.tag-accent { color: var(--c-accent); }
.text-muted { color: var(--c-muted); }
.text-sub { color: var(--c-sub); }
.text-green { color: var(--c-green); }
.text-red { color: var(--c-red); }
.page-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 20px; }

.mob-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(13,13,18,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--c-border);
  z-index: 200;
  padding: 6px 8px;
  padding-bottom: env(safe-area-inset-bottom, 6px);
}
.mob-nav-inner { display: flex; align-items: center; justify-content: space-around; }
.mob-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 14px; border-radius: var(--r-md);
  background: none; border: none;
  color: var(--c-muted); font-family: inherit;
  text-decoration: none; cursor: pointer; transition: var(--t);
  position: relative;
}
.mob-nav-btn.active { color: var(--c-accent); }
.mob-nav-btn i { font-size: 1.2rem; }
.mob-nav-btn span { font-size: 0.58rem; font-weight: 600; letter-spacing: 0.03em; }
.mob-nav-dot {
  position: absolute; top: 4px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid var(--c-bg);
  display: none;
}
.mob-nav-dot.show { display: block; }

@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 200px 1fr; }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--nav-mob-h) 1fr;
  }
  .sidebar { display: none; }
  .main-content { padding: 16px 12px 80px; max-width: 100%; }
  .mob-nav { display: block; }
  .top-search { display: none; }
  .top-bar { padding: 0 14px; }

  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-side { padding: 32px 20px; }

  .chat-layout { grid-template-columns: 1fr; position: relative; }
  .chat-list-panel { width: 100%; }
  .chat-window {
    position: absolute; inset: 0;
    background: var(--c-bg);
    z-index: 10;
    flex-direction: column;
    display: flex;
    overflow: hidden;
  }

  .profile-ava { width: 72px; height: 72px; }
  .profile-stats { gap: 16px; }

  .pub-media-grid.n3 { grid-template-columns: 1fr 1fr; }
  .pub-media-grid.n3 .mi:first-child { grid-row: auto; }

  .field-row { grid-template-columns: 1fr; }
  .form-page { padding: 20px 0 80px; }
  .form-card { border-radius: 0; border-left: none; border-right: none; padding: 20px 16px; }
}

@media (max-width: 480px) {
  .pub-media-grid.n2 { grid-template-columns: 1fr; }
  .pub-media-grid.n4 { grid-template-columns: 1fr 1fr; }
  .otp-group { gap: 6px; }
  .otp-input { width: 44px; height: 54px; font-size: 1.3rem; }
  .profile-top { flex-direction: column; align-items: center; text-align: center; }
  .profile-stats { justify-content: center; }
  .profile-actions { justify-content: center; }
}

.form-page { padding: 32px 0 60px; }
.form-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  max-width: 560px; margin: 0 auto;
}
.form-section { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); margin: 20px 0 12px; }
.form-fields { display: flex; flex-direction: column; gap: 14px; }

.step-dots { display: flex; gap: 6px; margin-bottom: 20px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-border); transition: var(--t); }
.step-dot.active { background: var(--c-accent); transform: scale(1.3); }
.step-dot.done { background: var(--c-green); }

.mode-badge {
  position: fixed; top: calc(var(--nav-h) + 8px); right: 14px; z-index: 999;
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--r-full); pointer-events: none; font-family: var(--font-ui);
}
.debug-toggle { position: fixed; bottom: 72px; right: 16px; z-index: 10000; width: 40px; height: 40px; border-radius: 50%; background: rgba(13,13,18,.95); border: 1px solid var(--c-border); color: var(--c-sub); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; transition: var(--t); }
.debug-toggle:hover { border-color: var(--c-accent); color: var(--c-accent); }
.debug-panel { position: fixed; bottom: 120px; right: 16px; z-index: 9999; width: 300px; display: none; flex-direction: column; gap: 8px; }
.debug-panel.open { display: flex; }
.debug-log-box { background: rgba(8,8,14,.98); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 10px 12px; font-family: monospace; font-size: 0.68rem; color: var(--c-green); max-height: 160px; overflow-y: auto; }
.debug-metrics { background: rgba(8,8,14,.98); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 10px 14px; display: flex; gap: 16px; }
.dm-label { color: var(--c-muted); font-size: 0.58rem; text-transform: uppercase; }
.dm-value { color: var(--c-text); font-family: monospace; font-size: 0.78rem; font-weight: 700; }
