/* ============================================================
   TempMail UI - X style glassmorphism
   Keywords: monochrome + blue accent / frosted glass / soft radius
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --clr-primary:        #0F1419;
  --clr-primary-dark:   #000000;
  --clr-primary-light:  #2F3336;
  --clr-accent:         #1D9BF0;
  --clr-accent-soft:    rgba(29, 155, 240, 0.14);
  --clr-jade:           #00BA7C;
  --clr-jade-light:     #35D39D;
  --clr-danger:         #F4212E;
  --clr-success:        #00BA7C;
  --clr-warn:           #FFD400;

  --bg:                 #F7F9F9;
  --bg-card:            rgba(255, 255, 255, 0.62);
  --bg-sidebar:         rgba(255, 255, 255, 0.55);
  --bg-elevated:        rgba(255, 255, 255, 0.78);
  --bg-soft:            rgba(239, 243, 244, 0.72);
  --text:               #0F1419;
  --text-secondary:     #536471;
  --text-muted:         #657786;
  --border:             rgba(15, 20, 25, 0.10);
  --border-light:       rgba(15, 20, 25, 0.06);
  --shadow:             rgba(15, 20, 25, 0.08);
  --shadow-strong:      rgba(15, 20, 25, 0.14);
  --glass-blur:         blur(24px) saturate(1.55);
  --glass-border:       1px solid rgba(255, 255, 255, 0.55);
  --sidebar-text:       #0F1419;
  --sidebar-muted:      rgba(15, 20, 25, 0.48);
  --sidebar-hover:      rgba(15, 20, 25, 0.05);
  --sidebar-active:     rgba(29, 155, 240, 0.12);

  --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --radius:    20px;
  --radius-md: 16px;
  --radius-sm: 999px;
  --radius-xs: 12px;
  --transition: 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);

  --sidebar-w: 248px;
}

[data-theme="dark"] {
  --bg:             #000000;
  --bg-card:        rgba(22, 24, 28, 0.58);
  --bg-sidebar:     rgba(15, 20, 25, 0.52);
  --bg-elevated:    rgba(22, 24, 28, 0.78);
  --bg-soft:        rgba(32, 35, 39, 0.72);
  --text:           #E7E9EA;
  --text-secondary: #AAB8C2;
  --text-muted:     #71767B;
  --border:         rgba(239, 243, 244, 0.12);
  --border-light:   rgba(239, 243, 244, 0.07);
  --shadow:         rgba(0, 0, 0, 0.35);
  --shadow-strong:  rgba(0, 0, 0, 0.55);
  --glass-border:   1px solid rgba(255, 255, 255, 0.08);
  --sidebar-text:   #E7E9EA;
  --sidebar-muted:  rgba(231, 233, 234, 0.48);
  --sidebar-hover:  rgba(239, 243, 244, 0.06);
  --sidebar-active: rgba(29, 155, 240, 0.16);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 12% 8%, rgba(29, 155, 240, 0.18), transparent 30rem),
    radial-gradient(circle at 88% 10%, rgba(120, 86, 255, 0.12), transparent 26rem),
    radial-gradient(circle at 50% 100%, rgba(0, 186, 124, 0.10), transparent 32rem),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--clr-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(101, 119, 134, 0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }

/* ===== AuthPage ===== */
#auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}
#auth-page::before,
#auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}
#auth-page::before {
  width: 28rem;
  height: 28rem;
  top: -8rem;
  right: -6rem;
  background: radial-gradient(circle, rgba(29, 155, 240, 0.28), transparent 70%);
}
#auth-page::after {
  width: 24rem;
  height: 24rem;
  bottom: -8rem;
  left: -4rem;
  background: radial-gradient(circle, rgba(120, 86, 255, 0.18), transparent 70%);
}
.auth-card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: 28px;
  padding: 2.4rem 2.1rem;
  width: 100%;
  max-width: 430px;
  box-shadow:
    0 24px 60px var(--shadow-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  position: relative;
  z-index: 1;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}
.auth-logo .logo-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(145deg, #0F1419, #1D9BF0);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  margin-bottom: 0.85rem;
  color: #fff;
  box-shadow: 0 10px 28px rgba(29, 155, 240, 0.28);
}
.auth-logo h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-logo p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.auth-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.7rem 0.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  border-radius: 999px;
  font-weight: 600;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}
.auth-tab.active {
  color: var(--text);
  background: var(--bg-elevated);
  box-shadow: 0 4px 14px var(--shadow);
}
.auth-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== Sidebar ===== */
#main-layout { display: flex; flex: 1; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 8px 0 30px rgba(15, 20, 25, 0.04);
}
.sidebar-logo {
  padding: 1.35rem 1.15rem 1.05rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-logo .logo-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(145deg, #0F1419, #1D9BF0);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(29, 155, 240, 0.24);
}
.sidebar-logo span {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--sidebar-text);
  letter-spacing: -0.02em;
}
.sidebar-logo small {
  display: block;
  font-size: 0.68rem;
  color: var(--sidebar-muted);
  margin-top: 1px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 0.9rem 0.75rem;
}
.nav-section {
  padding: 0.65rem 0.85rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.9rem;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 999px;
  transition: color var(--transition), background var(--transition), transform var(--transition);
  position: relative;
  font-weight: 600;
}
.nav-item:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}
.nav-item.active {
  color: var(--sidebar-text);
  background: var(--sidebar-active);
  box-shadow: inset 0 0 0 1px rgba(29, 155, 240, 0.18);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 50%;
  width: 4px;
  height: 1.15rem;
  transform: translateY(-50%);
  background: var(--clr-accent);
  border-radius: 999px;
}
.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.98rem;
}

.sidebar-bottom {
  padding: 0.9rem 0.85rem 1.05rem;
  border-top: 1px solid var(--border-light);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  margin-bottom: 0.55rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(145deg, #0F1419, #1D9BF0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}
.user-chip-info { overflow: hidden; }
.user-chip-name {
  font-size: 0.82rem;
  color: var(--sidebar-text);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role {
  font-size: 0.68rem;
  color: var(--sidebar-muted);
}
.btn-logout,
.btn-theme {
  width: 100%;
  padding: 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn-logout {
  background: rgba(244, 33, 46, 0.08);
  border: 1px solid rgba(244, 33, 46, 0.16);
  color: var(--clr-danger);
}
.btn-logout:hover {
  background: rgba(244, 33, 46, 0.14);
}
.btn-theme {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  margin-top: 0.45rem;
}
.btn-theme:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

/* ===== Main Content ===== */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 249, 249, 0.62);
  border-bottom: 1px solid var(--border-light);
  padding: 0.9rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
[data-theme="dark"] .topbar {
  background: rgba(0, 0, 0, 0.45);
}
.topbar-title {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.topbar-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.08rem;
}

.page {
  flex: 1;
  padding: 1.5rem 1.6rem 2.2rem;
  max-width: 1120px;
  width: 100%;
}

/* ===== Shared Components ===== */
.card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius);
  box-shadow:
    0 10px 30px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .card-header {
  background: rgba(255, 255, 255, 0.02);
}
.card-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}
.card-body { padding: 1.25rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 8px 24px var(--shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px var(--shadow-strong);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-note { font-size: 0.72rem; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 1.05rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 700;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--clr-primary);
  color: white;
  box-shadow: 0 8px 18px rgba(15, 20, 25, 0.18);
}
.btn-primary:hover:not(:disabled) {
  background: #1a1f24;
  transform: translateY(-1px);
}
.btn-success {
  background: var(--clr-jade);
  color: white;
  box-shadow: 0 8px 18px rgba(0, 186, 124, 0.22);
}
.btn-success:hover:not(:disabled) { background: #00a06b; }
.btn-danger {
  background: var(--clr-danger);
  color: white;
  box-shadow: 0 8px 18px rgba(244, 33, 46, 0.22);
}
.btn-danger:hover:not(:disabled) { background: #dc1e2a; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.04);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-soft);
  color: var(--text);
}
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.78rem; }

/* Form */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.form-input {
  display: block;
  width: 100%;
  padding: 0.72rem 0.95rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
[data-theme="dark"] .form-input {
  background: rgba(255, 255, 255, 0.04);
}
.form-input:focus {
  border-color: rgba(29, 155, 240, 0.65);
  box-shadow: 0 0 0 4px rgba(29, 155, 240, 0.14);
  background: var(--bg-elevated);
}
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th {
  text-align: left;
  padding: 0.72rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(239, 243, 244, 0.55);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="dark"] th {
  background: rgba(255, 255, 255, 0.03);
}
td {
  padding: 0.78rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(29, 155, 240, 0.04); }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge-green {
  background: rgba(0, 186, 124, 0.12);
  color: var(--clr-jade);
  border-color: rgba(0, 186, 124, 0.16);
}
.badge-red {
  background: rgba(244, 33, 46, 0.12);
  color: var(--clr-danger);
  border-color: rgba(244, 33, 46, 0.16);
}
.badge-gold {
  background: rgba(29, 155, 240, 0.12);
  color: var(--clr-accent);
  border-color: rgba(29, 155, 240, 0.16);
}
.badge-gray {
  background: rgba(101, 119, 134, 0.12);
  color: var(--text-muted);
}
.badge-retained {
  background: rgba(29, 155, 240, 0.12);
  color: #0C7BC0;
  border-color: rgba(29, 155, 240, 0.16);
}
[data-theme="dark"] .badge-gray { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .badge-retained {
  background: rgba(29, 155, 240, 0.18);
  color: #79C8F8;
}

.retained-mail-row { cursor: pointer; }

/* Code / API key */
.code-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--clr-accent);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  font-size: 0.85rem;
}
.copy-btn:hover {
  color: var(--clr-accent);
  background: var(--clr-accent-soft);
}

/* Email list item */
.email-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.email-item:hover { background: rgba(29, 155, 240, 0.04); }
.email-item:last-child { border-bottom: none; }
.email-item-main { flex: 1; min-width: 0; }
.email-item-sender {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.email-item-subject {
  font-size: 0.86rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-item-time {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Mailbox cards */
.mailbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.mailbox-card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.15rem;
  box-shadow: 0 10px 28px var(--shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform var(--transition), box-shadow var(--transition);
}
.mailbox-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px var(--shadow-strong);
}
.mailbox-address {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 0.55rem;
}
.mailbox-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.mailbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.mailbox-pager {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: 16px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 8px 22px var(--shadow);
}
.mailbox-pager-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.mailbox-pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.mailbox-page-info {
  min-width: 5.5rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
}
.mailbox-page-btn {
  min-width: 5.5rem;
}

/* Domain guide */
.domain-guide-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
}
.guide-step {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 0;
}
.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0F1419, #1D9BF0);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}
.step-body { flex: 1; }
.step-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.step-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Toast */
#toast-container {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  background: var(--bg-elevated);
  border: var(--glass-border);
  border-radius: 16px;
  padding: 0.85rem 0.95rem;
  box-shadow: 0 16px 40px var(--shadow-strong);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: slideIn 0.25s ease;
  border-left: 3px solid var(--clr-accent);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  font-size: 0.86rem;
  font-weight: 600;
}
.toast.success { border-left-color: var(--clr-success); }
.toast.error   { border-left-color: var(--clr-danger); }
.toast.warn    { border-left-color: var(--clr-warn); }
@keyframes slideIn {
  from { transform: translateY(12px) translateX(12px); opacity: 0; }
  to   { transform: translateY(0) translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}
.modal {
  background: var(--bg-elevated);
  border: var(--glass-border);
  border-radius: 24px;
  padding: 1.7rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 70px var(--shadow-strong);
  position: relative;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.modal-title {
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
  padding-right: 1.5rem;
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  font-size: 1.05rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.3rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.2rem 0;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  display: block;
}
.empty-state p { font-size: 0.9rem; }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--clr-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Email detail */
.email-detail-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .email-detail-header {
  background: rgba(255, 255, 255, 0.02);
}
.email-subject-big {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 0.7rem;
  letter-spacing: -0.02em;
}
.email-info-row {
  display: flex;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  align-items: center;
}
.email-info-row strong { color: var(--text); }
.email-detail-card { overflow: hidden; }
.email-body-frame {
  width: 100%;
  border: none;
  min-height: 400px;
  background: white;
  display: block;
  border-radius: 0 0 var(--radius) var(--radius);
}
.email-body-text {
  padding: 1.3rem;
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.8;
  font-family: var(--font-mono);
}

/* Toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0;
}
.toggle-label { font-size: 0.9rem; color: var(--text); font-weight: 600; }
.toggle-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
  font-weight: 400;
}
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(101, 119, 134, 0.28);
  border-radius: 999px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.toggle input:checked + .toggle-slider { background: var(--clr-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* API key hero */
.apikey-hero {
  text-align: center;
  padding: 2rem 1rem;
}
.apikey-hero .big-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}
.apikey-hero h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.apikey-hero p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Hamburger */
.hamburger-btn {
  display: none;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  border-radius: 12px;
  transition: background var(--transition);
  flex-shrink: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hamburger-btn:hover { background: var(--sidebar-hover); }

/* Sidebar backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.35);
  z-index: 199;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.sidebar-backdrop.show { display: block; }

/* Tablet */
@media (max-width: 768px) and (min-width: 601px) {
  .sidebar {
    width: 72px;
    overflow: hidden;
  }
  .sidebar .nav-item span,
  .sidebar-logo span,
  .sidebar-logo small,
  .user-chip-info,
  .nav-section {
    display: none;
  }
  .sidebar-logo { justify-content: center; padding: 1rem 0.5rem; }
  .nav-item {
    justify-content: center;
    padding: 0.8rem;
  }
  .nav-item.active::before { display: none; }
  .sidebar-bottom { padding: 0.55rem; }
  .user-chip { justify-content: center; }
  .btn-logout, .btn-theme { font-size: 0; padding: 0.55rem 0; }
  .page { padding: 1rem; }
}

/* Mobile */
@media (max-width: 600px) {
  .hamburger-btn { display: inline-flex; align-items: center; }

  .sidebar {
    position: fixed !important;
    left: -270px !important;
    width: 248px !important;
    z-index: 200;
    height: 100vh;
    transition: left 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sidebar.mob-open {
    left: 0 !important;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.28);
  }
  .sidebar .nav-item span,
  .sidebar-logo span,
  .sidebar-logo small,
  .user-chip-info,
  .nav-section {
    display: block !important;
  }
  .sidebar-logo {
    justify-content: flex-start !important;
    padding: 1.35rem 1.15rem 1.05rem !important;
  }
  .nav-item {
    justify-content: flex-start !important;
    padding: 0.72rem 0.9rem !important;
    gap: 0.7rem !important;
  }
  .sidebar-bottom { padding: 0.9rem 0.85rem 1.05rem !important; }
  .user-chip { justify-content: flex-start !important; }
  .btn-logout, .btn-theme {
    font-size: 0.8rem !important;
    padding: 0.55rem !important;
  }

  .content { width: 100vw; min-width: 0; }

  .topbar {
    padding: 0.7rem 0.9rem;
    gap: 0.4rem;
    flex-wrap: nowrap;
  }
  .topbar > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
  }
  .topbar-title {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-subtitle { font-size: 0.72rem; }
  #topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: flex-end;
    flex-shrink: 0;
  }
  #topbar-actions .btn {
    font-size: 0.74rem;
    padding: 0.34rem 0.62rem;
  }

  .page { padding: 0.9rem; }

  .card-header { padding: 0.8rem 1rem; }
  .card-body { padding: 1rem; }

  th, td {
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
    margin-bottom: 1rem;
  }
  .stat-value { font-size: 1.45rem; }

    .mailbox-grid { grid-template-columns: 1fr; }
  .mailbox-pager {
    flex-direction: column;
    align-items: stretch;
  }
  .mailbox-pager-controls {
    justify-content: space-between;
  }
  .mailbox-page-info {
    flex: 1;
  }

  .domain-guide-grid { grid-template-columns: 1fr !important; }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    border-radius: 24px 24px 0 0;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.4rem 1.2rem 2rem;
    max-width: 100%;
  }

  #toast-container {
    bottom: 0.8rem;
    right: 0.8rem;
    left: 0.8rem;
  }
  .toast {
    max-width: 100%;
    min-width: 0;
  }

  .code-box { font-size: 0.74rem; }
  .email-frame { min-height: 200px; }

  .guide-step { gap: 0.6rem; }
  .step-num {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }
}

/* Batch action bar */
.batch-bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: rgba(29, 155, 240, 0.08);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.batch-bar.active { display: flex; }
.batch-bar .batch-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--clr-accent);
  min-width: 3.5rem;
}
.batch-bar .batch-sep {
  width: 1px;
  height: 1.4rem;
  background: var(--border);
}

/* Domain checkbox */
.domain-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--clr-accent);
  flex-shrink: 0;
}

.grain-bg {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' fill='%23000' opacity='.03'/%3E%3C/svg%3E");
}

/* Table filter row */
.table-filter-row td {
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.28);
}
[data-theme="dark"] .table-filter-row td {
  background: rgba(255, 255, 255, 0.02);
}
.table-filter-row .form-input {
  background: rgba(255, 255, 255, 0.5);
}
[data-theme="dark"] .table-filter-row .form-input {
  background: rgba(255, 255, 255, 0.04);
}
.table-filter-row label {
  user-select: none;
}

/* API docs cards / misc polish */
.api-doc-card,
.docs-card {
  border-radius: var(--radius);
}
pre, code {
  font-family: var(--font-mono);
}
pre,
.code-box pre,
.api-doc-code,
[id^="api-doc-code-"] {
  background: #0B1120 !important;
  color: #E2E8F0 !important;
  border-radius: 16px;
  padding: 1rem 1.05rem;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(15, 23, 42, 0.18);
}
.card .code-box {
  background: #0B1120;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #E2E8F0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(15, 23, 42, 0.18);
}
.card .code-box pre,
.card .code-box code {
  color: #E2E8F0;
  background: transparent;
}
code:not(.code-box) {
  font-family: var(--font-mono);
  background: rgba(15, 20, 25, 0.92);
  color: #E2E8F0;
  border-radius: 8px;
  padding: 0.12rem 0.4rem;
  font-size: 0.86em;
}

/* Compose */
.compose-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}
@media (max-width: 980px) {
  .compose-layout { grid-template-columns: 1fr; }
}
.compose-body {
  min-height: 220px;
  resize: vertical;
  line-height: 1.55;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.86rem;
}
.compose-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}
.badge-yellow {
  background: rgba(230, 168, 23, 0.16);
  color: #b58100;
}

/* Account API key display */
.accounts-table td {
  vertical-align: middle;
}
.api-key-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.api-key-text {
  flex: 1;
  min-width: 0;
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  word-break: break-all;
  white-space: normal;
  overflow-wrap: anywhere;
}
[data-theme="dark"] .api-key-text {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}


/* Compose formats & attachments */
.compose-format-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.compose-format-tab {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.compose-format-tab.active {
  background: var(--clr-primary, #0f1419);
  color: #fff;
  border-color: transparent;
}
.compose-md-preview {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: var(--bg-soft);
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}
.compose-md-preview pre {
  background: rgba(15,20,25,0.92);
  color: #e2e8f0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  overflow: auto;
}
.compose-file-list {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.compose-file-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  font-size: 0.82rem;
}
.compose-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.compose-file-size {
  color: var(--text-muted);
  font-size: 0.75rem;
}
