/* =====================================================================
   AllahProject Mail — UI
   Dark-space theme. Mobile-first. Safe-area aware. Bottom action bar.
   ===================================================================== */

:root {
  --bg:           #050710;
  --bg-2:         #080b14;
  --card:         rgba(13, 18, 30, 0.80);
  --card-solid:   #0d1220;
  --card-2:       rgba(10, 14, 24, 0.78);
  --border:       rgba(255, 255, 255, 0.07);
  --border-strong:rgba(255, 255, 255, 0.13);
  --border-glow:  rgba(37, 231, 255, 0.18);
  --text:         #e9eef6;
  --text-soft:    #b8c4d2;
  --muted:        #677585;
  --muted-2:      #4a5562;
  --accent:       #25e7ff;
  --accent-2:     #0096d4;
  --accent-3:     #7c6bff;
  --accent-glow:  rgba(37, 231, 255, 0.30);
  --accent-ink:   #03141b;
  --success:      #4ade80;
  --warn:         #fbbf24;
  --danger:       #ff6b7a;
  --shadow-lg:    0 24px 64px rgba(0,0,0,.75);
  --shadow-card:  0 8px 32px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
  --radius:       16px;
  --radius-sm:    11px;
  --safe-top:     env(safe-area-inset-top, 0px);
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
  --safe-left:    env(safe-area-inset-left, 0px);
  --safe-right:   env(safe-area-inset-right, 0px);
  --bottombar-h:  64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11","ss01","ss03";
  min-height: 100dvh;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  animation: bodyFadeIn .5s ease both;
}
@keyframes bodyFadeIn { from { opacity: 0; } to { opacity: 1; } }

button { font-family: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Star-field canvas ---------- */
#starfield {
  position: fixed; inset: 0; z-index: -2;
  pointer-events: none;
  /* The canvas is driven by JS; no CSS needed beyond positioning. */
}

/* ---------- Background nebula orbs ---------- */
.bg-orbs {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none;
}
.orb {
  position: absolute; border-radius: 50%;
  will-change: transform;
}
/* Orb 1 — cyan, top-left */
.orb-1 {
  width: 640px; height: 640px;
  top: -180px; left: -140px;
  background: radial-gradient(circle, rgba(37,231,255,.22) 0%, rgba(0,120,200,.10) 50%, transparent 70%);
  filter: blur(90px);
  animation: float1 20s ease-in-out infinite;
}
/* Orb 2 — blue, bottom-right */
.orb-2 {
  width: 700px; height: 700px;
  bottom: -220px; right: -180px;
  background: radial-gradient(circle, rgba(0,150,212,.20) 0%, rgba(30,60,180,.10) 50%, transparent 70%);
  filter: blur(100px);
  animation: float2 25s ease-in-out infinite;
}
/* Orb 3 — purple, centre */
.orb-3 {
  width: 500px; height: 500px;
  top: 35%; left: 45%;
  background: radial-gradient(circle, rgba(124,107,255,.16) 0%, rgba(80,40,200,.08) 50%, transparent 70%);
  filter: blur(80px);
  animation: float3 28s ease-in-out infinite;
}
/* Orb 4 — deep indigo, top-right (new) */
.orb-4 {
  width: 420px; height: 420px;
  top: -60px; right: -80px;
  background: radial-gradient(circle, rgba(90,50,255,.14) 0%, rgba(37,231,255,.05) 60%, transparent 75%);
  filter: blur(70px);
  animation: float4 22s ease-in-out infinite;
}

@keyframes float1 { 0%,100%{transform:translate(0,0)}   50%{transform:translate(45px,65px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)}   50%{transform:translate(-55px,-45px)} }
@keyframes float3 { 0%,100%{transform:translate(-50%,0)} 50%{transform:translate(-50%,-35px)} }
@keyframes float4 { 0%,100%{transform:translate(0,0)}   50%{transform:translate(-30px,40px)} }

/* On low-power/mobile: kill animations, shrink blur, hide extra orbs */
@media (max-width: 720px) {
  .orb   { animation: none !important; }
  .orb-1 { filter: blur(60px); opacity: .55; }
  .orb-2 { filter: blur(70px); opacity: .45; }
  .orb-3, .orb-4 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none !important; }
  body { animation: none !important; }
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) calc(16px + var(--safe-right))
           calc(28px + var(--safe-bottom) + var(--bottombar-h, 0px))
           calc(16px + var(--safe-left));
  position: relative;
}
@media (min-width: 720px) {
  .wrap {
    padding-left: 24px; padding-right: 24px;
    padding-bottom: calc(48px + var(--safe-bottom));
  }
}
@media (min-width: 980px) {
  .wrap { padding: 36px 32px 60px; }
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 22px;
}
.brand-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-mark {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgba(37,231,255,.25), 0 8px 24px rgba(37,231,255,.30);
}
.logo-mark.admin {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #1a0d0d;
  box-shadow: 0 0 0 1px rgba(245,158,11,.25), 0 8px 24px rgba(245,158,11,.35);
}
.logo-mark svg { width: 22px; height: 22px; }

.brand-text { min-width: 0; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand-domain {
  font-size: 11px; color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 480px) { .brand-domain { display: none; } }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  background: rgba(74,222,128,.07);
  border: 1px solid rgba(74,222,128,.18);
  border-radius: 100px;
  font-size: 12px; font-weight: 500;
  color: var(--success);
  white-space: nowrap;
}
.status-pill .dot {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2.2s ease-in-out infinite;
}
.status-pill.offline { background: rgba(255,90,90,.07); border-color: rgba(255,90,90,.18); color: #ff7b7b; }
.status-pill.offline .dot { background: #ff7b7b; animation: none; }
@media (max-width: 480px) {
  .status-pill { padding: 6px 8px; font-size: 0; gap: 0; }
  .status-pill .dot { width: 8px; height: 8px; }
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

/* User menu */
.user-menu { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 6px 10px 6px 6px;
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: background .2s, border-color .2s;
}
.user-btn:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.22); }
.user-btn svg { width: 14px; height: 14px; opacity: .6; }
.user-btn .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
}
.user-name { max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .user-name { display: none; } }

.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px;
  background: var(--card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
  animation: popIn .15s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.user-pop-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: transparent; border: 0;
  border-radius: 10px;
  color: var(--text); text-decoration: none;
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .15s;
}
.user-pop-item:hover { background: rgba(255,255,255,.06); }
.user-pop-item svg { width: 16px; height: 16px; opacity: .7; flex-shrink: 0; }

/* ---------- Cards grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color .3s ease, box-shadow .3s ease;
  /* contain helps browser skip re-layout of other elements */
  contain: layout style;
}
@media (min-width: 720px) {
  .card {
    /* Smaller blur = faster compositing on desktop GPU */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 22px 18px;
  }
}
/* Top shimmer line */
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37,231,255,.18), rgba(124,107,255,.12), transparent);
  pointer-events: none;
}
/* Hover: subtle glow border */
.card:hover {
  border-color: rgba(37,231,255,.20);
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(37,231,255,.08) inset;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
}
.card-label svg { width: 14px; height: 14px; opacity: .75; }

.card-value {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(14px, 4.4vw, 19px);
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 14px;
  min-height: 28px;
  letter-spacing: -.01em;
  line-height: 1.4;
}
.card-value.code {
  font-size: clamp(28px, 9vw, 44px);
  font-weight: 700;
  letter-spacing: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #7cf8ff 40%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(37,231,255,.45));
  user-select: all;
}

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: background .18s, border-color .18s, transform .1s, box-shadow .18s;
}
.btn svg { width: 14px; height: 14px; opacity: .8; flex-shrink: 0; }
.btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(37,231,255,.22), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn.primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 22px rgba(37,231,255,.38), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn.big { width: 100%; padding: 14px 18px; font-size: 14px; min-height: 50px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.09); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger { color: var(--danger); border-color: rgba(255,107,122,.22); }
.icon-btn.danger:hover { background: rgba(255,107,122,.1); }

.text-btn {
  background: transparent; border: 0; color: var(--text-soft);
  padding: 8px 10px; font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: 8px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s;
}
.text-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.text-btn.danger { color: var(--danger); }
.text-btn.danger:hover { background: rgba(255,107,122,.12); color: var(--danger); }
.addr-head-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- Inbox ---------- */
.inbox {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-card);
  contain: layout style;
}
@media (min-width: 720px) {
  .inbox {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 18px 20px 18px;
  }
}

.inbox-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.inbox-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.inbox-title h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-soft); letter-spacing: -.01em; }
.inbox-tools { display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  background: rgba(255,255,255,.06);
  border-radius: 100px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  transition: background .2s, color .2s;
}
.badge.has { background: rgba(37,231,255,.14); color: var(--accent); }

.status {
  color: var(--muted); font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 50vw;
}

.messages {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 60vh; overflow-y: auto;
  margin: 0 -4px; padding: 0 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.messages::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; }
.messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.15); }

.msg {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: background .18s, border-color .18s, transform .1s;
  animation: msgIn .3s cubic-bezier(.2,.8,.2,1) both;
  position: relative;
  cursor: pointer;
}
.msg:hover, .msg:focus-visible {
  background: rgba(37,231,255,.04);
  border-color: rgba(37,231,255,.18);
  outline: none;
}
.msg:active { transform: scale(.99); }
@keyframes msgIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.msg-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg-from {
  font-weight: 600; color: var(--text-soft);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 65%;
}
.msg-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted-2); }
.msg-subject { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.msg-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-code-pill {
  position: absolute; top: 10px; right: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase;
  background: rgba(37,231,255,.12); color: var(--accent);
  padding: 3px 8px; border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
}
.msg-code-pill b { font-weight: 700; }

.empty {
  list-style: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 12px 38px; color: var(--muted-2); text-align: center;
  gap: 10px; font-size: 13px;
}
.empty svg { width: 38px; height: 38px; opacity: .3; margin-bottom: 4px; }
.empty-sub { font-size: 11px; color: var(--muted-2); opacity: .75; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(28px + var(--safe-bottom) + var(--bottombar-h, 0px));
  transform: translateX(-50%) translateY(20px);
  background: rgba(13,18,30,.96);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  opacity: 0;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255,107,122,.4); color: #ffb1b8; }

/* ---------- Code flash ---------- */
.flash { animation: flash .8s cubic-bezier(.2,.8,.2,1); }
@keyframes flash {
  0%   { filter: drop-shadow(0 0 12px rgba(37,231,255,.4)) brightness(1); }
  25%  { filter: drop-shadow(0 0 36px var(--accent)) brightness(1.5) drop-shadow(0 0 8px #fff); }
  100% { filter: drop-shadow(0 0 14px rgba(37,231,255,.45)) brightness(1); }
}

/* ---------- Promo banner (AllahSpam) ---------- */
.promo-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background:
    radial-gradient(120% 200% at 0% 0%, rgba(37,231,255,.16), transparent 55%),
    radial-gradient(120% 200% at 100% 100%, rgba(124,107,255,.20), transparent 55%),
    linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(37,231,255,.22);
  box-shadow: 0 8px 28px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.05);
  transition: transform .18s ease, box-shadow .22s ease, border-color .22s ease;
  position: relative;
  overflow: hidden;
}
.promo-banner::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.07) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform .55s ease;
  pointer-events: none;
}
.promo-banner:hover {
  transform: translateY(-2px);
  border-color: rgba(37,231,255,.50);
  box-shadow: 0 14px 40px rgba(37,231,255,.16), inset 0 1px 0 rgba(255,255,255,.08);
}
.promo-banner:hover::before { transform: translateX(100%); }
.promo-banner:active { transform: translateY(0); }

.promo-banner-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 4px 16px rgba(37,231,255,.38);
}
.promo-banner-icon svg { width: 22px; height: 22px; }

.promo-banner-text { flex: 1; min-width: 0; }
.promo-banner-title {
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--accent), #a0f5ff, var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.promo-banner-sub {
  font-size: 13px; color: var(--text-soft);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.promo-banner-cta {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(37,231,255,.10);
  border: 1px solid rgba(37,231,255,.28);
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -.01em;
}
.promo-banner-cta svg { width: 14px; height: 14px; }

@media (max-width: 560px) {
  .promo-banner { padding: 12px 14px; gap: 12px; }
  .promo-banner-icon { width: 38px; height: 38px; }
  .promo-banner-icon svg { width: 19px; height: 19px; }
  .promo-banner-title { font-size: 14px; }
  .promo-banner-sub { font-size: 12px; white-space: normal; }
  .promo-banner-cta span { display: none; }
  .promo-banner-cta { padding: 8px; }
}

/* ---------- Bottom bar (mobile) ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: none;
  padding: 8px calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left));
  background: rgba(5,7,16,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
}
@media (max-width: 760px) { .bottombar { display: flex; gap: 8px; } }
.bottombar-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  background: transparent; border: 0;
  color: var(--text-soft);
  padding: 8px 4px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background .15s, color .15s;
}
.bottombar-btn svg { width: 22px; height: 22px; }
.bottombar-btn:active { background: rgba(255,255,255,.06); }
.bottombar-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 4px 14px rgba(37,231,255,.32);
}
.bottombar-btn.primary:active { transform: scale(.97); }

/* ---------- Sheets (modals) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet[hidden] { display: none !important; }
@media (min-width: 720px) { .sheet { align-items: center; } }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.60);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-panel {
  position: relative;
  width: 100%; max-width: 520px;
  background: var(--card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0;
  padding: 12px 18px calc(20px + var(--safe-bottom));
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 -24px 64px rgba(0,0,0,.7), 0 0 0 1px rgba(37,231,255,.06) inset;
  animation: slideUp .25s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 720px) {
  .sheet-panel {
    border-radius: 18px;
    margin: 0 16px;
    padding: 22px;
    animation: popUp .2s cubic-bezier(.2,.8,.2,1);
  }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes popUp   { from { opacity: 0; transform: scale(.95) translateY(6px); } to { opacity: 1; transform: none; } }
.sheet-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,.14);
  border-radius: 100px;
  margin: 0 auto 14px;
}
@media (min-width: 720px) { .sheet-handle { display: none; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-title { font-size: 16px; font-weight: 700; }

/* Address list inside sheet */
.addr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.addr-item { display: flex; align-items: stretch; gap: 6px; }
.addr-pick {
  flex: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left; cursor: pointer;
  color: var(--text);
  transition: background .18s, border-color .18s;
}
.addr-pick:hover { background: rgba(255,255,255,.06); border-color: var(--border-strong); }
.addr-pick.current {
  border-color: rgba(37,231,255,.4);
  background: rgba(37,231,255,.06);
}
.addr-text { font-family: 'JetBrains Mono', monospace; font-size: 13px; word-break: break-all; }
.addr-meta { font-size: 11px; color: var(--muted); }

/* Email detail */
.msg-detail { padding: 4px 4px 16px; }
.msg-detail-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.msg-detail-subject { font-size: 17px; font-weight: 700; color: var(--text); }
.msg-detail-from { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-soft); word-break: break-all; }
.msg-detail-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }
.msg-detail-code {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(37,231,255,.07);
  border: 1px solid rgba(37,231,255,.22);
  border-radius: 12px; padding: 12px 14px;
  margin-bottom: 14px;
}
.msg-detail-code-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 700; letter-spacing: 4px;
  color: var(--accent);
}
.msg-detail-body {
  font-size: 13px; color: var(--text-soft);
  white-space: pre-wrap; word-break: break-word;
  background: rgba(255,255,255,.022);
  border-radius: 10px; padding: 12px 14px;
  max-height: 50vh; overflow-y: auto;
  line-height: 1.55;
}
.msg-detail-body iframe { width: 100%; border: 0; min-height: 240px; background: #fff; border-radius: 8px; }

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
.page-login { display: flex; }
.login-wrap {
  width: 100%;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  gap: 18px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(37,231,255,.06) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: cardIn .4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.login-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 22px;
}
.login-brand .logo-mark { width: 48px; height: 48px; border-radius: 14px; }
.login-brand .logo-mark svg { width: 26px; height: 26px; }
.login-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin-top: 6px; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--muted);
}
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
  min-height: 46px;
}
.field input:focus {
  border-color: var(--accent);
  background: rgba(37,231,255,.04);
  box-shadow: 0 0 0 3px rgba(37,231,255,.14);
}

.field-pw { position: relative; }
.field-pw input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  background: transparent; border: 0;
  display: grid; place-items: center;
  color: var(--muted); cursor: pointer; border-radius: 8px;
}
.pw-toggle:hover { color: var(--text); background: rgba(255,255,255,.04); }
.pw-toggle svg { width: 18px; height: 18px; }

.field-checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-soft); cursor: pointer;
  padding: 4px 0;
}
.field-checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

.btn-spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.28);
  color: #fde68a;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px; line-height: 1.45;
  margin-bottom: 14px;
}

.login-error {
  background: rgba(255,107,122,.07);
  border: 1px solid rgba(255,107,122,.28);
  color: #ffc4ca;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13px;
  margin-top: -4px;
  animation: shake .35s;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.login-foot {
  margin-top: 18px; text-align: center;
  font-size: 12px; color: var(--muted-2); line-height: 1.5;
}
.login-mark {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--muted-2); letter-spacing: 1px;
}

/* =====================================================================
   ADMIN PAGE
   ===================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; color: var(--text); }

.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}
.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.admin-card-head h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }

.users-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.users-table { width: 100%; border-collapse: collapse; min-width: 580px; }
.users-table th {
  font-size: 11px; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.users-table td {
  padding: 12px 10px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: 0; }
.users-table .username {
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.username-admin-pill {
  font-size: 9px; font-weight: 700; letter-spacing: .4px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #1a0d0d;
  padding: 2px 6px; border-radius: 6px;
  text-transform: uppercase;
}
.user-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
}
.user-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.user-status.disabled { color: var(--muted); }
.user-status.disabled .dot { background: var(--muted); }
.user-status.expired { color: var(--warn); }
.user-status.expired .dot { background: var(--warn); }
.user-actions { display: flex; gap: 6px; justify-content: flex-end; }

.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.session-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(255,255,255,.022);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.session-info { min-width: 0; }
.session-user { font-weight: 600; font-size: 13px; }
.session-meta { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); margin-top: 4px; word-break: break-all; }

.audit-list { list-style: none; padding: 0; margin: 0; max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.audit-row {
  display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px; font-size: 12px;
}
.audit-row:hover { background: rgba(255,255,255,.03); }
.audit-time { font-family: 'JetBrains Mono', monospace; color: var(--muted); font-size: 11px; }
.audit-text b { color: var(--text); font-weight: 600; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.form-error { color: #ffb1b8; font-size: 13px; padding: 8px 0; }

.edit-username {
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  font-size: 14px; color: var(--text);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  .users-table th:nth-child(4),
  .users-table td:nth-child(4),
  .users-table th:nth-child(5),
  .users-table td:nth-child(5) { display: none; }
}
