/**
 * CoreUI Pont Theme Customizations
 * Estética 100% CoreUI Bootstrap Admin Panel para el Estudio Jurídico Pont
 */

:root {
  --cui-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --pont-gold: #b8962e;
  --pont-gold-dark: #634e12;
  --pont-gold-light: #fbf9f4;
  --pont-gold-border: #d4c29a;
  --pont-dark: #0a0805;
  --pont-card-border: rgba(10, 8, 5, 0.08);
}

/* Tipografía 100% unificada con body font family (protegiendo fuentes de iconos) */
html,
body,
input,
select,
textarea,
button,
table,
td,
th,
p,
h1,
h2,
h3,
h4,
h5,
h6,
.badge,
.form-control,
.form-select,
.font-monospace,
.sms-verbatim-box,
.ficha-table,
code,
pre,
kbd,
samp {
  font-family: var(--cui-body-font-family) !important;
}

/* Protección y renderizado correcto y exclusivo de todos los iconos FontAwesome 6 */
.fa,
.fas,
.fa-solid,
.fa-solid::before {
  font-family: var(--fa-style-family, "Font Awesome 6 Free") !important;
  font-weight: 900 !important;
}

.far,
.fa-regular,
.fa-regular::before {
  font-family: var(--fa-style-family, "Font Awesome 6 Free") !important;
  font-weight: 400 !important;
}

.fab,
.fa-brands,
.fab::before,
.fa-brands::before {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

[class^="fa-"]:not(.fa-brands):not(.fab)::before,
[class*=" fa-"]:not(.fa-brands):not(.fab)::before {
  font-family: var(--fa-style-family, "Font Awesome 6 Free") !important;
}

/* ==========================================================================
   FOLDER / SUBFOLDER CARD & MARQUEE STYLING
   ========================================================================== */
.folder-card {
  position: relative;
  overflow: hidden !important;
  background: #ffffff;
  min-width: 0 !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.folder-name-container {
  overflow: hidden !important;
  white-space: nowrap !important;
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex: 1 1 0% !important;
  display: block !important;
}

/* En reposo (inmóvil): estrictamente cortado con puntos suspensivos (...) */
.folder-marquee-text,
.folder-title-text,
[data-marquee="true"] {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  line-height: 1.35;
  box-sizing: border-box;
  will-change: transform;
}

/* Estado activo de desplazamiento: expande el texto para mostrarlo 100% completo */
.folder-marquee-text.is-scrolling,
.folder-title-text.is-scrolling,
[data-marquee="true"].is-scrolling {
  display: inline-block !important;
  width: auto !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

/* Banner de encabezado / ruta: Mostrar texto completo sin recortes */
.folder-banner-path,
.folder-banner-title,
.folder-banner-full {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.45 !important;
  text-overflow: unset !important;
}

body {
  font-family: var(--cui-body-font-family);
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   MINIMALIST & SOBER SIDEBAR - COLORES PLENOS
   ========================================================================== */
.coreui-sidebar {
  background: #14171f !important;
  border-right: 1px solid #232733 !important;
  box-shadow: none !important;
}

/* Sidebar Brand Header */
.coreui-sidebar .sidebar-header {
  background: #0f1219 !important;
  border-bottom: 1px solid #232733 !important;
  padding: 0 !important;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: none !important;
}

.sidebar-brand-wrapper {
  width: 100%;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  user-select: none;
}

.sidebar-brand-logo-img {
  max-height: 36px;
  max-width: 165px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: none !important;
  transition: opacity 0.2s ease;
  display: block;
  margin: 0 auto;
}

.sidebar-brand-edit-pill {
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: #232733;
  border: 1px solid #374151;
  color: #e5e7eb;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.coreui-sidebar .sidebar-header:hover .sidebar-brand-edit-pill {
  opacity: 1;
}

/* Sidebar Navigation Items */
.coreui-sidebar .sidebar-nav {
  padding: 0.6rem 0.4rem !important;
}

.coreui-sidebar .sidebar-nav .nav-title {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-top: 0.8rem;
  margin-bottom: 0.25rem;
  padding: 0.35rem 0.85rem;
}

.coreui-sidebar .sidebar-nav .nav-title::before {
  display: none !important;
}

.coreui-sidebar .sidebar-nav .nav-item {
  margin-bottom: 2px;
}

.coreui-sidebar .sidebar-nav .nav-link {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.55rem 0.85rem;
  color: #9ca3af;
  border-radius: 4px;
  border-left: none !important;
  display: flex;
  align-items: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  box-shadow: none !important;
}

.coreui-sidebar .sidebar-nav .nav-link .nav-icon {
  color: #6b7280;
  font-size: 0.9rem;
  width: 1.5rem;
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.coreui-sidebar .sidebar-nav .nav-link .nav-text {
  letter-spacing: 0.01em;
}

/* Hover State (Color Pleno) */
.coreui-sidebar .sidebar-nav .nav-link:hover {
  color: #ffffff;
  background: #1f2430 !important;
  transform: none !important;
}

.coreui-sidebar .sidebar-nav .nav-link:hover .nav-icon {
  color: #d1d5db;
  transform: none !important;
  filter: none !important;
}

/* Active State (Fondo Mostaza Traslúcido) */
.coreui-sidebar .sidebar-nav .nav-link.active {
  color: #ffffff !important;
  background: rgba(184, 150, 46, 0.22) !important;
  border: 1px solid rgba(184, 150, 46, 0.45) !important;
  font-weight: 600;
  transform: none !important;
  box-shadow: none !important;
}

.coreui-sidebar .sidebar-nav .nav-link.active .nav-icon {
  color: #d4af37 !important;
  filter: none !important;
  transform: none !important;
}

.coreui-sidebar .sidebar-nav .nav-link.active .nav-text {
  color: #ffffff !important;
}

/* Navigation Badges (Colores Plenos) */
.coreui-sidebar .sidebar-nav .nav-link .badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  font-weight: 700;
  box-shadow: none !important;
}

#badge-nav-webmail {
  background: #0f1219 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.coreui-sidebar .sidebar-nav .nav-link.active #badge-nav-webmail {
  background: #b8962e !important;
  color: #ffffff !important;
  border: none;
}

#badge-nav-deadlines {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: none !important;
}

/* CoreUI Card & Widget Extensions */
.card {
  border-radius: 0px !important;
  border: 1px solid rgba(10, 8, 5, 0.08);
}

.card-header {
  border-radius: 0px !important;
  background-color: #ffffff;
  border-bottom: 1px solid rgba(10, 8, 5, 0.08);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.85rem 1.25rem;
}

.widget-stat-card {
  border-radius: 0px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
}

/* Fix sidebar overlap on desktop */
@media (min-width: 992px) {
  .wrapper {
    padding-left: var(--cui-sidebar-occupy-width, 256px);
    transition: padding-left 0.15s ease-in-out;
    will-change: padding-left;
  }

  .sidebar.hide~.wrapper,
  .sidebar.sidebar-narrow-unfoldable:not(:hover)~.wrapper {
    padding-left: 0;
  }
}

/* Table Enhancements */
.table {
  font-size: 0.82rem;
}

.table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #475569;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.table td {
  vertical-align: middle;
}

/* Tree View for Folders in CoreUI */
.tree-node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.75rem;
  transition: background-color 0.15s ease;
}

.tree-node-row:hover {
  background-color: #f8fafc;
}

/* Switch Styling */
.form-check-input:checked {
  background-color: #10b981;
  border-color: #10b981;
}

/* Dropzone styling */
.coreui-dropzone {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.coreui-dropzone:hover,
.coreui-dropzone.dragover {
  border-color: #b8962e;
  background: #fbf9f4;
}

/* SMS Drawer Details */
.sms-detail-drawer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 2px solid #b8962e;
  padding: 1.25rem;
}

.sms-verbatim-box {
  background: #ffffff;
  border-left: 3px solid #b8962e;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #0f172a;
}

/* SMS Template Cards & Editor */
.sms-tpl-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 1rem 1.25rem;
  transition: all 0.15s ease;
  border-radius: 0px;
}

.sms-tpl-card:hover {
  border-color: #b8962e;
  box-shadow: 0 4px 12px rgba(184, 150, 46, 0.08);
}

.sms-preview-phone {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 1.25rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sms-preview-bubble {
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 0px;
  font-size: 0.8rem;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  position: relative;
  word-break: break-word;
}

/* Ficha Técnica Sobria & Aire */
.ficha-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.ficha-table td {
  border: 1px solid #e2e8f0;
  padding: 7px 12px !important;
  font-size: 0.74rem;
}

.ficha-table tr:hover td {
  background-color: #fafbfc;
}

/* Forensic Print Certificate */
@media print {
  body * {
    visibility: hidden;
  }

  #modal-root,
  #modal-root * {
    visibility: visible;
  }

  #modal-root {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #ffffff !important;
  }

  .modal-dialog {
    max-width: 100% !important;
    margin: 0 !important;
  }

  .modal-content {
    border: none !important;
    box-shadow: none !important;
  }

  .modal-header,
  .modal-footer,
  .btn-no-print {
    display: none !important;
  }
}

/* ============================================================= */
/* ============================================================= */
/* Interactive Calendar Styles (Month / Week / Day Views)       */
/* ============================================================= */
.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-bottom: none;
}

.cal-grid-header>div {
  background: #f8fafc;
  text-align: center;
  font-weight: 700;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.15rem;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
}

.cal-cell {
  background: #ffffff;
  min-height: 80px;
  padding: 3px 4px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  border: 2px solid transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.cal-cell:hover {
  background: #fbf9f4;
  border-color: #d4c29a;
}

.cal-cell.cal-today {
  background: #fffef8;
  border-color: #b8962e !important;
}

.cal-cell.cal-today .cal-day-num-text {
  color: #b8962e;
  font-weight: 800;
}

.cal-cell.cal-selected {
  background: #f8fafc;
  border-color: #0a0805 !important;
  box-shadow: inset 0 0 0 1px #0a0805;
}

.cal-cell.cal-other-month {
  background: #fafbfc;
  opacity: 0.45;
  cursor: pointer;
}

.cal-day-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.cal-events-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.cal-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 0px;
  display: inline-block;
}

.cal-event-pill {
  font-size: 0.58rem !important;
  padding: 1.5px 3px;
  border-radius: 2px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-hyphens: auto;
  line-height: 1.15;
  font-weight: 600 !important;
  color: #ffffff !important;
  background-color: #0d6efd !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cal-event-pill.pill-pending {
  background-color: #d97706 !important;
  color: #ffffff !important;
}

.cal-event-pill.pill-overdue {
  background-color: #dc2626 !important;
  color: #ffffff !important;
}

.cal-event-pill.pill-done {
  background-color: #16a34a !important;
  color: #ffffff !important;
}

/* Week View Styles */
.cal-week-grid-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  min-height: 380px;
  width: 100%;
}

.cal-week-col {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.cal-week-col-header {
  background: #f8fafc;
  padding: 6px 3px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.cal-week-col-header:hover {
  background: #f1f5f9;
}

.cal-week-col.is-today .cal-week-col-header {
  background: #fffef2;
  border-bottom: 2px solid #b8962e;
}

.cal-week-col.is-selected .cal-week-col-header {
  background: #0a0805;
  color: #ffffff;
}

.cal-week-col.is-selected .cal-week-col-header * {
  color: #ffffff !important;
}

.cal-week-col-body {
  padding: 4px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 420px;
}

.cal-week-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #0d6efd;
  padding: 4px 5px;
  border-radius: 2px;
  font-size: 0.62rem;
  cursor: pointer;
  transition: all 0.15s ease;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-hyphens: auto;
  line-height: 1.15;
}

.cal-week-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cal-week-card.card-pending {
  border-left-color: #d97706;
}

.cal-week-card.card-overdue {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.cal-week-card.card-done {
  border-left-color: #16a34a;
  opacity: 0.75;
}

/* Day View Styles */
.cal-day-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 14px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 520px;
}

.cal-day-event-item {
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0d6efd;
  background: #ffffff;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 2px;
  transition: all 0.15s ease;
}

.cal-day-event-item:hover {
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cal-day-event-item.is-overdue {
  border-left-color: #dc2626;
  background: #fffcfc;
}

.cal-day-event-item.is-pending {
  border-left-color: #d97706;
}

.cal-day-event-item.is-done {
  border-left-color: #16a34a;
  opacity: 0.8;
}

/* Folder Cards */
.folder-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.folder-card:hover {
  transform: translateY(-1px);
  border-color: #b8962e !important;
  box-shadow: 0 4px 12px rgba(184, 150, 46, 0.12) !important;
}

/* Document Viewer Unificado con Estética Pont & Compartir */
.doc-viewer-modal .modal-dialog {
  max-width: 92vw;
  margin: 1.25rem auto;
  transition: all 0.2s ease-out;
}

.doc-viewer-modal .modal-content {
  background: #0a0805 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(184, 150, 46, 0.35) !important;
  border-radius: 0px !important;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75) !important;
}

.doc-viewer-header {
  background: #0a0805 !important;
  border-bottom: 1px solid rgba(184, 150, 46, 0.28) !important;
  padding: 0.5rem 1.25rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.doc-viewer-brand-logo {
  max-height: 28px;
  max-width: 130px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

.doc-viewer-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 0px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 0.38rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.doc-viewer-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: #ffffff;
}

.doc-viewer-btn-gold {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #f1f5f9 !important;
}

.doc-viewer-btn-gold:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
  box-shadow: none !important;
}

.doc-viewer-btn-close {
  background: rgba(239, 68, 68, 0.14) !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
  border-radius: 0px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 0.38rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-viewer-btn-close:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.doc-viewer-body {
  padding: 0 !important;
  background: #181b24;
  height: calc(85vh - 54px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Maximizado a pantalla completa (100vw x 100vh) */
.doc-viewer-modal.is-maximized .modal-dialog,
.modal-fullscreen#doc-viewer-dialog,
.doc-viewer-modal .modal-dialog.modal-fullscreen {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  top: 0 !important;
  left: 0 !important;
  position: fixed !important;
  border-radius: 0 !important;
  z-index: 99999 !important;
}

.doc-viewer-modal.is-maximized .modal-content,
.modal-fullscreen#doc-viewer-dialog .modal-content,
.doc-viewer-modal .modal-dialog.modal-fullscreen .modal-content {
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  border: none !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.doc-viewer-modal.is-maximized .doc-viewer-body,
.modal-fullscreen#doc-viewer-dialog .doc-viewer-body,
.doc-viewer-modal .modal-dialog.modal-fullscreen .doc-viewer-body {
  flex: 1 1 auto !important;
  height: calc(100vh - 54px) !important;
  max-height: calc(100vh - 54px) !important;
  width: 100% !important;
  overflow-y: auto !important;
}

.doc-sheet-canvas {
  background: #181b24;
  padding: 2rem 1rem;
  min-height: 100%;
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.doc-sheet-paper {
  background: #ffffff;
  color: #1a1a1a;
  width: 100%;
  max-width: 880px;
  min-height: 750px;
  padding: 2.5rem 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.8;
  font-size: 0.92rem;
  box-sizing: border-box;
}

/* Reglas Responsive para Mobile y Tablets */
@media (max-width: 768px) {
  .doc-viewer-modal .modal-dialog {
    max-width: 100vw !important;
    width: 100vw !important;
    margin: 0 !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
  }

  .doc-viewer-modal .modal-content {
    height: 100dvh !important;
    min-height: 100dvh !important;
    border: none !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .doc-viewer-header {
    padding: 0.4rem 0.55rem !important;
    gap: 0.35rem !important;
    min-height: 48px !important;
  }

  .doc-viewer-brand-logo {
    max-height: 20px !important;
    max-width: 70px !important;
  }

  /* Solo iconos en móviles con touch target óptimo */
  .doc-viewer-btn span,
  .doc-viewer-btn-close span,
  .btn-viewer span {
    display: none !important;
  }

  .doc-viewer-btn,
  .doc-viewer-btn-close,
  .btn-viewer {
    padding: 0.4rem 0.55rem !important;
    min-width: 36px !important;
    height: 36px !important;
    font-size: 0.85rem !important;
    gap: 0 !important;
  }

  .doc-viewer-body {
    flex: 1 1 auto !important;
    height: calc(100dvh - 48px) !important;
    max-height: calc(100dvh - 48px) !important;
  }

  .doc-sheet-canvas {
    padding: 0.5rem 0.35rem !important;
  }

  .doc-sheet-paper {
    padding: 1rem 0.75rem !important;
    min-height: auto !important;
    font-size: 0.84rem !important;
    box-shadow: none !important;
  }

  .docx-wrapper {
    padding: 0 !important;
    background: transparent !important;
  }

  .docx-wrapper>section.docx {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.75rem !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-height: auto !important;
  }
}

/* ==========================================================================
   ENLACES ÚTILES (USEFUL LINKS) - CARDS & DRAG & DROP
   ========================================================================== */
.link-card-container {
  display: flex;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.link-card-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 1.15rem;
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.link-card-box:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: rgba(184, 150, 46, 0.35) !important;
  transform: translateY(-2px);
}

.link-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  min-width: 0;
  width: 100%;
}

.link-card-icon-box {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: #fdfaf2;
  border: 1px solid rgba(184, 150, 46, 0.25);
  color: #b8962e;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
}

.link-card-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.link-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.link-card-url {
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.link-card-desc {
  font-size: 0.76rem;
  line-height: 1.45;
  color: #475569;
  margin-bottom: 0.9rem;
  flex-grow: 1;
  min-height: 2.9em;
  max-height: 2.9em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: break-word;
}

.link-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: auto;
  flex-wrap: wrap;
}

.drag-handle {
  cursor: grab;
  color: #94a3b8;
  padding: 2px 4px;
  border-radius: 4px;
  touch-action: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.drag-handle:hover {
  color: #b8962e;
  background: rgba(184, 150, 46, 0.1);
}

.drag-handle:active {
  cursor: grabbing;
}

.sortable-ghost {
  opacity: 0.4;
  background: #f8fafc !important;
  border: 1.5px dashed #b8962e !important;
}

.sortable-chosen {
  border-color: #b8962e !important;
  box-shadow: 0 8px 24px rgba(184, 150, 46, 0.25) !important;
}

.link-new-card-col {
  min-height: 175px;
}

.link-card-new-btn {
  height: 100%;
  min-height: 175px;
  background: rgba(184, 150, 46, 0.03) !important;
  border: 2px dashed #b8962e !important;
  border-radius: 0px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.65rem !important;
  color: #856a1b !important;
  padding: 1.5rem 1rem !important;
  transition: all 0.2s ease-in-out !important;
  cursor: pointer !important;
  text-decoration: none !important;
}

.link-card-new-btn:hover {
  background: rgba(184, 150, 46, 0.09) !important;
  border-color: #92751f !important;
  border-style: dashed !important;
  color: #5c470e !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(184, 150, 46, 0.18) !important;
}

.link-new-plus-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(184, 150, 46, 0.14);
  border: 1.5px solid rgba(184, 150, 46, 0.4);
  color: #b8962e;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  transition: all 0.2s ease;
}

.link-card-new-btn:hover .link-new-plus-circle {
  background: #b8962e;
  color: #ffffff;
  border-color: #b8962e;
  transform: scale(1.08);
}

.link-new-text {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   DESPLAZAMIENTO EN BANNER (MARQUEE TICKER) AL POSICIONAR EL CURSOR
   ========================================================================== */
.text-truncate,
.folder-marquee-text,
.link-card-title,
.link-card-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  scroll-behavior: auto;
}

.text-truncate::-webkit-scrollbar,
.folder-marquee-text::-webkit-scrollbar,
.link-card-title::-webkit-scrollbar,
.link-card-url::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN SUPERIOR (TOP NAVBAR HEADER)
   ========================================================================== */
.header.header-sticky {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  min-height: auto !important;
  position: sticky !important;
  z-index: 1050 !important;
}

#global-search-wrapper {
  z-index: 1060 !important;
}

/* Cabeceras de tablas sticky fijadas por debajo del buscador y dropdowns */
thead.sticky-top,
.table thead.sticky-top,
.table th,
.table thead th,
.table-responsive thead.sticky-top,
.card-body thead.sticky-top {
  z-index: 5 !important;
}

/* ==========================================================================
   BUSCADOR GLOBAL CON RESULTADOS CLASIFICADOS EN DIV FLOTANTE (TEMA CLARO)
   ========================================================================== */
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  max-height: 540px;
  background: #ffffff;
  border: 1px solid rgba(184, 150, 46, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
  border-radius: 0px;
  overflow-y: auto;
  z-index: 99999 !important;
  color: #1e293b;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.search-category-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-top: 1px solid #e2e8f0;
  padding: 7px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #856a1b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-category-header:first-child {
  border-top: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.12s ease;
  text-decoration: none;
  background: #ffffff;
}

.search-result-item:hover,
.search-result-item:focus {
  background: #fdfbf7;
  outline: none;
}

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

.search-result-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.search-result-body {
  min-width: 0;
  flex-grow: 1;
}

.search-result-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.search-result-meta {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 2px;
}

.search-match-highlight {
  color: #856a1b;
  background: rgba(184, 150, 46, 0.16);
  font-weight: 700;
  padding: 0 3px;
  border-radius: 2px;
}

.search-empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
  background: #ffffff;
}

.search-footer-info {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 7px 14px;
  font-size: 0.68rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* ==========================================================================
   Módulo Webmail (Pont Corporate - Layout Vertical con Lista Arriba y Lectura Abajo)
   ========================================================================== */

.webmail-workspace {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  display: flex;
  height: calc(100vh - 135px);
  min-height: 600px;
  overflow: hidden;
  position: relative;
}

/* 1. Columna Izquierda: Carpetas (Con modo Colapsable a sólo iconos) */
.webmail-folders-pane {
  width: 220px;
  min-width: 220px;
  background: #fbfbfd;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.webmail-folders-pane.collapsed {
  width: 58px;
  min-width: 58px;
}

.webmail-folders-header {
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.webmail-folders-pane.collapsed .webmail-folders-header {
  justify-content: center;
  padding: 0.75rem 0.3rem;
}

.webmail-folders-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
  margin: 0;
}

.webmail-folders-pane.collapsed .webmail-folders-title {
  display: none;
}

.btn-toggle-folders {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 2px;
  font-size: 0.78rem;
  transition: color 0.15s, background 0.15s;
}

.btn-toggle-folders:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.webmail-compose-btn-wrap {
  padding: 0.75rem 0.85rem 0.5rem 0.85rem;
}

.webmail-folders-pane.collapsed .webmail-compose-btn-wrap {
  padding: 0.75rem 0.4rem 0.5rem 0.4rem;
  display: flex;
  justify-content: center;
}

.btn-webmail-compose {
  background: linear-gradient(135deg, #b8962e 0%, #9e7f22 100%);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.85rem;
  border: none;
  border-radius: 0px;
  box-shadow: 0 2px 8px rgba(184, 150, 46, 0.25);
  transition: all 0.2s ease;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.btn-webmail-compose:hover {
  background: linear-gradient(135deg, #a68423 0%, #876a17 100%);
  box-shadow: 0 4px 12px rgba(184, 150, 46, 0.35);
  transform: translateY(-1px);
}

.webmail-folders-pane.collapsed .btn-webmail-compose {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 0px;
  gap: 0;
}

.webmail-folders-pane.collapsed .btn-webmail-compose span {
  display: none;
}

.webmail-folder-nav {
  list-style: none;
  padding: 0.3rem 0.5rem;
  margin: 0;
  overflow-y: auto;
  flex-grow: 1;
}

.webmail-folders-pane.collapsed .webmail-folder-nav {
  padding: 0.3rem 0.25rem;
}

.webmail-folder-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0px;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  user-select: none;
  position: relative;
  text-align: left;
}

.webmail-folders-pane.collapsed .webmail-folder-item {
  justify-content: center;
  padding: 0.65rem 0;
  gap: 0;
}

.webmail-folder-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.webmail-folder-item.active {
  background: #f4eee1;
  color: #785e13;
  font-weight: 700;
  border-left-color: #b8962e;
}

.webmail-folder-item i {
  width: 18px;
  text-align: center;
  margin-right: 0;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.webmail-folders-pane.collapsed .webmail-folder-item i {
  margin-right: 0;
  font-size: 1.15rem;
  width: auto;
}

.webmail-folder-name {
  flex: 1 1 auto;
  text-align: left;
  margin: 0;
  min-width: 0;
  line-height: 1.25;
  display: inline-block;
}

.webmail-folders-pane.collapsed .webmail-folder-name {
  display: none;
}

.webmail-folder-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
}

.webmail-folder-item.active .webmail-folder-badge {
  background: #b8962e;
  color: #ffffff;
}

.webmail-folders-pane.collapsed .webmail-folder-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 1px 4px;
  font-size: 0.58rem;
  border-radius: 8px;
}

.webmail-server-status {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.68rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.webmail-folders-pane.collapsed .webmail-server-status {
  justify-content: center;
  padding: 0.65rem 0;
}

.webmail-folders-pane.collapsed .webmail-server-status span.server-label {
  display: none;
}

/* 2. Contenedor Principal en 2 Bloques Verticales (Lista Arriba, Lectura Abajo) */
.webmail-main-stack {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
}

/* Bloque Superior: Lista de Mensajes */
.webmail-top-list-pane {
  height: 42%;
  min-height: 220px;
  max-height: 48%;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid #e2e8f0;
  background: #ffffff;
  position: relative;
}

.webmail-list-header {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfbfd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.webmail-search-box {
  position: relative;
  width: 260px;
  max-width: 100%;
}

.webmail-search-box input {
  font-size: 0.78rem;
  padding-left: 2rem;
  border-radius: 0px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  height: 31px;
}

.webmail-search-box input:focus {
  border-color: #b8962e;
  box-shadow: 0 0 0 2px rgba(184, 150, 46, 0.15);
}

.webmail-search-box .search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.74rem;
}

.webmail-filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.webmail-tab-btn {
  background: none;
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  padding: 3px 8px;
  border-radius: 0px;
  cursor: pointer;
  transition: all 0.15s;
}

.webmail-tab-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.webmail-tab-btn.active {
  background: #f4eee1;
  color: #785e13;
  border-color: #e2d2b0;
}

.webmail-messages-scroll {
  flex-grow: 1;
  overflow-y: auto;
  background: #ffffff;
}

/* Tabla de Mensajes */
.webmail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.webmail-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 5;
}

.webmail-table-row {
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
  user-select: none;
}

.webmail-table-row:hover {
  background: #f8fafc;
}

.webmail-table-row.active {
  background: #fbf9f4 !important;
}

.webmail-table-row.unread {
  background: #ffffff;
  font-weight: 700;
}

.webmail-table-row.unread td {
  color: #0f172a;
}

.webmail-table td {
  padding: 7px 10px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-status {
  width: 44px;
  text-align: center;
  padding-right: 4px !important;
}

.cell-from {
  width: 220px;
  max-width: 240px;
  color: #334155;
}

.cell-subject {
  max-width: 450px;
  color: #1e293b;
}

.cell-date {
  width: 130px;
  text-align: right;
  color: #64748b;
  font-size: 0.72rem;
}

.cell-size {
  width: 70px;
  text-align: right;
  color: #94a3b8;
  font-size: 0.7rem;
}

.msg-unread-dot {
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  display: inline-block;
}

.msg-star-btn {
  background: none;
  border: none;
  padding: 0 3px;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.8rem;
  transition: color 0.15s;
}

.msg-star-btn:hover,
.msg-star-btn.starred {
  color: #eab308;
}

/* Bloque Inferior: Panel de Lectura */
.webmail-bottom-reading-pane {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 58%;
  overflow-y: auto;
  background: #ffffff;
}

.webmail-reading-toolbar {
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfbfd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.webmail-reading-header {
  padding: 1rem 1.4rem 0.85rem 1.4rem;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.webmail-reading-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.webmail-sender-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.webmail-sender-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #f4eee1 0%, #ebdcc0 100%);
  color: #785e13;
  font-weight: 700;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
  border: 1px solid #e2d2b0;
  border-radius: 0px;
  flex-shrink: 0;
}

.webmail-attachments-section {
  padding: 0.75rem 1.4rem;
  border-top: 1px solid #e2e8f0;
  background: #fbfbfd;
}

.webmail-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 0.25rem 0.5rem;
  font-size: 0.76rem;
  color: #334155;
  text-decoration: none;
  transition: all 0.15s;
  border-radius: 0px;
}

.webmail-attachment-chip:hover {
  background: #f8fafc;
  border-color: #b8962e;
  color: #0f172a;
}

.folder-tree-select-row {
  transition: background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.folder-tree-select-row:hover {
  background-color: #f1f5f9 !important;
}

.folder-tree-select-row.is-selected {
  background-color: #fefce8 !important;
  border-left: 3px solid #b8962e !important;
}

.webmail-action-tile {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  text-decoration: none !important;
  transition: all 0.2s ease;
  border-radius: 0px !important;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.webmail-action-tile:hover {
  background: #f8fafc !important;
  border-color: #b8962e !important;
  box-shadow: 0 4px 12px rgba(184, 150, 46, 0.15) !important;
  color: #0f172a !important;
}

.webmail-action-tile.active,
.webmail-action-tile:active {
  background: #fefce8 !important;
  border-color: #b8962e !important;
  border-left: 3px solid #b8962e !important;
}

/* 4. Cuerpo de Correo en HTML Enriquecido */
.webmail-reading-body {
  flex-grow: 1;
  padding: 1.4rem;
  overflow-y: auto;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #1e293b;
}

.webmail-reading-body img {
  max-width: 100% !important;
  height: auto !important;
}

.webmail-reading-body table {
  max-width: 100% !important;
}

.webmail-reading-body a {
  color: #b8962e;
  text-decoration: underline;
}

.webmail-reading-body a:hover {
  color: #876a17;
}

.webmail-reading-body blockquote {
  border-left: 3px solid #b8962e;
  padding-left: 12px;
  margin-left: 0;
  color: #64748b;
}

/* Estado Vacío de Webmail */
.webmail-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  padding: 2rem 1.5rem;
  text-align: center;
  color: #64748b;
}

.webmail-empty-icon {
  width: 52px;
  height: 52px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

/* Modal de Redacción */
.webmail-compose-dialog {
  max-width: 780px;
}

.webmail-compose-toolbar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  padding: 4px 8px;
  display: flex;
  gap: 4px;
}

.webmail-compose-toolbar button {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: #475569;
  padding: 3px 6px;
  cursor: pointer;
}

.webmail-compose-toolbar button:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.webmail-compose-editor {
  border: 1px solid #e2e8f0;
  min-height: 220px;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
  background: #ffffff;
  outline: none;
}

.webmail-compose-editor:focus {
  border-color: #b8962e;
}

/* ==========================================================================
   MÓDULO WEBMAIL: ADAPTACIÓN RESPONSIVE (MÓVILES Y TABLETS)
   ========================================================================== */
@media (max-width: 991.98px) {
  .webmail-workspace {
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    border-radius: 0px !important;
  }

  .webmail-folders-pane {
    width: 100% !important;
    min-width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  .webmail-folders-pane .webmail-folder-nav {
    max-height: 180px;
    overflow-y: auto;
  }

  .webmail-folders-pane.collapsed .webmail-folder-nav {
    display: none !important;
  }

  .webmail-folders-pane.collapsed .webmail-server-status {
    display: none !important;
  }

  .webmail-folders-pane.collapsed .webmail-compose-btn-wrap {
    display: block !important;
    padding: 0.5rem 0.75rem !important;
  }

  .webmail-folders-pane.collapsed .btn-webmail-compose {
    width: 100% !important;
    height: auto !important;
    padding: 0.5rem 0.75rem !important;
    gap: 0.45rem !important;
  }

  .webmail-folders-pane.collapsed .btn-webmail-compose span {
    display: inline !important;
  }

  .webmail-top-list-pane {
    height: 380px !important;
    min-height: 280px !important;
    max-height: 420px !important;
  }
}

@media (max-width: 767.98px) {
  .webmail-list-header {
    padding: 0.5rem 0.65rem !important;
    gap: 0.45rem !important;
  }

  .webmail-search-box {
    width: 100% !important;
  }

  .webmail-filter-tabs {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .webmail-filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .webmail-table {
    table-layout: fixed !important;
    width: 100% !important;
  }

  .webmail-table th.cell-status,
  .webmail-table td.cell-status {
    width: 38px !important;
    padding: 6px 2px !important;
  }

  .webmail-table th.cell-from,
  .webmail-table td.cell-from {
    width: 42% !important;
    padding: 7px 4px !important;
    font-size: 0.75rem !important;
  }

  .webmail-table th.cell-subject,
  .webmail-table td.cell-subject {
    width: 58% !important;
    padding: 7px 6px !important;
    font-size: 0.76rem !important;
  }

  .webmail-reading-toolbar {
    padding: 0.5rem 0.65rem !important;
    gap: 0.35rem !important;
    flex-wrap: wrap !important;
  }

  .webmail-reading-header {
    padding: 0.75rem 0.85rem !important;
  }

  .webmail-reading-title {
    font-size: 0.98rem !important;
    margin-bottom: 0.4rem !important;
  }

  .webmail-reading-body {
    padding: 0.85rem !important;
    font-size: 0.82rem !important;
    min-height: 180px !important;
  }

  .webmail-attachments-section {
    padding: 0.65rem 0.85rem !important;
  }

  .webmail-attachment-chip {
    font-size: 0.72rem !important;
    padding: 0.25rem 0.45rem !important;
  }

  .webmail-giant-modal {
    max-width: 100vw !important;
    width: 100vw !important;
    margin: 0 !important;
  }

  .webmail-giant-reading-body {
    padding: 0.85rem !important;
    font-size: 0.84rem !important;
    max-height: calc(85vh - 200px) !important;
  }

  .webmail-compose-toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .webmail-compose-toolbar::-webkit-scrollbar {
    display: none;
  }

  .webmail-compose-editor {
    min-height: 160px !important;
    max-height: 260px !important;
    font-size: 0.82rem !important;
  }
}

/* Modal Gigante de Lectura de Correo */
.webmail-giant-modal {
  max-width: 95vw !important;
  width: 95vw !important;
  margin: 1rem auto !important;
}

@media (min-width: 1400px) {
  .webmail-giant-modal {
    max-width: 1380px !important;
  }
}

.webmail-giant-reading-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #1e293b;
  min-height: 350px;
  max-height: calc(85vh - 240px);
  overflow-y: auto;
  background: #ffffff;
  padding: 1.75rem 2rem;
  border: 1px solid #e2e8f0;
}

.webmail-giant-reading-body blockquote {
  border-left: 3px solid #b8962e;
  padding-left: 14px;
  margin: 1rem 0;
  color: #64748b;
  font-size: 0.9rem;
}

.webmail-giant-reading-body img {
  max-width: 100% !important;
  height: auto !important;
}

/* ==========================================================================
   DASHBOARD HOME TABLES: RESPONSIVE ZERO-SCROLL ON MOBILE
   ========================================================================== */
@media (max-width: 767.98px) {
  .table-home-responsive {
    table-layout: fixed !important;
    width: 100% !important;
    margin-bottom: 0 !important;
  }

  .table-home-responsive th,
  .table-home-responsive td {
    padding: 0.5rem 0.35rem !important;
    vertical-align: middle !important;
  }

  .card-body > .table-responsive {
    overflow-x: hidden !important;
  }

  .table-home-responsive .btn-group {
    display: inline-flex;
    flex-wrap: nowrap;
  }
}

/* ==========================================================================
   AGENDA Y DIRECTORIO DE CONTACTOS (ESTÉTICA HOMOGÉNEA COREUI PONT)
   ========================================================================== */
.agenda-az-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  background: #f8fafc;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
}

.agenda-az-btn {
  border-radius: 0px !important;
  font-size: 0.72rem !important;
  line-height: 1.5 !important;
  padding: 2px 7px !important;
  font-weight: 600;
  border: 1px solid transparent;
  color: #64748b;
  background: transparent;
  transition: all 0.15s ease;
}

.agenda-az-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #cbd5e1;
}

.agenda-az-btn.has-contacts {
  color: #1e293b;
  font-weight: 700;
  border-color: #e2e8f0;
  background: #ffffff;
}

.agenda-az-btn.active {
  background: #1e293b !important;
  color: #b8962e !important;
  border-color: #1e293b !important;
  font-weight: 800;
}

.agenda-avatar-box {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 0px;
}

.btn-xs {
  padding: 0.15rem 0.4rem !important;
  font-size: 0.72rem !important;
  line-height: 1.4 !important;
  border-radius: 0px !important;
}

@media (max-width: 767.98px) {
  .agenda-az-bar {
    padding: 0.4rem 0.5rem;
    gap: 2px;
  }

  .agenda-az-btn {
    font-size: 0.68rem !important;
    padding: 2px 5px !important;
  }
}