:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-subtle: #eef2f6;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.16);
  --accent: #0ea5e9;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 28px -6px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 56px -12px rgba(15, 23, 42, 0.12);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* Splash Overlay */
.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 44px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  width: 90%;
}
.splash-icon { width: 48px; height: 48px; margin-bottom: 16px; }
.spinner-ring {
  width: 28px;
  height: 28px;
  margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.splash-title { font-size: 16px; font-weight: 600; color: var(--text); }
.splash-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; word-break: break-all; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ================= ENTERPRISE PORTAL VIEW ================= */
.portal-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 18% -10%, rgba(37, 99, 235, 0.08), transparent 60%),
    radial-gradient(ellipse 65% 45% at 88% 0%, rgba(14, 165, 233, 0.07), transparent 55%),
    var(--bg);
}

.portal-header {
  border-bottom: 1px solid rgba(226, 232, 240, 0.75);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.portal-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-lockup { display: inline-flex; align-items: center; text-decoration: none; }

.portal-status-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-pill, .sec-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  flex-shrink: 0;
}

.portal-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 28px 40px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(37, 99, 235, 0.18);
  padding: 6px 13px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.hero-title {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 18px;
}
.hero-accent {
  background: linear-gradient(120deg, #1d4ed8 0%, #2563eb 48%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 30px;
}

.feature-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
}
.feature-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-md);
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-blue { background: #eff6ff; color: #2563eb; }
.icon-cyan { background: #ecfeff; color: #0284c7; }
.icon-indigo { background: #eef2ff; color: #4f46e5; }
.feature-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.feature-text { font-size: 13px; line-height: 1.55; color: var(--text-muted); }

.trust-metrics {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 8px;
}
.metric-item { display: flex; flex-direction: column; gap: 2px; }
.metric-val { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.metric-lbl { font-size: 12px; color: var(--text-muted); }
.metric-divider { width: 1px; height: 30px; background: var(--border); }

/* Auth Card */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 34px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-card-head { margin-bottom: 26px; }
.auth-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 8px;
}
.auth-card-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-card-head p { font-size: 13.5px; color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.form-group input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-ring);
}

.input-with-suffix { position: relative; display: flex; align-items: center; }
.input-with-suffix input { padding-right: 118px; }
.domain-hint {
  position: absolute;
  right: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
  background: var(--surface-muted);
  padding: 3px 8px;
  border-radius: 6px;
  transition: opacity 0.15s;
}
.domain-hint.faded { opacity: 0; }

.input-password-wrap { position: relative; display: flex; align-items: center; }
.input-password-wrap input { padding-right: 42px; }
.icon-btn-inline {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
}
.icon-btn-inline:hover { color: var(--text); background: var(--surface-muted); }

.form-error {
  font-size: 13px;
  color: #b91c1c;
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  border-radius: 9px;
  padding: 10px 12px;
}

.btn-primary-lg {
  height: 46px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px -4px rgba(37, 99, 235, 0.45);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn-primary-lg:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -4px rgba(37, 99, 235, 0.55);
}
.btn-primary-lg:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.auth-card-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}
.auth-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
}

.portal-footer {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 28px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-top: 1px solid rgba(226, 232, 240, 0.7);
}

/* ================= WEBMAIL INBOX VIEW (GMAIL / OUTLOOK) ================= */
.mail-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.mail-topbar {
  height: 60px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.topbar-brand { display: flex; align-items: center; }

.topbar-search {
  flex: 1;
  max-width: 560px;
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f1f5f9;
  padding: 0 36px 0 40px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.topbar-search input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.search-clear:hover { background: var(--border); color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.icon-btn.spinning svg { animation: spin 0.7s linear infinite; }

.account-menu-wrap { position: relative; }
.account-pill {
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 3px 12px 3px 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.account-pill:hover { background: var(--bg); border-color: #cbd5e1; }
.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-email-text {
  font-size: 13px;
  font-weight: 500;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 46px;
  width: 256px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}
.dropdown-header { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.dropdown-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.dropdown-addr { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-align: left;
}
.dropdown-item:hover { background: var(--surface-muted); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* 3-Pane Workspace */
.mail-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Left Sidebar */
.mail-sidebar {
  width: 236px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-address-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px;
  box-shadow: var(--shadow-sm);
}
.sidebar-addr-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar-addr-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 5px 0 10px;
  word-break: break-all;
  font-family: var(--font-mono);
}
.btn-copy-address {
  width: 100%;
  height: 34px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-copy-address:hover { background: var(--primary); color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  width: 100%;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: #e2e8f0; color: var(--text); }
.nav-item.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.nav-left { display: flex; align-items: center; gap: 10px; }
.nav-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-secondary);
}
.nav-item.active .nav-badge { background: rgba(29, 78, 216, 0.14); color: #1d4ed8; }
.nav-badge.badge-accent { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar-tip { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); }
.sidebar-meta { font-size: 11px; color: var(--text-muted); }

/* Middle List Pane */
.mail-list-pane {
  width: 376px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  min-height: 0;
}
.list-header {
  height: 52px;
  flex-shrink: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.list-title-wrap { display: flex; align-items: baseline; gap: 8px; }
.list-title-wrap h2 { font-size: 15px; font-weight: 700; color: var(--text); }
.list-count { font-size: 12px; color: var(--text-muted); }

.btn-ghost-sm {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.btn-ghost-sm:hover { background: var(--surface-muted); color: var(--text); }
.btn-ghost-sm.danger-text { color: var(--danger); }
.btn-ghost-sm.danger-text:hover { background: var(--danger-soft); }

.email-list-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.email-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.email-item:hover { background: #f8fafc; }
.email-item.unread { background: #f8fbff; }
.email-item.unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}
.email-item.selected { background: #eff6ff; }

.item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.item-body { flex: 1; min-width: 0; }
.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.item-sender {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-item.unread .item-sender { font-weight: 700; color: var(--text); }
.item-time { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; }

.item-subject {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
.email-item.unread .item-subject { font-weight: 700; }

.item-snippet {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-code-pill {
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.item-code-pill:hover { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Waiting / Empty List State */
.list-empty-state {
  padding: 56px 24px;
  text-align: center;
}
.list-empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.list-empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.list-empty-state p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 18px; }

/* Right Reader Pane */
.mail-reader-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  min-height: 0;
}
.reader-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}
.empty-illustration {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.reader-empty h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.reader-empty p { font-size: 13px; max-width: 340px; line-height: 1.6; }

.reader-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.reader-toolbar {
  height: 52px;
  flex-shrink: 0;
  padding: 0 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 6px; }

.reader-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 36px;
}

/* Verification Hero Banner */
.verify-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.verify-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.verify-label {
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  display: block;
  margin-bottom: 4px;
}
.verify-code-digits {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #0f172a;
}
.btn-copy-code {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-copy-code:hover { background: var(--primary-hover); }
.btn-copy-code.copied { background: var(--success); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }

.verify-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed #bfdbfe;
}
.verify-code-row.hidden + .verify-links-row {
  padding-top: 0;
  border-top: none;
}
.btn-verify-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-verify-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.reader-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}
.reader-subject {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 16px;
}
.reader-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.reader-sender-block { display: flex; align-items: center; gap: 12px; }
.sender-avatar-lg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sender-name-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.sender-name { font-size: 14.5px; font-weight: 700; color: var(--text); }
.sender-addr { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }
.recipient-line { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.reader-time { font-size: 12.5px; color: var(--text-muted); }

.reader-body-wrap { min-height: 260px; }
.email-iframe {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
}
.email-plaintext {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.btn-primary {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--bg); }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s ease;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-only { display: none; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 35;
}

/* Responsive */
@media (max-width: 980px) {
  .portal-main {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 28px 20px;
  }
  .portal-footer { flex-direction: column; text-align: center; }
  .mail-list-pane { width: 320px; }
}

@media (max-width: 768px) {
  .mobile-only { display: inline-flex; }
  .portal-status-bar { display: none; }
  .topbar-left { min-width: auto; }
  .topbar-brand img { height: 26px; }
  .sync-indicator, .account-email-text { display: none; }
  .mail-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .mail-sidebar.open { transform: translateX(0); }
  .mail-list-pane { width: 100%; border-right: none; }
  .mail-reader-pane {
    position: fixed;
    inset: 60px 0 0 0;
    z-index: 25;
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }
  .mail-reader-pane.mobile-open { transform: translateX(0); }
  .reader-scroll { padding: 16px; }
}
