/* ==========================================================================
   TMAIL USER DASHBOARD — PREMIUM CYBER-DARK SAAS DESIGN SYSTEM
   ========================================================================== */

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

:root {
  /* Color Palette */
  --bg: #0A0A0E;
  --bg-deep: #060608;
  --surface: #121218;
  --surface-raised: #181822;
  --surface-card: #1D1D28;
  --surface-hover: #242434;
  --surface-active: #2C2C3E;

  /* Ink & Typography */
  --ink: #FFFFFF;
  --text: #ECECEE;
  --text-muted: #9E9EA8;
  --text-dim: #636372;

  /* Borders & Dividers */
  --border: #222230;
  --border-strong: #333346;
  --border-focus: #4F4F6C;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Accent Colors */
  --red: #FF2D3D;
  --red-hover: #FF4755;
  --red-soft: rgba(255, 45, 61, 0.12);
  --red-border: rgba(255, 45, 61, 0.3);
  --red-glow: rgba(255, 45, 61, 0.25);

  --green: #10B981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --green-border: rgba(16, 185, 129, 0.3);
  --green-glow: rgba(16, 185, 129, 0.2);

  --yellow: #F59E0B;
  --yellow-soft: rgba(245, 158, 11, 0.12);
  --yellow-border: rgba(245, 158, 11, 0.3);

  --blue: #3B82F6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --blue-border: rgba(59, 130, 246, 0.3);

  --purple: #8B5CF6;
  --purple-soft: rgba(139, 92, 246, 0.12);
  --purple-border: rgba(139, 92, 246, 0.3);

  /* Fonts */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions & Shadows */
  --transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --sidebar-w: 260px;
  --topbar-h: 62px;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden !important;
}

/* Subtle Ambient Scanline Grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 45, 61, 0.008) 2px, rgba(255, 45, 61, 0.008) 4px);
  pointer-events: none;
  z-index: 999;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

/* ==========================================================================
   GATE SCREEN / LOGIN
   ========================================================================== */
.gate-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(255, 45, 61, 0.08) 0%, transparent 60%), var(--bg);
}

.gate-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(255, 45, 61, 0.06);
  position: relative;
  overflow: hidden;
}

.gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.gate-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

.gate-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.gate-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.gate-desc code {
  font-family: var(--font-mono);
  background: var(--surface-raised);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--yellow);
  font-size: 12px;
}

.gate-input-group {
  margin-bottom: 20px;
}

.gate-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.gate-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.gate-input {
  width: 100%;
  height: 44px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0 42px 0 14px;
  transition: var(--transition);
}

.gate-input:focus {
  outline: none;
  border-color: var(--red);
  background: var(--surface-raised);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.btn-toggle-key {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-toggle-key:hover {
  color: var(--ink);
}

.btn-gate-submit {
  width: 100%;
  height: 44px;
  background: var(--red);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--red-glow);
}

.btn-gate-submit:hover {
  background: var(--red-hover);
  box-shadow: 0 6px 20px var(--red-glow);
  transform: translateY(-1px);
}

.btn-gate-submit:active {
  transform: translateY(0);
}

.gate-dns-hint {
  margin-top: 24px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}

.dns-hint-title {
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.dns-hint-title strong {
  color: var(--ink);
}

.dns-hint-records {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dns-hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  background: var(--surface-raised);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 11.5px;
}

.dns-hint-badge {
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid var(--purple-border);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

.dns-hint-badge-mx {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-border);
}

.dns-hint-val code {
  color: var(--yellow);
}

/* ==========================================================================
   APP ROOT LAYOUT & SIDEBAR (Vercel / Linear Architecture)
   ========================================================================== */
.app-layout-root {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 190;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Dashboard Sidebar */
.dashboard-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition-slow);
}

/* Sidebar Brand */
.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo .logo-text {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-text span {
  color: var(--red);
}

.sidebar-role-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  background: var(--surface-card);
  border: 1px solid var(--border);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}

/* Sidebar User Key Card */
.sidebar-user-card {
  margin: 16px 14px 10px 14px;
  padding: 10px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info-text {
  flex: 1;
  min-width: 0;
}

.user-info-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.user-info-val {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sidebar-copy {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-sidebar-copy:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

/* Sidebar Nav */
.sidebar-nav {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-section-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 10px 10px 4px 10px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.nav-item.active {
  background: var(--surface-card);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-item.active .nav-item-icon {
  color: var(--red);
}

.nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: var(--transition);
  flex-shrink: 0;
}

.nav-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-hover);
  color: var(--ink);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  min-width: 20px;
  text-align: center;
  transition: var(--transition);
}

.nav-item.active .nav-counter {
  background: var(--red);
  color: #FFFFFF;
}

.nav-counter.spam {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.nav-counter.neutral {
  color: var(--blue);
  background: var(--blue-soft);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-version-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
}

.sidebar-add-domain-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  transition: var(--transition);
}

.sidebar-add-domain-link:hover {
  background: var(--surface-hover);
  border-color: var(--red);
  color: var(--red);
}

/* ==========================================================================
   MAIN WRAPPER & TOPBAR HEADER
   ========================================================================== */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* Topbar Header Modern */
.topbar-modern {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  background: rgba(18, 18, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.topbar-left-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  padding: 6px;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-hamburger:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.breadcrumb-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.breadcrumb-section {
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.breadcrumb-separator {
  color: var(--border-strong);
}

.breadcrumb-current {
  color: var(--ink);
  font-weight: 700;
}

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

/* Global Domain Selector Dropdown */
.global-domain-dropdown-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 220px;
}

.global-domain-dropdown-wrap .dropdown-icon {
  display: none;
}

.global-domain-dropdown-wrap .c-select-wrap {
  width: 100%;
}

.global-domain-dropdown-wrap .c-select-trigger {
  height: 36px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 12px;
}

.global-domain-dropdown-wrap .c-select-menu {
  min-width: 240px;
}

.topbar-domain-select {
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 0 28px 0 32px;
  cursor: pointer;
  transition: var(--transition);
  max-width: 220px;
}

.topbar-domain-select:hover {
  border-color: var(--border-strong);
}

.topbar-domain-select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red-glow);
}

/* Action button topbar */
.btn-topbar-action {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-topbar-action:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* Realtime SSE Indicator */
.sse-indicator-modern {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  transition: var(--transition);
}

.sse-dot,
.sse-dot-pulse {
  width: 9px !important;
  height: 9px !important;
  min-width: 9px !important;
  min-height: 9px !important;
  border-radius: 50% !important;
  background: #6B7280;
  display: inline-block !important;
  flex-shrink: 0 !important;
  transition: var(--transition);
}

.sse-indicator-modern.connected .sse-dot-pulse,
.sse-indicator-modern.connected .sse-dot,
.sse-dot.active,
.sse-dot-pulse.active {
  background: #10B981 !important;
  box-shadow: 0 0 10px #10B981, 0 0 4px #10B981 !important;
  animation: ssePulse 1.8s infinite ease-in-out !important;
}

.sse-indicator-modern.connected .sse-label,
.sse-indicator-modern.connected #sseText {
  color: #10B981;
}

@keyframes ssePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* Language Switcher */
.lang-switcher-wrap {
  display: inline-flex;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-lang {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-lang:hover {
  color: var(--ink);
}

.btn-lang.active {
  background: var(--surface-raised);
  color: var(--red);
}

/* Logout Button */
.btn-logout-modern {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout-modern:hover {
  background: var(--red);
  color: #FFFFFF;
  box-shadow: 0 2px 10px var(--red-glow);
}

/* ==========================================================================
   CONTENT AREA & TAB PANES
   ========================================================================== */
.dashboard-main-content {
  padding: 28px 32px 56px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1 0 auto;
  box-sizing: border-box;
}

.tab-pane {
  display: none;
  animation: fadeInPane 0.22s ease-out forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Content Header Banner */
.view-header-banner {
  margin-bottom: 24px;
}

.view-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.4px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-header-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* General Card Box */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

/* ==========================================================================
   LIVE INBOX & SPAM TOOLBAR & EMAIL LIST
   ========================================================================== */
.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 480px;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
  padding: 0 14px 0 38px;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-tool {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-tool:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* Email List Container */
.email-list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.email-row:first-child {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.email-row {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  gap: 16px;
}

.email-row:last-child {
  border-bottom: none;
}

.email-row:hover {
  background: var(--surface-hover);
}

.email-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 0;
}

.email-main-info {
  flex: 1;
  min-width: 0;
}

.email-sender-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.email-sender {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.email-recipient-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

.email-subject {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.email-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-meta-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.email-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 44px;
  height: 44px;
  stroke: var(--text-dim);
  margin-bottom: 12px;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface-card);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
  z-index: 15;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.pagination-left {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-dim);
}

.page-size-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-size-picker select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.pagination-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-page {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 0 10px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-page:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-number {
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 6px;
}

/* ==========================================================================
   SLIDE-OVER DRAWER EMAIL READER
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-reader {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 760px;
  max-width: 85vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

body.modal-open {
  overflow: hidden !important;
}

.btn-drawer-back {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-drawer-back:hover {
  background: var(--surface-hover);
  border-color: var(--red);
  color: var(--red);
}

@media (max-width: 1024px) {
  .btn-drawer-back {
    display: inline-flex;
  }
}

.modal-overlay.open .modal-reader {
  transform: translateX(0);
}

.modal-top {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-raised);
}

.modal-subject {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-close-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: var(--ink);
  border-color: var(--red);
  background: var(--red-soft);
}

/* Modal Sender Card */
.modal-sender-card {
  padding: 16px 22px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.sender-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #FF6B8B);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.sender-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sender-header-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.sender-title-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.sender-email-raw {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.recipient-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.lbl-to {
  color: var(--text-dim);
}

.val-to {
  color: var(--ink);
  font-weight: 600;
}

.btn-copy-mini {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  transition: var(--transition);
}

.btn-copy-mini:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.modal-meta-right {
  text-align: right;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.meta-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.meta-size {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.modal-tabs {
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: var(--surface);
}

.modal-tab-btn {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 14px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-tab-btn.active {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-border);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: var(--bg);
}

.modal-iframe {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: none;
  background: #FFFFFF;
}

.modal-text-content {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.6;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-raised);
}

/* ==========================================================================
   DOMAIN & DNS MANAGEMENT (Tab 3)
   ========================================================================== */
.stats-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-metric-lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-metric-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}

/* Domain Grid Cards */
.domains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
}

.domain-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.domain-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.domain-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.domain-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.domain-badge.verified {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.domain-badge.pending {
  background: var(--yellow-soft);
  color: var(--yellow);
  border: 1px solid var(--yellow-border);
}

.domain-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.domain-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.domain-stat-lbl {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

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

.btn-domain-action {
  flex: 1;
  min-width: 90px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-domain-action:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* Add Domain Box & Sync DNS */
.add-domain-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.add-domain-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.add-domain-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.add-domain-desc code {
  color: var(--yellow);
  font-family: var(--font-mono);
}

.add-domain-row {
  display: flex;
  gap: 10px;
  max-width: 820px;
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
}

.add-domain-row #newDomainInput {
  flex: 1 1 260px;
  min-width: 220px;
}

/* Synced Wildcard DNS Tutorial Card */
.wildcard-tutorial-card {
  background: var(--surface-raised);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
  position: relative;
  overflow: hidden;
}

.wildcard-tutorial-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3B82F6, #60A5FA, #22C55E);
}

.wildcard-alert-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-left: 3px solid #EF4444;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.wildcard-alert-text {
  font-size: 12px;
  line-height: 1.5;
  color: #FCA5A5;
}

.wildcard-alert-text strong {
  display: block;
  color: #FEE2E2;
  margin-bottom: 3px;
}

.wildcard-alert-text p {
  color: #F87171;
  margin: 0;
}

.wildcard-record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.w-rec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.w-rec-type {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 3px;
}

.badge-type-mx {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.w-rec-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.w-rec-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.2);
  padding: 5px 8px;
  border-radius: 3px;
}

.w-rec-lbl {
  color: var(--text-dim);
}

.w-rec-val-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-copy-inline {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  border-radius: 3px;
  transition: var(--transition);
}

.btn-copy-inline:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   WHITELIST & BLACKLIST RULES (Tab 4)
   ========================================================================== */
.domain-select-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.domain-dropdown {
  height: 42px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0 12px;
  cursor: pointer;
  width: 100%;
}

.domain-dropdown:focus {
  outline: none;
  border-color: var(--red);
}

.admin-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.admin-status-pill.locked {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
}

.admin-status-pill.unlocked {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34D399;
}

.alias-input-row {
  display: flex;
  gap: 10px;
  max-width: 820px;
  width: 100%;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.alias-input-row #newAliasInput {
  flex: 1 1 260px;
  min-width: 220px;
}

.rules-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.rules-filter-group {
  display: inline-flex;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}

.rules-filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.rules-filter-btn:hover {
  color: var(--ink);
}

.rules-filter-btn.active {
  background: var(--surface-hover);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rules-table th {
  padding: 12px 16px;
  text-align: left;
  background: var(--surface-card);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.rules-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.rules-table tr:last-child td {
  border-bottom: none;
}

.default-rule-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(147, 51, 234, 0.35);
  color: #C084FC;
}

/* ==========================================================================
   DOMAIN SETTINGS (Tab 5)
   ========================================================================== */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.mode-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.mode-option.selected {
  border-color: var(--red);
  background: rgba(255, 45, 61, 0.05);
  box-shadow: 0 0 0 1px var(--red-glow);
}

.mode-radio {
  margin-top: 3px;
  accent-color: var(--red);
}

.mode-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.mode-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Switch Toggle Component */
.switch-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-toggle .slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: var(--border-strong);
  border-radius: 24px;
  transition: var(--transition);
  border: 1px solid var(--border);
}

.switch-toggle .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.switch-toggle input:checked + .slider {
  background-color: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}

.switch-toggle input:checked + .slider::before {
  transform: translateX(20px);
}

.btn-dns-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60A5FA;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-dns-check:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60A5FA;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.btn-dns-check:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dns-check-result-card {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: var(--transition);
}

.dns-check-result-card.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
}

.dns-check-result-card.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FBBF24;
}

.dns-check-result-card.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}

.lock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #FCA5A5;
  font-size: 12px;
  margin-bottom: 16px;
}

/* Subdomain Mode Cards */
.subdomain-mode-card {
  transition: var(--transition);
}

.subdomain-mode-card:hover {
  border-color: var(--border-strong) !important;
  background: var(--surface-raised) !important;
}

.subdomain-mode-card.selected {
  border-color: var(--red) !important;
  background: rgba(255, 45, 61, 0.06) !important;
  box-shadow: 0 0 0 1px var(--red-glow);
}

/* Subdomain Rule Item */
.subdomain-rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.subdomain-rule-item:last-child {
  border-bottom: none;
}

.subdomain-rule-item:hover {
  background: var(--surface-hover);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--red);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.error {
  border-left-color: var(--red);
}

.toast.success {
  border-left-color: var(--green);
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Mobile)
   ========================================================================== */
@media (max-width: 1024px) {
  .modal-reader {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-left: none !important;
    border-radius: 0 !important;
  }
}

@media (max-width: 900px) {
  .dashboard-sidebar {
    transform: translateX(-100%);
  }

  .dashboard-sidebar.active {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .btn-hamburger {
    display: flex;
  }

  .desktop-only {
    display: none !important;
  }

  .desktop-only-inline {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .dashboard-main-content {
    padding: 16px 12px;
  }

  .topbar-modern {
    padding: 0 14px;
    height: 56px;
    gap: 8px;
  }

  .topbar-left-side {
    gap: 10px;
    min-width: 0;
    flex: 1;
  }

  .breadcrumb-section, .breadcrumb-separator {
    display: none !important;
  }

  .breadcrumb-current {
    font-size: 14px;
    font-weight: 700;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right-side {
    gap: 8px;
    flex-shrink: 0;
  }

  .btn-topbar-action .btn-action-label {
    display: none !important;
  }

  .btn-topbar-action {
    padding: 0 10px;
    height: 34px;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .topbar-modern {
    padding: 0 12px;
    height: 52px;
  }

  .breadcrumb-current {
    max-width: 120px;
    font-size: 13px;
  }

  .sse-indicator-modern {
    padding: 0 8px;
    height: 32px;
    gap: 0;
    min-width: 32px;
    justify-content: center;
  }

  .sse-indicator-modern .sse-label,
  .sse-indicator-modern #sseText {
    display: none !important;
  }

  .lang-switcher-wrap {
    height: 32px;
  }

  .btn-lang {
    padding: 0 6px;
    font-size: 10px;
  }

  .btn-logout-modern {
    display: none !important;
  }

  .dashboard-main-content {
    padding: 12px 10px;
  }
}

/* ==========================================================================
   MOBILE ACTION BAR (Domain Filter & Refresh above Inbox)
   ========================================================================== */
.mobile-action-bar {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
}

.mobile-domain-select-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.mobile-domain-select-wrap .dropdown-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 2;
}

.mobile-domain-select {
  width: 100%;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px 0 36px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-domain-select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red-glow);
  outline: none;
}

.btn-mobile-refresh {
  height: 42px;
  padding: 0 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-mobile-refresh:hover, .btn-mobile-refresh:active {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--red);
}

/* ==========================================================================
   EMAIL ITEM ROW STYLING (Linear / Modern SaaS Aesthetic)
   ========================================================================== */
.email-item {
  display: grid;
  grid-template-columns: 130px 220px minmax(220px, 1fr) 140px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  gap: 16px;
  font-size: 13px;
  position: relative;
}

.email-item:last-child {
  border-bottom: none;
}

.email-item:hover {
  background: var(--surface-hover);
}

.email-item:hover .item-hover-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.email-item:hover .item-date {
  opacity: 0.15;
}

.email-item.unread {
  background: rgba(255, 45, 61, 0.035);
}

.email-item.unread .unread-dot {
  opacity: 1;
  transform: scale(1);
}

.email-item.unread .item-sender-name {
  color: var(--ink);
  font-weight: 700;
}

.email-item.unread .item-subject .subject-text {
  font-weight: 700;
  color: var(--ink);
}

.email-item.flash-new {
  animation: flashHighlight 2s ease-out;
}

@keyframes flashHighlight {
  0% { background: rgba(16, 185, 129, 0.25); }
  100% { background: transparent; }
}

/* Col 1: Status Dot & Domain Badge */
.item-col-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.6);
  transition: transform var(--transition), opacity var(--transition);
}

.item-domain-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 115px;
  display: inline-block;
  line-height: 1.2;
}

.item-domain-badge.spam {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red-border);
  max-width: 140px;
}

/* Col 2: Parties (Sender Name + Recipient Address) */
.item-col-parties {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.item-sender-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.item-to-address {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Col 3: Content (Subject & Attachment) */
.item-col-content {
  min-width: 0;
}

.item-subject {
  color: var(--text);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.item-att-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.subject-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Col 4: Meta & Hover Actions */
.item-col-meta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.item-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: opacity var(--transition);
}

.item-hover-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--surface-hover);
  padding-left: 8px;
  transition: opacity var(--transition), visibility var(--transition);
}

.btn-hover-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-hover-action:hover {
  background: var(--surface-raised);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-hover-action.delete:hover {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-border);
}

.spam-meta-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spam-ttl-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Mobile Responsiveness for Email Item */
@media (max-width: 768px) {
  .email-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 8px;
    border: 1px solid var(--border);
  }

  .email-item:hover {
    background: var(--surface-raised);
  }

  .email-item.unread {
    border-left: 3px solid var(--red);
    background: rgba(255, 45, 61, 0.04);
  }

  .item-col-badge {
    justify-content: space-between;
    width: 100%;
  }

  .item-domain-badge {
    max-width: none;
  }

  .item-col-parties {
    gap: 3px;
  }

  .item-sender-name {
    font-size: 14px;
    font-weight: 700;
  }

  .item-to-address {
    font-size: 12px;
  }

  .item-col-content {
    margin-top: 2px;
  }

  .item-subject {
    font-size: 13.5px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
  }

  .item-col-meta {
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
  }

  .item-hover-actions {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: transparent;
    padding-left: 0;
  }

  .item-date {
    opacity: 1 !important;
  }
}

/* ==========================================================================
   ADMIN LOCK BADGE & CHIPS
   ========================================================================== */
.admin-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
  vertical-align: middle;
}

.admin-lock-svg {
  flex-shrink: 0;
}

.lock-shackle-pulse {
  animation: lockPulse 2s ease-in-out infinite;
}

@keyframes lockPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.att-chip {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.att-chip:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--ink);
}

.modal-attachments {
  padding: 12px 22px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   GATE TOPBAR & SITE FOOTER
   ========================================================================== */
.gate-topbar {
  height: 60px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gate-topbar .topbar-left, .gate-topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-dashboard {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   SITE FOOTER (CYBER-DARK SEAMLESS SAAS FOOTER)
   ========================================================================== */
.site-footer {
  position: relative;
  width: 100%;
  margin-top: auto;
  padding: 38px 24px 34px;
  background: linear-gradient(180deg, 
    rgba(10, 10, 14, 0) 0%, 
    rgba(12, 12, 17, 0.6) 20%, 
    rgba(7, 7, 10, 0.94) 60%, 
    rgba(5, 5, 7, 0.98) 100%
  );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 -16px 36px -12px rgba(0, 0, 0, 0.6);
  text-align: center;
  overflow: hidden;
  z-index: 20;
}

/* Subtle Glowing Cyber-Red Hairline Divider */
.site-footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.04) 15%, 
    rgba(255, 45, 61, 0.22) 35%, 
    rgba(255, 45, 61, 0.65) 50%, 
    rgba(255, 45, 61, 0.22) 65%, 
    rgba(255, 255, 255, 0.04) 85%, 
    transparent 100%
  );
  pointer-events: none;
}

/* Soft Ambient Radial Center Glow above the footer */
.site-footer::after {
  content: '';
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  width: min(650px, 90vw);
  height: 60px;
  background: radial-gradient(ellipse at center, rgba(255, 45, 61, 0.09) 0%, rgba(255, 45, 61, 0.02) 45%, transparent 70%);
  pointer-events: none;
  filter: blur(8px);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
}

.footer-links a:hover {
  color: #FFFFFF;
  background: rgba(255, 45, 61, 0.08);
  border-color: rgba(255, 45, 61, 0.25);
  box-shadow: 0 2px 10px rgba(255, 45, 61, 0.15);
  transform: translateY(-1px);
}

.footer-links .dot {
  font-size: 6px;
  color: var(--border-strong);
  opacity: 0.45;
  user-select: none;
  line-height: 1;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  opacity: 0.75;
  margin: 0;
}

@media (max-width: 768px) {
  .dashboard-main-content {
    padding: 20px 16px 40px;
  }
  .site-footer {
    padding: 28px 16px 26px;
  }
  .footer-links {
    gap: 4px;
  }
  .footer-links a {
    font-size: 10px;
    padding: 4px 7px;
  }
  .footer-copy {
    font-size: 10px;
  }
}

/* ==========================================================================
   TMAIL CUSTOM CYBER-DARK DROPDOWN SYSTEM
   ========================================================================== */
.custom-select-hidden {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0) !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.c-select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 100%;
}

.c-select-wrap.open {
  z-index: 1060;
}

.c-select-trigger {
  width: 100%;
  height: 40px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.c-select-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.c-select-wrap.open .c-select-trigger {
  border-color: var(--red);
  background: var(--surface-raised);
  box-shadow: 0 0 0 2px var(--red-glow);
}

.c-select-trigger-content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.c-select-icon {
  color: var(--red);
  flex-shrink: 0;
}

.c-select-current-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.c-select-chevron {
  color: var(--text-dim);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.c-select-wrap.open .c-select-chevron {
  transform: rotate(180deg);
  color: var(--red);
}

/* Floating Dropdown Menu */
.c-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  min-width: 180px;
  background: #14141c;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.16s;
  pointer-events: none;
  overflow: hidden;
}

.c-select-wrap.open .c-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.c-select-menu-inner {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.c-select-option {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: var(--transition);
}

.c-select-option:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.c-select-option.active {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 700;
}

.c-opt-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.c-opt-check {
  display: none;
  color: var(--red);
  flex-shrink: 0;
}

.c-select-option.active .c-opt-check {
  display: block;
}

/* Compact version for pagination & Drop-Up menus */
.c-select-wrap.compact {
  width: auto;
  min-width: 64px;
}

.c-select-wrap.compact .c-select-trigger {
  height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

/* Drop-up behavior: opens above trigger to prevent viewport/card clipping */
.c-select-wrap.compact .c-select-menu,
.c-select-wrap.drop-up .c-select-menu,
.page-size-picker .c-select-wrap .c-select-menu,
.pagination-bar .c-select-wrap .c-select-menu {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
  min-width: 74px;
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.c-select-wrap.compact.open .c-select-menu,
.c-select-wrap.drop-up.open .c-select-menu,
.page-size-picker .c-select-wrap.open .c-select-menu,
.pagination-bar .c-select-wrap.open .c-select-menu {
  transform: translateY(0) scale(1);
}

.c-select-wrap.compact .c-select-option {
  padding: 6px 10px;
  font-size: 11px;
}


