:root {
  --bg: #080808;
  --blue: #3f7df5;
  --blue-bright: #4f8cff;
  --blue-soft: #8ab4f8;
  --card-a: #0a0a0a;
  --card-b: #050505;
  --border: #2a2a2a;
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.45);
  --muted-2: rgba(255, 255, 255, 0.28);
  --green: #22c55e;
  --radius: 18px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.bg-root {
  min-height: 100vh;
  position: relative;
  background-color: rgb(8, 8, 8);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='20' viewBox='0 0 16 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.022' fill-rule='evenodd'%3E%3Cpath d='M8 0v20L0 10M16 0v10L8 0M16 10v10H8'/%3E%3C/g%3E%3C/svg%3E");
}
.bg-fade {
  position: absolute; top: 0; left: 0; right: 0; height: 220px;
  background: linear-gradient(rgb(0, 0, 0) 0%, transparent 100%);
  z-index: 0; pointer-events: none;
}

/* ─── Views ─────────────────────────────────────────────────────────────── */
.view { display: none; position: relative; z-index: 1; min-height: 100vh; }
.view.is-active { display: block; }

/* ─── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 34px; gap: 16px;
}
.brand-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--blue-soft);
}
.brand-pill .dot, .eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--blue-bright);
  box-shadow: 0 0 10px var(--blue-bright);
}
.topbar-spacer { width: 120px; }
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none;
  transition: color .18s ease;
}
.back-link:hover { color: #fff; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--blue); color: #fff; border: none; border-radius: 12px;
  font-family: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  padding: 0 26px; height: 50px; position: relative;
  box-shadow: 0 8px 26px rgba(63, 125, 245, .35);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn-primary:hover { background: #4a86ff; transform: translateY(-2px); box-shadow: 0 12px 34px rgba(63, 125, 245, .45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary[disabled] { opacity: .7; cursor: default; transform: none; box-shadow: none; }
.btn-lg { height: 58px; font-size: 16px; padding: 0 34px; }
.btn-block { width: 100%; margin-top: 6px; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border-soft);
  color: #fff; font-family: inherit; font-weight: 700; font-size: 13px;
  border-radius: 10px; padding: 9px 16px; cursor: pointer; transition: border-color .18s, background .18s;
}
.btn-ghost:hover { border-color: rgba(79, 140, 255, .4); background: rgba(79, 140, 255, .08); }

.btn-spinner, .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
.btn-spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  max-width: 1180px; margin: 0 auto; padding: 60px 40px 80px;
  display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 40px; min-height: 74vh;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(79, 140, 255, .08); border: 1px solid rgba(79, 140, 255, .22);
  color: var(--blue-soft); font-size: 11px; font-weight: 700; letter-spacing: .6px;
  padding: 6px 15px; border-radius: 999px; margin-bottom: 22px;
}
.hero-title {
  font-size: clamp(56px, 8vw, 104px); font-weight: 900; letter-spacing: -3px;
  line-height: .92; margin-bottom: 22px;
}
.hero-title .accent { color: var(--blue); }
.hero-sub { color: var(--muted); font-size: 16px; line-height: 1.7; max-width: 460px; margin-bottom: 34px; }
.trust-row { display: flex; align-items: center; gap: 12px; margin-top: 30px; color: var(--muted); font-size: 13.5px; }
.trust-stars { display: flex; gap: 2px; }
.trust-stars svg { width: 16px; height: 16px; fill: var(--blue-bright); }

.hero-art { position: relative; display: flex; align-items: center; justify-content: center; }
.art-glow {
  position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 125, 245, .30) 0%, rgba(63, 125, 245, .06) 45%, transparent 70%);
  filter: blur(10px); animation: pulse 5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }
.art-float { position: relative; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 30px 50px rgba(0, 0, 0, .55)); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-16px) rotate(1deg); } }
.envelope { width: 340px; height: auto; }

/* ─── Overlays / modals ─────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s ease;
}
.overlay.is-open { display: flex; opacity: 1; }
.modal {
  position: relative; width: 100%; max-width: 460px;
  background: linear-gradient(180deg, #101010 0%, #0a0a0a 100%);
  border: 1px solid var(--border); border-radius: 20px; padding: 34px 32px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  transform: translateY(14px) scale(.97); opacity: 0;
  transition: transform .24s cubic-bezier(.2, .8, .3, 1), opacity .24s ease;
}
.overlay.is-open .modal { transform: none; opacity: 1; }
.modal-close {
  position: absolute; top: 18px; right: 18px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--muted-2); cursor: pointer; border-radius: 8px;
  transition: color .16s, background .16s;
}
.modal-close:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.modal-title { font-size: 30px; font-weight: 900; letter-spacing: -1px; margin: 6px 0 8px; }
.modal-sub { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 22px; }

/* ─── Form ──────────────────────────────────────────────────────────────── */
.field-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 1.4px;
  color: var(--muted-2); text-transform: uppercase; margin-bottom: 9px;
}
.field {
  width: 100%; height: 52px; padding: 0 16px; font-family: inherit; font-size: 15px;
  color: #fff; background: rgba(255, 255, 255, .03); border: 1px solid var(--border);
  border-radius: 12px; outline: none; transition: border-color .18s, box-shadow .18s;
}
.field::placeholder { color: rgba(255, 255, 255, .25); }
.field:focus { border-color: rgba(79, 140, 255, .6); box-shadow: 0 0 0 3px rgba(63, 125, 245, .15); }

.agree { display: flex; align-items: flex-start; gap: 11px; margin: 18px 0 22px; cursor: pointer; user-select: none; }
.agree input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-box {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 6px; margin-top: 1px;
  border: 1.5px solid var(--border); background: rgba(255, 255, 255, .03);
  display: flex; align-items: center; justify-content: center; color: #fff;
  transition: background .16s, border-color .16s;
}
.checkbox-box svg { opacity: 0; transform: scale(.5); transition: opacity .15s, transform .15s; }
.agree input:checked + .checkbox-box { background: var(--blue); border-color: var(--blue); }
.agree input:checked + .checkbox-box svg { opacity: 1; transform: scale(1); }
.agree input:focus-visible + .checkbox-box { box-shadow: 0 0 0 3px rgba(63, 125, 245, .25); }
.agree-text { font-size: 13.5px; color: rgba(255, 255, 255, .7); line-height: 1.55; }
.agree-text a { color: var(--blue-soft); text-decoration: none; }
.agree-text a:hover { text-decoration: underline; }

/* ─── Account picker ────────────────────────────────────────────────────── */
.account-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; margin-right: -4px; }
.account-list::-webkit-scrollbar { width: 6px; }
.account-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }
.account-card {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  background: rgba(255, 255, 255, .02); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; cursor: pointer; font-family: inherit;
  transition: border-color .18s, background .18s, transform .12s;
}
.account-card:hover { border-color: rgba(79, 140, 255, .5); background: rgba(79, 140, 255, .05); transform: translateX(2px); }
.account-avatar {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; object-fit: cover;
  background: radial-gradient(circle at 40% 30%, #26324d, #10151f); border: 1px solid var(--border-soft);
}
.account-avatar.placeholder { display: flex; align-items: center; justify-content: center; color: var(--blue-soft); font-weight: 800; font-size: 18px; }
.account-name { font-size: 15px; font-weight: 700; color: #fff; }
.account-tag { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.account-go { margin-left: auto; color: var(--muted-2); }
.account-card:hover .account-go { color: var(--blue-soft); }

/* ─── Inbox ─────────────────────────────────────────────────────────────── */
.inbox-topbar { max-width: 1180px; margin: 0 auto; }
.inbox-wrap { max-width: 760px; margin: 0 auto; padding: 30px 24px 90px; }
.inbox-head { text-align: center; margin-bottom: 34px; }
.inbox-addr-pill {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 18px;
  background: rgba(79, 140, 255, .08); border: 1px solid rgba(79, 140, 255, .22);
  padding: 7px 16px; border-radius: 999px;
}
.inbox-addr-pill .label { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--muted-2); }
.inbox-addr-pill .addr { font-size: 13px; font-weight: 700; color: var(--blue-soft); }
.inbox-title { font-size: 40px; font-weight: 900; letter-spacing: -1.5px; margin-bottom: 6px; }
.inbox-count { color: var(--muted); font-size: 14px; }

.inbox-list { display: flex; flex-direction: column; gap: 10px; }
.mail-card {
  display: flex; align-items: flex-start; gap: 14px; text-align: left; width: 100%;
  background: linear-gradient(180deg, rgba(20, 20, 20, .6), rgba(8, 8, 8, .6));
  border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px;
  cursor: pointer; font-family: inherit;
  transition: border-color .18s, background .18s, transform .12s;
}
.mail-card:hover { border-color: rgba(79, 140, 255, .45); background: rgba(79, 140, 255, .04); transform: translateY(-1px); }
.mail-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; overflow: hidden;
}
.mail-avatar img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.mail-avatar.generic { background: rgba(79, 140, 255, .12); color: var(--blue-soft); }
.mail-main { flex: 1; min-width: 0; }
.mail-subject { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.mail-from { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-date { font-size: 12.5px; color: var(--muted-2); white-space: nowrap; margin-left: 12px; padding-top: 2px; }
.mail-chevron { color: var(--muted-2); align-self: center; }
.mail-card:hover .mail-chevron { color: var(--blue-soft); }

/* ─── Empty / loading states ────────────────────────────────────────────── */
.state {
  text-align: center; padding: 70px 20px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.state .emoji { font-size: 40px; }
.state .title { color: #fff; font-weight: 700; font-size: 16px; }
.state .sub { font-size: 14px; }
.skeleton {
  height: 74px; border-radius: 14px; border: 1px solid var(--border);
  background: linear-gradient(100deg, rgba(255,255,255,.03) 30%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.03) 70%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Email detail ──────────────────────────────────────────────────────── */
.modal-email { max-width: 720px; padding: 0; overflow: hidden; }
.email-head { padding: 28px 30px 20px; border-bottom: 1px solid var(--border); }
.email-subject { font-size: 20px; font-weight: 800; letter-spacing: -.4px; padding-right: 30px; }
.email-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.email-date { color: var(--muted-2); white-space: nowrap; }
.email-body-frame { position: relative; background: #f4f5f8; max-height: 68vh; overflow-y: auto; }
.email-body-frame iframe { display: block; width: 100%; border: none; background: #fff; }
.email-plain { padding: 26px 30px; white-space: pre-wrap; word-break: break-word; color: #16181d; background: #fff; font-size: 14px; line-height: 1.7; }
.email-loading { display: flex; align-items: center; justify-content: center; padding: 60px; background: #fff; }
.email-loading .spinner { border-color: rgba(0,0,0,.15); border-top-color: var(--blue); }

/* ─── Toasts ────────────────────────────────────────────────────────────── */
.toast-stack { position: fixed; top: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: linear-gradient(180deg, #141414, #0c0c0c); border: 1px solid var(--border);
  border-left: 3px solid var(--blue); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55); color: #fff; font-size: 14px; line-height: 1.5;
  transform: translateX(120%); transition: transform .3s cubic-bezier(.2, .8, .3, 1);
}
.toast.show { transform: none; }
.toast.error { border-left-color: #ef4444; }
.toast.success { border-left-color: var(--green); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.error .toast-icon { color: #f87171; }
.toast.success .toast-icon { color: #4ade80; }
.toast.info .toast-icon { color: var(--blue-soft); }

/* ─── Entrance animations ───────────────────────────────────────────────── */
.fade-up { opacity: 0; transform: translateY(24px); animation: fadeUp .7s cubic-bezier(.2, .8, .3, 1) forwards; }
.fade-up.d1 { animation-delay: .05s; }
.fade-up.d2 { animation-delay: .13s; }
.fade-up.d3 { animation-delay: .21s; }
.fade-up.d4 { animation-delay: .29s; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 30px 26px 60px; min-height: auto; gap: 10px; }
  .hero-art { order: -1; height: 240px; }
  .envelope { width: 240px; }
  .art-glow { width: 300px; height: 300px; }
  .topbar { padding: 20px; }
  .topbar-spacer { display: none; }
  .brand-pill { display: none; }
  .inbox-topbar .brand-pill { display: inline-flex; }
  .hero-title { letter-spacing: -2px; }
  .inbox-title { font-size: 30px; }
}
@media (max-width: 520px) {
  .inbox-topbar .brand-pill { display: none; }
  .modal { padding: 28px 22px 24px; }
  .modal-title { font-size: 26px; }
}
