@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-obsidian: #060911;
  --bg-deep: #0b101d;
  --glass-bg: rgba(15, 23, 42, 0.58);
  --glass-bg-elevated: rgba(22, 32, 56, 0.72);
  --glass-bg-hover: rgba(30, 43, 72, 0.65);
  --glass-bg-active: rgba(56, 189, 248, 0.13);
  --glass-modal: rgba(12, 18, 34, 0.86);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-strong: rgba(255, 255, 255, 0.17);
  --glass-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.05);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #38bdf8;
  --accent-secondary: #6366f1;
  --accent-glow: rgba(56, 189, 248, 0.28);

  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #f43f5e;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fondo ambiental arquitectonico para efecto Glassmorfismo */
.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 18%, rgba(56, 189, 248, 0.15) 0%, transparent 42%),
    radial-gradient(circle at 86% 22%, rgba(99, 102, 241, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 52% 88%, rgba(14, 165, 233, 0.11) 0%, transparent 48%),
    linear-gradient(160deg, #050811 0%, #0a101f 50%, #070b16 100%);
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 20%, transparent 80%);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}

.orb-1 {
  width: 460px;
  height: 460px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.32), transparent 70%);
}

.orb-2 {
  width: 520px;
  height: 520px;
  bottom: -160px;
  right: -100px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28), transparent 70%);
}

.hidden {
  display: none !important;
}

/* =========================================================
   1. PANTALLA DE LOGIN (GLASSMORFISMO EJECUTIVO)
   ========================================================= */
.login-viewport {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-glass-shell {
  width: 100%;
  max-width: 420px;
  background: rgba(11, 17, 32, 0.68);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 28px 70px -16px rgba(0, 0, 0, 0.75), inset 0 1px 0 0 rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 38px 36px 36px;
  position: relative;
  overflow: hidden;
  animation: fadeScaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-glass-shell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.55), transparent);
}

.login-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.login-crest {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: rgba(56, 189, 248, 0.11);
  border: 1px solid rgba(56, 189, 248, 0.28);
  box-shadow: 0 8px 24px -6px rgba(56, 189, 248, 0.2), var(--glass-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  margin-bottom: 14px;
}

.login-crest svg {
  width: 22px;
  height: 22px;
}

.login-domain-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: #94a3b8;
  margin-bottom: 12px;
}

.login-domain-pill svg {
  width: 12px;
  height: 12px;
  color: var(--accent-primary);
}

.login-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.glass-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.glass-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.glass-input-icon svg {
  width: 17px;
  height: 17px;
}

.glass-input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 42px;
  background: rgba(8, 13, 26, 0.58);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.glass-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(12, 19, 36, 0.78);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.glass-input-Plain {
  padding-left: 14px;
  padding-right: 14px;
}

.input-action-btn {
  position: absolute;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.input-action-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.input-action-btn svg {
  width: 16px;
  height: 16px;
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.quick-fill-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.quick-fill-link:hover {
  color: #7dd3fc;
}

.login-error-box {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  font-size: 12.5px;
  line-height: 1.4;
}

.btn-primary-glass {
  height: 46px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.85), rgba(79, 70, 229, 0.85));
  box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.38), var(--glass-highlight);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all 0.2s ease;
  padding: 0 18px;
}

.btn-primary-glass:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -5px rgba(14, 165, 233, 0.5), var(--glass-highlight);
  border-color: rgba(125, 211, 252, 0.7);
}

.btn-primary-glass svg {
  width: 17px;
  height: 17px;
}

.login-telemetry-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--glass-border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.telemetry-badge {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.telemetry-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.telemetry-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

.status-dot.pending {
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

/* =========================================================
   2. BUZON DE CORREO PERSONAL (LAYOUT 3 PANELES GLASS)
   ========================================================= */
.mailbox-viewport {
  position: relative;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  padding: 14px;
  display: grid;
  grid-template-columns: 268px 390px 1fr;
  gap: 14px;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* --- PANEL IZQUIERDO: SIDEBAR --- */
.sidebar-header {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-domain {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent-primary);
}

.compose-cta-wrap {
  padding: 14px 16px 10px;
}

.btn-compose {
  width: 100%;
  height: 44px;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-section-title {
  padding: 0 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item-btn {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.nav-item-btn:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-primary);
}

.nav-item-btn.active {
  background: var(--glass-bg-active);
  border-color: rgba(56, 189, 248, 0.28);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item-left svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-item-btn.active .nav-item-left svg,
.nav-item-btn:hover .nav-item-left svg {
  color: var(--accent-primary);
}

.nav-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.nav-item-btn.active .nav-badge {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
}

.label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-ejecutivo { background: #38bdf8; box-shadow: 0 0 8px rgba(56, 189, 248, 0.5); }
.dot-finanzas { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.dot-infraestructura { background: #818cf8; box-shadow: 0 0 8px rgba(129, 140, 248, 0.5); }
.dot-seguridad { background: #f43f5e; box-shadow: 0 0 8px rgba(244, 63, 94, 0.5); }
.dot-personal { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--glass-border);
  background: rgba(7, 11, 22, 0.42);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar-monogram {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
}

.user-meta-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta-email {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-glass-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-glass-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--glass-border-strong);
}

.icon-glass-btn.danger:hover {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.4);
}

.icon-glass-btn svg {
  width: 15px;
  height: 15px;
}

/* --- PANEL CENTRAL: LISTA DE CORREOS --- */
.list-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.current-folder-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box-wrap svg {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 35px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(8, 13, 26, 0.55);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.filter-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.filter-pill.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

.bulk-toolbar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 15, 29, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
}

.bulk-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-chip {
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--glass-border-strong);
}

.btn-chip.warn:hover {
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-chip.danger:hover {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.4);
}

.btn-chip svg {
  width: 13.5px;
  height: 13.5px;
}

.email-list-scroll {
  flex: 1;
  overflow-y: auto;
  divide-y: 1px solid var(--glass-border);
}

.email-row {
  position: relative;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  display: flex;
  gap: 11px;
  transition: background 0.15s ease;
}

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

.email-row.selected {
  background: rgba(56, 189, 248, 0.11);
  border-left: 3px solid var(--accent-primary);
  padding-left: 13px;
}

.email-row.unread {
  background: rgba(255, 255, 255, 0.025);
}

.email-row.unread .email-row-sender,
.email-row.unread .email-row-subject {
  font-weight: 600;
  color: #ffffff;
}

.unread-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  flex-shrink: 0;
}

.email-row-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.star-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
}

.star-btn.starred {
  color: #f59e0b;
}

.star-btn svg {
  width: 15px;
  height: 15px;
}

.email-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.email-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.email-row-sender {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.email-row-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.email-row-subject {
  font-size: 12.5px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.email-row-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.badge-tag {
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
}

.badge-blocked {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

.badge-attachment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.badge-attachment svg {
  width: 12px;
  height: 12px;
}

.row-hover-actions {
  position: absolute;
  right: 12px;
  top: 10px;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(12, 18, 34, 0.92);
  border: 1px solid var(--glass-border-strong);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.email-row:hover .row-hover-actions {
  display: flex;
}

/* --- PANEL DERECHO: LECTURA Y MODULOS DE GESTION --- */
.reading-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reading-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.context-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.context-banner.danger {
  background: rgba(244, 63, 94, 0.13);
  border: 1px solid rgba(244, 63, 94, 0.38);
  color: #fecdd3;
}

.context-banner.warning {
  background: rgba(245, 158, 11, 0.13);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: #fde68a;
}

.context-banner.info {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-text svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.detail-subject-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-subject {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.detail-sender-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sender-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sender-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sender-avatar-lg {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-primary);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sender-name-line {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.sender-email-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.security-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crypto-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #6ee7b7;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.crypto-pill.fail {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.crypto-pill svg {
  width: 12px;
  height: 12px;
}

.metadata-grid {
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.meta-item strong {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
}

.email-body-surface {
  padding: 24px;
  border-radius: var(--radius-md);
  background: rgba(9, 14, 28, 0.45);
  border: 1px solid var(--glass-border);
  font-size: 14.5px;
  line-height: 1.72;
  color: #e2e8f0;
}

.email-body-surface p {
  margin-bottom: 14px;
}

.email-body-surface p:last-child {
  margin-bottom: 0;
}

.email-body-surface ul,
.email-body-surface ol {
  margin: 12px 0 16px 22px;
}

.email-body-surface li {
  margin-bottom: 6px;
}

.email-body-surface code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

.attachments-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attachments-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.attachment-card {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attachment-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.attachment-info svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.attachment-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* Respuesta rapida inline */
.quick-reply-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.glass-textarea {
  width: 100%;
  min-height: 105px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(7, 11, 22, 0.6);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}

.glass-textarea:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.empty-state-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
}

/* =========================================================
   3. VISTAS ESPECIALIZADAS: BLOQUEADOS & POSTGRES/NAMECHEAP
   ========================================================= */
.module-view-container {
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.module-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.module-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.glass-card-block {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(13, 20, 38, 0.55);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-block-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-block-title svg {
  width: 17px;
  height: 17px;
  color: var(--accent-primary);
}

.form-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.glass-select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(8, 13, 26, 0.78);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.glass-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.glass-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}

.glass-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  vertical-align: middle;
}

.mono-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #e2e8f0;
}

/* =========================================================
   4. MODALES FLOTANTES GLASSMORFICOS
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 6, 14, 0.68);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-glass-window {
  width: 100%;
  max-width: 680px;
  background: var(--glass-modal);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeScaleIn 0.22s ease-out;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-title svg {
  width: 17px;
  height: 17px;
  color: var(--accent-primary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--glass-border);
  background: rgba(7, 11, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Notificaciones Toast */
.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glass-toast {
  min-width: 290px;
  max-width: 410px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: rgba(14, 22, 42, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  color: var(--text-primary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeScaleIn 0.2s ease-out;
}

.glass-toast svg {
  width: 17px;
  height: 17px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

@keyframes fadeScaleIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Scrollbars sutiles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

.mobile-only-btn {
  display: none;
}

.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 6, 14, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.table-responsive-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1180px) {
  .mailbox-viewport {
    grid-template-columns: 230px 330px 1fr;
  }
}

/* =========================================================
   5. SISTEMA RESPONSIVE MOVIL Y TABLET (CELULARES)
   ========================================================= */
@media (max-width: 900px) {
  html, body {
    height: 100dvh;
  }

  .mobile-only-btn {
    display: inline-flex;
  }

  .login-viewport {
    height: 100dvh;
    padding: 16px;
    overflow-y: auto;
  }

  .login-glass-shell {
    padding: 28px 22px 24px;
    border-radius: 20px;
  }

  .login-title {
    font-size: 19px;
  }

  .glass-input,
  .search-input,
  .glass-select,
  .glass-textarea {
    font-size: 16px; /* Evita auto-zoom en iOS Safari */
  }

  .mailbox-viewport {
    width: 100vw;
    height: 100dvh;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
  }

  /* Sidebar como Drawer Deslizante Glassmorfico en Movil */
  .sidebar-panel {
    position: fixed;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: min(84vw, 300px);
    z-index: 70;
    transform: translateX(-110%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(11, 17, 32, 0.92);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
  }

  .sidebar-panel.drawer-open {
    transform: translateX(0);
  }

  /* Navegacion Maestro-Detalle en Celulares */
  .list-panel {
    width: 100%;
    height: 100%;
    flex: 1;
  }

  .detail-panel {
    display: none;
    width: 100%;
    height: 100%;
    flex: 1;
  }

  .mailbox-viewport.mobile-detail-open .list-panel {
    display: none;
  }

  .mailbox-viewport.mobile-detail-open .detail-panel {
    display: flex;
  }

  .reading-toolbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .reading-scroll {
    padding: 16px 14px;
    gap: 14px;
  }

  .detail-subject {
    font-size: 17px;
  }

  .email-body-surface {
    padding: 16px;
    font-size: 14px;
  }

  .module-view-container {
    padding: 16px 14px;
    gap: 16px;
  }

  .module-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bulk-toolbar {
    padding: 8px 12px;
    overflow-x: auto;
    gap: 8px;
  }

  .bulk-actions {
    flex-shrink: 0;
  }

  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-glass-window {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 18px;
  }

  .modal-body {
    padding: 14px;
    max-height: 70dvh;
  }

  .modal-footer {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .glass-toast {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .login-telemetry-footer {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .telemetry-badge {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .login-options-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
