* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #f4f7fb;
  font-family: Arial, "Segoe UI", sans-serif;
  color: #202124;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
}

/* =========================
   CONTENEDOR GENERAL
========================= */
.buzon-gmail {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #f6f8fc 0%, #f2f6fb 100%);
  height: 100vh;
  min-height: 100vh;
  align-items: stretch;
  position: relative !important;
  z-index: 0 !important;
  overflow: visible;
}

.buzon-unificado {
  flex: 1;
  min-width: 0;
  width: 100%;
  position: relative;
  z-index: 1;
  min-height: 0;
  display: flex;
}

.buzon-panel {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5ebf3;
  border-radius: 22px;
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.07),
    0 2px 8px rgba(15, 23, 42, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.buzon-panel-fijo {
  flex-shrink: 0;
  background: #ffffff;
  position: relative;
  z-index: 5;
  border-bottom: 1px solid #eef2f7;
}

.buzon-formulario {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* =========================
   SIDEBAR
========================= */
.buzon-sidebar {
  position: initial;

  top: 80px;              

  width: 68px;
  height: 420px; 

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;

  padding: 8px 4px;

  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e8f0;
  border-radius: 14px;

  backdrop-filter: blur(8px);

  box-shadow:
    0 6px 16px rgba(15, 23, 42, 0.06),
    0 2px 4px rgba(15, 23, 42, 0.03);

  z-index: 999;

  transition: all 0.2s ease;
}

.buzon-logo {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b57d0;
  font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

/* =========================
   MENU
========================= */
.buzon-menu {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: visible !important;
  position: relative;
  z-index: 999999;
}

.buzon-menu li {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5f6368;
  font-size: 19px;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible !important;
  z-index: 999999;
  background: transparent;
}

.buzon-menu li:hover {
  background: #f4f8ff;
  color: #517bd6;
  transform: translateY(-1px);
}

.buzon-menu li.active {
  background: linear-gradient(180deg, #dbeafe 0%, #d3e3fd 100%);
  color: #5475e4;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

/* =========================
   TOOLTIP
========================= */
.buzon-menu li .menu-text {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
  background: linear-gradient(135deg, #5892dd, #4c81e2);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(15, 23, 42, 0.1);
  z-index: 2147483647 !important;
  transition: all 0.2s ease;
}

.buzon-menu li:hover .menu-text {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* =========================
   CABECERA PRINCIPAL
========================= */
.buzon-panel-top {
  position: relative;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 12px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-bottom: 1px solid #edf2f7;
  flex-wrap: wrap;
}

.buzon-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.buzon-title-icon {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: linear-gradient(180deg, #eef4ff 0%, #e7f0ff 100%);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.buzon-title-text {
  min-width: 0;
}

.buzon-title-text h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  color: #0f172a;
}

.buzon-title-text span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.3;
}

.buzon-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================
   BOTONES SUPERIORES
========================= */
.gm-btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: #334155;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.gm-btn-icon:hover {
  background: #f8fbff;
  border-color: #c7d7ec;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.gm-btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #2563eb;
  color: #ffffff;
}

.gm-btn-primary:hover {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  border-color: #1d4ed8;
  color: #ffffff;
}

/* =========================
   BARRA DE BÚSQUEDA
========================= */
.buzon-barra-unica {
  position: relative;
  z-index: 29;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: #fcfdff;
  border-bottom: 1px solid #edf2f7;
  flex-wrap: wrap;
}

.barra-busqueda {
  flex: 1;
  min-width: 320px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 15px;
  padding: 0 12px;
  transition: all 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.barra-busqueda:focus-within {
  border-color: #2563eb;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.08),
    0 4px 14px rgba(37, 99, 235, 0.08);
}

.barra-busqueda i {
  color: #64748b;
  font-size: 14px;
  flex-shrink: 0;
}

.barra-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: #111827;
  padding: 10px 0;
  min-width: 0;
}

.barra-input::placeholder {
  color: #94a3b8;
}

.barra-botones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================
   ACCIONES MASIVAS
========================= */
.buzon-masivas-unico {
  position: relative;
  z-index: 28;
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(180deg, #f8fbff 0%, #f5f9ff 100%);
  border-bottom: 1px solid #e6eef9;
  flex-wrap: wrap;
}

.buzon-masivas-unico.show {
  display: flex;
}

.buzon-masivas-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05);
}

.buzon-masivas-info i {
  color: #2563eb;
}

.buzon-masivas-botones {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.gm-btn {
  border: 1px solid #d7e2ef;
  background: #ffffff;
  color: #1f2937;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  white-space: nowrap;
}

.gm-btn:hover {
  background: #f8fbff;
  border-color: #bfd5f3;
  color: #0b57d0;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}
/* =========================
   CONTENEDOR DE TABLA
========================= */
.buzon-tabla-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #ffffff;
  border-top: 1px solid #eef2f7;
}

/* SCROLL MÁS FINO */
.buzon-tabla-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.buzon-tabla-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

/* =========================
   TABLA
========================= */
.buzon-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: #ffffff;
}

/* =========================
   HEADER MÁS PEQUEÑO
========================= */
.buzon-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}

/* =========================
   CUERPO MÁS COMPACTO
========================= */
.buzon-table tbody td {
  padding: 8px 10px;
  font-size: 11px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #1f2937;
}

.buzon-table tbody tr {
  transition: background 0.15s ease;
}

.buzon-table tbody tr:hover td {
  background: #f8fbff;
}

/* =========================
   PRIMERA COLUMNA
========================= */
.buzon-table tbody td:first-child {
  width: 38px;
  text-align: center;
}

.buzon-table tbody td:first-child input {
  width: 13px;
  height: 13px;
}

/* =========================
   COLUMNAS
========================= */
.buzon-table tbody td:nth-child(2) {
  font-weight: 700;
  color: #0b57d0;
}

.buzon-table tbody td:nth-child(3) {
  font-weight: 600;
  color: #111827;
}

/* =========================
   FILA NO LEÍDA MÁS SUTIL
========================= */
.buzon-table tbody tr.fila-no-leida td {
  background: #f8fbff;
}

.buzon-table tbody tr.fila-no-leida td:first-child {
  box-shadow: inset 3px 0 0 #2563eb;
}

/* =========================
   ACCIONES MÁS PEQUEÑAS
========================= */
.buzon-table .acciones-wrap {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.buzon-table .btn-accion-mini {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.15s ease;
}

.buzon-table .btn-accion-mini:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

/* =========================
   RESPONSIVE MÁS COMPACTO
========================= */
@media (max-width: 768px) {
  .buzon-table {
    min-width: 760px;
  }

  .buzon-table thead th,
  .buzon-table tbody td {
    padding: 7px 8px;
    font-size: 10px;
  }

  .buzon-table .btn-accion-mini {
    width: 24px;
    height: 24px;
  }
}

/* =========================
   FOOTER / PAGINACIÓN
========================= */
.buzon-footer {
  padding: 10px 14px;
  border-top: 1px solid #eef2f7;
  background: #fcfdff;
}

/* =========================
   SPINNER SIMPLE
========================= */
.buzon-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #cfe0ff;
  border-top: 3px solid #0b57d0;
  border-radius: 50%;
  animation: buzonSpin 0.85s linear infinite;
}

/* =========================
   MODAL GLOBAL DE CARGA
========================= */
.buzon-loading-modal-global {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.buzon-loading-modal-box {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 20px;
  border: 1px solid #dbe7f5;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  padding: 30px 26px;
  text-align: center;
  animation: buzonFadeIn 0.25s ease;
}

.buzon-loading-modal-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px auto;
  border: 4px solid #dbeafe;
  border-top: 4px solid #2563eb;
  border-radius: 50%;
  animation: buzonSpin 0.8s linear infinite;
}

.buzon-loading-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.buzon-loading-modal-text {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

/* =========================
   UTILIDADES VISUALES
========================= */
.buzon-panel,
.buzon-sidebar,
.barra-busqueda,
.gm-btn,
.gm-btn-icon,
.buzon-masivas-info {
  will-change: transform;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
  .buzon-gmail {
    gap: 12px;
    padding: 12px;
  }

  .buzon-panel-top,
  .buzon-barra-unica,
  .buzon-masivas-unico {
    padding-left: 16px;
    padding-right: 16px;
  }

  .barra-busqueda {
    min-width: 260px;
  }
}

@media (max-width: 992px) {
  .buzon-sidebar {
    width: 70px;
    min-width: 70px;
    border-radius: 18px;
  }

  .buzon-menu li {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }

  .buzon-logo {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }

  .buzon-panel-top,
  .buzon-barra-unica,
  .buzon-masivas-unico {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 768px) {
  .buzon-gmail {
    padding: 10px;
    gap: 10px;
  }

  .buzon-panel-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .buzon-head-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .buzon-barra-unica {
    flex-direction: column;
    align-items: stretch;
  }

  .barra-busqueda {
    min-width: 100%;
  }

  .barra-botones {
    justify-content: flex-end;
  }

  .buzon-masivas-unico {
    flex-direction: column;
    align-items: flex-start;
  }

  .buzon-masivas-botones {
    width: 100%;
  }

  .buzon-title-text h4 {
    font-size: 17px;
  }

  .buzon-title-text span {
    font-size: 12px;
  }
}

@media (max-width: 576px) {
  .buzon-gmail {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .buzon-sidebar {
    position: relative;
    top: 0;
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    justify-content: center;
    border-radius: 18px;
    padding: 8px;
  }

  .buzon-menu {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  .buzon-menu li .menu-text {
    display: none;
  }

  .buzon-panel-top,
  .buzon-barra-unica,
  .buzon-masivas-unico {
    padding-left: 12px;
    padding-right: 12px;
  }

  .buzon-title-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
    border-radius: 12px;
  }

  .buzon-title-text h4 {
    font-size: 16px;
  }

  .buzon-title-text span {
    font-size: 11px;
  }

  .gm-btn,
  .gm-btn-icon {
    box-shadow: none;
  }

  .gm-btn {
    width: auto;
  }

  .buzon-panel {
    border-radius: 18px;
  }
}

/* =========================
   ANIMACIONES
========================= */
@keyframes buzonSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes buzonFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* Aviso de actualizacion sin bloquear el buzon ni desenfocar el contenido. */
#buzonLoadingModal {
  inset:auto 20px 20px auto;
  width:min(340px, calc(100vw - 40px));
  background:transparent;
  backdrop-filter:none;
  pointer-events:none;
}
#buzonLoadingModal .buzon-loading-modal-box {
  width:100%;padding:14px 18px;border-radius:10px;
  box-shadow:0 4px 18px rgba(15,23,42,.15);
}
#buzonLoadingModal .buzon-loading-modal-spinner {
  width:24px;height:24px;margin:0 auto 8px;border-width:3px;
}
#buzonLoadingModal .buzon-loading-modal-title {font-size:14px;margin-bottom:4px;}

/* Centrar el aviso de carga sin bloquear la pantalla. */
#buzonLoadingModal {
  inset:50% auto auto 50%;
  transform:translate(-50%,-50%);
}
