:root {
  --bg: #0b1020;
  --bg-2: #0f172a;
  --panel: #131a2b;
  --panel-2: #1a2236;
  --panel-3: #202a42;
  --text: #eef2ff;
  --muted: #9aa8c7;
  --border: rgba(255,255,255,.08);
  --accent: #7c5cff;
  --accent-2: #5a8cff;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
html { background: var(--bg) !important; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg), var(--bg-2)) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
}
a { color: inherit; text-decoration: none; }
p { line-height: 1.6; }
strong, h1, h2, h3 { color: var(--text); }
code { background: rgba(255,255,255,.07); padding: 2px 6px; border-radius: 8px; }
pre { white-space: pre-wrap; word-break: break-word; }

.shell { min-height:100vh; display:grid; grid-template-columns: 260px minmax(0,1fr) 300px; gap: 24px; padding: 24px; align-items:start; }
.sidebar, .rightbar { position: sticky; top: 24px; height: calc(100vh - 48px); }
.content { min-width: 0; }
.content-full { grid-column: 1 / -1; display:flex; align-items:center; justify-content:center; }

.brand { display:flex; align-items:center; gap:12px; margin-bottom: 24px; }
.brand-mark { width:44px; height:44px; display:grid; place-items:center; border-radius:14px; background: rgba(124,92,255,.15); color: #b6a3ff; font-size: 22px; flex: 0 0 auto; }
.brand-title { font-size: 28px; font-weight: 800; line-height:1.1; }
.brand-sub { color: var(--muted); font-size: 13px; }

.nav { display:flex; flex-direction:column; gap:10px; margin-bottom:20px; }
.nav a { padding: 14px 16px; border-radius: 14px; color: var(--muted); background: transparent; border: 1px solid transparent; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.nav a:hover { background: rgba(124,92,255,.1); color: var(--text); border-color: var(--border); }
.nav-badge, .badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display:inline-flex; align-items:center; justify-content:center; background: linear-gradient(135deg,var(--accent),var(--accent-2)); color:#fff; font-size:12px; font-weight:700; }
.hidden { display:none !important; }

.card { background: rgba(19,26,43,.95); border:1px solid var(--border); border-radius: 24px; padding: 20px; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.card.small, .card-tight { padding: 16px; }
.stack-list { padding-left: 18px; color: var(--muted); }
.page-head { display:flex; align-items:center; justify-content:space-between; gap: 16px; margin-bottom: 18px; }
h1 { margin: 0 0 8px; font-size: 44px; line-height:1.1; }
.muted, .meta-line { color: var(--muted); }
.meta-line { font-size: 14px; }
.tiny { font-size: 12px; }
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; border:1px solid transparent; }
.alert.error { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.28); color: #fecaca; }
.alert.success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.28); color: #bbf7d0; }

.composer textarea, .message-composer textarea { width:100%; min-height: 120px; resize: vertical; background: var(--panel-2); border:1px solid var(--border); border-radius: 18px; padding: 18px; color: var(--text); font-size: 16px; }
.composer-row, .settings-actions, .section-title-row, .message-panel-head, .conversation-topline, .notification-topline, .post-actions-row, .comment-actions-row { display:flex; align-items:center; justify-content:space-between; gap: 16px; }
.check { display:flex; align-items:center; gap: 10px; color: var(--muted); }
.check input { width:auto; margin:0; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; border:none; border-radius: 16px; padding: 12px 18px; font-weight: 700; cursor:pointer; }
.btn.primary { background: linear-gradient(135deg,var(--accent),var(--accent-2)); color: white; }
.btn.ghost { background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--border); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.small-btn { padding: 10px 14px; border-radius: 14px; }
.link-btn { background:none; border:none; color:var(--muted); padding:0; cursor:pointer; font:inherit; font-weight:600; }
.link-btn:hover { color: var(--text); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.action-chip { display:inline-flex; align-items:center; gap: 8px; padding: 10px 14px; border-radius: 999px; border:1px solid var(--border); background: rgba(255,255,255,.04); color: var(--muted); }
.action-chip:hover { background: rgba(255,255,255,.06); }
.action-chip.active { color: var(--text); background: rgba(124,92,255,.12); }

.feed-list, .admin-list { display:flex; flex-direction:column; gap: 18px; margin-top: 18px; }
.post-top, .post-actions, .section-head, .inline-cluster, .profile-stats { display:flex; align-items:center; gap: 12px; flex-wrap: wrap; }
.section-head { justify-content:space-between; }
.pill { padding: 8px 12px; border-radius: 999px; font-size: 12px; background: rgba(124,92,255,.12); color: #c7b8ff; }
.pill.success { background: rgba(34,197,94,.14); color: #bbf7d0; }
.pill.danger { background: rgba(239,68,68,.14); color: #fecaca; }
.pill.warn { background: rgba(245,158,11,.14); color: #fde68a; }
.pill.muted-pill { background: rgba(255,255,255,.07); color: var(--muted); }
.empty { text-align:center; color: var(--muted); }

.auth-wrap, .landing, .maintenance-wrap { min-height: calc(100vh - 48px); display:grid; place-items:center; }
.auth-card, .landing-card, .maintenance-card { width: min(100%, 520px); background: rgba(19,26,43,.96); border:1px solid var(--border); border-radius: 28px; padding: 28px; box-shadow: 0 18px 50px rgba(0,0,0,.28); text-align:center; }
.auth-card h1, .landing-card h1, .maintenance-card h1 { font-size: 34px; }
label { display:block; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
input, textarea, select {
  width:100%;
  margin-top:8px;
  background: var(--panel-2);
  border:1px solid var(--border);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
}
select { appearance: none; }
.actions { display:flex; gap: 12px; margin-top: 20px; flex-wrap:wrap; }

.profile-head { overflow:hidden; }
.profile-cover { height: 118px; margin: -20px -20px 0; background: radial-gradient(circle at top right, rgba(255,255,255,.16), transparent 38%), linear-gradient(135deg, rgba(124,92,255,.72), rgba(90,140,255,.45)); border-radius: 24px 24px 18px 18px; border-bottom: 1px solid var(--border); }
.profile-main { display:grid; grid-template-columns: auto minmax(0,1fr); gap: 18px; margin-top: -36px; align-items:start; }
.profile-copy { flex:1; min-width:260px; }
.profile-heading { display:flex; align-items:flex-start; justify-content:space-between; gap: 18px; flex-wrap:wrap; }
.profile-title-row h1 { margin-bottom: 0; }
.profile-handle { margin: 6px 0 12px; }
.profile-bio { margin: 0 0 14px; max-width: 70ch; }
.profile-actions { display:flex; gap: 10px; flex-wrap:wrap; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--border); display:grid; place-items:center; font-weight: 800; color:#dbe4ff; }
.avatar.large { width: 96px; height: 96px; border-radius: 50%; background: var(--panel-2); border: 4px solid var(--panel); display:grid; place-items:center; font-size: 30px; font-weight: 800; box-shadow: 0 14px 30px rgba(0,0,0,.25); }

.report-box { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.report-box summary { cursor:pointer; color: var(--muted); }
.report-form, .admin-action-form, .settings-grid { display:grid; gap: 12px; margin-top: 12px; }
.field-row { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stats-grid { display:grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { min-height: 116px; display:flex; flex-direction:column; justify-content:space-between; }
.stat-kicker { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 34px; line-height: 1; }
.admin-tabs { display:flex; gap: 10px; flex-wrap:wrap; margin-bottom: 18px; }
.admin-tabs a { padding: 12px 14px; border-radius: 14px; border:1px solid var(--border); color: var(--muted); }
.admin-tabs a.active, .admin-tabs a:hover { color: var(--text); background: rgba(124,92,255,.12); }
.admin-toolbar { display:grid; grid-template-columns: minmax(0,1fr) 240px auto; gap: 14px; align-items:end; margin-bottom: 18px; }
.toolbar-actions { display:flex; gap: 10px; align-items:end; }
.admin-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.admin-item { padding: 14px 0; border-top: 1px solid var(--border); }
.admin-item:first-child { border-top: 0; padding-top: 0; }
.admin-item.compact p { margin: 6px 0 0; }
.admin-record p { margin: 10px 0; }
.stack-actions { display:grid; gap: 12px; margin-top: 12px; }
.quote-box { background: rgba(255,255,255,.04); border:1px solid var(--border); padding: 14px; border-radius: 16px; color: var(--muted); }
.small-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow:auto; }
.toggle-card { display:flex; align-items:center; justify-content:space-between; gap:18px; padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.04); border:1px solid var(--border); }
.toggle-card input { width:auto; margin-top:0; }

.settings-form { display:grid; gap: 14px; }
.input-prefix { display:flex; align-items:center; margin-top:8px; background: var(--panel-2); border:1px solid var(--border); border-radius: 16px; overflow:hidden; }
.input-prefix span { padding: 0 16px; color: var(--muted); font-weight: 700; }
.input-prefix input { margin-top:0; border:0; border-radius:0; background: transparent; }
.post-owner-tag { color: var(--muted); font-size: 14px; font-weight: 700; }
.author-link:hover { text-decoration: underline; }

.suggested-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.suggested-user { display:flex; align-items:center; gap: 12px; padding: 12px; border-radius: 16px; border: 1px solid var(--border); background: rgba(255,255,255,.03); }
.suggested-user:hover { background: rgba(124,92,255,.08); }

.post-body { margin: 16px 0; }
.post-stats { display:flex; align-items:center; justify-content:space-between; gap: 16px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); flex-wrap:wrap; }
.reaction-summary { display:flex; align-items:center; gap: 6px; }
.reaction-summary span { display:inline-flex; }
.post-actions-row { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); justify-content:flex-start; gap: 20px; flex-wrap:wrap; }
.comment-stack { display:grid; gap: 10px; margin-top: 16px; }
.comment-item { padding: 14px; border-radius: 18px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.comment-head { display:flex; align-items:center; justify-content:space-between; gap: 12px; margin-bottom: 8px; }
.comment-form { display:grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 14px; }
.comment-form input { margin-top: 0; }
.comment-actions-row { justify-content:flex-start; }

.reaction-picker { position: relative; display:inline-flex; align-items:center; gap: 0; }
.reaction-picker::after { content:''; position:absolute; left:0; right:0; bottom:100%; height: 12px; }
.reaction-picker.open .reaction-menu,
.reaction-picker:hover .reaction-menu,
.reaction-picker:focus-within .reaction-menu { opacity:1; transform:translateY(0) scale(1); pointer-events:auto; }
.reaction-quick-form { margin:0; }
.reaction-trigger { display:inline-flex; align-items:center; gap: 8px; border:1px solid var(--border); background: rgba(255,255,255,.04); color: var(--muted); padding: 10px 14px; border-radius: 999px 0 0 999px; cursor:pointer; font:inherit; font-weight:700; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.reaction-trigger:hover { color: var(--text); background: rgba(255,255,255,.06); }
.reaction-trigger.active { color: var(--text); background: rgba(124,92,255,.14); }
.reaction-trigger.small { padding: 8px 12px; font-size: 13px; }
.reaction-trigger[disabled] { opacity: .55; cursor: not-allowed; }
.reaction-trigger-emoji { font-size: 18px; line-height:1; }
.reaction-expand { display:inline-flex; align-items:center; justify-content:center; min-width: 38px; border:1px solid var(--border); border-left:0; background: rgba(255,255,255,.04); color: var(--muted); padding: 10px 12px; border-radius: 0 999px 999px 0; cursor:pointer; font:inherit; font-weight:700; transition: background .16s ease, color .16s ease; }
.reaction-expand:hover, .reaction-picker.open .reaction-expand { color: var(--text); background: rgba(255,255,255,.06); }
.reaction-expand.small { min-width: 32px; padding: 8px 10px; }
.reaction-menu { position:absolute; left:0; bottom: calc(100% + 8px); display:flex; gap: 8px; padding: 8px 10px; border-radius: 999px; background: rgba(19,26,43,.98); border:1px solid var(--border); box-shadow: 0 18px 30px rgba(0,0,0,.35); opacity:0; transform:translateY(8px) scale(.96); pointer-events:none; transition: opacity .16s ease, transform .16s ease; z-index:20; }
.reaction-menu.compact { gap: 6px; padding: 6px 8px; }
.reaction-menu form { margin:0; display:flex; }
.reaction-option { display:inline-flex; align-items:center; justify-content:center; width: 40px; height: 40px; background:transparent; border:none; color: var(--muted); cursor:pointer; padding: 0; border-radius: 999px; transition: transform .16s ease, background .16s ease, color .16s ease; }
.reaction-option:hover { transform: translateY(-8px) scale(1.14); color: var(--text); background: rgba(255,255,255,.04); }
.reaction-option.active { background: rgba(124,92,255,.14); color: var(--text); }
.reaction-option-emoji { font-size: 26px; line-height: 1; }
.reaction-option-label { font-size: 11px; white-space:nowrap; }

.media-grid { display:grid; gap: 10px; margin-top: 12px; }
.media-count-1 { grid-template-columns: 1fr; }
.media-count-2, .media-count-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.media-count-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.media-card { border-radius: 18px; overflow:hidden; border:1px solid var(--border); display:block; }
.media-card img { display:block; width:100%; height:100%; object-fit:cover; min-height:160px; }

.messages-layout { display:grid; grid-template-columns: 340px minmax(0,1fr); gap: 18px; }
.conversation-list { display:grid; gap: 10px; }
.conversation-link { display:flex; align-items:flex-start; gap: 12px; padding: 12px; border-radius: 18px; border:1px solid var(--border); background: rgba(255,255,255,.03); }
.conversation-link.active, .conversation-link:hover { background: rgba(124,92,255,.08); }
.conversation-copy { min-width:0; flex:1; }
.conversation-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-panel { display:grid; gap: 14px; }
.message-thread { display:grid; gap: 12px; min-height: 380px; max-height: 60vh; overflow:auto; padding-right: 6px; }
.message-composer { display:grid; gap: 12px; }
.composer-tools { display:flex; align-items:center; justify-content:space-between; gap: 12px; flex-wrap:wrap; }
.upload-pill { display:inline-flex; align-items:center; gap:10px; border:1px dashed var(--border); padding: 10px 14px; border-radius: 999px; cursor:pointer; background: rgba(255,255,255,.03); }
.upload-pill input { display:none; }
.message-bubble { max-width: 80%; padding: 12px 14px; border-radius: 18px; background: rgba(255,255,255,.05); border:1px solid var(--border); }
.message-row.mine { display:flex; justify-content:flex-end; }
.message-row.mine .message-bubble { background: rgba(124,92,255,.16); }
.empty-thread { color: var(--muted); text-align:center; padding: 24px 10px; }
.large-empty { min-height: 280px; display:grid; place-items:center; }

.notification-card { display:flex; align-items:center; justify-content:space-between; gap: 16px; }
.notification-card.unread { border-color: rgba(124,92,255,.28); background: rgba(124,92,255,.06); }
.notification-copy { flex:1; }

@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1200px) {
  .shell { grid-template-columns: 220px minmax(0,1fr); }
  .rightbar { display:none; }
}
@media (max-width: 980px) {
  .admin-grid, .field-row, .admin-toolbar, .stats-grid, .messages-layout, .suggested-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding: 16px; }
  .sidebar,.rightbar { position:static; height:auto; }
  .content-full { display:block; }
  h1 { font-size: 34px; }
  .profile-main { align-items:center; }
  .comment-form { grid-template-columns: 1fr; }
  .post-stats { flex-direction:column; align-items:flex-start; }
}
.inline-form { margin: 0; }
.tiny-btn { font-size: 12px; }
.message-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; color: var(--muted); font-size:12px; }
.message-actions-row { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin-top:10px; }
.message-row.own { display:flex; justify-content:flex-end; }
.message-row.own .message-bubble { background: rgba(124,92,255,.16); }
.message-bubble.unsent { opacity: .8; }
.compact-media img { min-height: 100px; }


.profile-stats span { display:inline-flex; align-items:center; gap: 6px; padding: 10px 12px; border-radius: 999px; background: rgba(255,255,255,.04); border:1px solid var(--border); }
.post-stats { font-size: 14px; }
.reaction-badge { display:inline-flex; align-items:center; justify-content:center; width: 22px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.04); }
.post-actions-row { gap: 12px; }
.post-actions-row > .action-chip, .post-actions-row .inline-form { margin: 0; }
.messages-layout { align-items:stretch; }
.conversations-panel, .message-panel { min-height: 640px; }
.conversation-list { max-height: min(70vh, 760px); overflow:auto; padding-right: 4px; }
.conversation-link { transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.conversation-link:hover { transform: translateY(-1px); }
.message-panel { grid-template-rows: auto minmax(0,1fr) auto; }
.message-panel-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.message-thread { background: rgba(255,255,255,.02); border:1px solid var(--border); border-radius: 20px; padding: 14px; }
.message-composer { padding-top: 12px; border-top: 1px solid var(--border); }
.comment-item p, .message-bubble p { margin: 0; }
@media (max-width: 860px) {
  .profile-main { grid-template-columns: 1fr; margin-top: -44px; }
  .profile-heading { flex-direction: column; align-items:flex-start; }
  .profile-actions { width:100%; }
  .profile-actions form { flex:1 1 auto; }
  .profile-actions .btn { width:100%; }
  .conversations-panel, .message-panel { min-height: auto; }
}
