/* ═══════════════════════════════════════════════════════════════════════════
   WIPED MESSENGER — App UI
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Core palette */
  --bg:           #080810;
  --bg-1:         #0e0e1a;
  --bg-2:         #141424;
  --bg-3:         #1a1a2e;
  --bg-hover:     #1e1e32;
  --bg-glass:     rgba(14, 14, 26, 0.7);

  /* Borders */
  --border:       rgba(120, 100, 255, 0.12);
  --border-soft:  rgba(255, 255, 255, 0.05);
  --border-glow:  rgba(124, 106, 247, 0.35);

  /* Text */
  --text:         #f0effe;
  --text-2:       #8b88b0;
  --text-3:       #44415e;

  /* Brand */
  --accent:       #7c6af7;
  --accent-2:     #9b8cff;
  --accent-dark:  #5b4dd6;
  --accent-soft:  rgba(124, 106, 247, 0.12);
  --accent-glow:  rgba(124, 106, 247, 0.25);

  /* Status */
  --danger:       #f05d7a;
  --danger-soft:  rgba(240, 93, 122, 0.12);
  --green:        #4ecca3;
  --green-soft:   rgba(78, 204, 163, 0.15);
  --gold:         #f4b942;

  /* Messages */
  --bubble-out:      linear-gradient(135deg, #7c6af7, #9b8cff);
  --bubble-in:       rgba(26, 26, 46, 0.9);
  --bubble-in-hover: rgba(30, 30, 52, 0.95);

  /* Layout */
  --sidebar-w: 300px;
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow:    0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
  --glow:      0 0 30px rgba(124, 106, 247, 0.2);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }

/* ── Noise texture overlay ─────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: .4;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .01em;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s, box-shadow .2s;
  box-shadow: 0 4px 20px var(--accent-glow);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,.08), transparent);
}
.btn-primary:hover { opacity: .92; box-shadow: 0 6px 28px var(--accent-glow); }
.btn-primary:active { transform: scale(.97); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-glow); }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(240,93,122,.2);
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-full { width: 100%; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--text-2);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   FIELDS
   ═══════════════════════════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--text-2); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }

input[type="text"], input[type="password"], input[type="search"], textarea, .field input, .field textarea {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
input:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(124,106,247,.06);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
  overflow: hidden;
}

/* Animated gradient background */
#auth-screen::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,106,247,.18) 0%, transparent 70%);
  top: -150px; left: 50%;
  transform: translateX(-50%);
  animation: breathe 6s ease-in-out infinite;
}
#auth-screen::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155,140,255,.1) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  animation: breathe 8s ease-in-out infinite reverse;
}
@keyframes breathe {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: .6; }
  50% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}

.auth-wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  padding: 44px 36px 40px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glow);
  border-radius: 24px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow), var(--glow), inset 0 1px 0 rgba(255,255,255,.06);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}

.auth-logo {
  width: 64px; height: 64px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(124,106,247,.6));
  animation: floatLogo 4s ease-in-out infinite;
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.auth-wrap h1 {
  font-size: 24px; font-weight: 800;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--text), var(--accent-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.auth-sub { color: var(--text-2); font-size: 13px; margin-bottom: 20px; text-align: center; }

.auth-panel { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.auth-panel.hidden { display: none; }
.auth-toggle { text-align: center; font-size: 13px; color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
#app-shell {
  display: flex;
  height: 100vh; width: 100vw;
  overflow: hidden;
  position: relative; z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Subtle top glow */
#sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-title {
  font-weight: 800; font-size: 18px;
  letter-spacing: -.4px; flex: 1;
  background: linear-gradient(135deg, var(--text) 60%, var(--accent-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

#btn-new-chat {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 20px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-glow);
  transition: background .15s, box-shadow .2s;
}
#btn-new-chat:hover { background: var(--accent); color: #fff; box-shadow: 0 0 16px var(--accent-glow); }

.sidebar-search { padding: 10px 12px; }
.sidebar-search input {
  border-radius: 12px;
  padding: 9px 14px 9px 36px;
  font-size: 13.5px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b88b0' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* Conv list */
.conv-list { list-style: none; flex: 1; overflow-y: auto; padding: 6px 0; }

.conv-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  margin: 1px 6px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active {
  background: var(--accent-soft);
  border: 1px solid var(--border-glow);
}
.conv-item.active .conv-name { color: var(--accent-2); }

.conv-avatar {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  color: var(--accent-2);
  flex-shrink: 0;
  position: relative;
}
.conv-avatar .online-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 6px var(--green);
}

.conv-body { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conv-time { font-size: 11px; color: var(--text-3); }
.conv-badge {
  background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 8px; padding: 2px 7px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  display: flex; align-items: center; justify-content: space-around;
  padding: 10px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-1);
}
.sidebar-nav-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: background .15s;
  position: relative;
}
.sidebar-nav-btn:hover { background: var(--bg-hover); }
.sidebar-nav-btn.active { background: var(--accent-soft); }

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
#chat-panel {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

/* Background pattern */
#chat-panel::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(124,106,247,.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(155,140,255,.03) 0%, transparent 50%);
  pointer-events: none;
}

.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  color: var(--text-3); position: relative; z-index: 1;
}
.chat-empty img {
  width: 80px; opacity: .12; filter: grayscale(1) brightness(2);
  animation: floatLogo 5s ease-in-out infinite;
}
.chat-empty p { font-size: 15px; color: var(--text-3); }

#chat-active { display: flex; flex-direction: column; height: 100%; position: relative; z-index: 1; }

/* Chat header */
#chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
  min-height: 62px;
}
.back-btn { display: none; }
.chat-peer-info { flex: 1; min-width: 0; }
#chat-peer-name { font-weight: 700; font-size: 16px; display: block; }
.peer-status { font-size: 12px; color: var(--text-3); }
.peer-status.online { color: var(--green); }
.chat-actions { display: flex; gap: 4px; }

/* ── Messages ──────────────────────────────────────────────────────────────── */
.messages-list {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 16px;
  display: flex; flex-direction: column;
  gap: 2px;
}

.msg-date-sep {
  text-align: center; font-size: 11.5px;
  color: var(--text-3); padding: 10px 0;
  display: flex; align-items: center; gap: 10px;
  letter-spacing: .04em; text-transform: uppercase;
}
.msg-date-sep::before, .msg-date-sep::after {
  content: ''; flex: 1; border-top: 1px solid var(--border-soft);
}

.msg-row {
  display: flex; align-items: flex-end; gap: 8px;
  max-width: 70%;
  animation: msgIn .18s cubic-bezier(.25,.46,.45,.94);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-row.out { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.in  { align-self: flex-start; }

.msg-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--accent-2);
  flex-shrink: 0; margin-bottom: 0;
}
.msg-row.out .msg-avatar-sm { display: none; }

.msg-bubble {
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  max-width: 100%;
}

.msg-row.out .msg-bubble {
  background: linear-gradient(135deg, #7c6af7, #9b8cff);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 16px rgba(124,106,247,.35);
}
.msg-row.in .msg-bubble {
  background: var(--bubble-in);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 5px;
  backdrop-filter: blur(8px);
}

/* Group radius adjustments */
.msg-row.out.group-start .msg-bubble { border-top-right-radius: 18px; }
.msg-row.out.group-mid   .msg-bubble,
.msg-row.out.group-end   .msg-bubble { border-top-right-radius: 6px; }
.msg-row.in.group-start  .msg-bubble { border-top-left-radius: 18px; }
.msg-row.in.group-mid    .msg-bubble,
.msg-row.in.group-end    .msg-bubble { border-top-left-radius: 6px; }

.msg-row.group-mid, .msg-row.group-end { margin-top: 2px; }
.msg-row.group-start { margin-top: 10px; }

.msg-meta {
  display: flex; align-items: center; gap: 4px;
  margin-top: 4px;
  font-size: 10.5px;
  color: rgba(255,255,255,.5);
  justify-content: flex-end;
}
.msg-row.in .msg-meta { color: var(--text-3); justify-content: flex-start; }

/* Ephemeral */
.msg-bubble.ephemeral { border: 1px solid rgba(244,185,66,.25); }
.msg-bubble.ephemeral::before {
  content: '🔥';
  font-size: 10px;
  position: absolute; top: -10px; right: 2px;
}

/* Reply */
.msg-reply {
  background: rgba(0,0,0,.2);
  border-left: 3px solid rgba(255,255,255,.35);
  border-radius: 6px;
  padding: 5px 9px;
  margin-bottom: 7px;
  font-size: 12px; opacity: .85;
}
.msg-row.in .msg-reply { background: var(--bg-3); border-left-color: var(--accent); }

/* System */
.msg-system {
  text-align: center; font-size: 12px;
  color: var(--text-3); padding: 4px 0;
}

/* Typing */
.typing-indicator {
  display: flex; align-items: center; gap: 5px;
  padding: 12px 16px;
  background: var(--bubble-in);
  border: 1px solid var(--border-soft);
  border-radius: 18px; border-bottom-left-radius: 5px;
  width: fit-content; backdrop-filter: blur(8px);
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: typingBounce 1.3s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .18s; }
.typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMPOSE
   ═══════════════════════════════════════════════════════════════════════════ */
#compose {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
  position: relative; z-index: 1;
}

#msg-input {
  flex: 1;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 16px;
  resize: none;
  max-height: 140px; overflow-y: auto;
  line-height: 1.45; font-size: 14.5px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
#msg-input:focus {
  border-color: var(--accent);
  background: rgba(124,106,247,.06);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-send {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 13px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: opacity .15s, transform .1s, box-shadow .2s;
}
.btn-send:hover { opacity: .9; box-shadow: 0 6px 24px var(--accent-glow); }
.btn-send:active { transform: scale(.93); }
.btn-send::after { content: '↑'; font-weight: 700; }

/* Ephemeral picker */
.ephemeral-btn.active { color: var(--gold); }
.ephemeral-menu {
  position: absolute;
  bottom: calc(100% + 8px); left: 56px;
  background: var(--bg-2);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow), var(--glow);
  overflow: hidden;
  display: flex; flex-direction: column;
  z-index: 10;
  backdrop-filter: blur(16px);
  animation: scaleIn .15s ease;
}
.ephemeral-menu button {
  padding: 10px 22px; text-align: left;
  font-size: 13px; color: var(--text-2);
  transition: background .1s, color .1s;
}
.ephemeral-menu button:hover { background: var(--bg-hover); color: var(--text); }
.ephemeral-menu button.selected { color: var(--gold); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDE PANELS
   ═══════════════════════════════════════════════════════════════════════════ */
.side-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 360px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-glow);
  box-shadow: var(--shadow), var(--glow);
  display: flex; flex-direction: column;
  z-index: 50;
  animation: slideIn .22s cubic-bezier(.25,.46,.45,.94);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-header h2 { font-size: 17px; font-weight: 700; }

/* Notes */
#notes-list {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.note-card {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  cursor: pointer;
  transition: background .1s, border-color .15s;
  font-size: 13px; color: var(--text-2);
  display: flex; flex-direction: column; gap: 4px;
}
.note-card:hover { background: var(--bg-hover); border-color: var(--border-glow); }
.note-card-date { font-size: 11px; color: var(--text-3); }
#notes-panel .btn-primary { margin: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 30px 28px 26px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow), var(--glow);
  display: flex; flex-direction: column; gap: 16px;
  animation: scaleIn .18s cubic-bezier(.25,.46,.45,.94);
  position: relative; overflow: hidden;
}
.modal-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}
@keyframes scaleIn {
  from { transform: scale(.94) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-box h3 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }

.modal-buttons { display: flex; gap: 10px; margin-top: 4px; }
.modal-buttons button { flex: 1; }

/* Call modal */
#modal-call .modal-box { text-align: center; padding: 40px 28px; }
#call-modal-from { font-size: 30px; font-weight: 800; margin: 8px 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   ACCOUNT PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
body.page-account {
  overflow: auto;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 48px 16px;
  min-height: 100vh;
  background: var(--bg);
}
body.page-account::after {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(124,106,247,.12) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

.account-wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column; gap: 10px;
}

.account-header { margin-bottom: 20px; }
.account-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.back-link { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; transition: color .15s; }
.back-link:hover { color: var(--text); text-decoration: none; }

.account-section {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  display: flex; flex-direction: column; gap: 14px;
  backdrop-filter: blur(16px);
  transition: border-color .2s;
}
.account-section:hover { border-color: var(--border-glow); }
.account-section h2 {
  font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .08em;
}

.account-number-card { display: flex; flex-direction: column; gap: 8px; }
.account-number-card label { font-size: 13px; color: var(--text-2); }
.account-number-row { display: flex; align-items: center; gap: 10px; }
.account-number-row code {
  font-family: var(--mono); font-size: 22px; font-weight: 700;
  letter-spacing: 3px; color: var(--text);
  background: rgba(255,255,255,.04);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.account-hint { font-size: 12.5px; color: var(--text-3); }

.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row input { flex: 1; }
.field-row .btn-primary { white-space: nowrap; height: 42px; }

.subscription-card {
  background: rgba(124,106,247,.06);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px; min-height: 80px;
  justify-content: center;
}

.tier-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700; width: fit-content;
}
.tier-badge.free { background: var(--bg-3); color: var(--text-2); }
.tier-badge.paid {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.danger-zone { border-color: rgba(240,93,122,.15); }
.danger-zone h2 { color: var(--danger); }
.danger-zone { gap: 10px; }

/* ═══════════════════════════════════════════════════════════════════════════
   ERROR PAGES
   ═══════════════════════════════════════════════════════════════════════════ */
body.error-page {
  overflow: auto;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.error-wrap { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.error-icon { font-size: 72px; animation: floatLogo 4s ease-in-out infinite; }
.error-wrap h1 { font-size: 80px; font-weight: 800; color: var(--text-3); letter-spacing: -4px; }
.error-wrap p { font-size: 18px; color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999; pointer-events: none;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-glow);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 30px; font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  animation: toastIn .22s cubic-bezier(.25,.46,.45,.94);
  white-space: nowrap;
  backdrop-filter: blur(12px);
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  :root { --sidebar-w: 100vw; }

  #sidebar {
    position: fixed; inset: 0; z-index: 10;
    transform: translateX(0);
    transition: transform .28s cubic-bezier(.25,.46,.45,.94);
  }
  #sidebar.hidden-mobile { transform: translateX(-100%); }
  #chat-panel { position: fixed; inset: 0; }
  .back-btn { display: flex; }
  .side-panel { width: 100vw; }
  .modal-box { margin: 16px; max-width: 100%; }
  body.page-account { padding: 24px 12px; }
  .account-number-row code { font-size: 16px; letter-spacing: 2px; }
}
