/* ============================================================
   X-inspired UI, dark theme (matches the provided reference: near-black
   surfaces, saturated blue accent, compact rounded right-rail cards).
   ============================================================ */
:root {
  --bg: #000000;
  --surface: #0d0f13;
  --surface-2: #15181e;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-hover-strong: rgba(255, 255, 255, 0.1);
  --text: #e7e9ea;
  --text-secondary: #8b98a5;
  --border: #23262d;
  --blue: #3b82f6;
  --blue-dark: #2f6fe0;
  --blue-tint: rgba(59, 130, 246, 0.15);
  --red: #f4506b;
  --red-tint: rgba(244, 80, 107, 0.14);
  --green: #00d488;
  --green-tint: rgba(0, 212, 136, 0.14);
  --gold: #ffd400;
  --gold-dark: #caa400;
  --gold-tint: rgba(255, 212, 0, 0.12);
  --logo-filter: invert(1);
  --bg-translucent: rgba(0, 0, 0, 0.8);
  --bg-translucent-strong: rgba(0, 0, 0, 0.95);
  --hero-gradient: radial-gradient(circle at 30% 30%, #1a2540, #000);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f7f9f9;
  --surface-2: #eff3f4;
  --bg-hover: rgba(15, 20, 25, 0.06);
  --bg-hover-strong: rgba(15, 20, 25, 0.1);
  --text: #0f1419;
  --text-secondary: #536471;
  --border: #eff3f4;
  --logo-filter: none;
  --bg-translucent: rgba(255, 255, 255, 0.85);
  --bg-translucent-strong: rgba(255, 255, 255, 0.95);
  --hero-gradient: radial-gradient(circle at 30% 30%, #dbeafe, #ffffff);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.brand-mark { display: inline-flex; align-items: center; justify-content: center; }
.brand-logo { filter: var(--logo-filter); display: block; }
.pulse-loading { display: flex; justify-content: center; padding: 40px 0; }

.theme-toggle {
  display: flex; align-items: center; gap: 20px; padding: 12px; border-radius: 999px;
  font-size: 17px; font-weight: 500; color: var(--text); background: none; border: none;
  width: fit-content; max-width: 100%; text-align: left;
}
.theme-toggle:hover { background: var(--bg-hover); }
.theme-toggle svg { width: 24px; height: 24px; flex-shrink: 0; }

/* ---- Layout shell ---- */
.shell {
  max-width: 1265px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 275px minmax(0, 600px) 350px;
  min-height: 100vh;
}
@media (max-width: 1080px) {
  .shell { grid-template-columns: 88px minmax(0, 600px) 350px; }
  .col-left .nav-label, .col-left .brand-text, .compose-btn span { display: none; }
  .compose-btn { width: 52px; height: 52px; padding: 0; border-radius: 50%; }
  .account-chip .acc-info, .account-chip .chip-caret { display: none; }
}
@media (max-width: 990px) { .col-right { display: none; } }
@media (max-width: 690px) {
  .shell { grid-template-columns: 1fr; }
  .col-left {
    position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: auto;
    flex-direction: row; justify-content: space-around; align-items: center;
    border-right: none; border-top: 1px solid var(--border); padding: 6px 4px; z-index: 30;
    background: var(--bg-translucent-strong); backdrop-filter: blur(8px);
  }
  .col-left .brand, .col-left .compose-btn, .col-left .account-chip { display: none; }
  .nav-link { padding: 10px; }
  .col-center { padding-bottom: 60px; }
}

.col-left {
  border-right: 1px solid var(--border);
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 999px; margin: 4px 4px 8px;
  font-weight: 800; font-size: 20px; letter-spacing: -0.01em; width: fit-content;
}
.brand:hover { background: var(--bg-hover); }

.nav-link {
  display: flex; align-items: center; gap: 20px;
  padding: 12px; border-radius: 999px;
  font-size: 20px; font-weight: 400; color: var(--text);
  width: fit-content; max-width: 100%;
}
.nav-link:hover { background: var(--bg-hover); }
.nav-link.active { font-weight: 700; background: var(--blue-tint); color: #fff; }
.nav-link svg { width: 26px; height: 26px; flex-shrink: 0; }

.compose-btn {
  margin-top: 16px; width: 90%;
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  padding: 15px; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.compose-btn:hover { background: var(--blue-dark); }

.account-chip {
  margin-top: auto; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 999px; position: relative;
}
.account-chip:hover { background: var(--bg-hover); }
.acc-info { min-width: 0; flex: 1; }
.chip-caret { flex-shrink: 0; color: var(--text-secondary); }
.chip-caret svg { width: 16px; height: 16px; display: block; }

.col-center { border-right: 1px solid var(--border); min-height: 100vh; }

.topbar {
  position: sticky; top: 0; background: var(--bg-translucent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); padding: 12px 16px; z-index: 10;
  display: flex; align-items: center; gap: 20px; justify-content: space-between;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 800; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text); }
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn svg { width: 19px; height: 19px; }

.tabbar { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; text-align: center; padding: 16px 0; font-weight: 500; color: var(--text-secondary);
  background: none; border: none; position: relative;
}
.tab:hover { background: var(--bg-hover); }
.tab.active { color: var(--text); font-weight: 700; }
.tab.active::after {
  content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 56px; height: 4px; border-radius: 4px; background: var(--blue);
}

.col-right { padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }
.search-box {
  margin: 8px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 15px;
}
.search-box svg { width: 18px; height: 18px; flex-shrink: 0; }
.search-box input { background: none; border: none; color: var(--text); font-size: 15px; flex: 1; font-family: var(--font); }
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--text-secondary); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px; }
.panel h3 { font-size: 20px; margin: 4px 0 8px; font-weight: 800; }
.panel-row { padding: 10px 0; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.panel-row:first-of-type { border-top: none; }
.panel-row .label { font-size: 13px; color: var(--text-secondary); }
.panel-row .title { font-weight: 700; font-size: 15px; }
.trend-tag { color: var(--blue); font-weight: 700; }
.trend-count { color: var(--text-secondary); font-size: 13px; }
.suggest-row { display: flex; align-items: center; gap: 10px; }
.suggest-row .btn-secondary { margin-left: auto; padding: 6px 14px; font-size: 13px; }

.discord-panel { display: block; text-decoration: none; transition: background 0.15s; }
.discord-panel:hover { background: var(--surface-2); }
.discord-panel-head { display: flex; align-items: center; gap: 10px; }
.discord-badge {
  width: 32px; height: 32px; border-radius: 50%; background: #5865f2;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.discord-badge svg { width: 18px; height: 18px; }
.discord-panel p { color: var(--text-secondary); font-size: 13px; line-height: 1.5; margin: 8px 0 2px; }
.footer-links { font-size: 13px; color: var(--text-secondary); padding: 4px 8px 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { text-decoration: underline; }
.footer-links span { color: var(--border); }

.legal-page { padding: 24px; line-height: 1.7; font-size: 15px; color: var(--text); }
.legal-page h1 { font-size: 26px; margin-bottom: 4px; }
.legal-page .updated { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.legal-page h2 { font-size: 18px; margin: 28px 0 8px; }
.legal-page p, .legal-page li { color: var(--text-secondary); }
.legal-page ul { padding-left: 20px; }

/* ---- Notifications ---- */
.notif-row { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-row.unread { background: var(--blue-tint); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-icon svg { width: 18px; height: 18px; }
.notif-icon.like { background: var(--red-tint); color: var(--red); }
.notif-icon.retweet { background: var(--green-tint); color: var(--green); }
.notif-icon.follow, .notif-icon.reply { background: var(--blue-tint); color: var(--blue); }
.notif-icon.affiliate, .notif-icon.verified { background: var(--gold-tint); color: var(--gold-dark); }
.notif-text { font-size: 14px; line-height: 1.4; }
.notif-preview { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.nav-badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }

/* ---- Messages ---- */
.conv-row { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.conv-row:hover { background: var(--bg-hover); }
.conv-row .conv-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 2px; }
.conv-row .conv-preview { color: var(--text-secondary); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.conv-row .conv-time { color: var(--text-secondary); font-size: 12px; margin-left: auto; white-space: nowrap; }
.msg-thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.msg-thread { display: flex; flex-direction: column; gap: 8px; padding: 16px; min-height: 300px; }
.msg-bubble { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.4; word-break: break-word; }
.msg-bubble.mine { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.msg-compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg); }
.msg-compose input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px; color: var(--text); font-family: var(--font); }
.msg-compose input:focus { outline: none; border-color: var(--blue); }

/* ---- Settings ---- */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); gap: 12px; }
.settings-label { font-weight: 700; font-size: 15px; }
.settings-desc { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* ---- Compose ---- */
.composer { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; }
.composer textarea {
  width: 100%; background: transparent; border: none; color: var(--text);
  font-size: 20px; font-family: var(--font); resize: none; min-height: 60px;
}
.composer textarea::placeholder { color: var(--text-secondary); }
.composer textarea:focus { outline: none; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.char-count { font-size: 13px; color: var(--text-secondary); }
.char-count.warn { color: var(--gold); }
.char-count.over { color: var(--red); }
.btn-primary {
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  padding: 9px 20px; font-weight: 700; font-size: 15px;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-secondary {
  background: transparent; border: 1px solid #3a3d44; color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px;
}
.btn-secondary:hover { background: var(--bg-hover); }
.as-org-select {
  background: var(--surface-2); color: var(--blue); border: 1px solid #3a3d44;
  border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 13px; font-weight: 700;
}

/* ---- Composer modal (X-style) ---- */
.composer-modal { max-width: 600px; padding: 0; }
.composer-topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; }
.audience-btn {
  background: none; border: 1px solid var(--blue); color: var(--blue); border-radius: 999px;
  padding: 4px 12px 4px 14px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 8px; position: relative;
}
.audience-btn svg { width: 14px; height: 14px; }
.audience-menu {
  position: absolute; top: 32px; left: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,0.5); z-index: 10; overflow: hidden; width: 260px;
}
.audience-option {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: none; border: none;
  color: var(--text); font-size: 14px; text-align: left;
}
.audience-option:hover { background: var(--bg-hover); }
.audience-option svg { width: 18px; height: 18px; color: var(--blue); flex-shrink: 0; }
.composer-reply-note { display: flex; align-items: center; gap: 6px; color: var(--blue); font-size: 13px; padding: 8px 0; }
.composer-reply-note svg { width: 16px; height: 16px; }
.composer-tools { display: flex; gap: 2px; }
.composer-tools .icon-btn { color: var(--blue); width: 34px; height: 34px; }
.composer-tools .icon-btn svg { width: 20px; height: 20px; }
.emoji-picker { display: none; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 10px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.emoji-option { background: none; border: none; font-size: 20px; padding: 6px; border-radius: 8px; cursor: pointer; }
.emoji-option:hover { background: var(--bg-hover); }
.media-preview-wrap { position: relative; margin: 8px 0; border-radius: 16px; overflow: hidden; }
.media-preview-wrap img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.media-remove {
  position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.75); color: #fff; border: none;
  border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}
.media-remove svg { width: 16px; height: 16px; }
.media-uploading { padding: 20px 0; }

/* ---- GIF picker ---- */
.gif-panel { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; max-height: 320px; overflow-y: auto; }
.gif-search-box { margin-bottom: 8px; }
.gif-search-box input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; color: var(--text); font-family: var(--font); font-size: 14px;
}
.gif-search-box input:focus { outline: none; border-color: var(--blue); }
.gif-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gif-result { background: var(--surface-2); border: none; border-radius: 8px; overflow: hidden; padding: 0; aspect-ratio: 1; cursor: pointer; }
.gif-result img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Profile photo/banner upload ---- */
.upload-preview { position: relative; border-radius: 12px; overflow: hidden; }
.upload-preview.banner-preview { height: 120px; background: var(--surface-2); }
.upload-preview.banner-preview img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.upload-preview.avatar-preview { display: flex; align-items: center; gap: 12px; background: none; }
.upload-trigger {
  position: relative; z-index: 1; font-size: 13px; padding: 6px 12px;
}
.upload-preview.banner-preview .upload-trigger { position: absolute; bottom: 10px; left: 10px; background: rgba(0,0,0,0.6); color: #fff; border: none; }

/* ---- Avatars ---- */
.avatar { object-fit: cover; background: #222; flex-shrink: 0; }
.avatar-circle { border-radius: 50%; }
.avatar-square { border-radius: 22%; }
.avatar-sm { width: 40px; height: 40px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 133px; height: 133px; border: 4px solid var(--bg); }
.avatar-xs { width: 18px; height: 18px; }

/* ---- Badges ---- */
.badge-check { display: inline-block; vertical-align: -3px; cursor: pointer; }
.affiliate-badge {
  display: inline-flex; vertical-align: -4px; width: 18px; height: 18px; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--border); margin-left: 1px; cursor: pointer;
}
.affiliate-badge img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Tweet card ---- */
.tweet { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; }
.tweet:hover { background: rgba(255,255,255,0.02); }
.tweet-body { flex: 1; min-width: 0; }
.retweet-note {
  font-size: 13px; color: var(--text-secondary); font-weight: 700;
  display: flex; align-items: center; gap: 6px; margin: 0 0 4px 28px;
}
.retweet-note svg { width: 14px; height: 14px; flex-shrink: 0; }
.tweet-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tweet-name { font-weight: 700; font-size: 15px; }
.tweet-name:hover { text-decoration: underline; }
.tweet-handle, .tweet-time { color: var(--text-secondary); font-size: 15px; }
.tweet-via { color: var(--text-secondary); font-size: 13px; margin-top: -2px; }
.tweet-org-tag {
  font-size: 12px; color: var(--gold-dark); border: 1px solid #4a3d00; background: var(--gold-tint);
  border-radius: 999px; padding: 1px 8px; margin-left: 2px; display: inline-flex; align-items: center; gap: 3px;
}

.tweet-more-wrap { margin-left: auto; position: relative; }
.tweet-more-btn {
  background: none; border: none; color: var(--text-secondary); width: 30px; height: 30px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tweet-more-btn svg { width: 18px; height: 18px; }
.tweet-more-btn:hover { color: var(--blue); background: var(--blue-tint); }
.tweet-more-menu {
  position: absolute; top: 32px; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,0.5); z-index: 20; overflow: hidden; min-width: 200px;
}
.tweet-more-option {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: none; border: none;
  color: var(--text); font-size: 14px; font-weight: 600; text-align: left;
}
.tweet-more-option svg { width: 18px; height: 18px; flex-shrink: 0; }
.tweet-more-option:hover { background: var(--bg-hover); }
.tweet-more-option.danger { color: var(--red); }
.tweet-more-option.danger:hover { background: var(--red-tint); }
.tweet-content { font-size: 15px; line-height: 20px; white-space: pre-wrap; word-break: break-word; margin: 2px 0 8px; }
.tweet-media { max-width: 100%; max-height: 500px; border-radius: 16px; border: 1px solid var(--border); margin-bottom: 8px; display: block; object-fit: cover; }
.reply-perm-note { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.reply-perm-note svg { width: 14px; height: 14px; }

.tweet-actions { display: flex; justify-content: space-between; max-width: 425px; margin-top: 2px; }
.tweet-action {
  display: flex; align-items: center; gap: 4px; background: none; border: none;
  color: var(--text-secondary); font-size: 13px; padding: 6px 6px; border-radius: 999px;
}
.tweet-action svg { width: 18px; height: 18px; }
.tweet-action:hover { color: var(--blue); background: var(--blue-tint); }
.tweet-action.like:hover, .tweet-action.like.active { color: var(--red); background: var(--red-tint); }
.tweet-action.retweet:hover, .tweet-action.retweet.active { color: var(--green); background: var(--green-tint); }
.tweet-action.bookmark:hover, .tweet-action.bookmark.active { color: var(--blue); background: var(--blue-tint); }
.tweet-action.pin-btn:hover, .tweet-action.pin-btn.active { color: var(--gold-dark); background: var(--gold-tint); }
.tweet-action.active svg path { fill: currentColor; }
.tweet-action.delete-btn:hover { color: var(--red); background: var(--red-tint); }

/* ---- Profile ---- */
.profile-banner { height: 200px; background: linear-gradient(135deg, #1a1d24, #0d0f13); position: relative; }
.profile-header { padding: 0 16px 12px; position: relative; }
.profile-avatar-wrap { margin-top: -67px; display: flex; justify-content: space-between; align-items: flex-end; }
.profile-name { font-size: 20px; font-weight: 800; margin: 12px 0 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.profile-handle { color: var(--text-secondary); font-size: 15px; }
.profile-bio { margin: 12px 0; font-size: 15px; line-height: 20px; }
.profile-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-secondary); font-size: 14px; margin-bottom: 10px; }
.profile-meta span { display: flex; align-items: center; gap: 5px; }
.profile-meta svg { width: 16px; height: 16px; }
.profile-stats { display: flex; gap: 20px; font-size: 14px; color: var(--text-secondary); }
.profile-stats b { color: var(--text); font-weight: 700; }
.stat-btn { background: none; border: none; color: var(--text-secondary); font-size: 14px; padding: 0; display: flex; gap: 4px; }
.stat-btn:hover b { text-decoration: underline; }
.stat-btn b { color: var(--text); font-weight: 700; }
.tier-pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px;
}
.tier-pill.full { color: var(--gold-dark); background: var(--gold-tint); border: 1px solid #4a3d00; }
.tier-pill.standard { color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); }

.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
.media-grid-item { display: block; aspect-ratio: 1; overflow: hidden; }
.media-grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Auth / empty states ---- */
.hero { display: flex; align-items: stretch; min-height: 100vh; }
.hero-left { flex: 1.2; background: var(--hero-gradient); display: flex; align-items: center; justify-content: center; }
.hero-right { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px; max-width: 500px; }
.hero-right h1 { font-size: 56px; margin: 0 0 32px; letter-spacing: -0.02em; }
.hero-right h2 { font-size: 26px; margin: 32px 0 16px; font-weight: 800; }
@media (max-width: 800px) { .hero-left { display: none; } .hero-right { max-width: none; margin: 0 auto; } }

.social-btn {
  border: 1px solid #3a3d44; border-radius: 999px; padding: 11px 24px; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 10px; justify-content: center; background: var(--surface); color: var(--text);
  width: 100%; margin-bottom: 12px;
}
.social-btn:hover { background: var(--bg-hover); }
.social-btn.discord { background: #5865f2; color: #fff; border: none; }
.social-btn.discord:hover { filter: brightness(1.08); }
.hero-divider { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 13px; margin: 4px 0 16px; }
.hero-divider::before, .hero-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.empty { padding: 60px 20px; text-align: center; color: var(--text-secondary); }

/* ---- Forms / modals ---- */
.form-field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; color: var(--text-secondary); font-weight: 700; }
.form-field input, .form-field textarea, .form-field select {
  background: var(--surface-2); border: 1px solid #3a3d44; border-radius: 8px; padding: 12px;
  color: var(--text); font-family: var(--font); font-size: 15px;
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--blue); outline: none; }
.form-error { color: var(--red); font-size: 13px; margin-top: -6px; margin-bottom: 10px; }
.form-hint { font-size: 13px; color: var(--text-secondary); margin: -8px 0 14px; line-height: 1.4; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; width: 100%; max-width: 460px; max-height: 85vh; overflow-y: auto; }
.modal h2 { margin-top: 0; font-size: 20px; }
.modal-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.modal-tab { flex: 1; padding: 10px 0; background: none; border: none; font-weight: 700; color: var(--text-secondary); border-bottom: 3px solid transparent; }
.modal-tab.active { color: var(--text); border-bottom-color: var(--blue); }

.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.role-tag { font-size: 11px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; margin-left: auto; }
.status-tag { font-size: 11px; border-radius: 999px; padding: 2px 8px; margin-left: 8px; font-weight: 700; }
.status-tag.active { color: var(--green); background: var(--green-tint); }
.status-tag.pending { color: var(--gold-dark); background: var(--gold-tint); }
.status-tag.suspended { color: var(--red); background: var(--red-tint); }
.row-menu { display: flex; gap: 6px; margin-left: 8px; }
.row-menu button { background: none; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 999px; padding: 3px 10px; font-size: 11px; }
.row-menu button:hover { color: var(--text); border-color: var(--text-secondary); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 12px 20px; border-radius: 999px; font-size: 14px; z-index: 100; }
.admin-btn { background: var(--gold); color: #2b2200; border: none; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; }
.link-blue { color: var(--blue); }
.link-blue:hover { text-decoration: underline; }
.section-label { font-size: 15px; font-weight: 800; margin: 4px 0 8px; }

/* ---- Account switcher popover ---- */
.switcher-popover {
  position: absolute; bottom: 66px; left: 0; width: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  z-index: 40; overflow: hidden; padding: 4px 0;
}
.switcher-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.switcher-item:hover { background: var(--bg-hover); }
.switcher-item .check { margin-left: auto; color: var(--blue); }
.switcher-divider { height: 1px; background: var(--border); margin: 4px 0; }
.switcher-action { padding: 12px 16px; font-weight: 500; font-size: 15px; }
.switcher-action:hover { background: var(--bg-hover); }

/* ---- Verification info popover ---- */
.verify-popover {
  position: fixed; z-index: 60; width: 280px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; box-shadow: 0 8px 28px rgba(0,0,0,0.5); font-size: 13px; color: var(--text-secondary);
}
.verify-popover .vp-title { color: var(--text); font-weight: 700; font-size: 14px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
