
/* SayfeSpace Social — 2027 Industrial Modern */
:root {
  --brand-h: 196;
  --brand-s: 100%;
  --brand-l: 52%;
  --primary: hsl(var(--brand-h), var(--brand-s), var(--brand-l));
  --primary-2: hsl(var(--brand-h), var(--brand-s), 44%);
  --primary-glow: hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.35);
  --accent: hsl(265, 90%, 66%);
  --accent-glow: hsla(265, 90%, 66%, 0.35);
  --danger: hsl(0, 84%, 60%);
  --success: hsl(142, 76%, 42%);
  --warning: hsl(38, 92%, 50%);

  --bg: hsl(220, 24%, 4%);
  --bg-1: hsl(220, 22%, 6%);
  --bg-2: hsl(220, 18%, 9%);
  --surface: hsl(220, 16%, 11%);
  --surface-solid: hsl(220, 16%, 13%);
  --surface-1: hsl(220, 14%, 15%);
  --surface-2: hsl(220, 12%, 19%);
  --surface-3: hsl(220, 10%, 23%);
  --border: hsla(220, 18%, 42%, 0.18);
  --border-strong: hsla(220, 18%, 50%, 0.28);

  --text: hsl(220, 18%, 96%);
  --text-2: hsl(220, 14%, 78%);
  --muted: hsl(220, 12%, 58%);
  --muted-2: hsl(220, 10%, 44%);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --gap: 16px;
  --header-h: 64px;
  --sidebar-w: 280px;
  --rightbar-w: 320px;
  --max-content: 640px;

  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.45);
  --glow-primary: 0 0 20px var(--primary-glow);
  --glow-accent: 0 0 20px var(--accent-glow);
  --transition-fast: 120ms cubic-bezier(0.4,0,0.2,1);
  --transition: 200ms cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg: hsl(220, 20%, 96%);
  --bg-1: hsl(220, 18%, 93%);
  --bg-2: hsl(220, 16%, 90%);
  --surface: hsl(0, 0%, 100%);
  --surface-solid: hsl(220, 14%, 97%);
  --surface-1: hsl(220, 12%, 95%);
  --surface-2: hsl(220, 10%, 91%);
  --surface-3: hsl(220, 8%, 86%);
  --border: hsla(220, 16%, 55%, 0.16);
  --border-strong: hsla(220, 16%, 55%, 0.28);
  --text: hsl(220, 22%, 12%);
  --text-2: hsl(220, 14%, 36%);
  --muted: hsl(220, 12%, 50%);
  --muted-2: hsl(220, 10%, 64%);
  --shadow: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45; overflow-x: hidden;
  user-select: none;
}
input, textarea, select, [contenteditable] { user-select: text; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }

.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h); border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-1) 0%, color-mix(in srgb, var(--bg-1) 92%, transparent) 100%);
  backdrop-filter: blur(16px);
}
.header .container {
  max-width: 1400px; margin: 0 auto; padding: 0 var(--gap);
  height: 100%; display: flex; align-items: center; gap: var(--gap);
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); cursor: pointer; transition: color var(--transition-fast); }
.logo:hover { color: var(--primary); }
.logo .mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-1); border: 1px solid var(--border-strong); color: var(--primary); }
.logo svg { width: 18px; height: 18px; }

.search { flex: 1; max-width: 420px; position: relative; }
.search input { width: 100%; height: 40px; padding: 0 16px 0 40px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; color: var(--text); font-size: 0.95rem; outline: none; transition: border var(--transition-fast), background var(--transition-fast); }
.search input:focus { border-color: var(--primary); background: var(--surface); }
.search::before {
  content: ''; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; background: var(--muted); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat;
}

.topnav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topnav button { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); border: 1px solid transparent; transition: all var(--transition-fast); position: relative; }
.topnav button:hover { background: var(--surface-1); color: var(--text-2); border-color: var(--border); }
.topnav button.active { color: var(--primary); background: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.12); border-color: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.25); }
.topnav button svg { width: 20px; height: 20px; }

.theme-toggle { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--border); margin-left: 4px; transition: all var(--transition-fast); }
.theme-toggle:hover { color: var(--text); background: var(--surface-1); }

.menu-btn { display: none; width: 36px; height: 36px; border-radius: 10px; place-items: center; color: var(--muted); border: 1px solid var(--border); }
.menu-btn svg { width: 20px; height: 20px; }

.main {
  flex: 1; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, var(--max-content)) var(--rightbar-w);
  gap: var(--gap); max-width: 1400px; margin: 0 auto; padding: var(--gap); width: 100%;
}

.sidebar.left { position: sticky; top: calc(var(--header-h) + var(--gap)); height: calc(100dvh - var(--header-h) - var(--gap)*2); display: flex; flex-direction: column; gap: var(--gap); }
.menu { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.menu button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: 0.98rem; transition: all var(--transition-fast); }
.menu button:hover { background: var(--surface-1); color: var(--text); }
.menu button.active { background: var(--surface-1); color: var(--primary); font-weight: 600; }
.menu button svg { width: 20px; height: 20px; }

.create-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.create-box button { width: 100%; height: 44px; border-radius: 12px; font-weight: 700; }

.content-col { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); padding-bottom: 80px; }

.sidebar.right { position: sticky; top: calc(var(--header-h) + var(--gap)); height: fit-content; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.widget h3 { margin: 0 0 14px; font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); }
.widget .footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--muted-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; transition: border-color var(--transition-fast), transform var(--transition-fast); }
.card:hover { border-color: var(--border-strong); }
.section-title { margin: 0 0 12px; font-size: 1.15rem; font-weight: 700; }
.empty-state { color: var(--muted); text-align: center; padding: 36px 20px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-1) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 120px; border-color: transparent; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.story-rail { display: flex; gap: 14px; padding: 4px 2px 8px; overflow-x: auto; scrollbar-width: none; }
.story-rail::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; min-width: 64px; }
.story .ring { width: 62px; height: 62px; border-radius: 50%; padding: 3px; background: conic-gradient(var(--primary), var(--accent), var(--primary)); transition: transform var(--transition-fast); }
.story:hover .ring { transform: scale(1.05); }
.story .ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); }
.story.unseen .ring { animation: pulse-ring 2.2s infinite; }
@keyframes pulse-ring { 0%,100% { box-shadow: 0 0 0 0 var(--primary-glow); } 50% { box-shadow: 0 0 0 8px transparent; } }
.story .name { font-size: 0.72rem; color: var(--text-2); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story.add .ring { background: var(--surface-1); border: 1px dashed var(--border-strong); display: grid; place-items: center; }
.story.add svg { width: 22px; height: 22px; color: var(--muted-2); }

.composer { display: flex; flex-direction: column; gap: 12px; }
.composer textarea { width: 100%; min-height: 80px; resize: vertical; padding: 12px 14px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit; outline: none; transition: border var(--transition-fast); }
.composer textarea:focus { border-color: var(--primary); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-tools { display: flex; gap: 8px; }
.tool { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--border); cursor: pointer; transition: all var(--transition-fast); position: relative; }
.tool:hover { color: var(--primary); background: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.1); border-color: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.3); }
.tool svg { width: 18px; height: 18px; }
.tool input { display: none; }
.right-actions { display: flex; gap: 8px; }
.media-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.media-preview .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; font-size: 0.82rem; color: var(--text-2); }
.media-preview .chip svg { width: 14px; height: 14px; }
.poll-composer { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.poll-composer.hidden { display: none; }
.poll-option-row { display: flex; align-items: center; gap: 8px; }
.poll-option-row input { flex: 1; padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); outline: none; }
.poll-option-row input:focus { border-color: var(--primary); }
#pollBtn.active { background: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.18); color: var(--primary); border-color: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.5); }
#addPollOption { align-self: flex-start; margin-top: 4px; }
#addPollOption.hidden { display: none; }
.poll-results { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.poll-bar { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; position: relative; overflow: hidden; transition: all var(--transition-fast); }
.poll-bar:hover { border-color: var(--primary); }
.poll-fill { position: absolute; left: 0; top: 0; bottom: 0; background: hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.15); width: var(--w, 0%); transition: width 0.4s ease; z-index: 0; }
.poll-bar span { position: relative; z-index: 1; }
.poll-bar small { float: right; position: relative; z-index: 1; }
.poll-meta { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-top: 8px; }
.preview-thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-1); }
.preview-thumb img, .preview-thumb video { width: 100%; height: 100%; object-fit: cover; }
.preview-thumb .remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; display: grid; place-items: center; font-size: 14px; cursor: pointer; }

button.primary, .primary { padding: 10px 18px; border-radius: 10px; background: var(--primary); color: #081017; font-weight: 700; transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
button.primary:hover { background: var(--primary-2); box-shadow: var(--glow-primary); }
button.primary:active, button.secondary:active { transform: scale(0.97); }
button.secondary, .secondary { padding: 10px 18px; border-radius: 10px; background: var(--surface-1); color: var(--text); font-weight: 600; border: 1px solid var(--border); transition: all var(--transition-fast); }
button.secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
button.full { width: 100%; }
button.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
button.icon-btn:hover { background: var(--surface-1); color: var(--text); }
.follow-btn.following { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.text-danger { color: var(--danger); font-size: 0.85rem; margin: 6px 0 0; }
.text-sm { font-size: 0.85rem; }

.post { display: flex; gap: 12px; padding: 16px; animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.post-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; cursor: pointer; border: 1px solid var(--border); background: var(--surface-1); }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.post-head .name { font-weight: 700; color: var(--text); cursor: pointer; }
.post-head .name:hover { text-decoration: underline; }
.post-head .verified { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); color: var(--bg); font-size: 0.65rem; font-weight: 800; line-height: 1; }
.post-handle { color: var(--muted); font-size: 0.9rem; }
.post-text { color: var(--text-2); white-space: pre-wrap; word-break: break-word; margin: 6px 0 10px; }
.post-text a { color: var(--primary); }
.post-text .hashtag { color: var(--primary); cursor: pointer; }
.post-text .hashtag:hover { text-decoration: underline; }

.post-media { margin-top: 8px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.post-media img, .post-media video, .post-media audio { width: 100%; display: block; }
.post-media audio { padding: 8px 0; }
.post-media-grid { display: grid; gap: 6px; margin-top: 8px; }
.post-media-grid.two { grid-template-columns: 1fr 1fr; }
.post-media-grid.three { grid-template-columns: 1fr 1fr; }
.post-media-grid.three .post-media:first-child { grid-column: span 2; }
.post-media-grid.four { grid-template-columns: 1fr 1fr; }
.post-media-grid .post-media { aspect-ratio: 1; margin-top: 0; }
.post-media-grid .post-media img, .post-media-grid .post-media video { height: 100%; object-fit: cover; }

.post-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); position: relative; }
.post-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-size: 0.88rem; font-weight: 600; transition: all var(--transition-fast); }
.post-actions button:hover { background: var(--surface-1); color: var(--text-2); }
.post-actions button svg { width: 18px; height: 18px; }
.post-actions button.liked { color: var(--danger); }
.post-actions button.liked svg { fill: currentColor; }
.post-actions button.bookmarked { color: var(--accent); }
.post-actions button.reposted { color: var(--success); }
.post-actions button.more { margin-left: auto; }

.comments { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.comments.active { display: block; }
.comment-row { display: flex; gap: 10px; margin-bottom: 10px; }
.comment-row img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.comment-row strong { color: var(--text); margin-right: 4px; }
.comment-row div { color: var(--text-2); font-size: 0.9rem; }
.comment-input { display: flex; gap: 8px; margin-top: 10px; }
.comment-input input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text); outline: none; }
.comment-input input:focus { border-color: var(--primary); }

.suggestion { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition-fast); }
.suggestion:last-child { border-bottom: none; }
.suggestion:hover { background: var(--surface-1); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
.suggestion img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.suggestion .info { flex: 1; min-width: 0; }
.suggestion .name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion .handle { font-size: 0.82rem; color: var(--muted); }
.suggestion button { padding: 6px 12px; font-size: 0.8rem; }

.trend-list { display: flex; flex-direction: column; gap: 10px; }
.trend-item { cursor: pointer; padding: 8px; border-radius: 8px; transition: background var(--transition-fast); }
.trend-item:hover { background: var(--surface-1); }
.trend-item .tag { font-weight: 700; color: var(--primary); }
.trend-item .count { font-size: 0.8rem; color: var(--muted-2); }

.profile-head { display: flex; gap: 18px; flex-wrap: wrap; }
.profile-head .avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface-1); box-shadow: var(--shadow); }
.profile-head .info { flex: 1; min-width: 220px; }
.profile-head h2 { margin: 0 0 4px; font-size: 1.4rem; display: flex; align-items: center; gap: 8px; }
.profile-head p { color: var(--text-2); margin: 8px 0 12px; }
.profile-stats { display: flex; gap: 24px; margin: 14px 0; }
.profile-stats strong { display: block; font-size: 1.15rem; color: var(--text); }
.profile-stats span { font-size: 0.82rem; color: var(--muted); }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.modal-overlay { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); padding: 16px; }
.modal-overlay.active { display: grid; animation: fadeIn 0.2s ease; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto; padding: 24px; animation: scaleIn 0.25s ease; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.modal h2, .modal h3 { margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.auth-modal { text-align: center; max-width: 420px; }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--surface-1); border: 1px solid var(--border-strong); color: var(--primary); animation: brandPulse 3s infinite; }
@keyframes brandPulse { 0%,100% { box-shadow: 0 0 0 0 var(--primary-glow); } 50% { box-shadow: 0 0 0 12px transparent; } }
.brand-mark svg { width: 32px; height: 32px; }
.auth-modal .subtitle { color: var(--muted); margin-bottom: 22px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; background: var(--surface-1); padding: 4px; border-radius: 12px; }
.tabs button { flex: 1; padding: 10px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.input-wrap { display: flex; align-items: center; gap: 10px; padding: 2px 14px; margin-bottom: 10px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; transition: border var(--transition-fast); }
.input-wrap:focus-within { border-color: var(--primary); }
.input-wrap svg { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.input-wrap input { flex: 1; height: 46px; background: transparent; border: none; color: var(--text); font: inherit; outline: none; }
.input-wrap input.hidden { display: none; }

.chat-modal { max-width: 560px; padding: 0; display: flex; flex-direction: column; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface-1); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
.chat-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.chat-title { flex: 1; }
.chat-title .name { font-weight: 700; }
.chat-title .handle { font-size: 0.82rem; color: var(--muted); }
.chat-messages { flex: 1; min-height: 320px; max-height: 55dvh; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { max-width: 78%; width: fit-content; min-width: 42px; padding: 10px 14px; border-radius: 18px; position: relative; font-size: 0.95rem; line-height: 1.35; word-break: break-word; }
.chat-bubble.own { align-self: flex-end; background: var(--primary); color: #081017; border-bottom-right-radius: 6px; }
.chat-bubble.other { align-self: flex-start; background: var(--surface-1); color: var(--text); border-bottom-left-radius: 6px; }
.chat-bubble .meta { font-size: 0.68rem; opacity: 0.7; margin-top: 4px; text-align: right; }
.chat-input-row { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text); outline: none; }
.chat-input-row input:focus { border-color: var(--primary); }

.edit-avatar-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.edit-avatar-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }

.story-overlay .modal { max-width: 420px; padding: 0; background: #000; border: none; border-radius: var(--radius-xl); overflow: hidden; }
.story-player { position: relative; width: 100%; aspect-ratio: 9/16; background: #000; display: grid; place-items: center; }
.story-player img, .story-player video { width: 100%; height: 100%; object-fit: contain; }
.story-progress { position: absolute; top: 12px; left: 12px; right: 12px; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.25); }
.story-progress span { display: block; height: 100%; background: #fff; width: 0%; border-radius: 3px; }
.story-bar-run { animation: story-bar 5s linear forwards; }
@keyframes story-bar { from { width: 0%; } to { width: 100%; } }

.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 110; height: 64px; padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-1) 92%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--border); justify-content: space-around; align-items: center; }
.mobile-nav button { flex: 1; height: 100%; display: grid; place-items: center; color: var(--muted); position: relative; }
.mobile-nav button.active { color: var(--primary); }
.mobile-nav button svg { width: 24px; height: 24px; }

.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(20px); z-index: 300; padding: 12px 20px; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity var(--transition), transform var(--transition); font-weight: 500; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.drawer-overlay { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity var(--transition); }
.drawer-overlay.active { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 151; background: var(--bg-1); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform var(--transition); padding: 20px; display: flex; flex-direction: column; gap: var(--gap); }
.drawer-overlay.active .drawer { transform: translateX(0); }

.more-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; min-width: 180px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; }
.more-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text-2); font-size: 0.9rem; }
.more-menu button:hover { background: var(--surface-1); color: var(--text); }
.more-menu button.danger { color: var(--danger); }

@media (max-width: 1200px) {
  .main { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar.right { display: none; }
}
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; padding-bottom: 90px; }
  .sidebar.left { display: none; }
  .topnav { display: none; }
  .search { max-width: none; }
  .mobile-nav { display: flex; }
  .menu-btn { display: grid; }
}

.hidden { display: none !important; }
.dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.search-section { margin: 10px 0 6px; color: var(--muted-2); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-header { justify-content: space-between !important; margin: 0 0 14px !important; align-items: center; }
.search-field { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text); }
.msg-preview { color: var(--muted); }
.chat-bubble img { max-width: 100%; border-radius: 8px; }
