/* ================= BarrosSpace — Cosmic Glassmorphism Design System ================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --brand: #8b5cf6;
  --brand-2: #ec4899;
  --brand-hover: #7c3aed;
  --brand-soft: rgba(139, 92, 246, 0.14);
  --brand-grad: linear-gradient(135deg, #7c3aed 0%, #a855f7 52%, #f43f5e 100%);
  --green: #10b981;
  --green-hover: #059669;
  --red: #f43f5e;
  --bg: #f4f2fc;
  --bg-mesh:
    radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.08) 0px, transparent 48%),
    radial-gradient(at 100% 15%, rgba(244, 63, 94, 0.06) 0px, transparent 45%),
    radial-gradient(at 50% 100%, rgba(14, 165, 233, 0.05) 0px, transparent 50%);
  --card: #ffffff;
  --card-glass: #ffffff;
  --text: #14121f;
  --muted: #6e6a85;
  --border: #e5e7eb;
  --neon-border: rgba(139, 92, 246, 0.32);
  --hover: rgba(139, 92, 246, 0.08);
  --input: #f3f4f6;
  --shadow: 0 4px 14px -3px rgba(24, 16, 56, 0.06), 0 2px 6px -2px rgba(24, 16, 56, 0.04);
  --shadow-lg: 0 18px 40px -8px rgba(24, 16, 56, 0.18), 0 6px 16px -4px rgba(24, 16, 56, 0.08);
  --online: #10b981;
  --radius: 18px;
  --radius-sm: 13px;
  --header: 0px;
  --rail-w: 250px;
}

html.rail-collapsed {
  --rail-w: 76px;
}

[data-theme="dark"] {
  --brand: #a855f7;
  --brand-hover: #9333ea;
  --brand-soft: rgba(168, 85, 247, 0.18);
  --bg: #080612;
  --bg-mesh:
    radial-gradient(at 8% 8%, rgba(124, 58, 237, 0.24) 0px, transparent 45%),
    radial-gradient(at 92% 18%, rgba(244, 63, 94, 0.18) 0px, transparent 45%),
    radial-gradient(at 50% 95%, rgba(6, 182, 212, 0.12) 0px, transparent 50%);
  --card: #17132b;
  --card-glass: #1b1632;
  --text: #f3f1fb;
  --muted: #9d96b8;
  --border: rgba(168, 85, 247, 0.22);
  --neon-border: rgba(236, 72, 153, 0.36);
  --hover: rgba(168, 85, 247, 0.13);
  --input: rgba(255, 255, 255, 0.055);
  --shadow:
    0 10px 32px -8px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(168, 85, 247, 0.14),
    0 1px 0 0 rgba(255, 255, 255, 0.07) inset;
  --shadow-lg:
    0 24px 52px -10px rgba(0, 0, 0, 0.8),
    0 0 24px -4px rgba(168, 85, 247, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  min-height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-mesh);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; outline: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; outline: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.link { color: var(--brand); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 13px; height: 34px; border-radius: 999px; font-weight: 600; font-size: 13px;
  background: var(--input); color: var(--text); border: 1px solid var(--border);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s ease;
  white-space: nowrap; flex-shrink: 0;
}
.btn:hover { background: var(--hover); border-color: var(--neon-border); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--brand-grad); color: #fff; border-color: transparent;
  box-shadow: 0 4px 16px -3px rgba(139, 92, 246, 0.55);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--brand-grad); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border-color: rgba(168, 85, 247, 0.25); }
.btn-soft:hover { background: rgba(168, 85, 247, 0.24); }
.btn-green {
  background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px -3px rgba(16, 185, 129, 0.45);
}
.btn-danger { background: var(--red); color: #fff; border-color: transparent; }
.btn-block { width: 100%; }
.btn-lg { height: 42px; font-size: 14.5px; border-radius: 12px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--input); border: 1px solid var(--border); font-size: 15px; position: relative; flex-shrink: 0;
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--neon-border); transform: translateY(-1px); }
.icon-btn.active { background: var(--brand-grad); color: #fff; }
.icon-btn.plain { background: transparent; border: none; width: 30px; height: 30px; border-radius: 50%; font-size: 14px; color: var(--muted); }
.icon-btn.plain:hover { background: var(--hover); color: var(--text); transform: none; }

/* ---------- Pulse Effect on Badges & Online Status ---------- */
@keyframes pulseWave {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes badgePulse {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: linear-gradient(135deg, #f43f5e, #e11d48); color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
  animation: badgePulse 2.2s infinite;
}
.badge:empty, .badge[data-n="0"] { display: none; animation: none; }

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--input);
  flex-shrink: 0;
}
.av-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
  border-radius: 50%;
}
.presence {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--card, #ffffff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  display: none;
  z-index: 4;
  pointer-events: none;
  box-sizing: border-box;
}
.presence.on {
  display: block;
  animation: pulseWave 2s infinite;
}
.presence-sm { width: 10px; height: 10px; right: 0px; bottom: 0px; border-width: 2px; }
.presence-md { width: 12.5px; height: 12.5px; right: 1px; bottom: 1px; border-width: 2px; }
.presence-lg { width: 15px; height: 15px; right: 3px; bottom: 3px; border-width: 2.5px; }
.presence-xl { width: 18px; height: 18px; right: 5px; bottom: 5px; border-width: 3px; }
.status-text.on { color: var(--online); font-weight: 600; }

/* ---------- Skeleton Shimmer Loading ---------- */
@keyframes shimmer {
  0% { background-position: -450px 0; }
  100% { background-position: 450px 0; }
}
.sk-box {
  background: linear-gradient(90deg, var(--input) 25%, rgba(168, 85, 247, 0.16) 50%, var(--input) 75%);
  background-size: 900px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 8px;
}
.sk-card {
  background: var(--card); backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.sk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sk-av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.sk-line { height: 10px; margin-bottom: 6px; border-radius: 6px; }
.sk-media { height: 210px; border-radius: 12px; margin-top: 10px; }

/* ================= AUTH PAGES (PC & MOBILE OPTIMIZED) ================= */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #090614;
  background-image:
    radial-gradient(at 15% 18%, rgba(124, 58, 237, 0.38) 0px, transparent 52%),
    radial-gradient(at 88% 82%, rgba(244, 63, 94, 0.28) 0px, transparent 52%),
    radial-gradient(at 50% 45%, rgba(14, 165, 233, 0.12) 0px, transparent 60%);
  color: #f5f3ff;
}
.auth-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  align-items: center;
  gap: 44px;
  padding: 36px 28px;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
}
.auth-brand {
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.auth-brand .brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(192, 132, 252, 0.3);
  font-size: 12px;
  font-weight: 700;
  color: #e9d5ff;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px -4px rgba(139, 92, 246, 0.35);
}
.auth-brand .brand-pill i {
  color: #f472b6;
  font-size: 12px;
}
.auth-logo-row {
  display: inline-flex;
  align-items: center;
  gap: 13px;
}
.auth-logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: var(--brand-grad);
  color: #ffffff;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    0 10px 26px -6px rgba(139, 92, 246, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.22) inset;
}
.auth-brand .logo-text {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.05;
  background: linear-gradient(135deg, #ffffff 12%, #d8b4fe 55%, #fda4af 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-brand p,
.auth-tagline {
  font-size: 15.5px;
  line-height: 1.6;
  margin-top: 12px;
  color: #cbd5e1;
  max-width: 440px;
  text-wrap: balance;
}
/* Mobile feature pills (hidden on Desktop where 2-card .auth-features is shown) */
.auth-mobile-chips {
  display: none;
}
.auth-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
  max-width: 450px;
  width: 100%;
}
.auth-feat {
  padding: 13px 15px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}
.auth-feat i {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--brand-grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 7px;
  font-size: 13px;
}
.auth-feat b {
  display: block;
  font-size: 13px;
  color: #fff;
}
.auth-feat span {
  font-size: 11.5px;
  color: #94a3b8;
}

.auth-card-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 410px;
  margin: 0 auto;
  background: rgba(22, 18, 40, 0.82);
  border: 1px solid rgba(168, 85, 247, 0.3);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 24px;
  padding: 28px 26px;
  box-shadow:
    0 24px 54px -14px rgba(0, 0, 0, 0.7),
    0 0 28px -8px rgba(168, 85, 247, 0.28),
    0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
  text-align: center;
  color: #f8fafc;
}
.auth-card-head {
  margin-bottom: 18px;
}
.auth-card h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 5px;
  letter-spacing: -0.5px;
  color: #fff;
}
.auth-card .sub {
  color: #94a3b8;
  font-size: 13.5px;
  margin: 0;
  line-height: 1.45;
}
.auth-card .divider-top {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 12px 0 16px;
}

/* Input Field Wrapper with Leading Icon */
.auth-field {
  position: relative;
  width: 100%;
  margin-bottom: 11px;
}
.auth-field .field-ic {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #a78bfa;
  font-size: 14.5px;
  pointer-events: none;
  z-index: 2;
  transition: color 0.18s ease;
}
.auth-field:focus-within .field-ic {
  color: #f472b6;
}
.auth-page,
.auth-card {
  color-scheme: dark !important;
}
.auth-card input:not([type="checkbox"]) {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.065);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #c084fc !important;
  color-scheme: dark !important;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.auth-card .pw-wrap input:not([type="checkbox"]) {
  padding-right: 44px;
}
.auth-card input:not([type="checkbox"])::placeholder {
  color: #94a3b8;
  -webkit-text-fill-color: #94a3b8;
  font-weight: 400;
}
.auth-card input:not([type="checkbox"]):focus,
.auth-card input:not([type="checkbox"]):active,
.auth-card input:not([type="checkbox"]):valid,
.auth-card input:not([type="checkbox"]):not(:placeholder-shown) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.auth-card input:not([type="checkbox"]):focus {
  border-color: #a855f7;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.24);
}
.auth-card input::selection {
  background: rgba(168, 85, 247, 0.45) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
/* Fix Chrome / Edge / Safari White & Black Autofill Background & Text on Dark Glass Inputs */
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus,
.auth-card input:-webkit-autofill:active,
.auth-card input:autofill {
  -webkit-box-shadow: 0 0 0 1000px #1e1738 inset !important;
  box-shadow: 0 0 0 1000px #1e1738 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  color: #ffffff !important;
  caret-color: #ffffff !important;
  border-color: rgba(168, 85, 247, 0.42) !important;
  color-scheme: dark !important;
  transition: background-color 99999s ease-out 0s;
}

/* Modern High-End OTP Verification Step Design */
.otp-hero-wrap {
  text-align: center !important;
  margin-bottom: 22px;
}
.otp-icon-glow {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3));
  border: 1px solid rgba(168, 85, 247, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #c084fc;
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.35);
}
.otp-hero-title {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin: 0 0 8px !important;
  letter-spacing: -0.4px !important;
  text-align: center !important;
  display: block !important;
  width: 100% !important;
}
.otp-hero-sub {
  font-size: 13.5px !important;
  color: #94a3b8 !important;
  margin: 0 0 12px !important;
  text-align: center !important;
  display: block !important;
  width: 100% !important;
}
.otp-email-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: rgba(139, 92, 246, 0.18) !important;
  border: 1px solid rgba(168, 85, 247, 0.42) !important;
  border-radius: 999px !important;
  padding: 7px 18px !important;
  color: #ffffff !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28) !important;
  word-break: break-all !important;
  max-width: 95% !important;
  margin: 0 auto !important;
}
.otp-email-pill span {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.otp-email-pill i {
  color: #f472b6;
  font-size: 14px;
}
.otp-box-wrap {
  margin: 0 auto 20px;
  max-width: 290px;
}
.otp-box-wrap input {
  width: 100% !important;
  height: 58px !important;
  text-align: center !important;
  font-size: 28px !important;
  font-weight: 900 !important;
  letter-spacing: 12px !important;
  padding: 0 0 0 12px !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1.5px solid rgba(168, 85, 247, 0.45) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  outline: none !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.2s ease !important;
}
.otp-box-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.25) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.25) !important;
  letter-spacing: 12px !important;
  font-size: 24px !important;
}
.otp-box-wrap input:focus {
  border-color: #ec4899 !important;
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.28), 0 8px 24px rgba(0, 0, 0, 0.45) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}
.otp-input-tip {
  font-size: 12px;
  color: #94a3b8;
  margin: 9px 0 0;
  font-weight: 500;
  text-align: center;
}
.otp-btn-submit {
  height: 48px !important;
  font-size: 15.5px !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 25px rgba(236, 72, 153, 0.38) !important;
}
.otp-actions-wrap {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  margin-top: 20px !important;
  padding-top: 16px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.otp-link-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  color: #cbd5e1 !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  padding: 8px 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  transition: all 0.18s ease !important;
}
.otp-link-btn i {
  color: #c084fc;
}
.otp-link-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(168, 85, 247, 0.45) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}
.otp-sep {
  display: none !important;
}

.auth-card .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Remember & Forgot Password Row */
.auth-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 2px 14px;
  font-size: 13px;
}
.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.auth-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #a855f7;
  border-radius: 5px;
  cursor: pointer;
}
.auth-card .forgot {
  display: inline-block;
  color: #d8b4fe;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  transition: color 0.15s ease;
}
.auth-card .forgot:hover {
  color: #f472b6;
  text-decoration: underline;
}

.auth-submit-btn {
  width: 100%;
  height: 46px !important;
  border-radius: 13px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  gap: 8px;
  margin-top: 2px;
  box-shadow: 0 10px 24px -6px rgba(139, 92, 246, 0.65);
}

.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin: 16px 0 14px;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.google-box {
  display: flex;
  justify-content: center;
  min-height: 44px;
}
.google-fallback {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13.5px;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.google-fallback:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(168, 85, 247, 0.4);
}
.auth-card .create {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13.5px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.auth-switch-link {
  color: #f472b6;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s ease, transform 0.15s ease;
}
.auth-switch-link:hover {
  color: #fda4af;
  text-decoration: underline;
}
.auth-switch-link i {
  font-size: 12px;
}
.auth-card .btn-green {
  height: 44px;
  font-size: 14px;
  padding: 0 20px;
  border-radius: 12px;
}
.auth-alert {
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 13px;
  text-align: left;
  line-height: 1.45;
}
.auth-alert.error {
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fecdd3;
}
.auth-alert.success {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
  word-break: break-all;
}
.auth-alert a {
  color: #fde047;
  text-decoration: underline;
  font-weight: 600;
}
.auth-footer {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-simple {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}
.auth-simple-brand {
  margin-bottom: 18px;
  text-decoration: none;
}
.auth-simple-brand .auth-logo-badge {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 17px;
}
.auth-simple .logo-text {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 12%, #d8b4fe 55%, #fda4af 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-simple .auth-card {
  width: 420px;
  max-width: 100%;
  text-align: left;
}
.auth-simple .auth-card h2 {
  text-align: left;
  font-size: 21px;
}
.auth-simple .actions,
.auth-actions-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}
.auth-simple .actions .btn,
.auth-actions-row .btn {
  width: 100%;
  min-width: 0;
  flex-shrink: 1;
  justify-content: center;
  height: 45px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
}
.auth-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  padding: 0 14px;
}
.auth-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(168, 85, 247, 0.35);
}
.auth-btn-main {
  padding: 0 16px;
  box-shadow: 0 10px 24px -6px rgba(139, 92, 246, 0.6);
}
.pw-wrap {
  position: relative;
}
.pw-wrap .toggle-pw {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 14px;
  z-index: 2;
  transition: color 0.15s ease, background 0.15s ease;
}
.pw-wrap .toggle-pw:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 920px) {
  .auth-main {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px 18px;
    text-align: center;
  }
  .auth-brand {
    padding: 0;
    align-items: center;
  }
  .auth-brand p,
  .auth-features {
    margin-left: auto;
    margin-right: auto;
  }
  .auth-features {
    text-align: left;
  }
}

/* ================= COLLAPSIBLE LEFT SIDEBAR MENU (.app-rail) ================= */
.app-rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  width: var(--rail-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 14px -4px rgba(24, 16, 56, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 12px;
  z-index: 120;
  transition: width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.2s ease;
  overflow: visible;
}

.rail-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
}

.rail-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 6px;
  min-height: 42px;
  transition: padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              justify-content 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  overflow: hidden;
  transition: gap 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--brand-grad);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -3px rgba(124, 58, 237, 0.55);
}
.brand-name {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  max-width: 170px;
  transform: translateX(0);
  transition: opacity 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1),
              max-width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rail-toggle-top {
  width: 34px;
  height: 34px;
  color: var(--text);
}

.search-box.rail-search {
  position: relative;
  width: 100%;
  margin: 0;
  display: flex;
  justify-content: center;
}
.search-box .search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 38px;
  padding: 0 12px;
  width: 100%;
  overflow: hidden;
  cursor: text;
  transition: width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-radius 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.18s ease,
              border-color 0.18s ease,
              box-shadow 0.18s ease;
}
.search-box .search-input:focus-within {
  border-color: var(--brand);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  text-overflow: ellipsis;
  opacity: 1;
  max-width: 190px;
  white-space: nowrap;
  transition: opacity 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              max-width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.search-box i {
  color: var(--muted);
  font-size: 13.5px;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.rail-compose-btn {
  width: 100%;
  height: 38px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
  white-space: nowrap;
  transition: width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              height 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-radius 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              margin 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              gap 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.2s ease,
              transform 0.15s ease;
}
.rail-compose-btn i {
  flex-shrink: 0;
  font-size: 14px;
}

.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  transition: padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rail-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 14px;
  background: var(--input);
  border: 1px solid var(--border);
  transition: background 0.18s ease,
              border-color 0.18s ease,
              padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              height 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-radius 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              gap 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  min-width: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  overflow: visible;
}
.rail-user:hover {
  background: var(--hover);
  border-color: var(--neon-border);
}
.rail-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rail-user .av-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.rail-user-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  opacity: 1;
  max-width: 140px;
  transform: translateX(0);
  transition: opacity 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              max-width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rail-user-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-user-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-section-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 6px 10px 2px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  max-height: 24px;
  transform: translateY(0);
  transition: opacity 0.18s ease,
              max-height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              padding 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.22s ease;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}
.rail-nav::-webkit-scrollbar { width: 4px; }
.rail-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }

.rail-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 9px;
  border-radius: 13px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  position: relative;
  white-space: nowrap;
  width: 100%;
  text-align: left;
  overflow: hidden;
  transition: background 0.18s ease,
              color 0.18s ease,
              padding 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              gap 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rail-item:hover {
  background: var(--hover);
  color: var(--text);
}
.rail-ic {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--input);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.rail-item:hover .rail-ic {
  border-color: var(--neon-border);
  color: var(--brand);
  background: var(--card);
}
.rail-item.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.rail-item.active .rail-ic {
  background: var(--brand-grad);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px -2px rgba(124, 58, 237, 0.5);
}
.rail-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 1;
  max-width: 170px;
  transform: translateX(0);
  transition: opacity 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1),
              max-width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rail-ic .badge {
  top: -4px;
  right: -4px;
}

.rail-collapse-btn {
  color: var(--muted);
  outline: none;
}
.rail-collapse-btn:focus-visible {
  outline: none;
}
.rail-collapse-btn #railToggleIcon {
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Collapsed state (`html.rail-collapsed`) */
html.rail-collapsed .app-rail {
  padding: 14px 8px;
}
html.rail-collapsed .rail-brand-row {
  justify-content: center;
  padding: 2px 0 6px;
}
html.rail-collapsed .brand-mark {
  gap: 0;
  justify-content: center;
}
html.rail-collapsed .brand-name {
  opacity: 0;
  max-width: 0;
  transform: translateX(-10px);
  pointer-events: none;
  visibility: hidden;
}
html.rail-collapsed .rail-search .search-input {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  margin: 0 auto;
  cursor: pointer;
}
html.rail-collapsed .rail-search .search-input input {
  opacity: 0;
  max-width: 0;
  width: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
  visibility: hidden;
}
html.rail-collapsed .rail-compose-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  margin: 0 auto 2px;
  gap: 0;
}
html.rail-collapsed .rail-user {
  justify-content: center;
  padding: 3px;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 50%;
  background: transparent;
  border-color: transparent;
  gap: 0;
  overflow: visible;
}
html.rail-collapsed .rail-user:hover {
  background: var(--hover);
}
html.rail-collapsed .rail-user-text {
  opacity: 0;
  max-width: 0;
  transform: translateX(-8px);
  pointer-events: none;
  visibility: hidden;
}
html.rail-collapsed .rail-section-label {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  transform: translateY(-4px);
  pointer-events: none;
  visibility: hidden;
}
html.rail-collapsed .rail-label {
  opacity: 0;
  max-width: 0;
  transform: translateX(-10px);
  pointer-events: none;
  visibility: hidden;
}
html.rail-collapsed .rail-item {
  justify-content: center;
  padding: 7px 0;
  gap: 0;
}
html.rail-collapsed .rail-collapse-btn #railToggleIcon {
  transform: rotate(180deg);
}

.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 320px; max-height: calc(100vh - 40px);
  overflow-y: auto; padding: 10px; z-index: 500;
}
.dropdown h3 { font-size: 16px; font-weight: 800; padding: 4px 8px 8px; display: flex; justify-content: space-between; align-items: center; }
.dropdown h3 .link { font-size: 12px; font-weight: 600; }
.search-box .dropdown { left: 0; right: auto; width: 300px; top: calc(100% + 6px); }
.rail-me-drop {
  bottom: calc(100% + 8px);
  top: auto;
  left: 0;
  right: auto;
  width: 280px;
}
.dd-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 11px; cursor: pointer; position: relative;
  transition: background .15s;
}
.dd-item:hover { background: var(--hover); }
.dd-item .grow { flex: 1; min-width: 0; }
.dd-item .title { font-weight: 600; font-size: 13.5px; }
.dd-item .sub { font-size: 11.5px; color: var(--muted); }
.dd-item .ic {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.dd-sep { border-top: 1px solid var(--border); margin: 6px 4px; }
.dd-empty { padding: 22px 8px; text-align: center; color: var(--muted); }

/* ================= MAIN CONTENT + FEED 2-COLUMN LAYOUT ================= */
#main {
  padding-top: var(--header);
  padding-left: var(--rail-w);
  min-height: 100vh;
  transition: padding-left 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.16s ease;
}
.layout-3 {
  display: grid;
  grid-template-columns: minmax(0, 760px) 365px;
  justify-content: center;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 22px;
}
.sidebar-left, .sidebar-right {
  position: sticky; top: calc(var(--header) + 20px);
  height: fit-content; max-height: calc(100vh - var(--header) - 40px);
  overflow-y: auto;
}
.sidebar-left::-webkit-scrollbar, .sidebar-right::-webkit-scrollbar { width: 4px; }
.sidebar-left::-webkit-scrollbar-thumb, .sidebar-right::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }

/* Deep Cosmic Glass Cards with subtle neon glow on hover */
.bento-box, .card, .mini-profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .22s ease, box-shadow .22s ease;
}
.bento-box:hover, .card:hover, .mini-profile-card:hover {
  border-color: var(--neon-border);
}
.bento-box { padding: 14px 16px; margin-bottom: 16px; }
.mini-profile-card { overflow: hidden; margin-bottom: 14px; }
.mini-profile-card .mp-banner {
  height: 56px; background: var(--brand-grad); background-size: cover; background-position: center;
}
.mini-profile-card .mp-body { padding: 0 12px 12px; margin-top: -22px; display: flex; flex-direction: column; align-items: flex-start; }
.mini-profile-card .mp-body img { width: 46px; height: 46px; border: 2.5px solid var(--bg); box-shadow: var(--shadow); }
.mini-profile-card .mp-name { font-weight: 800; font-size: 14.5px; margin-top: 6px; }
.mini-profile-card .mp-bio { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  font-weight: 600; font-size: 13.5px; cursor: pointer; transition: all .15s;
}
.side-link:hover { background: var(--hover); transform: translateX(2px); }
.side-link .si {
  width: 32px; height: 32px; border-radius: 9px; background: var(--input);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.side-link img { width: 32px; height: 32px; }
.side-title {
  color: var(--text); font-weight: 800; font-size: 14.5px; padding: 2px 4px 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.side-title .link { font-size: 12.5px; font-weight: 600; }
.side-sep { border-top: 1px solid var(--border); margin: 8px 4px; }
.side-footer { color: var(--muted); font-size: 12px; padding: 4px 8px; }

/* Rich Online Contacts & People You May Know in Right Sidebar */
.contact {
  display: flex; align-items: center; gap: 11px; padding: 8px 8px; border-radius: 12px;
  cursor: pointer; font-weight: 600; font-size: 13.5px; transition: background .15s;
}
.contact:hover { background: var(--hover); }
.contact img { width: 38px; height: 38px; }
.contact .c-info { flex: 1; min-width: 0; }
.contact .c-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.contact .sub {
  font-size: 11.5px; color: var(--muted); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.contact .sub.activity { color: #c084fc; }
[data-theme="light"] .contact .sub.activity { color: #7c3aed; }
.contact .unread-pill {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--brand-grad); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  animation: badgePulse 2.2s infinite;
}

.pymk-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 6px; border-radius: 12px;
  transition: background .15s;
}
.pymk-item:hover { background: var(--hover); }
.pymk-item .grow { flex: 1; min-width: 0; }
.pymk-item .name { font-weight: 700; font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pymk-item .mutual-tag {
  font-size: 11.5px; color: var(--brand); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}

/* Right Sidebar Extra Widgets (Trending, Events, Community) */
.trend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.trend-item:hover {
  background: var(--hover);
}
.trend-tag {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.trend-tag i {
  color: var(--brand);
  font-size: 12px;
}
.trend-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}
.trend-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
}

.event-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 13px;
  background: var(--input);
  border: 1px solid var(--border);
}
.event-card + .event-card {
  margin-top: 8px;
}
.event-ic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.event-info {
  min-width: 0;
  flex: 1;
}
.event-info b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.event-info span {
  font-size: 11.5px;
  color: var(--muted);
}

.feed { min-width: 0; width: 100%; }
.page { max-width: 1080px; margin: 0 auto; padding: 20px 18px; }
.page-narrow { max-width: 720px; margin: 0 auto; padding: 20px 18px; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 14px; }

.card { margin-bottom: 16px; position: relative; }
.card-pad { padding: 14px 18px; }
.card-title {
  font-size: 16px; font-weight: 800; padding: 14px 18px 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.card-title .link { font-size: 13px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 36px 18px; }
.empty i { font-size: 38px; margin-bottom: 10px; display: block; color: var(--brand); opacity: .7; }
.loader {
  width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .75s linear infinite; margin: 28px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Stories / Reels Bar ---------- */
/* ==================== BẢN TIN 24H (STORIES & VIEWER) ==================== */
.stories-bar {
  display: flex; gap: 12px; overflow-x: auto; padding: 14px 16px;
  scrollbar-width: none; margin-bottom: 16px;
}
.stories-bar::-webkit-scrollbar { display: none; }
.story-card {
  position: relative; width: 124px; height: 188px; border-radius: 16px;
  overflow: hidden; flex-shrink: 0; cursor: pointer;
  border: 1.5px solid var(--neon-border);
  background: linear-gradient(145deg, #6d28d9 0%, #a855f7 52%, #f43f5e 100%);
  box-shadow: 0 8px 20px -6px rgba(24, 16, 56, 0.25);
  transition: opacity .15s ease;
}
.story-card:hover { opacity: 0.94; }
.story-card .st-bg {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.92);
}
.story-card .st-text-bg {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center; color: #fff; font-weight: 700; font-size: 13px;
  line-height: 1.35;
}
.story-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.12) 0%, transparent 45%, rgba(12,8,28,0.82) 100%);
  pointer-events: none;
}
.story-card .st-ring {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 2px; border-radius: 50%;
  background: var(--brand-grad);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.story-card .st-ring img { width: 34px; height: 34px; border: 2px solid #ffffff; }
.story-card .st-name {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2;
  color: #fff; font-size: 12.5px; font-weight: 700; line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.story-card.create .st-plus {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  border: 2.5px solid #ffffff; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.6);
}

/* Story Viewer Modal */
.story-viewer-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(8, 5, 16, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeInModal .18s ease-out;
}
.story-viewer-box {
  position: relative; width: 100%; max-width: 400px; height: 92vh; max-height: 700px;
  border-radius: 24px; overflow: hidden; background: #0c0818;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.12);
  display: flex; flex-direction: column;
}
.story-progress-bar {
  display: flex; gap: 4px; padding: 12px 14px 6px;
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
}
.story-progress-segment {
  flex: 1; height: 3px; border-radius: 999px; background: rgba(255,255,255,0.3); overflow: hidden;
}
.story-progress-fill {
  height: 100%; width: 0%; background: #fff; transition: width .1s linear;
}
.story-viewer-head {
  position: absolute; top: 22px; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
}
.story-viewer-author {
  display: flex; align-items: center; gap: 10px;
}
.story-viewer-author img {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid #8b5cf6;
}
.story-viewer-author b {
  display: block; font-size: 13.5px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.story-viewer-author small {
  display: block; font-size: 11px; color: rgba(255,255,255,0.7);
}
.story-viewer-close {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.4); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all .15s;
}
.story-viewer-close:hover { background: rgba(244,63,94,0.6); }

.story-viewer-content {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.story-viewer-content img,
.story-viewer-content video {
  width: 100%; height: 100%; object-fit: cover;
}
.story-viewer-text {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 32px 24px; text-align: center; color: #fff; font-size: 22px; font-weight: 800;
  line-height: 1.4; word-break: break-word; text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.story-viewer-foot {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  padding: 12px 14px 16px; background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, transparent 100%);
  display: flex; flex-direction: column; gap: 10px;
}
.story-reactions-row {
  display: flex; align-items: center; justify-content: space-around;
}
.story-react-btn {
  background: transparent; border: none; font-size: 22px; cursor: pointer;
  transition: transform .15s cubic-bezier(0.16, 1, 0.3, 1);
}
.story-react-btn:hover { transform: scale(1.35); }
.story-reply-form {
  display: flex; align-items: center; gap: 8px;
}
.story-reply-input {
  flex: 1; height: 40px; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px; padding: 0 16px; color: #fff; font-size: 13.5px; outline: none;
  backdrop-filter: blur(10px);
}
.story-reply-input::placeholder { color: rgba(255,255,255,0.65); }
.story-reply-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--brand-grad); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s;
}
.story-reply-send:hover { transform: scale(1.08); }

/* ==================== INSTAGRAM/FACEBOOK STYLE STORY STUDIO ==================== */
.story-creator-modal {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(5, 3, 12, 0.92); backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex; align-items: center; justify-content: center; padding: 12px;
  animation: fadeInModal .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.story-editor-frame {
  position: relative; width: 100%; max-width: 380px; height: 620px; max-height: 90vh;
  border-radius: 28px; overflow: hidden; background: #0c0818;
  box-shadow: 0 28px 70px rgba(0,0,0,0.85), 0 0 0 1px rgba(255,255,255,0.15);
  display: flex; flex-direction: column; justify-content: space-between;
  user-select: none;
}
.story-editor-media {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1;
}
.story-editor-grad-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
  transition: background 0.3s ease;
}
.story-editor-top-tools {
  position: relative; z-index: 30; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}
.story-tool-pill-group {
  display: flex; align-items: center; gap: 8px;
}
.story-editor-tool-btn {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.45); color: #fff; font-size: 13px; font-weight: 700;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; transition: all .15s ease;
}
.story-editor-tool-btn:hover {
  background: rgba(255,255,255,0.25); transform: translateY(-1px);
}
.story-editor-tool-btn.icon-only {
  width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%;
}
.story-editor-bottom-bar {
  position: relative; z-index: 30; padding: 14px 18px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
}
.story-publish-btn {
  flex: 1; height: 46px; border-radius: 999px; border: none;
  background: var(--brand-grad); color: #fff; font-size: 14.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; box-shadow: 0 8px 24px rgba(124, 58, 237, 0.5);
  transition: all .18s ease;
}
.story-publish-btn:hover {
  transform: translateY(-2px); filter: brightness(1.1);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.65);
}

/* Draggable Text Overlay */
.story-text-sticker {
  position: absolute; z-index: 20; cursor: grab;
  padding: 8px 16px; border-radius: 12px;
  font-size: 20px; font-weight: 800; line-height: 1.35;
  text-align: center; max-width: 85%; word-break: break-word;
  user-select: none; transform: translate(-50%, -50%);
  touch-action: none;
  transition: box-shadow .15s ease;
}
.story-text-sticker:active { cursor: grabbing; }
.story-text-sticker.selected {
  outline: 2px dashed rgba(255,255,255,0.85);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.story-sticker-del-btn {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f43f5e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  transition: transform .15s ease, background .15s ease;
  z-index: 25;
}
.story-sticker-del-btn:hover {
  transform: scale(1.18);
  background: #e11d48;
}
.story-trash-zone {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px dashed rgba(255, 255, 255, 0.45);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 28;
  opacity: 0;
  pointer-events: none;
  transition: all .2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.story-trash-zone.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.story-trash-zone.active {
  background: rgba(244, 63, 94, 0.95);
  border-color: #ffffff;
  color: #fff;
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 0 22px rgba(244, 63, 94, 0.85);
}
.story-text-drag-hint {
  position: absolute; bottom: 75px; left: 0; right: 0; text-align: center;
  font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8); pointer-events: none; z-index: 25;
}

/* Text Editor Popover Overlay */
.story-text-edit-overlay {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 20px 18px; animation: fadeInModal .15s ease-out;
}
.story-text-edit-textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: #fff; font-size: 22px; font-weight: 800; text-align: center;
  font-family: inherit; line-height: 1.4; resize: none; margin: auto 0;
}
.story-color-palette {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  overflow-x: auto; padding: 10px 0;
}
.story-color-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4);
  cursor: pointer; flex-shrink: 0; transition: transform .15s;
}
.story-color-dot.active {
  transform: scale(1.25); border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,0.8);
}
.story-style-toggle-btn {
  height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15); color: #fff; font-size: 12px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}

/* ---------- Composer ---------- */
.composer-top { display: flex; gap: 12px; align-items: center; padding: 14px 16px 12px; }
.composer-top img { width: 42px; height: 42px; }
.composer-fake {
  flex: 1; background: var(--input); border: 1px solid var(--border); border-radius: 999px;
  height: 42px; padding: 0 16px; display: flex; align-items: center;
  color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 500; text-align: left;
  transition: all .15s;
}
.composer-fake:hover { border-color: var(--brand); background: var(--hover); }
.composer-actions {
  display: flex; gap: 8px; border-top: 1px solid var(--border); margin: 0 16px; padding: 10px 0 12px;
}
.composer-actions button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; border-radius: 12px; background: var(--input);
  color: var(--text); font-weight: 600; font-size: 13.5px; transition: all .15s;
}
.composer-actions button:hover { background: var(--brand-soft); color: var(--brand); }

/* ---------- Post Card ---------- */
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.post-head img { width: 42px; height: 42px; }
.post-head .grow { flex: 1; min-width: 0; }
.post-head .name { font-weight: 700; font-size: 14.5px; }
.post-head .name:hover { color: var(--brand); }
.post-head .meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.post-head .meta a:hover { text-decoration: underline; }
.post-content { padding: 6px 16px 12px; white-space: normal; word-wrap: break-word; font-size: 14.5px; line-height: 1.55; }
.post-content.big {
  font-size: 17px; font-weight: 700; line-height: 1.35;
  margin: 4px 14px 10px; padding: 18px 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(244, 63, 94, 0.1));
  border: 1px solid var(--border);
}
.post-content a { color: var(--brand); font-weight: 600; }
.post-menu-wrap { position: relative; }
.post-menu-wrap .dropdown { width: 210px; top: 100%; }

/* ---------- Smart Collage Grid (1, 2, 3, 4+) ---------- */
.media-grid {
  display: grid; gap: 4px; margin: 0 12px 10px; border-radius: 13px; overflow: hidden;
  border: 1px solid var(--border); background: #090812;
}
.media-grid .m { position: relative; cursor: pointer; background: #090812; overflow: hidden; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.media-grid .m:hover img { transform: scale(1.03); }
.media-grid.n1 .m img { max-height: 440px; object-fit: cover; margin: 0 auto; }
.media-grid.n1 .m video { max-height: 440px; object-fit: contain; }
.media-grid.n2 { grid-template-columns: 1fr 1fr; height: 260px; }
.media-grid.n3 {
  grid-template-columns: 1.35fr 1fr;
  grid-template-rows: 135px 135px;
}
.media-grid.n3 .m:first-child { grid-row: 1 / 3; }
.media-grid.n4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 150px 150px;
}
.media-grid .more {
  position: absolute; inset: 0; background: rgba(12, 10, 24, .68); backdrop-filter: blur(4px);
  color: #fff; font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.media-grid .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  color: #fff; font-size: 40px; text-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}

/* ---------- OpenGraph Link Preview Card ---------- */
.og-card {
  display: flex; flex-direction: column; margin: 0 14px 10px;
  border-radius: 13px; overflow: hidden;
  border: 1px solid var(--neon-border);
  background: var(--input);
  transition: transform .18s ease, border-color .18s ease;
}
.og-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.og-card .og-thumb {
  height: 150px; background-size: cover; background-position: center; position: relative;
}
.og-card .og-body { padding: 10px 13px; }
.og-card .og-domain {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--brand); display: flex; align-items: center; gap: 5px;
}
.og-card .og-title { font-weight: 800; font-size: 13.5px; margin-top: 2px; color: var(--text); }
.og-card .og-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

.shared-box { margin: 0 14px 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--input); }
.shared-box .post-head { padding-top: 10px; }
.shared-box.deleted { padding: 12px; color: var(--muted); }
.avatar-post {
  display: flex; justify-content: center; padding: 18px 0; margin: 0 12px 10px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(244, 63, 94, 0.12));
}
.avatar-post img { width: 180px; height: 180px; border-radius: 32%; object-fit: cover; border: 4px solid var(--card); box-shadow: var(--shadow-lg); cursor: pointer; }

.post-stats {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 14px 8px; color: var(--muted); font-size: 12px;
}
.post-stats .rx { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 600; }
.post-stats .rx:hover { color: var(--text); }
.rx-icons { display: flex; }
.rx-icons span {
  width: 19px; height: 19px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; background: var(--input); border: 1.5px solid var(--bg); margin-left: -4px;
}
.rx-icons span:first-child { margin-left: 0; }
.post-stats .right { display: flex; gap: 12px; }
.post-stats .right span { cursor: pointer; }
.post-stats .right span:hover { color: var(--text); }

/* ---------- Reaction Hover Bar & Pill Actions ---------- */
.post-actions {
  display: flex; gap: 6px; border-top: 1px solid var(--border);
  margin: 0 14px; padding: 8px 0 8px;
}
.post-actions > * { flex: 1; }
.post-actions button.pa {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; border-radius: 10px; background: var(--input);
  color: var(--muted); font-weight: 600; font-size: 12.5px; transition: all .15s;
}
.post-actions button.pa:hover { background: var(--brand-soft); color: var(--brand); }
.post-actions button.pa .emo { font-size: 15px; }
.like-wrap { position: relative; }
.reaction-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0; display: flex; gap: 6px;
  background: var(--card-glass); backdrop-filter: blur(20px);
  border: 1px solid var(--neon-border); border-radius: 999px;
  padding: 6px 11px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transform: translateY(10px) scale(0.9);
  transition: all .22s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 30;
}
.like-wrap:hover .reaction-picker {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
}
.reaction-picker button {
  font-size: 25px; transition: transform .18s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative; line-height: 1;
}
.reaction-picker button:hover { transform: scale(1.42) translateY(-6px); }
.reaction-picker button::after {
  content: attr(data-label); position: absolute; top: -25px; left: 50%; transform: translateX(-50%);
  background: #14121f; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.reaction-picker button:hover::after { opacity: 1; }

/* ---------- Inline Comments Preview & Quick Input ---------- */
.comments { border-top: 1px solid var(--border); margin: 0 14px; padding: 6px 0 11px; }
.view-more-comments {
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
  padding: 3px 0 4px; display: inline-block;
}
.view-more-comments:hover { color: var(--brand); text-decoration: underline; }
.comment { display: flex; gap: 8px; margin: 7px 0; }
.comment img { width: 28px; height: 28px; }
.comment .bubble {
  background: var(--input); border: 1px solid var(--border);
  border-radius: 4px 13px 13px 13px; padding: 6px 11px; display: inline-block; max-width: 100%; word-wrap: break-word; font-size: 12.5px;
}
.comment .bubble .name { font-weight: 700; font-size: 12px; margin-right: 5px; }
.comment .bubble .name:hover { color: var(--brand); }
.comment .c-meta { font-size: 10.5px; color: var(--muted); padding: 2px 8px; display: flex; gap: 10px; }
.comment .c-meta button { font-weight: 600; font-size: 10.5px; color: var(--muted); }
.comment .c-meta button:hover { color: var(--red); }
.comment-form { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.comment-form img { width: 28px; height: 28px; }
.comment-form .cinput {
  flex: 1; display: flex; background: var(--input); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 4px 0 12px; align-items: center;
}
.comment-form .cinput:focus-within { border-color: var(--brand); background: var(--card); }
.comment-form input { flex: 1; border: none; background: transparent; outline: none; height: 30px; font-size: 12.5px; }
.comment-form button { color: var(--brand); width: 26px; height: 26px; border-radius: 50%; font-size: 12px; }
.comment-form button:hover { background: var(--brand-soft); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 6, 18, .78); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 100005; padding: 14px; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--card);
  border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-lg); width: 470px; max-width: 100%;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.16,1,.3,1);
}
@keyframes pop { from { transform: scale(.94) translateY(8px); } }
.modal-head { position: relative; text-align: center; padding: 14px 48px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-head .icon-btn { position: absolute; right: 12px; top: 10px; width: 32px; height: 32px; border-radius: 10px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.composer-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.composer-user img { width: 36px; height: 36px; }
.composer-user b { display: block; font-size: 13.5px; }
.composer-user span {
  font-size: 11px; background: var(--brand-soft); color: var(--brand); border-radius: 999px;
  padding: 2px 8px; display: inline-flex; gap: 4px; align-items: center; margin-top: 2px; font-weight: 700;
}
.composer-text { width: 100%; border: none; outline: none; resize: none; background: transparent; font-size: 17px; min-height: 100px; }
.composer-text.small-text { font-size: 14px; min-height: 70px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.previews .pv { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 1/1; background: #000; }
.previews .pv img, .previews .pv video { width: 100%; height: 100%; object-fit: cover; }
.previews .pv button {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(20, 18, 31, .8); color: #fff; font-size: 12px;
}
.add-to-post {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border); background: var(--input); border-radius: 12px;
  padding: 8px 12px; margin: 12px 0; font-weight: 600; font-size: 13px;
}
.add-to-post .tools { display: flex; gap: 6px; }
.add-to-post label, .add-to-post .tool {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; cursor: pointer; background: var(--card);
}
.add-to-post label:hover, .add-to-post .tool:hover { transform: scale(1.06); }
.progress { height: 5px; background: var(--input); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress div { height: 100%; width: 0; background: var(--brand-grad); transition: width .2s; }
.emoji-bar { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; margin-top: 6px; background: var(--input); }
.emoji-bar button { font-size: 18px; width: 32px; height: 32px; border-radius: 8px; }
.emoji-bar button:hover { background: var(--card); transform: scale(1.12); }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 12.5px; color: var(--muted); }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
  background: var(--input); outline: none; resize: vertical; font-size: 13.5px;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); background: var(--card); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(10, 8, 20, .95); backdrop-filter: blur(10px); z-index: 600; display: flex; align-items: center; justify-content: center; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 90vh; object-fit: contain; border-radius: 10px; }
.lightbox .lb-close, .lightbox .lb-nav {
  position: absolute; background: rgba(255, 255, 255, .14); color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 16px;
}
.lightbox .lb-close { top: 16px; left: 16px; }
.lightbox .lb-nav:hover, .lightbox .lb-close:hover { background: rgba(255, 255, 255, .28); }
.lightbox .prev { left: 16px; top: 50%; }
.lightbox .next { right: 16px; top: 50%; }
.lightbox .lb-count { position: absolute; bottom: 16px; color: #cbd5e1; font-weight: 600; }

/* ---------- Profile (Redesigned Clean Bento Layout) ---------- */
.profile-header { max-width: 1140px; margin: 18px auto 0; padding: 0 18px; }
.profile-header .inner {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}
[data-theme="dark"] .profile-header .inner {
  background: var(--card);
  border-color: var(--border);
}
.cover {
  height: 220px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(251, 113, 133, 0.35) 0%, transparent 45%),
    linear-gradient(125deg, #4338ca 0%, #7c3aed 48%, #db2777 88%, #f43f5e 100%);
  background-size: cover;
  background-position: center;
  position: relative;
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.28) 0%, transparent 45%);
  pointer-events: none;
}
.cover-btn {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(10px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  height: 34px;
  padding: 0 13px;
  font-size: 12.5px;
}
.cover-btn:hover { background: rgba(17, 24, 39, 0.9); color: #fff; border-color: rgba(255, 255, 255, 0.4); }

/* Profile Info: sits cleanly inside the white card, only avatar pulls up */
.profile-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 24px 18px;
  position: relative;
  flex-wrap: wrap;
}
.profile-main-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex: 1;
  min-width: 260px;
}
.profile-avatar {
  position: relative;
  margin-top: -66px;
  z-index: 3;
  flex-shrink: 0;
}
.profile-avatar img {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.14);
  background: #ffffff;
  object-fit: cover;
}
[data-theme="dark"] .profile-avatar img { border-color: #151126; }
.profile-avatar .presence-lg {
  width: 22px;
  height: 22px;
  right: 10px;
  bottom: 10px;
  border: 3.5px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}
[data-theme="dark"] .profile-avatar .presence-lg {
  border-color: #151126;
}
.profile-avatar .cam {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
  transition: transform 0.15s ease;
}
.profile-avatar .cam:hover { transform: scale(1.08); }

.pi-text {
  flex: 1;
  min-width: 200px;
  padding-top: 2px;
}
.pi-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pi-text h1 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  color: #1f2937;
}
[data-theme="dark"] .pi-text h1 { color: var(--text); }
.pi-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}
.pi-handle {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  margin-top: 2px;
}
.pi-bio {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
  margin-top: 8px;
  max-width: 540px;
}
.pi-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.pi-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--input);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.pi-chip i {
  color: var(--brand);
  font-size: 11.5px;
}

.pi-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  padding-top: 2px;
}
.pi-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  align-items: center;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 6px;
}
.pi-stat {
  padding: 2px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.pi-stat:hover {
  transform: translateY(-1px);
}
.pi-stat b {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.pi-stat span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.pi-stat + .pi-stat {
  border-left: 1px solid var(--border);
}

.pi-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.pi-actions .pi-btn-main,
.pi-actions .pi-btn-sec {
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
}
.pi-actions .pi-btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  flex-shrink: 0;
  font-size: 14px;
}

/* Profile Navigation Tabs */
.profile-tabs {
  display: flex;
  gap: 6px;
  border-top: 1px solid #e5e7eb;
  margin: 0 24px;
  padding: 10px 0;
  overflow-x: auto;
}
[data-theme="dark"] .profile-tabs { border-color: var(--border); }
.profile-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.profile-tabs a:hover { background: #f3f4f6; color: #1f2937; }
.profile-tabs a.active {
  background: var(--brand-grad);
  color: #ffffff;
  box-shadow: 0 4px 12px -2px rgba(139, 92, 246, 0.35);
}

/* Profile 2-Column Body */
.profile-body {
  max-width: 1140px;
  margin: 18px auto 32px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.pb-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--header) + 14px);
}
.pb-Left .card, .pb-left .card, .pb-right .card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .pb-left .card, [data-theme="dark"] .pb-right .card {
  background: var(--card);
  border-color: var(--border);
}
.pb-right { min-width: 0; }
.pb-full { grid-column: 1 / -1; min-width: 0; }

.bio-quote {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #374151;
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.5;
}
[data-theme="dark"] .bio-quote { background: var(--input); border-color: var(--border); color: var(--text); }

.intro-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.intro-item {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #374151;
  font-size: 13px;
}
[data-theme="dark"] .intro-item { color: var(--text); }
.intro-item .ic-box {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7c3aed;
  font-size: 12.5px;
  flex-shrink: 0;
}
[data-theme="dark"] .intro-item .ic-box { background: var(--input); border-color: var(--border); }

.pb-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
}
.pb-section-bar h3 {
  font-size: 15px;
  font-weight: 800;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="dark"] .pb-section-bar h3 { color: var(--text); }

.friends-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 6px 14px 14px;
}
.friends-grid a {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  width: 100%;
  text-align: center;
  padding: 6px 4px;
  border-radius: 14px;
  overflow: hidden;
  transition: background 0.18s ease, transform 0.18s ease;
}
.friends-grid a:hover {
  background: var(--hover);
  transform: translateY(-2px);
}
.friends-grid a img {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--input);
  display: block;
}
.friends-grid a span {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
[data-theme="dark"] .friends-grid a span {
  color: var(--text);
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px 14px 14px;
}
.photos-grid .ph {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  background: var(--input);
  position: relative;
  border: 1px solid var(--border);
}
.photos-grid .ph img,
.photos-grid .ph video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
  display: block;
}
.photos-grid .ph:hover img {
  transform: scale(1.05);
}

/* ---------- People / Friends Hub (Clean Single-Header Design) ---------- */
.friends-hub {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 36px;
}
.fh-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px 24px 0;
  margin-bottom: 20px;
}
.fh-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
}
.fh-title-group h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.fh-title-group p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}
.fh-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fh-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 38px;
  padding: 0 14px;
  min-width: 240px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fh-search:focus-within {
  border-color: var(--brand);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.fh-search input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 13.5px;
}
.fh-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px 0;
  overflow-x: auto;
}
.fh-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.fh-tab:hover {
  background: var(--hover);
  color: var(--text);
}
.fh-tab.active {
  background: var(--brand-grad);
  color: #ffffff;
  box-shadow: 0 4px 12px -2px rgba(139, 92, 246, 0.4);
}
.fh-count {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--input);
  color: var(--text);
}
.fh-tab.active .fh-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.fh-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.fh-toolbar h3 {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text);
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.person-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 14px 14px;
  text-align: center;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  position: relative;
}
.person-card::before {
  content: "";
  display: block;
  height: 54px;
  margin: 0 -14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.16) 0%, rgba(236, 72, 153, 0.14) 100%);
  border-bottom: 1px solid var(--border);
}
.person-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-border);
  box-shadow: var(--shadow-lg);
}
.person-card .pc-img {
  position: relative;
  width: 82px;
  height: 82px;
  margin: -41px auto 10px;
  z-index: 2;
  display: block;
  border-radius: 50%;
}
.person-card .pc-img img {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  border: 3.5px solid var(--card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: block;
}
.person-card .pc-img .presence {
  width: 16px;
  height: 16px;
  right: 5px;
  bottom: 5px;
  border: 2.5px solid var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  display: none;
}
.person-card .pc-img .presence.on {
  display: block;
}
.person-card .pc-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.person-card .pc-name { font-weight: 800; font-size: 15px; }
.person-card .pc-name:hover { color: var(--brand); }
.person-card .pc-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.person-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.person-row img { width: 50px; height: 50px; }
.person-row .grow { flex: 1; min-width: 0; }
.person-row .pr-name { font-weight: 700; font-size: 15px; }
.person-row .pr-name:hover { color: var(--brand); }
.person-row .pr-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.person-row + .person-row { border-top: 1px solid var(--border); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  font-weight: 700; font-size: 12.5px; box-shadow: var(--shadow); transition: all .15s;
}
.chip.active { background: var(--brand-grad); color: #fff; border-color: transparent; }

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 11px; align-items: center; padding: 8px 10px; border-radius: 12px; cursor: pointer; position: relative; }
.notif:hover { background: var(--hover); }
.notif .n-av { position: relative; flex-shrink: 0; }
.notif .n-av img { width: 44px; height: 44px; }
.notif .n-ic {
  position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: 10.5px; border: 2px solid var(--bg);
}
.notif .grow { flex: 1; min-width: 0; font-size: 13px; }
.notif .n-time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.notif.unread { background: var(--brand-soft); }
.notif.unread .n-time { color: var(--brand); font-weight: 700; }
.notif.unread::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0;
  animation: badgePulse 2s infinite;
}
.notif .n-actions { display: flex; gap: 6px; margin-top: 6px; }

/* ---------- Chat Dock & Redesigned Messenger Hub ---------- */
#chatDock { position: fixed; bottom: 12px; right: 18px; display: flex; gap: 12px; align-items: flex-end; z-index: 300; }
.chat-box {
  width: 320px; height: 420px; background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  --chat-grad: var(--brand-grad);
}

/* ==================== CUỘC GỌI & HIỆU ỨNG SÓNG ÂM RIPPLE (CALL ANIMATIONS) ==================== */
@keyframes callRipple1 {
  0% { transform: scale(1); opacity: 0.8; }
  50% { opacity: 0.45; }
  100% { transform: scale(1.65); opacity: 0; }
}
@keyframes callRipple2 {
  0% { transform: scale(1); opacity: 0.7; }
  50% { opacity: 0.35; }
  100% { transform: scale(2.15); opacity: 0; }
}
@keyframes callRipple3 {
  0% { transform: scale(1); opacity: 0.6; }
  50% { opacity: 0.25; }
  100% { transform: scale(2.65); opacity: 0; }
}
@keyframes ringShake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  10%, 30%, 50%, 70%, 90% { transform: rotate(-12deg) scale(1.1); }
  20%, 40%, 60%, 80% { transform: rotate(12deg) scale(1.1); }
}
@keyframes callBreatheGlow {
  0%, 100% { transform: scale(0.92); opacity: 0.45; filter: blur(35px); }
  50% { transform: scale(1.2); opacity: 0.85; filter: blur(55px); }
}
@keyframes bounceDots {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-5px); opacity: 1; }
}
@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ==================== GIAO DIỆN CỬA SỔ NỔI MESSENGER (GLASSMORPHISM) ==================== */
.call-modal-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(5, 3, 12, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fadeInModal 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.call-modal-card {
  position: relative; width: 100%; max-width: 375px;
  background: rgba(22, 16, 38, 0.88);
  backdrop-filter: blur(36px) saturate(190%);
  -webkit-backdrop-filter: blur(36px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px; padding: 18px 22px 24px;
  text-align: center; overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65), 0 0 50px rgba(139, 92, 246, 0.22);
  display: flex; flex-direction: column;
}
.call-modal-card.is-video {
  max-width: 410px;
  height: 560px;
  max-height: 88vh;
  padding: 0;
  background: #090614;
}
.call-outgoing-bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1); z-index: 1;
}
.call-video-cam-off-placeholder {
  position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(circle at center, #1f1638 0%, #0a0614 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.call-outgoing-video-overlay {
  position: relative; z-index: 3; display: flex; flex-direction: column;
  justify-content: space-between; height: 100%; width: 100%;
  padding: 18px 20px 22px; box-sizing: border-box;
  background: linear-gradient(to bottom, rgba(8, 5, 18, 0.78) 0%, rgba(8, 5, 18, 0.2) 32%, rgba(8, 5, 18, 0.35) 65%, rgba(8, 5, 18, 0.92) 100%);
}
.call-recipient-pip {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 12px;
}
.call-recipient-pip .call-avatar-wrap {
  width: 78px; height: 78px; margin: 0 auto 10px;
}
.call-card-topbar {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-bottom: 20px; z-index: 3; position: relative;
}
.call-card-title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; color: #a78bfa;
  background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 4px 11px; border-radius: 999px; letter-spacing: 0.3px;
}
.call-top-actions {
  display: flex; align-items: center; gap: 6px;
}
.call-top-btn {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.7);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  cursor: pointer; transition: all 0.15s ease;
}
.call-top-btn:hover {
  background: rgba(255, 255, 255, 0.2); color: #fff; transform: scale(1.08);
}
.call-top-btn.close:hover {
  background: rgba(244, 63, 94, 0.35); color: #f43f5e;
}
.call-ambient-glow {
  position: absolute; top: 12%; left: 50%; width: 200px; height: 200px;
  margin-left: -100px; border-radius: 50%;
  background: radial-gradient(circle, #8b5cf6 0%, #ec4899 70%, transparent 100%);
  animation: callBreatheGlow 3s infinite ease-in-out;
  pointer-events: none; z-index: 1;
}
.call-avatar-wrap {
  position: relative; width: 100px; height: 100px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.call-ripple-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(168, 85, 247, 0.65);
  pointer-events: none;
}
.call-ripple-ring.ring-1 {
  animation: callRipple1 2.4s infinite cubic-bezier(0, 0.2, 0.8, 1);
}
.call-ripple-ring.ring-2 {
  animation: callRipple2 2.4s infinite cubic-bezier(0, 0.2, 0.8, 1) 0.8s;
  border-color: rgba(236, 72, 153, 0.55);
}
.call-ripple-ring.ring-3 {
  animation: callRipple3 2.4s infinite cubic-bezier(0, 0.2, 0.8, 1) 1.6s;
  border-color: rgba(139, 92, 246, 0.45);
}
.call-avatar-img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  position: relative; z-index: 3;
}
.call-user-name {
  font-size: 20px; font-weight: 800; color: #fff; margin: 0 0 5px; z-index: 2; position: relative;
  letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-status-text {
  font-size: 13.5px; color: #c4b5fd; margin: 0 0 14px; z-index: 2; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.call-dot {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: #c4b5fd; margin: 0 1px;
}
.call-dot:nth-child(1) { animation: bounceDots 1.4s infinite ease-in-out; }
.call-dot:nth-child(2) { animation: bounceDots 1.4s infinite ease-in-out 0.2s; }
.call-dot:nth-child(3) { animation: bounceDots 1.4s infinite ease-in-out 0.4s; }

.call-e2ee-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(16, 185, 129, 0.12); color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  margin: 0 auto 16px; z-index: 2; position: relative;
}

/* Messenger Control Tools Grid */
.call-tools-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 14px; z-index: 3; position: relative; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.call-tool-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.call-tool-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.call-tool-btn:hover {
  background: rgba(255, 255, 255, 0.22); transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.call-tool-btn.active-off {
  background: #f43f5e; border-color: #f43f5e; color: #fff;
}
.call-tool-btn.hangup {
  background: #f43f5e; border-color: #f43f5e; color: #fff;
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.55);
}
.call-tool-btn.hangup:hover {
  background: #e11d48; transform: translateY(-2px) scale(1.06);
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.7);
}
.call-tool-label {
  font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.7);
}

/* Incoming Call Action Row (Từ chối & Trả lời) */
.call-incoming-row {
  display: flex; align-items: center; justify-content: space-around;
  margin-top: 16px; z-index: 3; position: relative; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.call-incoming-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.call-incoming-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  color: #fff; font-size: 22px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.call-incoming-btn.decline {
  background: #f43f5e; box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
}
.call-incoming-btn.decline:hover {
  transform: translateY(-2px) scale(1.08); background: #e11d48;
}
.call-incoming-btn.accept {
  background: #10b981; box-shadow: 0 6px 24px rgba(16, 185, 129, 0.55);
  animation: ringShake 2s infinite ease-in-out;
}
.call-incoming-btn.accept:hover {
  transform: translateY(-2px) scale(1.08); background: #059669;
}
.call-incoming-label {
  font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.85);
}

.call-actions-row {
  display: flex; align-items: center; justify-content: center; gap: 32px;
  z-index: 2; position: relative;
}
.call-action-btn {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  color: #fff; font-size: 24px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
.call-action-btn:hover {
  transform: scale(1.12);
  filter: brightness(1.1);
}
.call-action-btn.end-call {
  background: #f43f5e;
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.5);
}
.call-action-btn.accept-call {
  background: #10b981;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
  animation: ringShake 2s infinite ease-in-out;
}

/* Video Connected View */
.call-connected-frame {
  position: relative; width: 100%; max-width: 960px; height: 82vh;
  background: #0a0614; border-radius: 24px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.9);
  display: flex; flex-direction: column;
}
.call-connected-body {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #0c0817;
}
.call-video-remote {
  width: 100%; height: 100%; object-fit: cover;
}
.call-video-local-pip {
  position: absolute; bottom: 85px; right: 24px; width: 180px; height: 110px;
  border-radius: 14px; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); background: #18122b; z-index: 15;
}
.call-video-local-pip video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.call-audio-connected {
  text-align: center; z-index: 2; position: relative;
}
.call-waves-container {
  display: flex; align-items: center; justify-content: center; gap: 5px; height: 36px; margin: 18px 0;
}
.call-wave-bar {
  width: 5px; border-radius: 999px; background: linear-gradient(to top, #8b5cf6, #ec4899);
  animation: callWaveAnim 1.2s infinite ease-in-out;
}
.call-wave-bar:nth-child(1) { height: 12px; animation-delay: 0.1s; }
.call-wave-bar:nth-child(2) { height: 26px; animation-delay: 0.3s; }
.call-wave-bar:nth-child(3) { height: 34px; animation-delay: 0.15s; }
.call-wave-bar:nth-child(4) { height: 20px; animation-delay: 0.4s; }
.call-wave-bar:nth-child(5) { height: 10px; animation-delay: 0.2s; }

@keyframes callWaveAnim {
  0%, 100% { transform: scaleY(0.35); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}

.call-control-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px; display: flex; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88), transparent);
  z-index: 20;
}
.call-control-btn {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.18s ease;
}
.call-control-btn:hover {
  background: rgba(255, 255, 255, 0.25); transform: scale(1.08);
}
.call-control-btn.active-off {
  background: #f43f5e; color: #fff;
}
.call-control-btn.hangup {
  background: #f43f5e; font-size: 20px; width: 54px; height: 54px;
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.55);
}
.call-control-btn.hangup:hover {
  transform: scale(1.12);
  filter: brightness(1.1);
}
.call-duration-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff;
  margin-bottom: 12px;
}
.call-duration-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #10b981;
  box-shadow: 0 0 8px #10b981; animation: pulseDot 1.5s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
@media (min-width: 769px) {
  #chatDock {
    bottom: 0;
    right: 24px;
    gap: 14px;
  }
  #chatDock .chat-box {
    width: 360px;
    height: 490px;
    max-height: calc(100vh - 40px);
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
  #chatDock .chat-box.min {
    height: 50px !important;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  #chatDock .chat-head {
    height: 52px;
    padding: 8px 14px;
    box-sizing: border-box;
  }
  #chatDock .chat-head img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
  }
  #chatDock .chat-head .grow b {
    font-size: 14px;
    font-weight: 700;
  }
  #chatDock .chat-head .grow small {
    font-size: 11px;
    color: var(--muted);
  }
  #chatDock .chat-head .head-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  #chatDock .chat-head .icon-btn.plain {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
  }
  #chatDock .chat-head .icon-btn.plain:hover {
    background: rgba(139, 92, 246, 0.22);
    color: #fff;
  }
  #chatDock .chat-head .icon-btn.plain[data-act="chat-close"]:hover {
    background: rgba(244, 63, 94, 0.25);
    color: #f43f5e;
  }

  /* Compact Intro Card inside Floating PC Chat */
  #chatDock .chat-intro {
    padding: 12px 14px;
    margin: 4px auto 10px;
    max-width: 250px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: none;
  }
  #chatDock .chat-intro img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto 6px;
    border: 2px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  #chatDock .chat-intro b {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
  }
  #chatDock .chat-intro .small {
    font-size: 11.5px;
    color: var(--muted);
  }

  /* Footer on PC - Clean input with no clipping */
  #chatDock .chat-foot {
    height: 52px;
    padding: 8px 10px;
    gap: 6px;
    box-sizing: border-box;
  }
  #chatDock .chat-foot input {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 18px;
  }
  #chatDock .chat-foot > button,
  #chatDock .chat-foot .chat-attach-btn,
  #chatDock .chat-foot .emoji-toggle,
  #chatDock .chat-foot .quick-heart-btn,
  #chatDock .chat-foot button[type="submit"] {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    flex-shrink: 0;
  }
  #chatDock .chat-foot .quick-heart-btn {
    display: inline-flex;
    color: #f43f5e;
    transition: transform 0.15s ease;
  }
  #chatDock .chat-foot .quick-heart-btn:hover {
    transform: scale(1.15);
  }
  #chatDock .chat-foot button[type="submit"] {
    display: none;
  }

  /* When input has text, hide heart and show submit */
  #chatDock .chat-foot:has(input:not(:placeholder-shown)) .quick-heart-btn {
    display: none !important;
  }
  #chatDock .chat-foot:has(input:not(:placeholder-shown)) button[type="submit"] {
    display: inline-flex !important;
  }
}
.chat-box.min { height: auto; border-radius: 14px; }
.chat-box.min .chat-body, .chat-box.min .chat-foot, .chat-box.min .typing, .chat-box.min .chat-quick-bar { display: none; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.chat-head img { width: 34px; height: 34px; }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head .grow b { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .grow small { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chat-head .head-actions { display: flex; align-items: center; gap: 6px; }
.chat-head .icon-btn.plain { width: 32px; height: 32px; color: var(--brand); background: var(--brand-soft); border-radius: 50%; }
.chat-head .icon-btn.plain:hover { background: var(--brand-grad); color: #fff; }
.chat-head .icon-btn.plain.active { background: var(--brand-grad); color: #fff; box-shadow: 0 3px 10px rgba(124, 58, 237, 0.35); }

.chat-body {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px;
  background: rgba(139, 92, 246, 0.025);
}
.chat-intro {
  text-align: center; padding: 18px 14px; margin: 0 auto 10px; max-width: 320px;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow);
}
.chat-intro img { width: 64px; height: 64px; margin: 0 auto 8px; border: 3px solid var(--card); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.chat-intro b { display: block; font-size: 15.5px; font-weight: 800; margin-bottom: 2px; }
.chat-e2ee-pill {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(16, 185, 129, 0.12); color: var(--green);
}

.msg {
  max-width: 72%; padding: 9px 14px; border-radius: 16px 16px 16px 4px;
  word-wrap: break-word; white-space: pre-wrap; align-self: flex-start;
  background: var(--card); border: 1px solid var(--border); font-size: 14px;
  box-shadow: 0 2px 6px rgba(24, 16, 56, 0.04); line-height: 1.45;
}
.msg.me {
  align-self: flex-end; border-radius: 16px 16px 4px 16px;
  background: var(--chat-grad, var(--brand-grad)); color: #fff; border: none;
  box-shadow: 0 4px 12px -2px rgba(124, 58, 237, 0.38);
}
.msg.has-media {
  padding: 6px; overflow: hidden;
}
.msg.has-media .msg-caption {
  padding: 6px 8px 4px; display: block;
}
.msg-media-grid {
  display: grid; gap: 4px; border-radius: 12px; overflow: hidden;
  max-width: 280px;
}
.msg-media-grid.count-1 { grid-template-columns: 1fr; }
.msg-media-grid.count-2, .msg-media-grid.count-3, .msg-media-grid.count-4 { grid-template-columns: repeat(2, 1fr); }
.msg-media-item {
  position: relative; background: #0f172a; border-radius: 10px; overflow: hidden;
  cursor: pointer; display: block;
}
.msg-media-item img {
  width: 100%; max-height: 240px; object-fit: cover; display: block;
  transition: transform 0.2s ease;
}
.msg-media-item:hover img { transform: scale(1.02); }
.msg-media-item video {
  width: 100%; max-height: 240px; display: block; background: #000; border-radius: 10px;
}

.chat-media-preview {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--input); border-top: 1px solid var(--border);
  overflow-x: auto;
}
.chat-media-preview.hidden { display: none; }
.cmp-item {
  position: relative; width: 58px; height: 58px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--border); background: #000; flex-shrink: 0;
}
.cmp-item img, .cmp-item video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.cmp-item .cmp-badge {
  position: absolute; bottom: 3px; left: 4px; font-size: 9px;
  color: #fff; background: rgba(0,0,0,0.65); padding: 1px 4px; border-radius: 4px;
}
.cmp-item .cmp-del {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: rgba(15, 23, 42, 0.78); color: #fff;
  font-size: 10px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
}
.cmp-item .cmp-del:hover { background: var(--red); }

.ci-shared-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.ci-shared-thumb {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--input);
  border: 1px solid var(--border); cursor: pointer; position: relative;
}
.ci-shared-thumb img, .ci-shared-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ci-shared-thumb .vid-ic {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.28); color: #fff; font-size: 16px; pointer-events: none;
}
.msg-time {
  text-align: center; font-size: 11px; font-weight: 600; color: var(--muted);
  margin: 10px auto 4px; padding: 2px 10px; border-radius: 999px; background: var(--input);
}
.msg-seen { align-self: flex-end; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.typing { font-size: 12px; color: var(--brand); font-weight: 600; padding: 2px 16px; height: 18px; }

.chat-quick-bar {
  display: flex; align-items: center; gap: 6px; padding: 6px 14px;
  overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--border);
  background: var(--card);
}
.chat-quick-bar::-webkit-scrollbar { display: none; }
.chat-quick-chip {
  padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--input); border: 1px solid var(--border); color: var(--text);
  white-space: nowrap; transition: all 0.15s ease;
}
.chat-quick-chip:hover {
  background: var(--brand-soft); color: var(--brand); border-color: var(--neon-border);
}

.chat-foot {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--card); position: relative;
}
.chat-attach-wrap {
  position: relative; display: inline-flex; flex-shrink: 0;
}
.chat-attach-btn {
  background: var(--brand-soft); color: var(--brand);
}
.chat-attach-btn.open {
  background: var(--brand-grad); color: #fff !important;
}
.chat-attach-menu {
  position: absolute; bottom: calc(100% + 10px); left: 0;
  width: 225px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 6px; display: flex; flex-direction: column; gap: 4px; z-index: 999;
  animation: popUpMenu 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-attach-menu.hidden { display: none !important; }

/* Các nút chọn loại ảnh/video bên trong menu đính kèm */
.chat-attach-menu .cam-item,
.chat-foot .chat-attach-menu .cam-item,
#chatDock .chat-foot .chat-attach-menu .cam-item {
  width: 100% !important;
  height: auto !important;
  min-height: 48px !important;
  border-radius: 12px !important;
  padding: 8px 10px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  text-align: left !important;
  justify-content: flex-start !important;
  color: var(--text) !important;
  font-size: 13px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: none !important;
}
.chat-attach-menu .cam-item:hover,
.chat-foot .chat-attach-menu .cam-item:hover,
#chatDock .chat-foot .chat-attach-menu .cam-item:hover {
  background: var(--hover, rgba(255, 255, 255, 0.08)) !important;
}

.chat-attach-menu .cam-ic {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 15px !important;
  flex-shrink: 0 !important;
}
.chat-attach-menu .cam-ic.img { background: rgba(139, 92, 246, 0.16) !important; color: #a78bfa !important; }
.chat-attach-menu .cam-ic.vid { background: rgba(236, 72, 153, 0.16) !important; color: #f472b6 !important; }

.chat-attach-menu .cam-txt {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  min-width: 0 !important;
  white-space: normal !important;
}
.chat-attach-menu .cam-txt b {
  display: block !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
}
.chat-attach-menu .cam-txt small {
  display: block !important;
  font-size: 11px !important;
  color: var(--muted) !important;
  margin-top: 2px !important;
  white-space: nowrap !important;
}

.chat-foot input {
  flex: 1; background: var(--input); border: 1px solid var(--border);
  border-radius: 999px; height: 38px; padding: 0 15px; outline: none; font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-foot input:focus { border-color: var(--brand); background: var(--card); box-shadow: 0 0 0 3px var(--brand-soft); }

.chat-foot > button,
.chat-foot .chat-attach-btn,
.chat-foot .emoji-toggle,
.chat-foot .quick-heart-btn,
.chat-foot button[type="submit"] {
  color: var(--brand); width: 36px; height: 36px; border-radius: 50%;
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease; flex-shrink: 0;
}
.chat-foot > button:hover,
.chat-foot .chat-attach-btn:hover,
.chat-foot .emoji-toggle:hover { background: var(--brand-soft); }
.chat-foot button[type="submit"] {
  background: var(--chat-grad, var(--brand-grad)); color: #fff;
  box-shadow: 0 3px 10px -2px rgba(124, 58, 237, 0.45);
}
.chat-foot button[type="submit"]:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* 3-Column Messenger Page */
.messenger-page {
  display: flex; height: calc(100vh - var(--header) - 32px);
  max-width: 1260px; margin: 16px auto; padding: 0 18px; gap: 16px;
}
.conv-list {
  width: 320px; background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
}
.cl-head {
  padding: 16px 16px 10px;
}
.cl-title-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.cl-title-row h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.cl-e2ee-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(16, 185, 129, 0.12); color: var(--green);
}
.cl-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--input); border: 1px solid var(--border);
  border-radius: 999px; height: 38px; padding: 0 14px;
}
.cl-search:focus-within { border-color: var(--brand); background: var(--card); box-shadow: 0 0 0 3px var(--brand-soft); }
.cl-search input { border: none; outline: none; background: transparent; flex: 1; font-size: 13.5px; }

.cl-active-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 8px 16px 10px;
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.cl-active-strip::-webkit-scrollbar { display: none; }
.cl-active-user {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 54px; flex-shrink: 0; cursor: pointer; text-align: center;
}
.cl-active-user span.name {
  font-size: 11px; font-weight: 600; color: var(--text);
  width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cl-tabs {
  display: flex; gap: 6px; padding: 8px 14px 4px;
}
.cl-tab {
  flex: 1; height: 30px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  color: var(--muted); background: var(--input); transition: all 0.15s ease;
}
.cl-tab.active {
  background: var(--brand-soft); color: var(--brand);
}

.cl-scroll {
  flex: 1; overflow-y: auto; padding: 6px 10px 12px;
}
.cl-scroll::-webkit-scrollbar { width: 4px; }
.conv {
  display: flex; gap: 11px; align-items: center; padding: 9px 10px;
  border-radius: 14px; cursor: pointer; transition: all .15s; margin-bottom: 2px;
}
.conv:hover { background: var(--hover); }
.conv.active {
  background: var(--brand-soft);
  border: 1px solid rgba(139, 92, 246, 0.22);
}
.conv img { width: 46px; height: 46px; }
.conv .grow { flex: 1; min-width: 0; }
.conv .c-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.conv .c-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .c-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.conv .c-last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv.unread .c-last { color: var(--text); font-weight: 700; }
.conv.unread::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

.conv-main {
  flex: 1; display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
  min-width: 0; overflow: hidden;
}
.conv-main .chat-box { width: 100%; height: 100%; border-radius: 0; border: none; box-shadow: none; background: transparent; }
.conv-main .chat-head { padding: 12px 18px; cursor: default; }
.conv-main .chat-head img { width: 40px; height: 40px; }

/* Right Conversation Info Panel */
.conv-info {
  width: 295px; background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex-shrink: 0;
}
.conv-info.hidden { display: none; }
.ci-profile {
  text-align: center; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.ci-profile .av-wrap { margin: 0 auto 8px; display: inline-flex; }
.ci-profile img { width: 76px; height: 76px; }
.ci-profile h3 { font-size: 16px; font-weight: 800; }
.ci-profile .ci-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ci-actions {
  display: flex; justify-content: center; gap: 12px; margin-top: 12px;
}
.ci-act-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; color: var(--text);
}
.ci-act-btn span.ic {
  width: 36px; height: 36px; border-radius: 50%; background: var(--input);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-size: 14px; transition: all 0.15s ease;
}
.ci-act-btn:hover span.ic { background: var(--brand-grad); color: #fff; border-color: transparent; }
.ci-act-btn.muted span.ic {
  background: rgba(244, 63, 94, 0.12); color: var(--red); border-color: rgba(244, 63, 94, 0.28);
}
.ci-act-btn.muted:hover span.ic {
  background: var(--red); color: #fff; border-color: transparent;
}
.ci-act-btn.muted .txt {
  color: var(--red); font-weight: 700;
}

.ci-section {
  border-bottom: 1px solid var(--border); padding-bottom: 14px;
}
.ci-section:last-child { border-bottom: none; padding-bottom: 0; }
.ci-section-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.ci-section-title {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px;
}
.ci-section-head .ci-section-title { margin-bottom: 0; }
.ci-theme-badge {
  font-size: 11px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); padding: 2px 8px; border-radius: 999px;
}
.ci-themes {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  justify-items: center; padding: 4px 2px;
}
.ci-swatch {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: none; padding: 0; background-origin: border-box; background-clip: border-box;
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 13px;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.ci-swatch:hover { transform: scale(1.12); }
.ci-swatch.active {
  color: #fff;
  box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--text), 0 4px 10px rgba(15, 23, 42, 0.18);
  transform: scale(1.06);
}

/* Redesigned Privacy & Security Panel in Chat */
.ci-priv-wrap {
  display: flex; flex-direction: column; gap: 8px;
}
.ci-e2ee-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(139, 92, 246, 0.07) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px; padding: 11px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.ci-e2ee-top {
  display: flex; align-items: center; gap: 10px;
}
.ci-e2ee-ic {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(16, 185, 129, 0.15); color: #059669;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.ci-e2ee-top b { font-size: 12.5px; color: var(--text); display: block; }
.ci-e2ee-top span { font-size: 11px; color: #059669; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.ci-e2ee-code {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.85); border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: 9px; padding: 5px 9px; font-family: monospace; font-size: 11px;
  font-weight: 700; color: var(--text);
}
.ci-e2ee-code button {
  font-family: inherit; font-size: 11px; font-weight: 700; color: var(--brand);
  display: inline-flex; align-items: center; gap: 4px;
}
.ci-e2ee-code button:hover { text-decoration: underline; }

.ci-priv-list {
  display: flex; flex-direction: column; gap: 6px;
}
.ci-priv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px;
  background: var(--input); border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ci-priv-item:hover { border-color: rgba(139, 92, 246, 0.3); }
.ci-priv-ic {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--brand); display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.ci-priv-text { flex: 1; min-width: 0; }
.ci-priv-text b { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); }
.ci-priv-text small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ci-mini-switch {
  width: 36px; height: 20px; border-radius: 999px;
  background: #cbd5e1; position: relative; cursor: pointer;
  transition: background 0.2s ease; flex-shrink: 0; border: none; padding: 0;
}
.ci-mini-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s ease;
}
.ci-mini-switch.on { background: var(--brand-grad); }
.ci-mini-switch.on::after { transform: translateX(16px); }

.ci-priv-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 2px;
}
.ci-priv-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-radius: 10px; font-size: 11.5px; font-weight: 700;
  background: var(--input); border: 1px solid var(--border); color: var(--text);
  transition: all 0.15s ease;
}
.ci-priv-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: rgba(139, 92, 246, 0.3); }
.ci-priv-btn.danger { color: var(--red); }
.ci-priv-btn.danger:hover { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.3); color: var(--red); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: calc(var(--rail-w) + 16px); bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 700; transition: left 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
.toast {
  background: var(--card);
  box-shadow: var(--shadow-lg); border-radius: 14px; padding: 10px 12px; width: 300px;
  display: flex; gap: 10px; align-items: center; cursor: pointer; animation: slide .25s;
  border: 1px solid var(--border); border-left: 4px solid var(--brand);
}
.toast img { width: 38px; height: 38px; }
.toast .grow { flex: 1; font-size: 12.5px; }
@keyframes slide { from { transform: translateX(-120%); } }

/* ---------- Mobile Helper Buttons (Default Hidden on Desktop) ---------- */
.chat-back-btn,
.ci-close-btn {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.chat-back-btn:hover,
.ci-close-btn:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: rgba(139, 92, 246, 0.28);
}
.ci-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
}

/* ================= SETTINGS & SECURITY HUB (UNIFIED MODERN LAYOUT) ================= */
.settings-hub {
  max-width: 1080px;
  margin: 20px auto 38px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.st-hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.st-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--brand-grad);
}
.st-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.st-hero-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
.st-hero-user img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--card);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.22);
}
.st-hero-meta h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.st-hero-meta p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.st-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.st-tabs-bar::-webkit-scrollbar { display: none; }
.st-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--input);
  border: 1px solid transparent;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.st-tab-pill i { font-size: 14px; }
.st-tab-pill:hover {
  color: var(--brand);
  background: var(--brand-soft);
}
.st-tab-pill.active {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 4px 14px -3px rgba(139, 92, 246, 0.48);
}

.st-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.st-dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: pulseWave 2s infinite; }

.st-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.st-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.st-grid-2 > .st-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.st-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-width: 0;
  overflow: hidden;
}
.st-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.st-card-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.st-circle-ic {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand-soft);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.st-circle-ic i {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.st-card-title h3 { font-size: 15px; font-weight: 800; color: var(--text); }
.st-card-title p { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* Brand Gradient Switch */
.st-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  border: none;
}
[data-theme="dark"] .st-switch { background: #332d4b; }
.st-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.st-switch.on {
  background: var(--brand-grad);
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.35);
}
.st-switch.on::after { transform: translateX(20px); }

.st-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.st-row-item > div:first-child { min-width: 0; flex: 1; }
.st-row-item:first-child { border-top: none; padding-top: 0; }
.st-row-item:last-child { padding-bottom: 0; }
.st-row-item b { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.st-row-item span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.st-select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  background: var(--input);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.st-select:focus { border-color: var(--brand); }

/* Sessions Table (Device + Location + Action) */
.st-table-wrap { overflow-x: auto; margin: 0 -20px -18px; border-top: 1px solid var(--border); }
.st-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.st-table th {
  padding: 10px 20px;
  background: var(--input);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
.st-table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.st-table tr:last-child td { border-bottom: none; }
.st-table tr:hover td { background: var(--hover); }

.st-theme-card {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: var(--input);
  transition: all 0.18s ease;
}
.st-theme-card:hover { border-color: rgba(139, 92, 246, 0.4); }
.st-theme-card.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.st-theme-preview {
  height: 68px;
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 10px;
  display: flex;
  gap: 8px;
  border: 1px solid rgba(0,0,0,0.08);
}
.st-theme-preview.light { background: #f8f9fa; }
.st-theme-preview.dark  { background: #0f0b1d; border-color: rgba(255,255,255,0.1); }
.st-theme-preview .tp-rail {
  width: 18px; border-radius: 5px; background: linear-gradient(135deg, #8b5cf6, #ec4899);
}
.st-theme-preview .tp-main {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
}
.st-theme-preview.light .tp-bar { height: 14px; border-radius: 5px; background: #ffffff; border: 1px solid #e5e7eb; }
.st-theme-preview.dark  .tp-bar { height: 14px; border-radius: 5px; background: #1c1632; border: 1px solid #2e254d; }

/* ================= COMPREHENSIVE RESPONSIVE DESIGN (PC, TABLET & MOBILE) ================= */

/* 1. Large Laptop / Small Desktop (<= 1200px) */
@media (max-width: 1200px) {
  .layout-3 {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    padding: 18px 16px;
  }
  .messenger-page {
    position: relative;
    padding: 0 14px;
    gap: 12px;
  }
  .conv-list {
    width: 280px;
  }
  /* Make Info Panel overlay cleanly on smaller laptops/tablets so chat area isn't squished */
  .conv-info {
    position: absolute;
    top: 0;
    right: 14px;
    bottom: 0;
    width: 310px;
    z-index: 40;
    box-shadow: var(--shadow-lg);
  }
  .ci-close-btn {
    display: inline-flex;
  }
}

/* 2. Tablet Landscape (<= 980px) */
@media (max-width: 980px) {
  .layout-3 {
    grid-template-columns: minmax(0, 680px);
    justify-content: center;
  }
  .sidebar-right {
    display: none;
  }
  .hide-sm {
    display: none;
  }
  .st-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Desktop Helpers for Settings & Notifications ---------- */
.st-pw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.st-pw-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.notif-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.notif-readall-btn {
  height: 34px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 700;
}

/* 3. Tablet Portrait & Large Phones (<= 820px) */
@media (max-width: 820px) {
  /* Profile Page on Mobile & Tablet */
  .profile-header {
    padding: 0 12px;
    margin-top: 12px;
  }
  .profile-body {
    grid-template-columns: 1fr;
    padding: 0 12px;
    margin: 12px auto 24px;
    gap: 12px;
  }
  /* Hide duplicate left sidebar in Posts tab on mobile since Bio & Chips are already in the Hero card */
  .pb-left {
    display: none;
  }
  .cover {
    height: 156px;
  }
  .cover-btn {
    top: 12px;
    right: 12px;
    bottom: auto;
    height: 32px;
    padding: 0 11px;
    font-size: 12px;
    border-radius: 999px;
  }
  .profile-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 16px 14px;
    gap: 12px;
  }
  .profile-main-left {
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
    width: 100%;
    gap: 8px;
  }
  .profile-avatar {
    margin-top: -54px;
  }
  .profile-avatar img {
    width: 98px;
    height: 98px;
  }
  .pi-text {
    width: 100%;
    min-width: 0;
  }
  .pi-name-row {
    justify-content: center;
  }
  .pi-text h1 {
    font-size: 20px;
  }
  .pi-bio {
    margin: 6px auto 0;
    font-size: 13.5px;
  }
  .pi-chips {
    justify-content: center;
    margin-top: 8px;
    gap: 6px;
  }
  .pi-chip {
    padding: 3px 9px;
    font-size: 11.5px;
  }
  .pi-right-col {
    align-items: stretch;
    width: 100%;
    gap: 10px;
  }
  .pi-stats {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    padding: 8px 4px;
    border-radius: 14px;
  }
  .pi-actions {
    justify-content: center;
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .pi-actions .pi-btn-main,
  .pi-actions .pi-btn-sec,
  .pi-actions > .btn:not(.pi-btn-icon) {
    flex: 1 1 0%;
    min-width: 0;
    justify-content: center;
    height: 38px;
    font-size: 13px;
    border-radius: 12px;
  }
  .pi-actions .pi-btn-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
  }
  .profile-tabs {
    margin: 0 12px;
    padding: 8px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: hidden;
  }
  .profile-tabs a {
    min-width: 0;
    justify-content: center;
    padding: 8px 6px;
    font-size: 12px;
    border-radius: 10px;
    gap: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Messenger Single-Pane Switcher on Mobile/Tablet */
  .messenger-page {
    height: calc(100vh - 20px);
    margin: 10px auto;
    padding: 0 10px;
  }
  .conv-list {
    width: 100%;
  }
  .messenger-page.has-chat .conv-list {
    display: none;
  }
  .messenger-page:not(.has-chat) .conv-main {
    display: none;
  }
  .chat-back-btn {
    display: inline-flex;
  }
  .conv-info {
    right: 10px;
    width: calc(100% - 20px);
    max-width: 340px;
  }

  /* Friends Hub */
  .friends-hub {
    margin: 10px auto 24px;
    padding: 0 12px;
  }
  .fh-header {
    padding: 16px 16px 0;
    border-radius: 18px;
    margin-bottom: 14px;
  }
  .fh-top-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-bottom: 12px;
  }
  .fh-title-group h1 {
    font-size: 19px;
  }
  .fh-title-group p {
    font-size: 12.5px;
  }
  .fh-controls {
    width: 100%;
  }
  .fh-search {
    width: 100%;
    min-width: 0;
  }
  .fh-search input,
  .fh-search input:focus {
    width: 100%;
  }
  .fh-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0;
    overflow: hidden;
  }
  .fh-tab {
    min-width: 0;
    justify-content: center;
    padding: 8px 6px;
    font-size: 12px;
    gap: 5px;
    border-radius: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .fh-count {
    padding: 1px 6px;
    font-size: 10.5px;
  }

  /* Settings Hub */
  .settings-hub {
    margin: 10px auto 24px;
    padding: 0 12px;
  }
  .st-hero-card {
    padding: 16px 16px 0;
    border-radius: 18px;
  }
  .st-hero-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 14px;
  }
  .st-hero-top > label.btn {
    width: 100%;
    justify-content: center;
  }
  .st-tabs-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 0;
    overflow: hidden;
  }
  .st-tab-pill {
    min-width: 0;
    justify-content: center;
    padding: 9px 8px;
    font-size: 12px;
    border-radius: 11px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .st-card {
    padding: 15px;
    border-radius: 18px;
  }
  .st-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .st-card-head > .btn {
    width: 100%;
    justify-content: center;
  }
  .st-pw-grid,
  .st-form-grid-3,
  .st-form-grid-2 {
    grid-template-columns: 1fr;
  }
  .st-pw-submit .btn {
    width: 100%;
    justify-content: center;
  }

  /* Transform Active Devices Table into Stacked Mobile Cards */
  .st-table-wrap {
    border: none;
    background: transparent;
  }
  .st-table,
  .st-table tbody {
    display: block;
    width: 100%;
  }
  .st-table thead {
    display: none;
  }
  .st-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .st-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
  }
  .st-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: none;
    text-align: left !important;
  }
}

/* ---------- Mobile Header & Floating Bottom Dock (Hidden on Desktop) ---------- */
.mobile-header,
.mobile-bottom-nav {
  display: none;
}

/* 4. Mobile Phones & Small Tablets (<= 768px) */
@media (max-width: 768px) {
  /* Hide the left vertical rail on mobile and give #main 100% full width */
  .app-rail {
    display: none !important;
  }
  #main {
    padding-left: 0 !important;
    padding-top: 62px !important;
    padding-bottom: 92px !important;
  }

  /* --- Sleek Mobile Top Header (100% Locked Geometry Across All Pages) --- */
  .mobile-header {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: 58px;
    padding: 0 12px;
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.05);
    z-index: 500;
    box-sizing: border-box;
  }
  .mh-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  .mh-brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 13.5px;
  }
  .mh-brand-name {
    display: none !important;
  }

  /* Mobile Search Box in Header — Always exact same width on every page */
  .mh-search {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    position: relative;
  }
  .mh-search-input {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 38px;
    padding: 0 13px;
    border-radius: 999px;
    background: var(--input);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  }
  .mh-search.open .mh-search-input,
  .mh-search-input:focus-within {
    background: var(--card);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
  }
  .mh-search-input i {
    font-size: 12.5px;
    color: var(--muted);
  }
  .mh-search-input input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 13px;
    color: var(--text);
  }
  .mh-search-input input:focus {
    outline: none;
    box-shadow: none;
  }
  .mh-search .dropdown {
    position: fixed;
    top: 62px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 600;
  }

  /* Mobile Top Right Actions */
  .mh-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .mh-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.18s ease;
  }
  .mh-icon-btn.active,
  .mh-icon-btn:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: rgba(139, 92, 246, 0.3);
  }
  .mh-icon-btn .badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card);
  }
  .mh-icon-btn .badge:empty {
    display: none;
  }
  .mh-me-wrap {
    position: relative;
  }
  .mh-avatar-btn {
    position: relative;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.28);
    background: transparent;
    display: inline-flex;
  }
  .mh-avatar-btn .avatar {
    width: 34px;
    height: 34px;
  }
  .mh-me-drop {
    position: fixed;
    top: 62px;
    right: 12px;
    left: auto;
    width: min(260px, calc(100vw - 24px));
    z-index: 600;
  }

  /* --- Floating Detached Bottom Navigation Bar (iOS Dock + Pill Highlight + Center FAB) --- */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 10px;
    height: 68px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 26px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 10px rgba(139, 92, 246, 0.08);
    z-index: 500;
  }
  [data-theme="dark"] .mobile-bottom-nav {
    background: rgba(24, 19, 42, 0.94);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  }

  .mbn-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 54px;
    min-width: 48px;
    border-radius: 18px;
    color: #64748b;
    background: transparent;
    text-decoration: none;
    transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mbn-item:active {
    transform: scale(0.93);
  }
  .mbn-ic {
    position: relative;
    width: 34px;
    height: 26px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.22s ease;
  }
  .mbn-lbl {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.1px;
    transition: all 0.2s ease;
  }

  /* Pill Highlight Active State */
  .mbn-item.active {
    color: var(--brand);
    background: rgba(139, 92, 246, 0.11);
  }
  .mbn-item.active .mbn-ic {
    color: var(--brand);
    transform: translateY(-1px);
  }
  .mbn-item.active .mbn-lbl {
    color: var(--brand);
    font-weight: 700;
  }

  /* Unread Badge on Bottom Nav Icons */
  .mbn-ic .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card);
  }
  .mbn-ic .badge:empty {
    display: none;
  }

  /* Center Elevated Create Button */
  .mbn-create {
    position: relative;
  }
  .mbn-fab {
    width: 42px;
    height: 42px;
    margin-top: -16px;
    border-radius: 50%;
    background: var(--brand-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.42);
    border: 3px solid var(--card);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease;
  }
  .mbn-create:hover .mbn-fab,
  .mbn-create:active .mbn-fab {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 22px rgba(236, 72, 153, 0.48);
  }
  .mbn-create .mbn-lbl {
    color: var(--brand);
    font-weight: 700;
    margin-top: 1px;
  }

  /* --- Unified Outer Container Width & Padding Across ALL Mobile Pages --- */
  .layout-3,
  .friends-hub,
  .settings-hub,
  .page,
  .page-narrow {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12px 12px 24px !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }
  .layout-3 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }
  .profile-header {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12px 12px 0 !important;
    box-sizing: border-box !important;
  }
  .profile-body {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    margin: 0 auto !important;
    padding: 12px 12px 24px !important;
    gap: 12px;
    box-sizing: border-box !important;
  }

  /* Prevent Any Sub-Tab or Action Bar from Overflowing Viewport Width */
  .fh-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 0;
    overflow: hidden;
  }
  .fh-tab {
    min-width: 0;
    width: 100%;
    justify-content: center;
    padding: 8px 4px;
    font-size: 12px;
    gap: 4px;
    border-radius: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .fh-tab span:not(.fh-count) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .profile-tabs {
    margin: 0 12px;
    padding: 8px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: hidden;
  }
  .profile-tabs a {
    min-width: 0;
    width: 100%;
    justify-content: center;
    padding: 8px 4px;
    font-size: 12px;
    border-radius: 10px;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .st-tabs-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 0;
    overflow: hidden;
  }
  .st-tab-pill {
    min-width: 0;
    width: 100%;
    justify-content: center;
    padding: 9px 6px;
    font-size: 12px;
    border-radius: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Stories, Composer & Post Action Buttons on Mobile */
  .stories-bar,
  .story-bar {
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    max-width: 100%;
  }
  .story-card,
  .story {
    width: 102px;
    flex: 0 0 102px;
    height: 164px;
  }
  .composer-top {
    padding: 12px 12px 10px;
  }
  .composer-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0 12px;
    padding: 10px 0 12px;
  }
  .composer-actions button {
    min-width: 0;
    width: 100%;
    justify-content: center;
    padding: 0 4px;
    height: 36px;
    font-size: 12px;
    border-radius: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .composer-actions button span {
    display: inline !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .post {
    border-radius: 18px;
    max-width: 100%;
    overflow: hidden;
  }
  .post-head {
    padding: 12px 12px 6px;
  }
  .post-content,
  .post-text {
    padding: 4px 12px 10px;
    font-size: 14px;
  }
  .post-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0 12px;
  }
  .post-actions > * {
    min-width: 0;
  }
  .post-actions button.pa,
  .post-actions .act {
    min-width: 0;
    width: 100%;
    justify-content: center;
    height: 36px;
    padding: 0 4px;
    border-radius: 11px;
    background: var(--input);
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* --- Friends Hub & Person Cards (2-Column Balanced Grid on Mobile) --- */
  .people-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .person-card {
    padding: 0 10px 12px;
    border-radius: 16px;
  }
  .person-card::before {
    height: 44px;
    margin: 0 -10px;
  }
  .person-card .pc-img {
    width: 66px;
    height: 66px;
    margin: -33px auto 8px;
  }
  .person-card .pc-img img {
    width: 66px;
    height: 66px;
  }
  .person-card .pc-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .person-card .pc-actions .btn {
    width: 100%;
    justify-content: center;
    height: 33px;
    font-size: 12px;
    padding: 0 8px;
  }
  .person-row {
    padding: 10px 12px;
    gap: 10px;
  }
  .person-row img {
    width: 46px !important;
    height: 46px !important;
  }
  .person-row .pr-name {
    font-size: 14px;
  }
  .person-row .pr-actions {
    gap: 6px;
  }
  .person-row .pr-actions .btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  /* --- Notifications Page on Mobile --- */
  .notif-page-card {
    padding: 14px;
    border-radius: 18px;
  }
  .notif {
    padding: 10px 8px;
    gap: 10px;
    align-items: flex-start;
  }
  .notif .n-av img {
    width: 44px !important;
    height: 44px !important;
  }
  .notif .n-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
  }
  .notif .n-actions .btn {
    width: 100%;
    justify-content: center;
    height: 32px;
    font-size: 12px;
  }

  /* --- Messenger Page on Mobile --- */
  .messenger-page {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100vh - 154px);
    height: calc(100dvh - 154px);
    margin: 0 auto !important;
    padding: 8px 12px 0 !important;
    box-sizing: border-box !important;
  }
  .conv-list,
  .conv-main {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px;
  }
  .conv-main .chat-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 0;
  }
  .conv-main .chat-head {
    width: 100%;
    padding: 11px 14px;
    gap: 10px;
  }
  .conv-main .chat-head img {
    width: 38px;
    height: 38px;
  }
  .conv-main .chat-body {
    width: 100%;
    padding: 14px 12px;
  }
  .conv-main .chat-intro {
    width: 100%;
    max-width: 280px;
    padding: 14px 12px;
  }
  .conv-main .msg {
    max-width: 82%;
    font-size: 13.5px;
    padding: 9px 13px;
  }
  .conv-main .msg-media-grid {
    max-width: 235px;
  }
  .conv-main .chat-quick-bar {
    width: 100%;
    padding: 7px 12px;
  }
  .conv-main .chat-foot {
    width: 100%;
    padding: 9px 12px;
    gap: 7px;
  }
  .conv-main .chat-foot input {
    flex: 1 1 0%;
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    font-size: 13.5px;
  }
  .conv-main .chat-foot button {
    width: 36px;
    height: 36px;
  }
  /* Full-Screen Sheet for Conversation Info Panel on Mobile */
  .conv-info {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 18px 16px 96px;
    z-index: 520;
    box-shadow: 0 -10px 34px rgba(15, 23, 42, 0.18);
  }

  /* --- Modals as Native Mobile Bottom Sheets --- */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
  }
  .modal-head {
    padding: 13px 44px;
  }
  .modal-body {
    padding: 14px;
  }

  /* --- Auth Pages (Login / Register / Forgot / Reset) on Mobile --- */
  .auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 16px 14px 12px;
  }
  .auth-brand {
    text-align: center;
    align-items: center;
    width: 100%;
  }
  .auth-brand .brand-pill {
    padding: 4px 11px;
    font-size: 11px;
    margin-bottom: 10px;
  }
  .auth-logo-row {
    gap: 10px;
    justify-content: center;
  }
  .auth-logo-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 15px;
  }
  .auth-brand .logo-text {
    font-size: 30px;
    letter-spacing: -1.2px;
  }
  .auth-brand p,
  .auth-tagline {
    font-size: 13px;
    line-height: 1.48;
    margin-top: 7px;
    max-width: 330px;
    text-wrap: balance;
  }
  .auth-mobile-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
  }
  .auth-m-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.11);
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
  }
  .auth-m-chip i {
    color: #c084fc;
    font-size: 10.5px;
  }
  .auth-features {
    display: none;
  }
  .auth-card-wrap {
    width: 100%;
  }
  .auth-card {
    padding: 20px 18px;
    border-radius: 22px;
    max-width: 400px;
  }
  .auth-card-head {
    margin-bottom: 14px;
  }
  .auth-card h2 {
    font-size: 20px;
  }
  .auth-card .sub {
    font-size: 12.5px;
  }
  .auth-field {
    margin-bottom: 10px;
  }
  .auth-card input:not([type="checkbox"]) {
    height: 46px;
    font-size: 15px;
    border-radius: 13px;
    padding: 0 14px 0 40px;
  }
  .auth-meta-row {
    margin: 2px 2px 12px;
    font-size: 12.5px;
  }
  .auth-remember {
    font-size: 12.5px;
  }
  .auth-card .forgot {
    font-size: 12.5px;
  }
  .auth-submit-btn {
    height: 46px !important;
    font-size: 14.5px !important;
    border-radius: 13px !important;
  }
  .or {
    margin: 13px 0 11px;
    font-size: 10.5px;
  }
  .auth-card .create {
    margin-top: 13px;
    padding-top: 12px;
    font-size: 13px;
  }
  .auth-simple {
    padding: 18px 14px 12px;
  }
  .auth-simple-brand {
    margin-bottom: 14px;
  }
  .auth-simple .logo-text {
    font-size: 28px;
  }
  .auth-card .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .auth-card .row > * {
    min-width: 0;
  }
  .auth-simple .actions,
  .auth-actions-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 9px;
    width: 100%;
    margin-top: 12px;
  }
  .auth-simple .actions .btn,
  .auth-actions-row .btn {
    width: 100%;
    min-width: 0;
    flex-shrink: 1;
    height: 46px;
    justify-content: center;
    font-size: 13.5px;
    border-radius: 13px;
    padding: 0 10px;
  }
  .auth-footer {
    padding: 10px 12px 14px;
    font-size: 11px;
  }

  /* Chat Dock & Toasts positioned above the Floating Bottom Dock */
  #chatDock {
    right: 10px;
    bottom: 84px;
  }
  #chatDock .chat-box {
    width: calc(100vw - 20px);
    max-width: 330px;
  }
  #chatDock .chat-box:not(:last-child) {
    display: none;
  }
  #toasts {
    left: 12px;
    right: 12px;
    bottom: 86px;
  }
  .toast {
    width: 100%;
    max-width: 340px;
  }
}

/* 5. Small Mobile Phones (<= 480px) */
@media (max-width: 480px) {
  .mobile-bottom-nav {
    left: 10px;
    right: 10px;
    bottom: 8px;
    height: 64px;
    border-radius: 22px;
    padding: 4px 6px;
  }
  .mbn-fab {
    width: 40px;
    height: 40px;
    margin-top: -14px;
  }
  .mbn-lbl {
    font-size: 10.5px;
  }
  .composer-actions button {
    font-size: 11.5px;
    padding: 0 3px;
  }
  .post-actions button.pa,
  .post-actions .act {
    font-size: 12px;
    padding: 0 4px;
  }
  .fh-tab {
    padding: 7px 4px;
    font-size: 11.5px;
  }
  .fh-tab i {
    display: none;
  }
  .profile-tabs a {
    font-size: 11.5px;
    padding: 7px 4px;
  }
  .profile-tabs a i {
    display: none;
  }
  .st-tab-pill {
    padding: 8px 6px;
    font-size: 11.5px;
  }
  .st-dob-selects {
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 6px;
  }
  .st-dob-selects select {
    padding: 8px 6px;
    font-size: 12.5px;
  }
  .msg {
    max-width: 85%;
  }
}

/* ================= SMOOTH PAGE & TAB TRANSITIONS (PC & MOBILE) ================= */

/* 1. Top Gradient Route Progress Bar */
.route-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed 0%, #ec4899 50%, #38bdf8 100%);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.55);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}
.route-progress-bar.active {
  width: 72%;
  opacity: 1;
}
.route-progress-bar.done {
  width: 100%;
  opacity: 0;
}

/* 2. Main Page Directional Spring Animations */
#main {
  overflow-x: clip;
  transition: padding-left 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.16s ease;
}
#main.page-switching {
  opacity: 0.92;
}

@keyframes pageEnterForward {
  0% {
    opacity: 0;
    transform: translate3d(18px, 8px, 0) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pageEnterBackward {
  0% {
    opacity: 0;
    transform: translate3d(-18px, 8px, 0) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pageEnterFade {
  0% {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes subTabEnter {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.page-anim-forward {
  animation: pageEnterForward 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

.page-anim-backward {
  animation: pageEnterBackward 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

.page-anim-fade,
.page-anim-sub {
  animation: pageEnterFade 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

.subtab-enter {
  animation: subTabEnter 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

/* 3. Smooth Card & Item Cascade Animations */
@keyframes cardCascadeIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.post,
.person-card,
.st-card,
.notif {
  animation: cardCascadeIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.people-grid .person-card:nth-child(2),
#postList .post:nth-child(2),
.st-body .st-card:nth-child(2) {
  animation-delay: 0.03s;
}
.people-grid .person-card:nth-child(3),
#postList .post:nth-child(3),
.st-body .st-card:nth-child(3) {
  animation-delay: 0.06s;
}
.people-grid .person-card:nth-child(4),
#postList .post:nth-child(4) {
  animation-delay: 0.09s;
}
.people-grid .person-card:nth-child(5) {
  animation-delay: 0.12s;
}
.people-grid .person-card:nth-child(6) {
  animation-delay: 0.15s;
}

/* 4. Conversation Info Panel & Mobile Bottom Sheet Slide Animations */
@keyframes convInfoSlideIn {
  0% {
    opacity: 0;
    transform: translate3d(16px, 0, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.conv-info:not(.hidden) {
  animation: convInfoSlideIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 768px) {
  @keyframes mobileSheetUp {
    0% {
      opacity: 0;
      transform: translate3d(0, 28px, 0);
    }
    100% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }
  .modal {
    animation: mobileSheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .conv-info:not(.hidden) {
    animation: mobileSheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-anim-forward,
  .page-anim-backward,
  .page-anim-fade,
  .page-anim-sub,
  .subtab-enter,
  .post,
  .person-card,
  .st-card,
  .notif {
    animation: none !important;
  }
}

/* ================= CINEMATIC INTRO SPLASH SCREEN (#appSplash) ================= */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f4fe;
  overflow: hidden;
  user-select: none;
  transition: opacity 0.46s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.46s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.46s;
}
.auth-page .app-splash,
[data-theme="dark"] .app-splash {
  background: #090614;
}
.app-splash.splash-hide {
  opacity: 0;
  transform: scale(1.045);
  visibility: hidden;
  pointer-events: none;
}

/* Glowing Ambient Background Orbs */
.splash-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(65px);
  opacity: 0.55;
  animation: splashOrbFloat 4s ease-in-out infinite alternate;
}
.splash-orb.orb-1 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.38) 0%, transparent 70%);
  top: -80px;
  left: -60px;
}
.splash-orb.orb-2 {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.32) 0%, transparent 70%);
  bottom: -90px;
  right: -70px;
  animation-delay: -1.5s;
}
.splash-orb.orb-3 {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.24) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
@keyframes splashOrbFloat {
  0%   { transform: scale(0.92) translate(0, 0); }
  100% { transform: scale(1.1) translate(16px, -14px); }
}

.splash-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

.splash-brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stage 1: Logo BS Emblem Pop & Shimmer */
.splash-logo-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: splashLogoPop 0.62s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.splash-logo-ring {
  position: absolute;
  inset: -6px;
  border-radius: 24px;
  border: 2px solid rgba(139, 92, 246, 0.45);
  animation: splashRingPulse 1.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.splash-logo-box {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 52%, #f43f5e 100%);
  box-shadow: 0 16px 36px -6px rgba(124, 58, 237, 0.55),
              0 0 0 3px rgba(255, 255, 255, 0.9) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.auth-page .splash-logo-box,
[data-theme="dark"] .splash-logo-box {
  box-shadow: 0 16px 40px -6px rgba(168, 85, 247, 0.65),
              0 0 0 2px rgba(255, 255, 255, 0.22) inset;
}
.splash-logo-box::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -120%;
  width: 75%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: rotate(25deg);
  animation: splashLogoShine 1.3s cubic-bezier(0.22, 1, 0.36, 1) 0.32s forwards;
}
.splash-logo-box span {
  color: #ffffff;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -1px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

@keyframes splashLogoPop {
  0% {
    opacity: 0;
    transform: scale(0.35) rotate(-14deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes splashRingPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

@keyframes splashLogoShine {
  0%   { left: -120%; }
  100% { left: 160%; }
}

/* Stage 2: Wordmark Unfolds & Reveals Full "BarrosSpace." Text */
.splash-wordmark {
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  animation: splashWordExpand 0.68s cubic-bezier(0.22, 1, 0.36, 1) 0.42s forwards;
}
@keyframes splashWordExpand {
  0% {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
  }
  100% {
    max-width: 340px;
    opacity: 1;
    margin-left: 14px;
  }
}

.splash-word-inner {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1.4px;
  line-height: 1.15;
  padding-right: 4px;
}

.sw-char {
  display: inline-block;
  color: #1e1b4b;
  opacity: 0;
  transform: translate3d(0, 22px, 0) scale(0.9);
  filter: blur(6px);
  animation: splashCharReveal 0.46s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(0.46s + var(--i) * 0.042s);
}
.auth-page .sw-char,
[data-theme="dark"] .sw-char {
  color: #f8fafc;
}
.sw-char.sw-accent {
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 60%, #f43f5e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-page .sw-char.sw-accent,
[data-theme="dark"] .sw-char.sw-accent {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 60%, #fb7185 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sw-char.sw-dot {
  color: #f43f5e;
}

@keyframes splashCharReveal {
  0% {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(0.9);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

/* Tagline & Progress Line */
.splash-tagline {
  margin-top: 14px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #6e6a85;
  opacity: 0;
  transform: translateY(8px);
  animation: splashSubFade 0.45s ease 0.92s forwards;
}
.auth-page .splash-tagline,
[data-theme="dark"] .splash-tagline {
  color: #a59ec4;
}

.splash-progress {
  margin-top: 18px;
  width: 170px;
  height: 4px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.14);
  overflow: hidden;
  opacity: 0;
  animation: splashSubFade 0.35s ease 0.55s forwards;
}
.splash-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed 0%, #ec4899 55%, #f43f5e 100%);
  animation: splashBarFill 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
}

@keyframes splashSubFade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes splashBarFill {
  0%   { width: 0%; }
  65%  { width: 78%; }
  100% { width: 100%; }
}

@media (max-width: 600px) {
  .splash-logo-wrap,
  .splash-logo-box {
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }
  .splash-logo-box span {
    font-size: 21px;
  }
  .splash-word-inner {
    font-size: 30px;
    letter-spacing: -1px;
  }
  @keyframes splashWordExpand {
    0%   { max-width: 0; opacity: 0; margin-left: 0; }
    100% { max-width: 240px; opacity: 1; margin-left: 11px; }
  }
  .splash-tagline {
    font-size: 10px;
    letter-spacing: 0.18em;
  }
}
