/* ─────────────────────────────────────────────────────────────
   ShukaHub redesign — Black, Orange, Gold (2026-06-04 v2)
   Brand-accurate dark theme with editorial typography.
   Pure visual layer, loaded after style.css.
   Disable: remove the <link> in index.html.

/* Remove Android WebView blue tap highlight on all elements */
* { -webkit-tap-highlight-color: transparent; }
   ───────────────────────────────────────────────────────────── */

/* ═══ PALETTE & TOKENS ═════════════════════════════════════════ */
:root {
  --accent:           #E07A00;   /* brand orange (primary) */
  --accent2:          #f0891a;   /* lifted orange (gradient stop) */
  --accent-deep:      #c46a00;   /* dark orange (active) */
  --accent-glow:      rgba(224, 122, 0, 0.4);
  --gold:             #E07A00;   /* same as accent — no yellow detour */
  --gold-soft:        #f0891a;
  --gold-deep:        #c46a00;
  --gold-glint:       #f4a23a;   /* one subtle warm highlight tone */

  --bg1:              #050505;
  --bg2:              #000000;
  --panel:            #0e0e10;
  --panel2:           #16161a;

  --ink-deep:         #000000;
  --ink-mid:          #0a0a0c;

  --text:             #ffffff;
  --muted:            #9a9a9d;
  --muted-warm:       #b8a888;
  --line:             #1a1a1f;
  --hairline:         rgba(224, 122, 0, 0.10);
  --hairline-strong:  rgba(224, 122, 0, 0.22);

  --bubble-me-text:   #1a1100;
  --mention:          #1F85FF;   /* negative of #E07A00 orange */

  --shadow-sm:        0 4px 12px -4px rgba(0, 0, 0, 0.6);
  --shadow:           0 12px 32px -12px rgba(0, 0, 0, 0.75);
  --shadow-lg:        0 28px 70px -20px rgba(0, 0, 0, 0.9);
  --gold-glow-sm:     0 0 0 1px rgba(224, 122, 0, 0.18), 0 4px 14px -4px rgba(224, 122, 0, 0.35);
  --gold-glow:        0 0 0 1px rgba(224, 122, 0, 0.25), 0 10px 28px -8px rgba(224, 122, 0, 0.45);
  --inner-hi:         inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --font-display:     'Fraunces', 'Source Serif Pro', Georgia, serif;
  --font-body:        'Sora', system-ui, -apple-system, sans-serif;
  --font-auth:        'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono:        'JetBrains Mono', ui-monospace, monospace;

  --ease-out:         cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:      cubic-bezier(0.65, 0, 0.35, 1);
}

/* ═══ GLOBAL TYPOGRAPHY ════════════════════════════════════════ */
*, *::before, *::after { font-family: var(--font-body); }
input, textarea, button, select { font-family: var(--font-body); }

/* ═══ BODY + BACKDROP ══════════════════════════════════════════ */
body {
  background:
    radial-gradient(ellipse 70vw 60vh at 15% -5%, rgba(224, 122, 0, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 60vw 55vh at 100% 105%, rgba(224, 122, 0, 0.05) 0%, transparent 55%),
    linear-gradient(180deg, #050505 0%, #000000 100%);
  background-attachment: fixed;
  color: var(--text);
  font-weight: 400;
  letter-spacing: 0.005em;
}

body:not(.logged-in)::before {
  background:
    radial-gradient(ellipse 60vw 50vh at 20% 15%, rgba(224, 122, 0, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 50vw 45vh at 85% 90%, rgba(224, 122, 0, 0.09) 0%, transparent 55%);
  animation: none;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  transform: none;
}

/* Subtle grain — kept at low opacity, no blend mode so it doesn't dim overlays */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: 0.025;
  pointer-events: none;
  z-index: 1;
}

/* ═══ AUTH SCREEN ══════════════════════════════════════════════ */
.auth-page {
  background:
    radial-gradient(ellipse 70vw 80vh at 80% 50%, rgba(224, 122, 0, 0.10) 0%, transparent 55%),
    #000000;
}

.auth-left {
  background:
    radial-gradient(ellipse at center, rgba(224, 122, 0, 0.16) 0%, transparent 65%),
    linear-gradient(160deg, #0c0c0e 0%, #000000 100%);
  border-right: 1px solid var(--hairline);
}

.auth-left::before,
.auth-left::after { display: none; }

.auth-brand-logo {
  filter: drop-shadow(0 4px 18px rgba(224, 122, 0, 0.32));
}

.auth-right {
  background: linear-gradient(180deg, #050505 0%, #000000 100%);
}

.auth-form-wrap { max-width: 380px; }

.auth-heading h1 {
  font-family: var(--font-auth);
  font-weight: 800;
  font-style: normal;
  font-size: 30px;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #ffffff;
  margin-bottom: 8px;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
}

.auth-heading p {
  font-family: var(--font-auth);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin-bottom: 28px;
}

.auth-tabs {
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  border-radius: 0;
  padding: 0;
  gap: 0;
  margin-bottom: 24px;
}

.auth-tab {
  background: transparent !important;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 18px;
  font-family: var(--font-auth);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0;
  font-style: normal;
  transition: color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}

.auth-tab:hover { color: var(--gold); }

.auth-tab-active,
.auth-tab.auth-tab-active {
  color: var(--gold) !important;
  border-bottom-color: var(--accent) !important;
  background: transparent !important;
}

.auth-field { margin-bottom: 18px; }

.auth-field label {
  font-family: var(--font-auth);
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

input[type="text"], input[type="password"], input[type="email"], textarea,
.auth-field input {
  background: rgba(255, 255, 255, 0.025) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: 10px !important;
  padding: 13px 16px !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-family: var(--font-auth) !important;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

input::placeholder, textarea::placeholder {
  color: rgba(154, 154, 157, 0.6);
  font-style: normal;
  font-family: var(--font-auth);
}

input:focus, textarea:focus,
.auth-field input:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  box-shadow: 0 0 0 3px rgba(224, 122, 0, 0.12) !important;
}

.auth-btn {
  background: #E07A00 !important;
  color: #ffffff !important;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-family: var(--font-auth);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  box-shadow:
    0 10px 26px -6px rgba(224, 122, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 34px -8px rgba(224, 122, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.auth-btn:active { transform: translateY(0); }

.auth-forgot-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-auth);
  font-style: normal;
  font-size: 13px;
  margin-top: 14px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  letter-spacing: 0;
  transition: color 0.2s var(--ease-out);
}

.auth-forgot-btn:hover { color: var(--gold); }

.auth-remember {
  font-family: var(--font-auth);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.auth-msg {
  font-size: 13px;
  font-family: var(--font-auth);
  font-style: normal;
  color: var(--accent);
  min-height: 18px;
  margin-bottom: 6px;
}

.auth-left-footer a {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.auth-github-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: #ffffff;
}

.auth-github-btn:hover {
  background: rgba(224, 122, 0, 0.08);
  color: var(--gold);
  border-color: var(--accent);
}

/* ═══ TOPBAR ═══════════════════════════════════════════════════ */
.topbar {
  background: #000000;
  border-bottom: 1px solid var(--hairline);
  height: 64px;
  padding: 0 22px;
  z-index: 1500;
}

.logo-img {
  height: 44px;
  filter: drop-shadow(0 2px 10px rgba(224, 122, 0, 0.3));
}

.logo span {
  background: none;
  color: var(--gold);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  padding: 0;
  letter-spacing: -0.01em;
}

.profileIcon {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 122, 0, 0.12), var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease-out), transform 0.2s var(--ease-out);
}

.profileIcon:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 5px rgba(224, 122, 0, 0.2), var(--shadow);
}

.gear-btn, #userSearchBtn { color: var(--accent); }
#userSearchBtn svg { color: var(--gold); }

.hamburger-btn {
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.hamburger-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(224, 122, 0, 0.06);
}

/* ═══ SIDEBAR ══════════════════════════════════════════════════ */
.sidebar {
  background: #000000;
  border-right: 1px solid var(--hairline);
  position: relative;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, var(--accent-glow) 40%, var(--accent-glow) 60%, transparent 100%);
  opacity: 0.3;
  pointer-events: none;
}

.sidebar-header h3,
.sidebar h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.sidebar-divider {
  background: var(--hairline);
  height: 1px;
  margin: 14px 16px;
}

.sidebar-dots-btn,
.sidebar-tools-btn {
  color: var(--muted);
  background: transparent;
  border: none;
}

.sidebar-dots-btn:hover,
.sidebar-tools-btn:hover {
  color: var(--gold);
  background: rgba(224, 122, 0, 0.06);
}

.sidebar-btn {
  background: rgba(224, 122, 0, 0.08);
  border: 1px solid rgba(224, 122, 0, 0.28);
  color: var(--gold);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: 8px;
  padding: 8px 18px;
  display: block;
  width: fit-content;
  margin: 6px auto 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.sidebar-btn:hover {
  background: rgba(224, 122, 0, 0.16);
  border-color: var(--accent);
  color: var(--gold-soft);
}

/* Friend / group rows — gold bar on hover */
#friendsList > div,
#groupsList > div,
.friend-row,
.group-row {
  position: relative;
  padding: 10px 16px 10px 20px;
  border-radius: 0;
  transition: background 0.2s var(--ease-out);
  cursor: pointer;
}

#friendsList > div::before,
#groupsList > div::before,
.friend-row::before,
.group-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--gold) 0%, var(--accent) 100%);
  transform: translateY(-50%);
  transition: height 0.25s var(--ease-out);
  border-radius: 0 2px 2px 0;
}

#friendsList > div:hover,
#groupsList > div:hover,
.friend-row:hover,
.group-row:hover {
  background: rgba(224, 122, 0, 0.04);
}

#friendsList > div:hover::before,
#groupsList > div:hover::before,
.friend-row:hover::before,
.group-row:hover::before {
  height: 60%;
}

.friend-name {
  color: #ffffff;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.unread-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.friend-row img,
.group-icon {
  border: 1.5px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}

/* ═══ CHAT CONTAINER + HEADER ══════════════════════════════════ */
.chatContainer { background-color: var(--ink-deep); }

.chatContainer::before {
  background:
    radial-gradient(ellipse 60vw 50vh at 50% 100%, rgba(224, 122, 0, 0.04) 0%, transparent 50%),
    rgba(0, 0, 0, 0.82);
}

/* Floating chat header — frameless, messages scroll behind it */
.chat-header {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  background: transparent !important;
  border: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 10px 18px !important;
  min-height: 0 !important;
  z-index: 9;
  pointer-events: none;
}

.chat-header > * { pointer-events: auto; }

#chatHeaderText {
  font-size: 16px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

.chatBox { padding-top: 52px !important; }

/* Extra darkening at top of chat — helps the floating title stay readable */
.chatContainer::before {
  background:
    radial-gradient(ellipse 60vw 50vh at 50% 100%, rgba(224, 122, 0, 0.04) 0%, transparent 50%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.94) 0%, rgba(0, 0, 0, 0.82) 90px, rgba(0, 0, 0, 0.82) 100%) !important;
}

/* Search button moved into friend's profile modal */
#chatSearchBtn { display: none !important; }

/* Hide hamburger on normal Android (valera keeps it). Swipe from left edge still opens drawer. */
body.capacitor-android:not(.valera-variant) .hamburger-btn { display: none !important; }

#chatHeaderText {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  font-variation-settings: 'opsz' 60;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--muted);
  transition: all 0.2s var(--ease-out);
}

.icon-btn:hover {
  color: var(--gold);
  border-color: var(--accent);
  background: rgba(224, 122, 0, 0.08);
}

.chat-placeholder {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--muted);
  letter-spacing: 0.01em;
  text-align: center;
  padding: 60px 20px;
}

/* ═══ MESSAGE BUBBLES — signature ═══════════════════════════════
   Your messages: gold-to-orange gradient with deep ink text.
   Other messages: pure black with subtle gold-tinted hairline.
   ───────────────────────────────────────────────────────────── */
.message {
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: 0.005em;
  padding: 11px 15px;
  border-radius: 14px;
  max-width: 70%;
  position: relative;
  font-weight: 400;
}

.message.me {
  background: var(--accent);
  color: var(--bubble-me-text);
  border: 1px solid var(--accent-deep);
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 22px -8px rgba(224, 122, 0, 0.4);
}

.message.other {
  background: linear-gradient(180deg, #0e0e10 0%, #050505 100%);
  color: var(--text);
  border: 1px solid var(--hairline);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm), var(--inner-hi);
}

.message.me .msg-text-content,
.message.me .reply-chip,
.message.me a {
  color: var(--bubble-me-text);
}

.message.me .reply-chip {
  background: rgba(26, 17, 0, 0.10);
  border-left-color: rgba(26, 17, 0, 0.40);
  color: rgba(26, 17, 0, 0.75);
}

.message.me .msg-edited {
  color: rgba(26, 17, 0, 0.5);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  margin-left: 6px;
}

.message.other .msg-edited {
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  margin-left: 6px;
}

.sender-label {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 12px;
  color: var(--gold);
  padding-left: 42px;
  letter-spacing: 0.02em;
}

.chat-avatar {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm);
}

.reply-chip {
  font-family: var(--font-body);
  background: rgba(224, 122, 0, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11.5px;
  padding: 4px 8px;
  margin-bottom: 6px;
}

.message-row-wrapper { animation: msgIn 0.35s var(--ease-out) backwards; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══ CHAT INPUT ═══════════════════════════════════════════════ */
/* Floating chat input — messages scroll *under* it, stay visible through */
.chatContainer { position: relative; }

.chatBox {
  padding-bottom: 84px !important;
}

.chat-footer {
  position: absolute !important;
  bottom: 0;
  left: 0;
  right: 0;
  background: transparent !important;
  border: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 8px 16px 14px;
  z-index: 10;
  pointer-events: none;  /* let clicks pass through the empty footer area */
}

.chat-footer > * { pointer-events: auto; }  /* but the pill + buttons stay clickable */

.message-row {
  background: rgba(18, 18, 22, 0.22) !important;
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  border: none !important;
  outline: none !important;
  border-radius: 26px;
  padding: 6px 6px 6px 18px;
  box-shadow:
    0 14px 30px -14px rgba(0, 0, 0, 0.55) !important;
  transition: background 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.message-row:focus-within {
  background: rgba(18, 18, 22, 0.32) !important;
  transform: translateY(-2px);
  border: none !important;
  outline: none !important;
  box-shadow:
    0 18px 40px -14px rgba(0, 0, 0, 0.7) !important;
}

/* Fade-out gradient above the floating input — visually separates without hiding */
.chatContainer::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 75%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
  z-index: 8;
}

.message-row #messageInput,
.message-row input,
.message-row textarea {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: 14.5px;
  padding: 8px 4px !important;
  font-family: var(--font-body) !important;
}

.message-row #messageInput::placeholder,
.message-row input::placeholder {
  color: rgba(154, 154, 157, 0.55);
  font-style: italic;
  font-family: var(--font-display);
}

.send-btn {
  background: #E07A00 !important;
  color: #1a1100 !important;
  border: none !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  box-shadow:
    0 6px 16px -4px rgba(224, 122, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.send-btn svg { color: #1a1100; fill: #1a1100; }

.send-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 10px 24px -4px rgba(224, 122, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.message-row .img-pick-btn,
.message-row button[type="button"]:not(.send-btn) {
  color: var(--muted);
  background: transparent;
  border: none;
  transition: color 0.2s var(--ease-out);
}

.message-row .img-pick-btn:hover { color: var(--gold); }

/* ═══ OVERLAYS — ensure modals and settings fully cover chat ═══ */
.modal-overlay {
  background: rgba(0, 0, 0, 0.88) !important;
  backdrop-filter: blur(14px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  z-index: 5000 !important;
}

.settings-overlay {
  background: rgba(0, 0, 0, 0.78) !important;
  backdrop-filter: blur(12px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  z-index: 9000 !important;
}

.modal-box {
  background: linear-gradient(180deg, #0e0e10 0%, #050505 100%) !important;
  border: 1px solid var(--hairline-strong);
  border-radius: 18px;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(224, 122, 0, 0.08),
    var(--inner-hi);
  padding: 28px;
  position: relative;
}

.modal-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-glow) 50%, transparent 100%);
  border-radius: 18px 18px 0 0;
  pointer-events: none;
}

.lightbox-close {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  width: 32px;
  height: 32px;
}

.lightbox-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.profile-modal-name,
#groupModalName {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  font-variation-settings: 'opsz' 80;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.profile-modal-bio,
#groupModalDesc {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ═══ SETTINGS MENU (must clearly sit above chat) ══════════════ */
.profileMenu {
  background: linear-gradient(180deg, #0e0e10 0%, #050505 100%) !important;
  border: 1px solid var(--hairline-strong) !important;
  border-radius: 16px;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(224, 122, 0, 0.10),
    var(--inner-hi);
  z-index: 9500 !important;
  position: absolute;
}

.menu-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 17px;
  color: var(--gold);
  letter-spacing: -0.01em;
}

.menu-label {
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.settings-tab {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 6px;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.settings-tab.active {
  color: var(--gold);
  border-bottom-color: var(--accent);
  background: transparent;
}

.settings-tabs {
  border-bottom: 1px solid var(--hairline);
  gap: 6px;
}

/* ─── Settings sections (cards) ─── */
.settings-section {
  background: linear-gradient(180deg, rgba(254, 139, 0, 0.025) 0%, rgba(255, 255, 255, 0.015) 100%) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: 14px !important;
  padding: 4px 16px !important;
  margin-top: 32px !important;
  margin-bottom: 10px !important;
  position: relative;
  box-shadow: var(--shadow-sm), var(--inner-hi);
  transition: border-color 0.25s var(--ease-out), background 0.25s var(--ease-out);
}

.settings-section:hover {
  border-color: rgba(224, 122, 0, 0.18) !important;
}

.settings-section-danger {
  border-color: rgba(255, 90, 90, 0.18) !important;
  background: linear-gradient(180deg, rgba(255, 90, 90, 0.04) 0%, transparent 100%) !important;
}

.settings-section-label {
  position: absolute !important;
  top: -10px !important;
  left: 14px !important;
  font-family: var(--font-display) !important;
  font-style: italic !important;
  font-weight: 500 !important;
  font-size: 11px !important;
  color: var(--accent) !important;
  letter-spacing: 0.06em !important;
  text-transform: lowercase !important;
  margin: 0 !important;
  padding: 0 8px !important;
  background: #0a0a0c !important;
  border-radius: 4px !important;
}

/* ─── Settings rows ─── */
.settings-row {
  padding: 12px 0 !important;
  border-bottom: 1px solid var(--hairline) !important;
  border-radius: 0;
  transition: background 0.18s var(--ease-out) !important;
  margin: 0 -8px;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

.settings-row:hover {
  opacity: 1 !important;
  background: rgba(224, 122, 0, 0.05);
}

.settings-row-icon {
  background: rgba(224, 122, 0, 0.08) !important;
  border: 1px solid rgba(224, 122, 0, 0.18) !important;
  width: 34px !important;
  height: 34px !important;
  font-size: 15px !important;
}

.settings-row-text {
  font-family: var(--font-body) !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  letter-spacing: 0.005em !important;
  color: var(--text) !important;
}

.settings-row-arrow {
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 22px;
  opacity: 0.6;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.settings-row:hover .settings-row-arrow {
  opacity: 1;
  color: var(--accent);
  transform: translateX(3px);
}

.settings-row-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.settings-row-logout .settings-row-text { color: #ff8a65 !important; }
.settings-row-delete .settings-row-text { color: #ff5252 !important; }
.settings-row-logout .settings-row-icon { background: rgba(255, 138, 101, 0.10) !important; border-color: rgba(255, 138, 101, 0.22) !important; }
.settings-row-delete .settings-row-icon { background: rgba(255, 82, 82, 0.10) !important; border-color: rgba(255, 82, 82, 0.22) !important; }

/* ─── Toggle pill ─── */
.settings-toggle {
  width: 46px !important;
  height: 26px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 13px !important;
  border: 1px solid var(--hairline);
  transition: background 0.25s var(--ease-out), border-color 0.25s var(--ease-out) !important;
}

.settings-toggle::after {
  width: 20px !important;
  height: 20px !important;
  top: 2px !important;
  left: 2px !important;
  background: #f5f5f5 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45) !important;
  transition: transform 0.28s var(--ease-out), background 0.25s var(--ease-out) !important;
}

.settings-toggle.toggle-on {
  background: var(--accent) !important;
  border-color: var(--accent-deep) !important;
  box-shadow: 0 0 0 3px rgba(224, 122, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

.settings-toggle.toggle-on::after {
  transform: translateX(20px) !important;
  background: #ffffff !important;
}

/* ─── Decoration ring picker ─── */
.deco-option {
  border-radius: 12px !important;
  transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out) !important;
}

.deco-option:hover {
  border-color: rgba(224, 122, 0, 0.4) !important;
  transform: translateY(-2px);
}

.deco-option.active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(224, 122, 0, 0.2), var(--shadow-sm) !important;
}

.deco-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.deco-option.active .deco-label { color: var(--gold); }

/* ─── Section entry animation when settings opens ─── */
.settings-menu-open .settings-section { animation: settingsSectionIn 0.45s var(--ease-out) backwards; }
.settings-menu-open .settings-section:nth-of-type(1) { animation-delay: 0.05s; }
.settings-menu-open .settings-section:nth-of-type(2) { animation-delay: 0.10s; }
.settings-menu-open .settings-section:nth-of-type(3) { animation-delay: 0.15s; }
.settings-menu-open .settings-section:nth-of-type(4) { animation-delay: 0.20s; }
.settings-menu-open .settings-section:nth-of-type(5) { animation-delay: 0.25s; }

@keyframes settingsSectionIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── "Remember me" — make it actually readable ─── */
.auth-remember {
  color: var(--text) !important;
  font-size: 13px !important;
  opacity: 0.85;
}

.auth-remember input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.settings-profile-header {
  background: rgba(224, 122, 0, 0.04);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s var(--ease-out);
}

.settings-profile-header:hover {
  background: rgba(224, 122, 0, 0.07);
  border-color: rgba(224, 122, 0, 0.4);
}

.settings-profile-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: #ffffff;
}

.settings-profile-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Hide the "Get the App" section when already running inside the Android wrapper */
body.capacitor-android #getAppSection { display: none !important; }

/* Toggles — ON state.
 * NOTE: Use longhand `background-color` + `background-image` with literal hex values.
 * `background: var(...)` shorthand resolves longhand sub-properties via "pending
 * substitution" which cascades unreliably and ends up rendering as transparent. */
.settings-toggle.toggle-on,
.toggle-on,
[class*="toggle"][class*="-on"] {
  background-color: #E07A00 !important;
  background-image: linear-gradient(180deg, #f0891a 0%, #E07A00 100%) !important;
  color: #1a1100 !important;
  border-color: #E07A00 !important;
}

/* Search dropdown menus (search users, profile menu) — also sit above chat */
.search-menu,
#userSearchMenu,
#toolsMenu {
  z-index: 9500 !important;
}

/* ═══ GROUP LEAVE BUTTON ═══════════════════════════════════════ */
.group-modal-icon {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(224, 122, 0, 0.12);
}

.group-leave-btn {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* ═══ PINNED MSG BANNER ════════════════════════════════════════ */
.pinned-msg-banner {
  background: linear-gradient(90deg, rgba(224, 122, 0, 0.10) 0%, rgba(224, 122, 0, 0.04) 100%);
  border-bottom: 1px solid rgba(224, 122, 0, 0.25);
  color: var(--gold);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* ═══ WALLPAPER PICKER ═════════════════════════════════════════ */
.wallpaper-picker {
  background: linear-gradient(180deg, #0e0e10 0%, #050505 100%) !important;
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 9400 !important;
}

.wallpaper-picker-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  color: var(--gold);
}

.wallpaper-swatch {
  border-radius: 8px;
  border: 2px solid var(--hairline);
}

.wallpaper-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 122, 0, 0.2);
}

.wallpaper-remove-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
}

.wallpaper-remove-btn:hover {
  background: rgba(224, 122, 0, 0.06);
  color: var(--gold);
}

/* ═══ REACTIONS ════════════════════════════════════════════════ */
.reaction-picker {
  background: linear-gradient(180deg, #0e0e10 0%, #050505 100%);
  border: 1px solid var(--hairline-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 4px 6px;
}

.reaction-picker-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}

.reaction-picker-btn:hover {
  background: rgba(224, 122, 0, 0.14);
  transform: scale(1.18);
}

/* ═══ FILE CHIPS ═══════════════════════════════════════════════ */
.file-chip {
  background: rgba(224, 122, 0, 0.06);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}

.message.me .file-chip {
  background: rgba(26, 17, 0, 0.12);
  border-color: rgba(26, 17, 0, 0.25);
}

.file-chip-icon { color: var(--accent); }
.message.me .file-chip-icon { color: #1a1100; }

.file-chip-name {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.file-chip-dl {
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}

.message.me .file-chip-dl { color: #1a1100; }
.file-chip-dl:hover { transform: translateY(2px); }

/* ═══ SEARCH RESULTS ═══════════════════════════════════════════ */
.search-result-name {
  font-weight: 500;
  color: #ffffff;
  font-size: 14px;
}

.search-result-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.search-add-btn {
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--accent) 100%);
  border: none;
  color: #1a1100;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}

.search-add-btn:hover { transform: translateY(-1px); }

/* ═══ CHAT SEARCH BAR ══════════════════════════════════════════ */
.chat-search-bar {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 18px;
}

.chat-search-bar input {
  background: rgba(0, 0, 0, 0.5) !important;
  border: 1px solid var(--hairline) !important;
  color: #ffffff !important;
  font-size: 13px !important;
}

.chat-search-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* ═══ MESSAGE STATUS / TIMESTAMP ═══════════════════════════════ */
.msg-status,
.message-time,
.msg-time {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* ═══ SCROLLBARS ═══════════════════════════════════════════════ */
.chatBox::-webkit-scrollbar { width: 6px; }
.chatBox::-webkit-scrollbar-track { background: transparent; }
.chatBox::-webkit-scrollbar-thumb {
  background: rgba(224, 122, 0, 0.14);
  border-radius: 3px;
}
.chatBox::-webkit-scrollbar-thumb:hover { background: rgba(224, 122, 0, 0.4); }

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(224, 122, 0, 0.10);
  border-radius: 3px;
}

/* ═══ MENTIONS ═════════════════════════════════════════════════ */
.mention,
.msg-text-content a {
  color: var(--mention);
  text-decoration: none;
  border-bottom: 1px dotted var(--mention);
}

.message.me .mention {
  color: #0F4FAA;
  border-bottom-color: rgba(15, 79, 170, 0.5);
}

.message.me a {
  color: #4a2f00;
  border-bottom-color: rgba(74, 47, 0, 0.5);
}

/* ═══ NOTIFICATIONS ════════════════════════════════════════════ */
.in-app-notification,
[class*="notification"][class*="toast"] {
  background: linear-gradient(180deg, #0e0e10 0%, #050505 100%);
  border: 1px solid rgba(224, 122, 0, 0.35);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-family: var(--font-body);
}

/* ═══ PAGE LOAD ANIMATIONS ═════════════════════════════════════ */
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-heading {
  animation: pageReveal 0.7s var(--ease-out) backwards;
  animation-delay: 0.05s;
}

.auth-field:nth-of-type(1) { animation: pageReveal 0.6s var(--ease-out) backwards; animation-delay: 0.15s; }
.auth-field:nth-of-type(2) { animation: pageReveal 0.6s var(--ease-out) backwards; animation-delay: 0.22s; }
.auth-remember, .auth-msg  { animation: pageReveal 0.6s var(--ease-out) backwards; animation-delay: 0.30s; }
.auth-btn                  { animation: pageReveal 0.6s var(--ease-out) backwards; animation-delay: 0.35s; }
.auth-forgot-btn           { animation: pageReveal 0.6s var(--ease-out) backwards; animation-delay: 0.42s; }

/* ═══ LIGHT MODE (lightly tuned) ═══════════════════════════════ */
body.light-mode {
  --bg1: #faf6ed;
  --bg2: #f0e9d8;
  --panel: #ffffff;
  --panel2: #fbf6ea;
  --text: #0a0a0c;
  --muted: #6a5d4b;
  --line: #e8dcc4;
  --hairline: rgba(0, 0, 0, 0.08);
  background:
    radial-gradient(ellipse 80vw 60vh at 10% -10%, rgba(224, 122, 0, 0.16) 0%, transparent 55%),
    linear-gradient(180deg, #faf6ed 0%, #f0e9d8 100%);
}

body.light-mode .chatContainer { background-color: #faf6ed; }
body.light-mode .chatContainer::before { background: rgba(255, 252, 245, 0.55); }
body.light-mode .sidebar { background: #ffffff; border-right: 1px solid var(--hairline); }
body.light-mode .topbar { background: #ffffff; border-bottom: 1px solid var(--hairline); }
body.light-mode .modal-box { background: #ffffff !important; }
body.light-mode .profileMenu { background: #ffffff !important; }
body.light-mode .message.other {
  background: #ffffff;
  color: #0a0a0c;
  border: 1px solid var(--hairline);
}

/* ═══ SAVED MESSAGES SIDEBAR ROW ══════════════════════════════ */
.saved-msg-row {
  margin: 8px 8px 0;
  border-radius: 8px;
  background: rgba(224, 122, 0, 0.08);
  border: 1px solid rgba(224, 122, 0, 0.22);
  padding: 10px 14px !important;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.saved-msg-row::before { display: none; }

.saved-msg-row:hover {
  background: rgba(224, 122, 0, 0.14) !important;
  border-color: var(--accent) !important;
}

.saved-msg-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.saved-msg-row .friend-name { color: var(--gold); font-style: italic; font-family: var(--font-display); }

/* ═══ PRESENCE DOTS ════════════════════════════════════════════ */
.status-dot { display: none; transition: background 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out); }
.status-dot.online { display: block; background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.6); }
.status-dot.idle   { display: block; background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.55); }
.status-dot.dnd    { display: block; background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.55); }

/* Custom status text in profile modal */
.profile-modal-custom-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(254, 139, 0, 0.07);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 5px 12px 5px 8px;
  margin-top: 8px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--text);
}

.profile-modal-custom-status-emoji { font-style: normal; font-size: 15px; }

/* Presence picker in settings */
.presence-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.presence-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.presence-option:hover { border-color: rgba(254, 139, 0, 0.3); background: rgba(254, 139, 0, 0.04); }

.presence-option.active {
  border-color: var(--accent);
  background: rgba(254, 139, 0, 0.08);
  box-shadow: 0 0 0 2px rgba(254, 139, 0, 0.12);
}

.presence-option-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.presence-option-dot.online { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.55); }
.presence-option-dot.idle   { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.55); }
.presence-option-dot.dnd    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.55); }
.presence-option-dot.invisible { background: var(--muted); }

.presence-option-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.presence-option.active .presence-option-label { color: var(--gold); }

.custom-status-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
}

.custom-status-emoji {
  width: 44px !important;
  padding: 10px !important;
  text-align: center;
  font-size: 18px !important;
  flex-shrink: 0;
}

.custom-status-text {
  flex: 1;
  min-width: 0;
}

/* ═══ COLOR PICKER APPLY BUTTON FIX ═══════════════════════════ */
.cp-apply {
  width: auto !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  flex-shrink: 0;
}

/* ═══ DELETED MESSAGE TOMBSTONE ════════════════════════════════ */
.msg-deleted-bubble {
  background: transparent !important;
  border: 1px dashed var(--hairline) !important;
  box-shadow: none !important;
  color: var(--muted) !important;
  font-size: 13px !important;
  padding: 7px 14px !important;
  border-radius: 10px !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  pointer-events: none;
  max-width: 280px;
}

.msg-deleted-bubble em { font-style: italic; }
.msg-deleted-icon { font-style: normal; font-size: 13px; opacity: 0.7; }

/* ═══ DATE SEPARATORS ═════════════════════════════════════════ */
.msg-date-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 16px 10px;
  pointer-events: none;
}

.msg-date-sep-line {
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.msg-date-sep-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  padding: 2px 8px;
  background: rgba(224, 122, 0, 0.06);
  border: 1px solid rgba(224, 122, 0, 0.15);
  border-radius: 999px;
}

/* ═══ CUSTOM GROUP EMOJI ═══════════════════════════════════════ */
.custom-emoji-inline {
  width: 22px;
  height: 22px;
  vertical-align: -4px;
  object-fit: contain;
  border-radius: 3px;
  display: inline-block;
}

.custom-emoji-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 4px 8px;
  margin: 3px 4px 3px 0;
  font-size: 13px;
  color: var(--text);
}

.custom-emoji-chip code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ═══ MARKDOWN IN MESSAGES ═════════════════════════════════════ */
.msg-text-content strong { font-weight: 700; }
.msg-text-content em { font-style: italic; }
.msg-text-content s { opacity: 0.65; }

.msg-text-content code,
.msg-code {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  letter-spacing: 0;
}

.message.me code,
.message.me .msg-code {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.2);
  color: #1a1100;
}

.msg-codeblock {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 4px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-x: auto;
  max-width: 100%;
}

.message.me .msg-codeblock {
  background: rgba(0, 0, 0, 0.18);
  border-color: rgba(0, 0, 0, 0.22);
  color: #1a1100;
}

.msg-quote {
  display: inline-block;
  border-left: 3px solid var(--accent);
  padding: 1px 0 1px 10px;
  margin: 2px 0;
  font-style: italic;
  color: var(--muted);
  opacity: 0.95;
}

.message.me .msg-quote {
  border-left-color: rgba(0, 0, 0, 0.4);
  color: rgba(0, 0, 0, 0.7);
}

/* ═══ TOAST NOTIFICATIONS ══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}

.toast {
  pointer-events: auto;
  background: linear-gradient(180deg, #1a1626 0%, #0e0b17 100%);
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  padding: 12px 16px 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(254, 139, 0, 0.08);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  min-width: 220px;
  max-width: 360px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.toast.toast-show { opacity: 1; transform: translateX(0); }
.toast.toast-hide { opacity: 0; transform: translateY(-8px); }

.toast-icon {
  width: 24px; height: 24px;
  min-width: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  font-style: normal;
}

.toast-info  { border-color: rgba(224, 122, 0, 0.25); }
.toast-info  .toast-icon { background: rgba(224, 122, 0, 0.15); color: var(--accent); font-style: italic; }

.toast-success { border-color: rgba(82, 200, 120, 0.30); }
.toast-success .toast-icon { background: rgba(82, 200, 120, 0.18); color: #6ed98a; }

.toast-warning { border-color: rgba(255, 184, 71, 0.30); }
.toast-warning .toast-icon { background: rgba(255, 184, 71, 0.18); color: #ffcc66; }

.toast-error { border-color: rgba(255, 82, 82, 0.32); }
.toast-error .toast-icon { background: rgba(255, 82, 82, 0.18); color: #ff7070; }

.toast-msg { flex: 1; line-height: 1.4; }

@media (max-width: 600px) {
  .toast-container { left: 12px; right: 12px; bottom: 88px; align-items: stretch; }
  .toast { min-width: 0; max-width: 100%; }
}

/* ═══ CONFIRM MODAL ════════════════════════════════════════════ */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out);
}

.confirm-modal-overlay.confirm-modal-open { opacity: 1; }

.confirm-modal-box {
  background: linear-gradient(180deg, #1a1626 0%, #0e0b17 100%);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(254, 139, 0, 0.10);
  padding: 24px;
  min-width: 280px;
  max-width: 420px;
  width: 100%;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s var(--ease-out);
}

.confirm-modal-open .confirm-modal-box { transform: scale(1) translateY(0); }

.confirm-modal-danger { border-color: rgba(255, 82, 82, 0.35); }

.confirm-modal-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 20px;
  font-variation-settings: 'opsz' 80;
  color: var(--cream, #ffffff);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.confirm-modal-msg {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirm-modal-cancel,
.confirm-modal-ok {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), background 0.2s var(--ease-out);
  border: 1px solid transparent;
}

.confirm-modal-cancel {
  background: transparent;
  color: var(--muted);
  border-color: var(--hairline-strong);
}

.confirm-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.confirm-modal-ok {
  background: var(--accent);
  color: #1a1100;
  border-color: var(--accent-deep);
  box-shadow: 0 6px 16px -4px rgba(224, 122, 0, 0.35);
}

.confirm-modal-ok:hover { transform: translateY(-1px); }

.confirm-modal-ok-danger {
  background: linear-gradient(180deg, #ff5252 0%, #c91f1f 100%);
  color: #ffffff;
  border-color: #c91f1f;
  box-shadow: 0 6px 16px -4px rgba(255, 82, 82, 0.45);
}

/* ═══ MOBILE TUNING ════════════════════════════════════════════ */
@media (max-width: 768px) {
  .auth-heading h1 { font-size: 32px; }
  #chatHeaderText { font-size: 17px; }
  .message { max-width: 82%; font-size: 14px; }
}

/* ═══ MOBILE AUTH OVERFLOW FIX ═════════════════════════════════ */
html, body { overflow-x: hidden; }

@media (max-width: 880px) {
  .auth-right {
    padding: 28px 18px !important;
    width: 100% !important;
    left: 0 !important;
    overflow-x: hidden;
  }
  .auth-form-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .auth-tabs {
    width: 100%;
    box-sizing: border-box;
  }
  .auth-tab {
    min-width: 0;
    padding: 10px 6px !important;
    font-size: 14px !important;
  }
  .auth-field {
    width: 100%;
    box-sizing: border-box;
  }
  .auth-field input,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .auth-btn {
    width: 100% !important;
    box-sizing: border-box;
  }
}

/* ─── GOOGLE SIGN-IN BUTTON ──────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}

.auth-google-btn {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff !important;
  color: #1a1a1a !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: var(--font-body) !important;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
  transition: background 0.15s, box-shadow 0.15s;
  padding: 0 16px !important;
  margin-top: 2px;
}
.auth-google-btn:hover {
  background: #f5f5f5 !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4) !important;
}
.auth-google-btn:active {
  transform: scale(0.98);
}

@media (max-width: 500px) {
  .auth-heading h1 { font-size: 28px; }
  .auth-right { padding: 20px 14px !important; }
  .auth-brand-logo { height: 80px; }
}
