/* ============================================================
   uMail design system — dark green / teal brand
   Centralized design tokens. Every color in this file should
   trace back to a variable defined here.
   ============================================================ */

:root {
  /* ---- Core surfaces (dark, primary theme) ----
     Neutral charcoal on purpose — green is the BRAND ACCENT (buttons, links,
     icons, borders, glows), not the base surface hue. Keeping backgrounds
     neutral is what makes the accent read as a deliberate brand color
     instead of a monochrome wash. */
  --umail-bg: #17171A;
  --umail-bg-secondary: #1D1D21;
  --umail-surface: #232327;
  --umail-surface-elevated: #2B2B30;

  /* ---- Brand accents ---- */
  --umail-primary: #00C9A7;
  --umail-primary-hover: #18E0B8;
  --umail-secondary-accent: #00A98F;
  --umail-bright: #18E0B8;
  --umail-light-green: #8EF5DD;

  /* ---- Text ---- */
  --umail-text: #F5F5F4;
  --umail-heading-secondary: #E4E4E7;
  --umail-text-secondary: #A3A3A8;
  --umail-text-muted: #6E6E76;
  --umail-on-primary: #0B0F0D; /* text color placed on top of the primary accent */

  /* ---- Borders ----
     Green-tinted (not neutral gray) even though surfaces are neutral now —
     this is the "brand color in cards" cue: every card/input/panel edge
     carries a hint of the accent. */
  --umail-border: rgba(0, 201, 167, 0.22);
  --umail-border-strong: rgba(0, 201, 167, 0.40);

  /* ---- Tint scale (hover / active states, built from the primary accent) ---- */
  --tint-weak: rgba(0, 201, 167, 0.06);
  --tint-soft: rgba(0, 201, 167, 0.08);
  --tint-medium: rgba(0, 201, 167, 0.12);
  --tint-strong: rgba(0, 201, 167, 0.18);

  /* ---- Semantic (status) colors — independent of brand color ---- */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #38BDF8;

  /* ---- Gradients & effects ----
     --gradient-brand is reserved for the logo mark only — it's not reused as
     a generic "brand gradient" across avatars/progress bars/etc., those stay
     flat brand color so the gradient still reads as a deliberate choice. */
  --gradient-brand: linear-gradient(160deg, var(--umail-primary) 0%, var(--umail-secondary-accent) 55%, var(--umail-bright) 100%);
  --gradient-panel: linear-gradient(180deg, var(--umail-bg-secondary), var(--umail-primary));
  --glow-ambient: 0 0 30px rgba(0, 201, 167, 0.10);
  --glow-focus: 0 0 0 3px rgba(0, 201, 167, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.48);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* ---- Backwards-compatible aliases used throughout this file ---- */
  --bg: var(--umail-bg);
  --surface: var(--umail-surface);
  --surface-alt: var(--tint-soft);
  --surface-elevated: var(--umail-surface-elevated);
  --border: var(--umail-border);
  --text: var(--umail-text);
  --text-secondary: var(--umail-text-secondary);
  --accent: var(--umail-primary);
  --accent-hover: var(--umail-primary-hover);
  --lavender: var(--tint-medium); /* "selected / active" tint, not a light lavender anymore */
}

/* ---- Light theme (opt-in via the toggle; dark is the default brand theme) ----
   Off-white, not tinted mint — same reasoning as the dark theme: neutral
   surfaces, green carried by borders/icons/buttons/links instead. */
:root[data-theme="light"] {
  --umail-bg: #FAFAF8;
  --umail-bg-secondary: #F1F1EE;
  --umail-surface: #FFFFFF;
  --umail-surface-elevated: #FFFFFF;

  --umail-primary: #009F86;
  --umail-primary-hover: #00B894;
  --umail-secondary-accent: #00A98F;
  --umail-bright: #00B894;
  /* Darker than --umail-primary on purpose: this token is used as TEXT on
     light tinted backgrounds (badges, active nav, secondary buttons), and a
     pale mint here would fail contrast on a light surface. */
  --umail-light-green: #00694F;

  --umail-text: #1A1A1D;
  --umail-heading-secondary: #2B2B30;
  --umail-text-secondary: #64646B;
  --umail-text-muted: #96969C;
  --umail-on-primary: #FFFFFF;

  /* Green-tinted borders (not neutral gray) — the same "brand color in
     every card" cue as dark mode. */
  --umail-border: rgba(0, 159, 134, 0.22);
  --umail-border-strong: rgba(0, 159, 134, 0.42);

  --tint-weak: rgba(0, 159, 134, 0.05);
  --tint-soft: rgba(0, 159, 134, 0.08);
  --tint-medium: rgba(0, 159, 134, 0.12);
  --tint-strong: rgba(0, 159, 134, 0.20);

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.06);
  --shadow-md: 0 4px 16px rgba(24, 24, 27, 0.08);
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.12);
  --glow-ambient: 0 0 24px rgba(0, 159, 134, 0.08);

  --bg: var(--umail-bg);
  --surface: var(--umail-surface);
  --surface-alt: var(--tint-soft);
  --surface-elevated: var(--umail-surface-elevated);
  --border: var(--umail-border);
  --text: var(--umail-text);
  --text-secondary: var(--umail-text-secondary);
  --accent: var(--umail-primary);
  --accent-hover: var(--umail-primary-hover);
  --lavender: var(--tint-medium);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--umail-bg);
  color: var(--umail-text);
  font-family: var(--font-sans);
  min-height: 100%;
}

body { font-size: 15px; line-height: 1.5; }

/* A faint grain breaks up the flatness of the teal gradients/glows so they
   read as printed/designed rather than a smooth CG render. Kept very subtle. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 2147483647; pointer-events: none;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
:root[data-theme="light"] body::before { opacity: .025; }

a { color: var(--umail-bright); text-decoration: none; }
a:hover { color: var(--umail-light-green); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--umail-text); }
h2, h3 { color: var(--umail-heading-secondary); }

.muted { color: var(--umail-text-secondary); }
.text-muted-2 { color: var(--umail-text-muted); }

svg.icon, i[data-lucide] svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
}
.icon-sm svg, svg.icon-sm { width: 16px; height: 16px; }
.icon-md svg, svg.icon-md { width: 18px; height: 18px; }
.icon-nav svg, svg.icon-nav { width: 20px; height: 20px; }
.icon-lg svg, svg.icon-lg { width: 28px; height: 28px; }

/* ---------- Layout helpers ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.center { display: flex; align-items: center; justify-content: center; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.stack > * + * { margin-top: 10px; }

/* ---------- Ambient background ----------
   One dominant, irregularly-shaped wash (not a perfect circle, not mirrored
   by a matching twin) plus a much smaller, quieter accent placed off-axis.
   The point is to avoid the two-symmetric-glowing-orbs look. */
.ambient-bg {
  position: relative;
  isolation: isolate;
  background: var(--umail-bg);
}
.ambient-bg::before, .ambient-bg::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
}
.ambient-bg::before {
  width: 680px; height: 520px; left: -260px; bottom: -300px;
  border-radius: 38% 62% 58% 42% / 48% 40% 60% 52%;
  transform: rotate(-9deg);
  background: radial-gradient(ellipse at 38% 42%, rgba(0, 201, 167, 0.24), rgba(0, 201, 167, 0) 68%);
}
.ambient-bg::after {
  width: 300px; height: 340px; right: 6%; top: 12%;
  border-radius: 58% 42% 46% 54% / 40% 55% 45% 60%;
  transform: rotate(14deg);
  background: radial-gradient(ellipse at 55% 40%, rgba(24, 224, 184, 0.10), rgba(24, 224, 184, 0) 70%);
}
:root[data-theme="light"] .ambient-bg::before,
:root[data-theme="light"] .ambient-bg::after { opacity: .5; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.3rem; color: var(--umail-text); }
.logo-mark { width: 30px; height: 30px; flex-shrink: 0; filter: drop-shadow(0 0 10px rgba(0, 201, 167, 0.30)); }
.logo-word .u { background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-md);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--umail-primary); color: var(--umail-on-primary); }
.btn-primary:hover { background: var(--umail-primary-hover); text-decoration: none; box-shadow: var(--glow-ambient); }
.btn-secondary { background: transparent; color: var(--umail-light-green); border-color: rgba(0, 201, 167, 0.30); }
.btn-secondary:hover { background: var(--tint-medium); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--umail-text-secondary); }
.btn-ghost:hover { background: var(--tint-soft); text-decoration: none; color: var(--umail-text); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc3737; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, .icon-btn:focus-visible {
  outline: none; box-shadow: var(--glow-focus);
}

/* ---------- Cards / surfaces (glass) ----------
   Neutral charcoal glass, but the border stays green-tinted and picks up a
   very faint green glow — enough that a card still reads as "on brand"
   without the surface itself going green. */
.card {
  background: rgba(35, 35, 39, 0.70);
  border: 1px solid var(--umail-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md), 0 0 20px rgba(0, 201, 167, 0.05);
  padding: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
:root[data-theme="light"] .card {
  background: var(--umail-surface); backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: var(--shadow-md);
}
.card-elevated { background: rgba(43, 43, 48, 0.80); }
:root[data-theme="light"] .card-elevated { background: var(--umail-surface); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--tint-medium); color: var(--umail-light-green);
}
.badge svg { width: 14px; height: 14px; }
.badge-success { background: rgba(16,185,129,.14); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.16); color: var(--warning); }
.badge-error { background: rgba(239,68,68,.14); color: var(--error); }
.badge-info { background: rgba(56,189,248,.14); color: var(--info); }
.badge-muted { background: var(--tint-weak); color: var(--umail-text-muted); }

/* ---------- Forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: var(--umail-text); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="date"], input[type="time"], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-md);
  border: 1px solid rgba(0, 201, 167, 0.20); background: rgba(23, 23, 26, 0.55); color: var(--umail-text);
  font-size: .95rem; font-family: inherit;
}
:root[data-theme="light"] input[type="text"], :root[data-theme="light"] input[type="email"],
:root[data-theme="light"] input[type="password"], :root[data-theme="light"] input[type="search"],
:root[data-theme="light"] input[type="tel"], :root[data-theme="light"] input[type="date"], :root[data-theme="light"] input[type="time"],
:root[data-theme="light"] textarea, :root[data-theme="light"] select {
  background: var(--umail-surface); border-color: var(--umail-border);
}
input::placeholder, textarea::placeholder { color: var(--umail-text-muted); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--umail-primary); box-shadow: var(--glow-focus);
}
.field { margin-bottom: 12px; }
.field-hint { display: flex; align-items: flex-start; gap: 6px; font-size: .8rem; margin-top: 4px; color: var(--umail-text-secondary); }
.field-hint.ok { color: var(--umail-bright); }
.field-hint.err { color: var(--error); }
.field-hint svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }
.input-row { display: flex; gap: 10px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--umail-text-muted); pointer-events: none;
}
.input-icon-wrap input { padding-left: 40px; }
.input-icon-wrap .icon-btn-inline {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 6px; cursor: pointer; color: var(--umail-text-muted);
  display: inline-flex; border-radius: var(--radius-sm);
}
.input-icon-wrap .icon-btn-inline:hover { color: var(--umail-light-green); background: var(--tint-soft); }
.input-icon-wrap .icon-btn-inline svg { position: static; transform: none; }

.toggle-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--umail-text-secondary); }
.toggle-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--umail-primary); }

/* ---------- Top nav (app chrome) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--umail-bg-secondary); border-bottom: 1px solid var(--umail-border);
  padding: 10px 20px;
}
.topbar .container, .topbar-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1280px; margin: 0 auto; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--umail-text-secondary); font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; }
.nav-links a.active, .nav-links a:hover { color: var(--umail-primary); text-decoration: none; }

/* A full-text nav + the logo + an account switcher showing the whole email
   address doesn't fit a phone-width topbar in one row. Below 640px the nav
   and account switcher fall back to icon-only / avatar-only — the labels
   still exist for screen readers (aria-label on the parent control). */
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .logo-word { display: none; }
  .nav-links { gap: 10px; }
  .nav-label { display: none; }
  .account-label { display: none; }
  .account-trigger { padding: 6px; }
}
.verify-banner {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 8px 16px; font-size: .85rem; color: var(--warning);
  background: rgba(245, 158, 11, 0.12); border-bottom: 1px solid rgba(245, 158, 11, 0.25);
}
.verify-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.verify-banner a { color: var(--warning); text-decoration: underline; }
.offline-banner {
  position: sticky; top: 0; z-index: 30;
  color: var(--error); background: rgba(239, 68, 68, 0.12); border-bottom: 1px solid rgba(239, 68, 68, 0.25);
}
.offline-banner a { color: var(--error); }

/* ---------- Loading skeletons ---------- */
@keyframes skeleton-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.skeleton { background: var(--tint-soft); border-radius: var(--radius-sm); animation: skeleton-pulse 1.4s ease-in-out infinite; }
.skeleton-mail-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--umail-border); }
.skeleton-mail-item .skeleton { height: 10px; }
.skeleton-mail-item .sk-line-1 { width: 40%; }
.skeleton-mail-item .sk-line-2 { width: 70%; }
.skeleton-mail-item .sk-line-3 { width: 55%; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--umail-border);
  background: transparent; color: var(--umail-text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
}
.icon-btn:hover { background: var(--tint-soft); color: var(--umail-primary); }

/* Account switcher */
.account-switcher { position: relative; }
.account-trigger {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: var(--radius-md); border: 1px solid var(--umail-border); background: transparent;
  cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--umail-text);
}
.account-trigger:hover { background: var(--tint-soft); }
.account-trigger svg { width: 16px; height: 16px; color: var(--umail-text-secondary); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--umail-primary);
  color: var(--umail-on-primary); display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
}
.avatar { overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-md { width: 36px; height: 36px; font-size: .85rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 1.75rem; }
.avatar-row { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px;
  background: rgba(43, 43, 48, 0.92); border: 1px solid var(--umail-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 30;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
:root[data-theme="light"] .account-menu { background: var(--umail-surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.account-menu.open { display: block; }
.account-menu .group-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--umail-text-muted); padding: 8px 10px 4px; }
.account-menu .account-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: .88rem; color: var(--umail-text);
}
.account-menu .account-item:hover { background: var(--tint-soft); }
.account-menu .account-item svg { width: 16px; height: 16px; color: var(--umail-text-secondary); }
.account-menu .account-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--umail-text-muted); flex-shrink: 0; }
.account-menu .account-item.active .dot { background: var(--success); }
.account-menu .account-item.active { color: var(--umail-light-green); }
.account-menu hr { border: none; border-top: 1px solid var(--umail-border); margin: 6px 0; }

/* ---------- Landing page ---------- */
.hero {
  background: var(--umail-bg); color: var(--umail-text); padding: 90px 24px 110px; text-align: center;
  position: relative; overflow: hidden; isolation: isolate;
}
.hero::before {
  content: ""; position: absolute; z-index: -1; width: 940px; height: 720px; left: -300px; bottom: -440px;
  border-radius: 42% 58% 61% 39% / 46% 38% 62% 54%;
  transform: rotate(-7deg);
  background: radial-gradient(ellipse at 40% 38%, rgba(0, 201, 167, 0.26), rgba(0, 201, 167, 0) 66%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 60% 45% at 68% -8%, rgba(24, 224, 184, .16), transparent 62%);
  pointer-events: none;
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 18px; position: relative; color: var(--umail-text); }
.hero p { color: var(--umail-text-secondary); font-size: 1.1rem; max-width: 640px; margin: 0 auto 32px; position: relative; }
.hero .actions { display: flex; gap: 14px; justify-content: center; position: relative; flex-wrap: wrap; }

/* The marketing header (logo + Log in + Get Started) and the hero's fixed
   minimum font-size both measured wider than a 375px phone screen. */
@media (max-width: 400px) {
  .hero { padding: 60px 16px 80px; }
  .hero h1 { font-size: 2rem; }
  .topbar .btn { padding: 8px 12px; font-size: .85rem; }
  .topbar .gap-md { gap: 8px; }
}

.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: -60px auto 60px; max-width: 1000px; padding: 0 24px; position: relative; z-index: 2; }
@media (max-width: 720px) { .paths { grid-template-columns: 1fr; } }
.path-card { background: rgba(35, 35, 39, 0.85); border: 1px solid var(--umail-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px; text-align: left; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
:root[data-theme="light"] .path-card { background: var(--umail-surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.path-card .kicker { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--umail-bright); }
.path-card code { background: var(--tint-soft); color: var(--umail-light-green); padding: 2px 8px; border-radius: 6px; font-size: .95rem; }
.path-card p { color: var(--umail-text-secondary); margin: 12px 0 20px; }

.section { padding: 64px 24px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 32px; }
.feature { padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--umail-border); background: var(--umail-surface); }
.feature .icon { color: var(--umail-primary); margin-bottom: 10px; }
.feature .icon svg { width: 26px; height: 26px; }

footer.site-footer { border-top: 1px solid var(--umail-border); padding: 28px 24px; text-align: center; color: var(--umail-text-secondary); font-size: .85rem; }

/* ---------- Onboarding / auth pages ---------- */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; position: relative; overflow-x: hidden; isolation: isolate; background: var(--umail-bg); }
/* position: fixed (not absolute) so the glow stays anchored to the viewport
   corner instead of drifting to the bottom of a tall, variable-length form. */
.auth-shell::before {
  content: ""; position: fixed; z-index: -1; width: 760px; height: 600px; left: -280px; bottom: -320px;
  border-radius: 40% 60% 55% 45% / 50% 42% 58% 50%;
  transform: rotate(-8deg);
  background: radial-gradient(ellipse at 38% 40%, rgba(0, 201, 167, 0.24), rgba(0, 201, 167, 0) 66%);
}
.auth-shell::after {
  content: ""; position: fixed; z-index: -1; width: 280px; height: 320px; right: 8%; top: -140px;
  border-radius: 55% 45% 48% 52% / 42% 58% 42% 58%;
  transform: rotate(18deg);
  background: radial-gradient(ellipse at 55% 35%, rgba(24, 224, 184, 0.10), rgba(24, 224, 184, 0) 70%);
}
:root[data-theme="light"] .auth-shell::before, :root[data-theme="light"] .auth-shell::after { opacity: .5; }
.auth-shell > .topbar { background: transparent; border-bottom: 1px solid var(--umail-border); }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px 20px; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.card { padding: 20px 24px; }
.auth-card h2 { margin-bottom: 2px; }
.auth-card > p.muted { margin-bottom: 10px; }
.auth-card h2 { color: var(--umail-text); display: flex; align-items: center; gap: 10px; }
.auth-card h2 svg { width: 24px; height: 24px; color: var(--umail-primary); }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.type-card {
  border: 2px solid var(--umail-border); border-radius: var(--radius-md); padding: 10px 12px;
  cursor: pointer; text-align: center; background: rgba(23, 23, 26, 0.35); transition: border-color .15s, background .15s;
}
.type-card:hover { border-color: var(--umail-border-strong); }
.type-card.selected { border-color: var(--umail-primary); background: var(--tint-medium); }
.type-card .t-icon { color: var(--umail-text-secondary); margin-bottom: 2px; display: flex; justify-content: center; }
.type-card.selected .t-icon { color: var(--umail-primary); }
.type-card .t-icon svg { width: 20px; height: 20px; }
.type-card .t-title { font-weight: 700; color: var(--umail-text); }
.type-card .t-sub { font-size: .78rem; color: var(--umail-text-secondary); }

/* ---------- Dashboard ---------- */
.app-shell { display: flex; min-height: calc(100vh - 57px); }
.sidebar {
  width: 220px; flex-shrink: 0; border-right: 1px solid var(--umail-border);
  padding: 18px 12px; background: var(--umail-bg-secondary);
}
.sidebar .compose-btn { margin-bottom: 16px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-md);
  color: var(--umail-text-secondary); font-size: .9rem; font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a svg { width: 20px; height: 20px; color: var(--umail-text-secondary); flex-shrink: 0; }
.sidebar nav a:hover { background: var(--tint-soft); text-decoration: none; color: var(--umail-text); }
.sidebar nav a.active { background: var(--tint-medium); color: var(--umail-light-green); font-weight: 700; }
.sidebar nav a.active svg { color: var(--umail-primary); }
.sidebar nav a .count { margin-left: auto; font-size: .75rem; color: var(--umail-text-muted); }
.sidebar .folder-divider { font-size: .72rem; text-transform: uppercase; color: var(--umail-text-muted); margin: 14px 10px 6px; letter-spacing: .04em; }
.main-content { flex: 1; padding: 28px; overflow-x: hidden; background: var(--umail-bg); min-width: 0; }

/* A fixed 220px sidebar plus a two-column mail layout has nowhere to go on a
   phone — below 768px the folder list becomes a slide-in drawer (toggled by
   .sidebar-toggle, only rendered/shown at this width) instead of a
   permanent column, so the reading pane gets the full screen width. */
.sidebar-toggle { display: none; }
@media (max-width: 768px) {
  .app-shell { position: relative; overflow-x: hidden; }
  .sidebar {
    position: fixed; top: 57px; bottom: 0; left: 0; width: 260px; max-width: 80vw;
    z-index: 40; transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg); overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 57px 0 0 0; background: rgba(10, 10, 11, .5); z-index: 39;
  }
  .sidebar-backdrop.open { display: block; }
  .main-content { padding: 16px; }
  .sidebar-toggle { display: inline-flex; }
}
.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--umail-text); }
.progress-track { height: 8px; border-radius: 999px; background: var(--tint-soft); overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--umail-primary); border-radius: 999px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 14px; margin-top: 20px; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; border-radius: var(--radius-md); border: 1px solid var(--umail-border); background: var(--umail-surface); cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--umail-text); }
.quick-action:hover { background: var(--tint-soft); text-decoration: none; border-color: var(--umail-border-strong); }
.quick-action .qa-icon { color: var(--umail-primary); }
.quick-action .qa-icon svg { width: 24px; height: 24px; }

/* ---------- Mail list / reading pane ---------- */
.mail-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.mail-toolbar .search-wrap { flex: 1; position: relative; }
.mail-toolbar .search-wrap input { padding-left: 38px; }
.mail-toolbar .search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--umail-text-muted); width: 18px; height: 18px; }

.mail-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
/* Grid items don't shrink below their content's natural width by default — without
   this, one long unbroken string (a link, a token) in the reading pane pushes the
   whole column wider than the screen, and everything else silently clips instead
   of wrapping, since .main-content hides horizontal overflow rather than scrolling it. */
.mail-layout > * { min-width: 0; }
@media (max-width: 900px) { .mail-layout { grid-template-columns: 1fr; } }
.mail-list { background: var(--umail-surface); border: 1px solid var(--umail-border); border-radius: var(--radius-lg); overflow: hidden; }
.mail-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--umail-border); cursor: pointer; }
.mail-item:last-child { border-bottom: none; }
.mail-item:hover { background: var(--tint-weak); }
.mail-item.unread { font-weight: 700; }
.mail-item.selected { background: var(--tint-medium); }
.mail-item .m-from { font-size: .9rem; color: var(--umail-text); }
.mail-item .m-subject { font-size: .88rem; color: var(--umail-text); }
.mail-item .m-preview { font-size: .82rem; color: var(--umail-text-secondary); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .m-time { font-size: .75rem; color: var(--umail-text-muted); white-space: nowrap; }
.mail-item .m-main { flex: 1; min-width: 0; }

.reading-pane { background: var(--umail-surface); border: 1px solid var(--umail-border); border-radius: var(--radius-lg); padding: 26px; min-height: 300px; }
.reading-pane .subject { font-size: 1.3rem; margin-bottom: 14px; color: var(--umail-text); overflow-wrap: anywhere; }
.reading-pane .meta-row { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--umail-border); padding-bottom: 14px; margin-bottom: 18px; }
.reading-pane .body { white-space: pre-wrap; line-height: 1.7; color: var(--umail-text); overflow-wrap: anywhere; }
.reading-pane .body a { color: var(--umail-primary); text-decoration: underline; }
.reading-pane .body a:hover { color: var(--umail-light-green); }
.empty-state { text-align: center; color: var(--umail-text-secondary); padding: 60px 20px; }
.empty-state .e-icon { color: var(--umail-text-muted); margin-bottom: 12px; display: flex; justify-content: center; }
.empty-state .e-icon svg { width: 40px; height: 40px; }

/* ---------- Compose modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 11, .60); display: none;
  align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-overlay.open { display: flex; }
@media (min-width: 720px) { .modal-overlay { align-items: center; } }
.modal {
  background: rgba(43, 43, 48, 0.96); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  border: 1px solid var(--umail-border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
:root[data-theme="light"] .modal { background: var(--umail-surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
@media (min-width: 720px) { .modal { border-radius: var(--radius-lg); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--umail-border); }
.modal-header strong { color: var(--umail-text); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-top: 1px solid var(--umail-border); }

/* ---------- Contacts ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.contact-card { display: flex; gap: 12px; align-items: center; }
.contact-card .c-info { min-width: 0; }
.contact-card .c-name { font-weight: 700; color: var(--umail-text); }
.contact-card .c-email { font-size: .82rem; color: var(--umail-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
@media (max-width: 800px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-md); color: var(--umail-text-secondary); font-weight: 600; font-size: .88rem; margin-bottom: 2px; }
.settings-nav a svg { width: 18px; height: 18px; }
.settings-nav a.active, .settings-nav a:hover { background: var(--tint-medium); color: var(--umail-light-green); text-decoration: none; }
.settings-nav a.active svg, .settings-nav a:hover svg { color: var(--umail-primary); }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section h3 { display: flex; align-items: center; gap: 10px; }
.settings-section h3 svg { width: 20px; height: 20px; color: var(--umail-primary); }
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; cursor: pointer; inset: 0; background: var(--tint-strong); border-radius: 999px; transition: .15s; }
.toggle .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + .slider { background: var(--umail-primary); }
.toggle input:checked + .slider::before { transform: translateX(18px); background: var(--umail-on-primary); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-top: 16px; }
.plan-card { border: 1px solid var(--umail-border); border-radius: var(--radius-md); padding: 18px; text-align: center; background: var(--umail-surface); }
.plan-card.current { border-color: var(--umail-primary); box-shadow: var(--glow-focus); }
.plan-card .p-price { font-size: 1.5rem; font-weight: 800; margin: 8px 0; color: var(--umail-text); }
.plan-card ul { list-style: none; padding: 0; margin: 12px 0; font-size: .82rem; color: var(--umail-text-secondary); text-align: left; }
.plan-card li { padding: 3px 0; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--umail-surface-elevated); color: var(--umail-text); padding: 12px 20px; border-radius: var(--radius-md);
  font-size: .88rem; box-shadow: var(--shadow-lg); border: 1px solid var(--umail-border); z-index: 100; display: none;
}
#toast.show { display: block; }
#toast.error { background: var(--error); color: #fff; border-color: transparent; }
#toast.success { background: var(--success); color: #04231b; border-color: transparent; }

.loading-dot::after { content: "…"; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.9s linear infinite; display: inline-block; }

/* ---- Calendar ---- */
.cal-head { margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-card { padding: 0; overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays { border-bottom: 1px solid var(--umail-border); }
.cal-wd { padding: 10px 8px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--umail-text-secondary); text-align: center; }
.cal-cell { min-height: 104px; padding: 6px; border-right: 1px solid var(--umail-border); border-bottom: 1px solid var(--umail-border); cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--tint-weak); }
.cal-cell.other { opacity: .45; }
.cal-cell.selected { background: var(--tint-medium); }
.cal-num { font-size: .8rem; font-weight: 600; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--umail-text); }
.cal-cell.today .cal-num { background: var(--umail-primary); color: var(--umail-on-primary); }
.cal-chip { text-align: left; border: none; cursor: pointer; font: inherit; font-size: .74rem; padding: 2px 6px; border-radius: 6px; background: var(--tint-medium); color: var(--umail-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--umail-primary); }
.cal-chip:hover { background: var(--tint-strong, var(--tint-medium)); filter: brightness(1.15); }
.cal-more { font-size: .72rem; color: var(--umail-text-secondary); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; justify-content: center; margin-top: auto; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--umail-primary); display: block; }
@media (max-width: 640px) {
  .cal-cell { min-height: 58px; padding: 4px 2px; align-items: center; }
  .cal-chip, .cal-more { display: none; }
  .cal-dots { display: flex; }
}
.cal-row { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--umail-border); padding: 8px 2px; cursor: pointer; font: inherit; color: var(--umail-text); }
.cal-row:last-child { border-bottom: none; }
.cal-row:hover { background: var(--tint-weak); }
.cal-row-title { display: block; font-size: .9rem; font-weight: 600; }
.cal-row-meta { display: block; font-size: .78rem; color: var(--umail-text-secondary); }
.cal-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- Attachments ---- */
.attach-zone { border: 1.5px dashed var(--umail-border); border-radius: var(--radius-md, 12px); padding: 12px; transition: background .15s, border-color .15s; }
.attach-zone.dragging { border-color: var(--umail-primary); background: var(--tint-medium); }
.attach-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.attach-list:empty { display: none; }
.attach-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 10px; background: var(--tint-weak); border: 1px solid var(--umail-border); font-size: .85rem; }
.attach-chip > svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--umail-primary); }
.attach-chip .a-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--umail-text); }
.attach-chip .a-size { color: var(--umail-text-secondary); font-size: .75rem; white-space: nowrap; }
.a-remove { border: none; background: none; cursor: pointer; padding: 2px; border-radius: 6px; color: var(--umail-text-secondary); display: inline-flex; }
.a-remove:hover { background: var(--tint-medium); color: var(--umail-text); }
.a-remove svg { width: 16px; height: 16px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.att-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--umail-border); background: var(--tint-weak); color: var(--umail-text); max-width: 260px; text-decoration: none; }
.att-card:hover { background: var(--tint-medium); text-decoration: none; }
.att-card > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--umail-primary); }
.att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; font-weight: 600; }
.att-size { font-size: .72rem; color: var(--umail-text-secondary); white-space: nowrap; }
.att-card.att-image { flex-direction: column; align-items: stretch; padding: 6px; width: 150px; }
.att-card.att-image img { width: 100%; height: 100px; object-fit: cover; border-radius: 8px; display: block; }
.att-card.att-image .att-name { padding: 2px 4px; font-weight: 500; font-size: .78rem; }

/* ---- Theme picker (Settings → Appearance) ---- */
.theme-choices { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.theme-choice { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; padding: 18px 12px; border-radius: 14px; border: 1.5px solid var(--umail-border); background: var(--tint-weak); color: var(--umail-text); cursor: pointer; font: inherit; }
.theme-choice svg { width: 26px; height: 26px; color: var(--umail-primary); }
.theme-choice:hover { background: var(--tint-medium); }
.theme-choice.active { border-color: var(--umail-primary); background: var(--tint-medium); box-shadow: 0 0 0 3px var(--tint-medium); }

/* ---- Address filter (business accounts with several addresses) ---- */
.address-filter { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 0 12px; }
.af-chip { border: 1px solid var(--umail-border); background: var(--tint-weak); color: var(--umail-text-secondary); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .8rem; cursor: pointer; }
.af-chip:hover { background: var(--tint-medium); color: var(--umail-text); }
.af-chip.active { background: var(--umail-primary); border-color: var(--umail-primary); color: var(--umail-on-primary); font-weight: 600; }
.addr-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--umail-border); }
.addr-row:last-child { border-bottom: none; }
.addr-row .addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .9rem; }

/* ---- Gmail-style mail page ---- */
.search-pill { display: flex; align-items: center; gap: 8px; flex: 1; min-height: 52px; padding: 4px 10px; border-radius: 999px; background: var(--umail-surface); border: 1px solid var(--umail-border); }
.search-pill:focus-within { border-color: var(--umail-primary); box-shadow: 0 0 0 3px var(--tint-medium); }
.search-pill .sp-icon { width: 20px; height: 20px; color: var(--umail-text-muted); flex-shrink: 0; margin-left: 6px; }
.search-pill input[type="search"] { flex: 1; min-width: 0; border: none !important; background: transparent !important; box-shadow: none !important; outline: none; padding: 10px 4px !important; font: inherit; font-size: 1rem; color: var(--umail-text); }
.pill-avatar { display: none; border: none; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-lg { width: 46px; height: 46px; font-size: 1rem; }
.drawer-extra { display: none; }

.list-label { padding: 14px 18px 8px; font-size: .82rem; font-weight: 700; color: var(--umail-primary); letter-spacing: .02em; }
.mail-row { display: flex; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--umail-border); cursor: pointer; align-items: flex-start; }
.mail-row:hover { background: var(--tint-weak); }
.mail-row.selected { background: var(--tint-medium); }
.mr-main { flex: 1; min-width: 0; }
.mr-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mr-from { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; color: var(--umail-text-secondary); }
.mr-count { font-size: .78rem; color: var(--umail-text-muted); font-weight: 500; margin-left: 4px; }
.mr-time { font-size: .78rem; white-space: nowrap; color: var(--umail-text-muted); }
.mr-bottom { display: flex; align-items: flex-start; gap: 8px; }
.mr-text { flex: 1; min-width: 0; }
.mr-subject, .mr-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-subject { font-size: .95rem; color: var(--umail-text-secondary); }
.mr-preview { font-size: .88rem; color: var(--umail-text-muted); }
.mail-row.unread .mr-from, .mail-row.unread .mr-subject { font-weight: 700; color: var(--umail-text); }
.mail-row.unread .mr-time { font-weight: 700; color: var(--umail-text); }
.draft-tag { color: var(--error); font-weight: 600; }
.star-btn { border: none; background: none; cursor: pointer; padding: 4px; margin-top: 2px; color: var(--umail-text-muted); display: inline-flex; border-radius: 8px; }
.star-btn:hover { background: var(--tint-medium); color: var(--umail-text); }
.star-btn svg { width: 22px; height: 22px; }
.star-btn.on { color: #f5b400; }
.star-btn.on svg { fill: #f5b400; }

.reading-back { display: none; margin-bottom: 10px; }
.thread-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .88rem; align-items: flex-start; }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice-warn { background: rgba(255, 170, 0, .10); border: 1px solid rgba(255, 170, 0, .35); color: var(--umail-text); }
.notice-warn svg { color: #ffb020; }
.msg-card { border-top: 1px solid var(--umail-border); padding: 14px 0; }
.msg-card:first-child { border-top: none; padding-top: 0; }
.msg-head { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.msg-who { flex: 1; min-width: 0; }
.msg-addr { color: var(--umail-text-muted); font-size: .82rem; overflow-wrap: anywhere; }
.msg-to { font-size: .82rem; color: var(--umail-text-muted); overflow-wrap: anywhere; }
.msg-snippet { font-size: .82rem; color: var(--umail-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time { font-size: .78rem; color: var(--umail-text-muted); white-space: nowrap; }
.msg-card .body { margin: 14px 0 0 48px; }
.msg-atts { margin: 16px 0 0 48px; }
.fab-compose { display: none; }

@media (min-width: 769px) { .mail-page .mail-toolbar { max-width: 720px; } }
@media (max-width: 900px) {
  .mail-layout .reading-pane { display: none; }
  .mail-layout.reading .mail-list { display: none; }
  .mail-layout.reading .reading-pane { display: block; }
  .reading-back { display: inline-flex; }
}
@media (max-width: 768px) {
  .mail-page #app-nav { display: none; }
  .mail-page .app-shell { min-height: 100vh; }
  .mail-page .sidebar { top: 0; z-index: 60; }
  .mail-page .sidebar-backdrop { inset: 0; z-index: 59; }
  .mail-page .main-content { padding: 10px 8px 90px; }
  .mail-page .mail-toolbar { margin-bottom: 10px; }
  .mail-page .search-pill { min-height: 54px; background: var(--umail-bg-secondary); border-color: transparent; padding: 4px 8px; }
  .mail-page .search-pill .sp-icon { display: none; }
  .pill-avatar { display: inline-flex; }
  .pill-avatar .avatar { width: 38px; height: 38px; font-size: .9rem; }
  .mail-page .mail-list { border: none; border-radius: 0; background: transparent; }
  .mail-page .reading-pane { padding: 14px 10px; border-radius: 16px; }
  .msg-card .body, .msg-atts { margin-left: 0; }
  .drawer-extra { display: block; }
  .drawer-verify { margin: 12px 10px; font-size: .8rem; color: var(--umail-text-secondary); display: flex; gap: 6px; }
  .fab-compose {
    display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 16px; bottom: 20px; z-index: 30;
    padding: 16px 22px; border: none; border-radius: 18px; cursor: pointer; font: inherit; font-weight: 600;
    background: var(--umail-primary); color: var(--umail-on-primary); box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  }
  body:has(.mail-layout.reading) .fab-compose { display: none; }
}

.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--umail-primary); color: var(--umail-on-primary); font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.nav-badge[hidden] { display: none; }
.sidebar nav a .count { background: var(--umail-primary); color: var(--umail-on-primary); border-radius: 999px; padding: 1px 7px; font-weight: 700; }

.suggest-chip { cursor: pointer; }
.suggest-chip:hover { background: var(--tint-strong); }

/* ---- To / Cc / Bcc recipient boxes ---- */
[hidden] { display: none !important; }
.rcpt-head { display: flex; justify-content: space-between; align-items: baseline; }
.rcpt-toggles { display: inline-flex; gap: 2px; }
.link-btn { background: none; border: none; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; color: var(--umail-primary); padding: 2px 8px; border-radius: 8px; }
.link-btn:hover { background: var(--tint-medium); }
.rcpt-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 5px 10px; cursor: text; border: 1px solid var(--umail-border); border-radius: var(--radius-md); background: var(--umail-bg-secondary); }
:root[data-theme="light"] .rcpt-box { background: var(--umail-surface); }
.rcpt-box:focus-within { border-color: var(--umail-primary); box-shadow: var(--glow-focus); }
.rcpt-chips { display: contents; }
.rcpt-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--tint-medium); border: 1px solid var(--umail-border); font-size: .85rem; color: var(--umail-text); }
.rcpt-chip .rcpt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcpt-chip.invalid { background: rgba(255, 90, 90, .12); border-color: var(--error); color: var(--error); }
.rcpt-warn { font-style: normal; font-weight: 800; width: 15px; height: 15px; border-radius: 50%; background: var(--error); color: #fff; font-size: .7rem; display: inline-flex; align-items: center; justify-content: center; }
.rcpt-x { border: none; background: none; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1; padding: 0 6px; border-radius: 50%; }
.rcpt-x:hover { background: rgba(255, 255, 255, .12); }
.rcpt-box input.rcpt-input { flex: 1; min-width: 140px; border: none !important; background: transparent !important; box-shadow: none !important; padding: 6px 2px !important; }

/* Native date/time pickers follow the theme (dark calendar popup and icon in dark mode). */
input[type="date"], input[type="time"] { color-scheme: dark; }
:root[data-theme="light"] input[type="date"], :root[data-theme="light"] input[type="time"] { color-scheme: light; }

/* ---- Domain verification guide ---- */
.verify-title { font-weight: 700; font-size: 1.05rem; }
.verify-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: .9rem; line-height: 1.5; }
.dns-table { margin-top: 8px; border: 1px solid var(--umail-border); border-radius: 12px; overflow: hidden; }
.dns-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--umail-border); flex-wrap: wrap; }
.dns-row:first-child { border-top: none; }
.dns-k { width: 120px; flex-shrink: 0; color: var(--umail-text-secondary); font-size: .8rem; }
.dns-row code { word-break: break-all; }
.dns-note { color: var(--umail-text-muted); font-size: .78rem; }
.copy-btn { margin-left: auto; border: 1px solid var(--umail-border); background: var(--tint-weak); color: var(--umail-primary); border-radius: 8px; padding: 3px 10px; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; }
.copy-btn:hover { background: var(--tint-medium); }
.copy-btn.done { color: var(--umail-text); background: var(--tint-medium); }
.notice-ok { background: rgba(0, 201, 167, .10); border: 1px solid rgba(0, 201, 167, .35); color: var(--umail-text); }
.notice-ok svg { color: var(--umail-primary); }
#verify-result { margin-top: 12px; }

/* ---- Admin dashboard ---- */
#admin-nav .active { background: var(--tint-medium); color: var(--umail-light-green); font-weight: 700; }
#admin-nav .active svg { color: var(--umail-primary); }
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.admin-stat { background: var(--umail-surface); border: 1px solid var(--umail-border); border-radius: var(--radius-md); padding: 16px 18px; }
.admin-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--umail-text); }
.admin-stat-label { font-size: .82rem; color: var(--umail-text-secondary); margin-top: 2px; }
.admin-table-wrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--umail-border); border-radius: var(--radius-md); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th { text-align: left; padding: 10px 14px; background: var(--umail-bg-secondary); color: var(--umail-text-secondary); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.admin-table td { padding: 10px 14px; border-top: 1px solid var(--umail-border); color: var(--umail-text); }
.admin-row { cursor: pointer; }
.admin-row:hover td { background: var(--tint-weak); }
.admin-kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--umail-border); font-size: .9rem; }
.admin-kv span { color: var(--umail-text-secondary); }
.admin-kv:last-of-type { border-bottom: none; }

/* ---- Admin dashboard: Stripe/Linear-style additions ----
   All on the same design tokens as the rest of the app; no colors here that
   aren't already brand variables. Chart series colors are validated with
   dataviz's palette checker (2 categorical slots, CVD-safe both themes):
   "new" = --umail-secondary-accent, "suspended" = --error. */
.admin-brand-tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--umail-light-green); background: var(--tint-medium);
  display: inline-block; padding: 3px 9px; border-radius: 999px; margin: 0 0 16px 2px;
}
.admin-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 780px) { .admin-two-col { grid-template-columns: 1fr; } }

.admin-chart-card { padding: 18px 20px 8px; }
.chart-legend { display: flex; gap: 16px; margin: 10px 0 4px; font-size: .82rem; color: var(--umail-text-secondary); }
.chart-legend-item { display: flex; align-items: center; gap: 6px; }
.chart-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-swatch.s-new { background: var(--umail-secondary-accent); }
.chart-swatch.s-suspended { background: var(--error); }

.growth-chart-wrap { position: relative; }
.growth-svg { width: 100%; height: 200px; display: block; overflow: visible; }
.growth-svg .gridline { stroke: var(--umail-border); stroke-width: 1; }
.growth-svg .axis-label { fill: var(--umail-text-muted); font-size: 10px; font-family: var(--font-sans); }
.growth-svg .bar-new { fill: var(--umail-secondary-accent); }
.growth-svg .bar-suspended { fill: var(--error); }
.growth-svg rect.bar-hit { fill: transparent; cursor: pointer; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--umail-surface-elevated);
  border: 1px solid var(--umail-border-strong); border-radius: var(--radius-sm); padding: 7px 10px;
  font-size: .78rem; color: var(--umail-text); box-shadow: var(--shadow-md); white-space: nowrap;
  opacity: 0; transform: translateY(2px); transition: opacity .1s ease;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .ct-row { display: flex; align-items: center; gap: 6px; }
.chart-tooltip .ct-row + .ct-row { margin-top: 2px; }

.admin-plan-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.admin-plan-row .plan-name { width: 84px; flex-shrink: 0; font-size: .85rem; text-transform: capitalize; color: var(--umail-text); }
.admin-plan-row .progress-track { flex: 1; margin-top: 0; }
.admin-plan-row .plan-count { width: 34px; text-align: right; flex-shrink: 0; font-size: .85rem; color: var(--umail-text-secondary); font-variant-numeric: tabular-nums; }

.admin-health-row {
  display: flex; align-items: center; gap: 12px; background: var(--umail-surface);
  border: 1px solid var(--umail-border); border-radius: var(--radius-md); padding: 14px 16px;
}
.admin-health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.admin-health-dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.admin-health-dot.down { background: var(--error); box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
.admin-health-dot.unknown { background: var(--umail-text-muted); }
.admin-health-name { font-weight: 600; flex: 1; }
.admin-health-meta { font-size: .8rem; color: var(--umail-text-secondary); font-variant-numeric: tabular-nums; }
