/* --------------------------------------------------
   SISTEMA DE DISEÑO & VARIABLES
   -------------------------------------------------- */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Paleta de Colores HSL Premium */
  --bg-main: #060913;
  --bg-sidebar: rgba(11, 16, 30, 0.6);
  --bg-card: rgba(17, 24, 39, 0.7);
  --border-color: rgba(55, 65, 81, 0.5);
  --border-focus: rgba(99, 102, 241, 0.8);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --primary-hover: #4f46e5;
  --secondary: #374151;
  --secondary-hover: #4b5563;
  
  /* Estados */
  --color-pending: #f59e0b;
  --color-processing: #a855f7;
  --color-waiting: #3b82f6;
  --color-paid: #10b981;
  --color-sent: #06b6d4;
  --color-failed: #ef4444;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Reset y Bases */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 13.5px;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

#modal-client-edit {
  z-index: 3500 !important;
}
/* --------------------------------------------------
   EFECTOS DE BRILLO Y GLOW DE FONDO
   -------------------------------------------------- */
.glow-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.glow-spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  top: -200px;
  right: -100px;
  animation: floatGlow 12s infinite alternate;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  animation: floatGlow 15s infinite alternate-reverse;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 30px) scale(1.1); }
}

/* --------------------------------------------------
   ESTRUCTURA PRINCIPAL (DASHBOARD WRAPPER)
   -------------------------------------------------- */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 225px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.logo-area h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-area h2 span {
  color: var(--primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 12.5px;
  transition: var(--transition);
}

.nav-item i {
  font-size: 14px;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  background: var(--primary-glow);
  border-left: 3px solid var(--primary);
  color: var(--primary);
}

.sidebar-stats {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 14px;
}

.sidebar-stats h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}

.sidebar-footer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Área de Contenido Principal */
.main-content {
  flex: 1;
  min-width: 0; /* Evita que el contenedor flex desborde la pantalla */
  padding: 14px 20px;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}

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

.header-title {
  flex: 1 1 200px;
  min-width: 180px;
}

.header-title h1 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
  white-space: nowrap;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  color: var(--text-muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

/* Botones de Cabecera Refinados (Header Actions) */
.btn-hdr {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.btn-hdr i {
  font-size: 11.5px;
}

.btn-hdr-renaper {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}
.btn-hdr-renaper:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-hdr-purple {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.35);
  color: #d8b4fe;
}
.btn-hdr-purple:hover {
  background: rgba(168, 85, 247, 0.22);
  border-color: #a855f7;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-hdr-green {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.btn-hdr-green:hover {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-hdr-orange {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.btn-hdr-orange:hover {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-hdr-primary {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.btn-hdr-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}

/* --------------------------------------------------
   COMPONENTES DE BOTÓN E INPUTS
   -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-success {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--color-failed);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-icon-only {
  padding: 5px 8px;
  font-size: 11.5px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close:hover {
  color: var(--text-main);
}

/* --------------------------------------------------
   FILTROS Y TABLA DE TRÁMITES
   -------------------------------------------------- */
.filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-box i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
}

.search-box input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  height: 32px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.filter-options {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-options label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.select-input {
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  height: 32px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.select-input:focus {
  border-color: var(--border-focus);
}

/* Contenedor de la Tabla */
.table-container {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-scroll-hint-left,
.table-scroll-hint-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 20;
  color: #38bdf8;
  font-size: 15px;
}

.table-scroll-hint-left {
  left: 0;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
}

.table-scroll-hint-right {
  right: 0;
  background: linear-gradient(to left, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0) 100%);
}

.table-container.has-scroll-left .table-scroll-hint-left {
  opacity: 0.9;
}

.table-container.has-scroll-right .table-scroll-hint-right {
  opacity: 0.9;
}

/* Menú Desplegable de Estado Rápido (Enviado / Pendiente / Urgente) */
.status-action-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.status-menu-popup {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.1);
  padding: 6px;
  min-width: 140px;
  z-index: 10000;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

.status-action-dropdown:hover .status-menu-popup,
.status-action-dropdown.is-open .status-menu-popup {
  display: flex !important;
}

.status-action-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

.status-menu-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  padding: 4px 8px 3px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 2px;
}

.status-menu-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.status-menu-option .active-check {
  margin-left: auto;
  font-size: 10px;
  color: #38bdf8;
}

.status-menu-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.status-menu-option.option-delivered:hover,
.status-menu-option.option-delivered.active {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.status-menu-option.option-pending:hover,
.status-menu-option.option-pending.active {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.status-menu-option.option-urgent:hover,
.status-menu-option.option-urgent.active {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

@keyframes pulseUrgent {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.pulse-urgent {
  animation: pulseUrgent 2s infinite;
}

.desktop-table-wrapper {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.desktop-table-wrapper::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.mobile-cards-wrapper {
  display: none;
}

.premium-table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
  text-align: left;
  font-size: 11.5px;
}

.premium-table th {
  padding: 7px 8px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.premium-table td {
  padding: 6px 7px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  line-height: 1.35;
}

.premium-table th:last-child,
.premium-table td:last-child {
  min-width: 175px;
  width: 1%;
  text-align: right;
  white-space: nowrap;
  padding-right: 8px;
}

.actions-btn-group {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.actions-btn-group .btn-sm {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  white-space: nowrap;
}

.actions-btn-group .btn-icon-only {
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 11px;
}

.premium-table tbody tr {
  transition: var(--transition);
}

.premium-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

/* Badges de Estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-pending {
  color: var(--color-pending);
  background: rgba(245, 158, 11, 0.15);
}

.badge-processing {
  color: var(--color-processing);
  background: rgba(168, 85, 247, 0.15);
}

.badge-waiting_payment {
  color: var(--color-waiting);
  background: rgba(59, 82, 246, 0.15);
}

.badge-paid {
  color: var(--color-paid);
  background: rgba(16, 185, 129, 0.15);
}

.badge-email_sent {
  color: var(--color-sent);
  background: rgba(6, 182, 212, 0.15);
}

.badge-delivered, .badge-completed {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-failed {
  color: var(--color-failed);
  background: rgba(239, 68, 68, 0.15);
}

/* Loading en tabla */
.loading-td {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
}

/* --------------------------------------------------
   PANEL CARD (CONFIGURACIÓN)
   -------------------------------------------------- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.section-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.premium-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.col-6 {
  flex: 1;
}

.col-4 {
  flex: 1;
}

.col-12 {
  flex: 1 1 100%;
  width: 100%;
}

.premium-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.premium-form input, .premium-form select, .premium-form textarea {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  font-family: var(--font-main);
  transition: var(--transition);
}

.premium-form input:focus, .premium-form select:focus, .premium-form textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
  background: rgba(255, 255, 255, 0.04);
}

.input-help {
  font-size: 11px;
  color: var(--text-muted);
}

.password-input-wrapper {
  position: relative;
  display: flex;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 48px;
}

.password-input-wrapper .btn-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* --------------------------------------------------
   MODALES Y CONTENEDOR FLUIDO
   -------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.show,
.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-body {
  overflow-x: hidden;
  box-sizing: border-box;
}

.modal-content input[type="file"] {
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.85rem;
}

.modal.show .modal-content,
.modal.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 800;
}

/* --------------------------------------------------
   WIZARD DE PASOS DENTRO DEL MODAL
   -------------------------------------------------- */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  transition: var(--transition);
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 16px;
  transform: translateY(-12px);
}

.step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px var(--primary);
}

.step.active .step-label {
  color: var(--text-main);
}

.step.completed .step-num {
  background: var(--color-paid);
  border-color: var(--color-paid);
  color: #fff;
}

.step-line.active {
  background: var(--primary);
}

.wizard-step-content {
  display: none;
}

.wizard-step-content.active {
  display: block;
  animation: slideIn 0.3s ease;
}

/* --------------------------------------------------
   DETALLES DE CLIENTE Y ARCHIVOS
   -------------------------------------------------- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.info-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.info-box h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.info-box p {
  font-size: 13px;
  margin-bottom: 8px;
}

.info-box p strong {
  color: var(--text-muted);
}

.file-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.file-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-focus);
}

.file-link i {
  color: var(--primary);
  font-size: 16px;
}

/* --------------------------------------------------
   ACCIONES DEL FLUJO AUTOMATIZADO
   -------------------------------------------------- */
.action-panel {
  background: rgba(99, 102, 241, 0.03);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 12px;
}

.action-panel h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.action-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.loader-container {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
  padding: 16px 0;
}

/* CAPTCHA Interactivo */
.captcha-interactive {
  display: flex;
  gap: 20px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 10px;
}

.captcha-img-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 4px;
  height: 60px;
}

.captcha-img-wrapper img {
  height: 100%;
  object-fit: contain;
}

.captcha-img-wrapper button {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  width: 24px;
  height: 24px;
  font-size: 11px;
  color: #fff;
}

.captcha-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.captcha-input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-with-button {
  display: flex;
  gap: 10px;
}

.input-with-button input {
  flex: 1;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
}

.input-with-button input:focus {
  border-color: var(--border-focus);
}

/* Paso 2: Pago */
.payment-links-box {
  text-align: center;
  margin-bottom: 20px;
}

.payment-method-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.payment-screenshot-box {
  margin-bottom: 24px;
}

.payment-screenshot-box h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.screenshot-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 520px;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
}

.screenshot-container img {
  max-width: 100%;
  max-height: 480px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Dropzone de subida de archivos */
.file-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.file-drop-zone i {
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.file-drop-zone p {
  font-size: 13px;
  color: var(--text-muted);
}

.selected-file-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-paid);
  margin-top: 8px;
}

.receipt-actions {
  display: flex;
  justify-content: flex-end;
}

/* Paso 3: Email */
.email-preview-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.email-preview-box label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.email-preview-box textarea {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  font-family: monospace;
  outline: none;
  resize: vertical;
}

.final-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-large {
  padding: 14px 40px;
  font-size: 16px;
}

/* --------------------------------------------------
   TOASTS (NOTIFICACIONES FLOTANTES)
   -------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease forwards;
}

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

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

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --------------------------------------------------
   ANIMACIONES COMUNES Y UTILITIES
   -------------------------------------------------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.hide {
  display: none !important;
}

.blur-bg {
  filter: blur(4px);
}

/* Wizard Form Input Styles */
.wiz-form-group {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}

.wiz-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  width: 95px;
  flex-shrink: 0;
  text-align: left;
}

.wiz-input, .wiz-select {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
  width: 100%;
}

/* --------------------------------------------------
   SISTEMA RESPONSIVE Y MOBILE (MÓVIL Y TABLET)
   -------------------------------------------------- */

/* Barra de Navegación Móvil (Oculta en Desktop) */
.mobile-navbar {
  display: none;
}

.mobile-category-bar {
  display: none;
}

.mobile-sidebar-close-btn {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.mobile-card-cell {
  display: none;
}

@media (max-width: 900px) {
  body {
    padding-bottom: 30px;
  }

  .mobile-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(11, 17, 32, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 120;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-brand img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  .mobile-brand span {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
  }

  .mobile-brand span b {
    color: var(--primary);
  }

  .mobile-menu-btn, .mobile-logout-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
  }

  .mobile-logout-btn {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
  }

  /* Barra de Chips de Categorías Deslizable */
  .mobile-category-bar {
    display: block;
    background: rgba(15, 23, 42, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    position: sticky;
    top: 58px;
    z-index: 110;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .mobile-chips-scroll::-webkit-scrollbar {
    display: none;
  }

  .m-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .m-chip i {
    font-size: 0.85rem;
  }

  .m-chip.active {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    border-color: #6366f1;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
  }

  /* Sidebar Drawer */
  .mobile-sidebar-close-btn {
    display: flex;
    position: absolute;
    right: 12px;
    top: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
  }

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

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 290px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    background: #0f172a;
    overflow-y: auto;
  }

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

  .main-content {
    padding: 12px 10px;
    width: 100%;
  }

  .content-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  .header-title h1 {
    font-size: 18px;
    white-space: normal;
  }

  .header-title p {
    font-size: 12px;
    color: #94a3b8;
  }

  .header-actions {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    width: 100%;
    padding: 4px 2px 8px 2px;
    scrollbar-width: none;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .btn-hdr {
    flex-shrink: 0;
    white-space: nowrap;
    justify-content: center;
    padding: 8px 14px;
    font-size: 11.5px;
    border-radius: 8px;
  }

  .semaforo-filter-group {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
    gap: 6px;
    padding: 6px;
    box-sizing: border-box;
  }

  .semaforo-filter-group::-webkit-scrollbar {
    display: none;
  }

  .semaforo-pill {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
    background: rgba(15, 23, 42, 0.6);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .search-box, .filter-options, .filter-options select {
    width: 100%;
    max-width: 100%;
  }

  #btn-mark-all-delivered {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
  }

  /* --------------------------------------------------
     VISTA MÓVIL NATIVA (TARJETAS 100% FLUIDAS Y RESPONSIVAS)
     -------------------------------------------------- */
  .desktop-table-wrapper {
    display: none !important;
  }

  .mobile-cards-wrapper {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 6px;
    box-sizing: border-box;
  }

  .table-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .table-scroll-hint-left,
  .table-scroll-hint-right {
    display: none !important;
  }

  /* Tarjeta Móvil Nativa (0 bugs de tabla, 0 reflow congelado) */
  .m-tramite-card {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    width: 100%;
  }

  .m-tramite-card.card-expanded {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 6px 22px rgba(56, 189, 248, 0.15);
  }

  .m-card-header {
    cursor: pointer;
    user-select: none;
  }

  .m-card-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .m-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .m-id-tag {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.82rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 3px 8px;
    border-radius: 6px;
  }

  .m-card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .m-chevron {
    color: #94a3b8;
    font-size: 0.85rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .m-card-deadline {
    margin-bottom: 8px;
  }

  .m-card-client-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.35;
    margin-bottom: 6px;
    word-break: break-word;
  }

  .m-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  .m-ref {
    color: #a5b4fc;
    background: rgba(165, 180, 252, 0.12);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 500;
  }

  .m-price {
    color: #38bdf8;
    font-weight: 700;
  }

  .m-service {
    color: #94a3b8;
  }

  .m-card-quick-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }

  .m-card-quick-actions .btn {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  /* Sección de detalles expandibles (0 lag, instantáneo y fluido) */
  .m-card-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
    animation: mFadeIn 0.2s ease;
  }

  @keyframes mFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .m-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.82rem;
    margin-bottom: 14px;
  }

  .m-detail-box {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .m-detail-box.m-full-width {
    grid-column: span 2;
  }

  .m-lbl {
    color: #94a3b8;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  .m-val {
    color: #f1f5f9;
    font-weight: 500;
    word-break: break-word;
  }

  .m-val-highlight {
    color: #38bdf8;
    font-weight: 700;
  }

  .m-val-success {
    color: #4ade80;
    font-weight: 700;
  }

  .m-link {
    color: #38bdf8;
    text-decoration: none;
  }

  .m-link-wa {
    color: #4ade80;
  }

  .m-full-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .m-full-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 8px;
    font-size: 0.78rem;
  }

  /* PREVENCIÓN GLOBAL DE OVERFLOW HORIZONTAL */
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .dashboard-wrapper,
  .main-content {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* MODALES Y FORMULARIOS FLUIDOS (100% RESPONSIVE PARA MÓVILES SAMSUNG GALAXY) */
  .modal {
    padding: 8px !important;
    box-sizing: border-box;
    align-items: center;
    width: 100% !important;
    height: 100% !important;
  }

  .modal-content {
    padding: 18px 14px !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 94vh !important;
    max-height: 94dvh !important;
    border-radius: 16px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
  }

  /* Apilar verticalmente los campos de formulario en pantallas móviles */
  .form-row {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .form-row .col-6,
  .form-row .col-4,
  .form-row .col-3,
  .form-row .col-12 {
    width: 100% !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
  }

  .form-actions {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .form-actions .btn,
  .form-actions button {
    width: 100% !important;
    justify-content: center !important;
  }

  .info-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .costos-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .fichero-fs-topbar {
    padding: 0 12px !important;
    gap: 8px !important;
  }

  .fichero-fs-client-name {
    max-width: 170px !important;
    font-size: 1.05rem !important;
  }

  .fichero-fs-metrics-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  .fichero-fs-main {
    padding: 14px 10px !important;
  }

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

.wiz-input:focus, .wiz-select:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

select option {
  background-color: #0b1329 !important;
  color: #ffffff !important;
}

/* ========================================================
   ESTILOS REFORMA CRM: SEMÁFORO, FICHEROS Y COSTOS
   ======================================================== */
.semaforo-filter-group {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  background: rgba(15, 23, 42, 0.7);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.semaforo-pill {
  padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.semaforo-pill:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.semaforo-pill.active[data-sem="all"] {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

.semaforo-pill.active[data-sem="orange"] {
  background: rgba(249, 115, 22, 0.22);
  border-color: #f97316;
  color: #fb923c;
}

.semaforo-pill.active[data-sem="yellow"] {
  background: rgba(234, 179, 8, 0.22);
  border-color: #eab308;
  color: #facc15;
}

.semaforo-pill.active[data-sem="green"] {
  background: rgba(34, 197, 94, 0.22);
  border-color: #22c55e;
  color: #4ade80;
}

.sub-id-chip {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-decoration: none;
  display: inline-block;
  letter-spacing: 0.3px;
}

.sub-id-chip:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #ffffff;
}

.review-mode-toggle {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-review-on {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
}

.btn-review-on:hover {
  background: rgba(245, 158, 11, 0.28);
}

.btn-review-off {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.btn-review-off:hover {
  background: rgba(148, 163, 184, 0.25);
  color: #f1f5f9;
}

.btn-procesar-solteria {
  background: linear-gradient(135deg, #f97316, #ea580c) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  padding: 6px 12px !important;
  border-radius: 6px !important;
  box-shadow: 0 3px 12px rgba(249, 115, 22, 0.4) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer;
}

.btn-procesar-solteria:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.55) !important;
}

.client-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.client-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.costos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.costos-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
}

.costos-card h3 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   ESPACIO DE TRABAJO A PANTALLA COMPLETA: FICHEROS DE CLIENTES / GESTORES
   ========================================================================== */
.fichero-fullscreen-workspace {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2500;
  background: #090d16;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
  overflow: hidden;
}

.fichero-fullscreen-workspace.show {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.fichero-fs-topbar {
  height: 64px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.fichero-fs-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.fichero-fs-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #38bdf8;
  flex-shrink: 0;
}

.fichero-fs-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fichero-fs-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fichero-fs-client-name {
  margin: 2px 0 0 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fichero-fs-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-close-fs {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.btn-close-fs:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.fichero-fs-body {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.04), transparent 45%),
              radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.04), transparent 45%),
              #090d16;
}

.fichero-fs-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.2) transparent;
}

.fichero-fs-main::-webkit-scrollbar {
  width: 6px;
}

.fichero-fs-main::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 4px;
}

.fichero-fs-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  min-width: 0;
  overflow: hidden;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

#fichero-modal-email {
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  display: block !important;
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
  line-height: 1.3 !important;
  min-width: 0 !important;
}

#fichero-modal-email a {
  color: #38bdf8 !important;
  text-decoration: none !important;
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
  display: inline-block !important;
}

body.light-theme #fichero-modal-email a {
  color: #0284c7 !important;
}

body.light-theme #fichero-modal-email {
  color: #1e293b !important;
}

.text-success { color: #4ade80 !important; }
.text-slate { color: #cbd5e1 !important; }
.text-info { color: #38bdf8 !important; }
.text-emerald { color: #34d399 !important; }

.fichero-fs-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.fichero-fs-section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fichero-fs-section-desc {
  margin: 3px 0 0 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

.fichero-table-container {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  -webkit-overflow-scrolling: touch;
}

.fichero-tramites-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}

.fichero-tramites-table th {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.fichero-tramites-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

/* BARRA LATERAL DERECHA: FICHEROS ABIERTOS */
.fichero-fs-sidebar {
  width: 320px;
  background: #0b1120;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease, width 0.25s ease;
}

.fichero-fs-sidebar.collapsed {
  width: 0;
  overflow: hidden;
  border-left: none;
}

.fichero-sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
}

.btn-sidebar-close-all {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-sidebar-close-all:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.fichero-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}

.open-fichero-item {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.open-fichero-item:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(-2px);
}

.open-fichero-item.active {
  background: rgba(14, 165, 233, 0.12);
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.18);
}

.open-fichero-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #38bdf8;
  border-radius: 0 2px 2px 0;
}

.open-fichero-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.open-fichero-header-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.open-fichero-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.open-fichero-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-close-fichero-item {
  background: transparent;
  border: none;
  color: #64748b;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-close-fichero-item:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

.fichero-sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.5);
}

/* ADAPTACIÓN RESPONSIVE & OPTIMIZACIÓN DE RENDIMIENTO */
@media (max-width: 900px) {
  /* Eliminar filtros pesados y animaciones GPU continuas en móviles */
  .glow-container, .glow-spot {
    display: none !important;
    animation: none !important;
    filter: none !important;
  }

  .mobile-navbar,
  .top-header,
  .sidebar,
  .metric-card,
  .fichero-fs-modal,
  .modal-content,
  .fichero-fs-topbar,
  .fichero-fs-sidebar,
  .card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .mobile-navbar {
    background: #0b1120 !important;
  }

  .metric-card {
    background: #0f172a !important;
  }

  body.light-theme .mobile-navbar {
    background: #ffffff !important;
  }

  body.light-theme .metric-card {
    background: #ffffff !important;
  }

  .fichero-table-container,
  .table-responsive,
  .fichero-fs-main,
  .modal-body {
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
  }

  .fichero-fs-topbar {
    padding: 0 14px;
  }
  .fichero-fs-main {
    padding: 16px 14px;
  }
  .fichero-fs-sidebar {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    z-index: 2600;
    width: 280px;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
  }
  .fichero-fs-sidebar.mobile-open {
    transform: translateX(0);
  }
}

#modal-wizard {
  z-index: 3500;
}

/* ==========================================================================
   SISTEMA DE TEMA CLARO Y OSCURO (LIGHT & DARK THEME)
   ========================================================================== */
html.light-theme, body.light-theme {
  --bg-main: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #4f46e5;
  
  --primary: #4f46e5;
  --primary-glow: rgba(79, 70, 229, 0.12);
  --primary-hover: #4338ca;
  --secondary: #e2e8f0;
  --secondary-hover: #cbd5e1;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dark: #0f172a;
  
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
}

/* Ajustes globales de Tema Claro */
body.light-theme {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

body.light-theme .glow-container {
  display: none !important;
}

/* Sidebar en Modo Claro */
body.light-theme .sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03) !important;
}

body.light-theme .logo-area h2 {
  color: #0f172a !important;
}

body.light-theme .sidebar-nav .nav-item {
  color: #475569 !important;
}

body.light-theme .sidebar-nav .nav-item:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}

body.light-theme .sidebar-nav .nav-item.active {
  background: #eef2ff !important;
  color: #4f46e5 !important;
  border-left: 3px solid #4f46e5 !important;
}

body.light-theme .sidebar-stats {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .sidebar-stats h3 {
  color: #64748b !important;
}

body.light-theme .sidebar-stats .stat-mini {
  color: #334155 !important;
}

body.light-theme .sidebar-footer {
  border-top: 1px solid #e2e8f0 !important;
}

body.light-theme #user-profile-badge {
  color: #334155 !important;
}

/* Encabezados y Títulos */
body.light-theme .header-title h1 {
  color: #0f172a !important;
}

body.light-theme .header-title p {
  color: #64748b !important;
}

/* Botones de Cabecera (Header Actions) */
body.light-theme .btn-hdr {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .btn-hdr:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .btn-hdr-renaper {
  background: #eef2ff !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  color: #4f46e5 !important;
}

body.light-theme .btn-hdr-purple {
  background: #faf5ff !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
  color: #7c3aed !important;
}

body.light-theme .btn-hdr-green {
  background: #f0fdf4 !important;
  border-color: rgba(34, 197, 94, 0.4) !important;
  color: #16a34a !important;
}

body.light-theme .btn-hdr-orange {
  background: #fff7ed !important;
  border-color: rgba(249, 115, 22, 0.4) !important;
  color: #ea580c !important;
}

/* Botón de alternancia de Tema */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 600;
  border-radius: 8px;
}

.btn-theme-toggle i {
  font-size: 1.05rem;
  transition: transform 0.3s ease;
}

.btn-theme-toggle:hover i {
  transform: rotate(20deg) scale(1.1);
}

body.light-theme .btn-theme-toggle {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #f59e0b !important;
}

body:not(.light-theme) .btn-theme-toggle {
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
}

/* Botón móvil de tema */
.mobile-theme-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fbbf24;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

body.light-theme .mobile-theme-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #d97706;
}

/* Barra de Filtros y Búsqueda */
body.light-theme .filters-bar {
  background: transparent;
}

body.light-theme .search-box {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .search-box i {
  color: #94a3b8 !important;
}

body.light-theme .search-box input {
  background: transparent !important;
  color: #0f172a !important;
}

body.light-theme .search-box input::placeholder {
  color: #94a3b8 !important;
}

body.light-theme .select-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .select-input option {
  background: #ffffff !important;
  color: #0f172a !important;
}

body.light-theme .filter-options label {
  color: #64748b !important;
}

body.light-theme .semaforo-pill {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}

body.light-theme .semaforo-pill.active {
  background: #eef2ff !important;
  border-color: #6366f1 !important;
  color: #4338ca !important;
  font-weight: 700 !important;
}

/* Tablero y Tabla */
body.light-theme .table-container {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .premium-table th {
  background: #f8fafc !important;
  color: #64748b !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .premium-table td {
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
}

body.light-theme .premium-table tbody tr:hover {
  background: #f8fafc !important;
}

body.light-theme .table-scroll-hint-left {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0) 100%) !important;
}

body.light-theme .table-scroll-hint-right {
  background: linear-gradient(to left, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0) 100%) !important;
}

/* Tarjetas y Paneles (Contabilidad, Automatizaciones, Costos) */
body.light-theme .card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .accounting-container {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

body.light-theme .accounting-header h2,
body.light-theme .kpi-card h2,
body.light-theme .card h2,
body.light-theme .card h3 {
  color: #0f172a !important;
}

body.light-theme .kpi-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

body.light-theme .kpi-card span {
  color: #64748b !important;
}

body.light-theme .costos-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .costos-card h3 {
  color: #0f172a !important;
}

body.light-theme .automation-service-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .automation-service-card h4 {
  color: #0f172a !important;
}

body.light-theme .automation-logs-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .automation-logs-container {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

/* Modales en Modo Claro */
body.light-theme .modal {
  background: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(8px) !important;
}

body.light-theme .modal-content {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15) !important;
  color: #0f172a !important;
}

body.light-theme .modal-header {
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .modal-header h2,
body.light-theme .modal-header h3 {
  color: #0f172a !important;
}

body.light-theme .btn-close {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .btn-close:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Formularios en Modo Claro */
body.light-theme input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
body.light-theme select,
body.light-theme textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body.light-theme input:focus,
body.light-theme select:focus,
body.light-theme textarea:focus {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

body.light-theme .premium-form label,
body.light-theme .wiz-form-group label,
body.light-theme .form-group label {
  color: #475569 !important;
}

/* Normalización de textos inline oscuros */
body.light-theme [style*="color: #fff"],
body.light-theme [style*="color: #ffffff"],
body.light-theme [style*="color:#fff"],
body.light-theme [style*="color:#ffffff"] {
  color: #0f172a !important;
}

/* Excepciones de botones y badges con texto blanco */
body.light-theme .btn-primary,
body.light-theme .btn-success,
body.light-theme .btn-danger,
body.light-theme .badge-paid,
body.light-theme .badge-failed,
body.light-theme .badge-sent,
body.light-theme .badge-processing {
  color: #ffffff !important;
}

/* Mobile Navbar & Chips */
body.light-theme .mobile-navbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .mobile-brand span {
  color: #0f172a !important;
}

body.light-theme .mobile-menu-btn,
body.light-theme .mobile-logout-btn,
body.light-theme .mobile-theme-btn {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .mobile-category-bar {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .m-chip {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

body.light-theme .m-chip.active {
  background: #eef2ff !important;
  border-color: #4f46e5 !important;
  color: #4f46e5 !important;
}

/* Mobile cards en el Tablero */
body.light-theme .m-card,
body.light-theme .m-tramite-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .m-card-titular,
body.light-theme .m-card-client-name {
  color: #0f172a !important;
}

body.light-theme .m-val {
  color: #1e293b !important;
}

body.light-theme .m-card-header {
  border-bottom: 1px solid #f1f5f9 !important;
}

body.light-theme .m-card-details {
  border-top-color: #e2e8f0 !important;
}

body.light-theme .m-card-footer {
  border-top: 1px solid #f1f5f9 !important;
  background: #f8fafc !important;
}

/* Workspace Pantalla Completa (Ficheros) */
body.light-theme .fichero-fullscreen-workspace {
  background: #f1f5f9 !important;
}

body.light-theme .fichero-fs-topbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .fichero-fs-client-name {
  color: #0f172a !important;
}

body.light-theme .fichero-fs-sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
}

body.light-theme .fichero-sidebar-item {
  color: #334155 !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

body.light-theme .fichero-sidebar-item:hover {
  background: #f8fafc !important;
}

body.light-theme .fichero-sidebar-item.active {
  background: #eef2ff !important;
  border-left: 3px solid #4f46e5 !important;
  color: #4f46e5 !important;
}

body.light-theme .fichero-table-container {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .fichero-tramites-table th {
  background: #f8fafc !important;
  color: #64748b !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .fichero-tramites-table td {
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
}

body.light-theme .fichero-metric-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .fichero-metric-label {
  color: #64748b !important;
}

body.light-theme .fichero-metric-val {
  color: #0f172a !important;
}

/* Menús desplegables rápidos */
body.light-theme .status-menu-popup {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .status-menu-item {
  color: #334155 !important;
}

body.light-theme .status-menu-item:hover {
  background: #f1f5f9 !important;
}

/* Modal de Expediente Documental en Tema Claro */
body.light-theme #fichero-docs-expediente-modal .modal-content {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

body.light-theme #fichero-docs-expediente-modal .modal-content > div:first-child,
body.light-theme #fichero-docs-expediente-modal .modal-content > div:last-child {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

body.light-theme #fichero-docs-modal-title {
  color: #0f172a !important;
}

body.light-theme .fichero-doc-card {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

body.light-theme .fichero-doc-card div[title] {
  color: #0f172a !important;
}

/* Sección de Finalizados y Barra de Despacho en Expediente */
.fichero-dispatch-bar {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
}
body.light-theme .fichero-dispatch-bar {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.fichero-empty-final-zone {
  background: rgba(16, 185, 129, 0.04);
  border: 1.5px dashed rgba(16, 185, 129, 0.25);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
}
body.light-theme .fichero-empty-final-zone {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

/* Modal de Despacho Multi-Canal */
body.light-theme #fichero-dispatch-modal .modal-content {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
body.light-theme #fichero-dispatch-modal .modal-content > div:first-child,
body.light-theme #fichero-dispatch-modal .modal-content > div:last-child {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
body.light-theme #fichero-dispatch-modal h3 {
  color: #0f172a !important;
}
body.light-theme #fichero-dispatch-phone,
body.light-theme #fichero-dispatch-email,
body.light-theme #fichero-dispatch-template,
body.light-theme #fichero-dispatch-brand {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* ========================================================
   WHATSAPP HUB & CHATS EN VIVO
   ======================================================== */
.wa-hub-wrapper {
  display: flex;
  height: calc(100vh - 140px);
  min-height: 550px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.wa-hub-sidebar {
  width: 340px;
  min-width: 280px;
  max-width: 380px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.95);
}

.wa-sidebar-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wa-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
}

.wa-search-bar {
  padding: 10px 14px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.wa-search-bar i {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 13px;
}

.wa-search-bar input {
  width: 100%;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  padding: 8px 12px 8px 34px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.wa-search-bar input:focus {
  border-color: #22c55e;
}

.wa-chats-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.wa-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s ease;
}

.wa-chat-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.wa-chat-item.active {
  background: rgba(34, 197, 94, 0.12);
  border-left: 3px solid #22c55e;
}

.wa-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.wa-chat-info {
  flex: 1;
  min-width: 0;
}

.wa-chat-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.wa-chat-title {
  font-weight: 600;
  font-size: 13.5px;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat-time {
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
}

.wa-chat-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wa-chat-snippet {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.wa-chat-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.wa-hub-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(11, 19, 43, 0.85);
  position: relative;
}

.wa-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: #94a3b8;
}

.wa-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22c55e;
  font-size: 34px;
  margin-bottom: 16px;
}

.wa-active-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wa-chat-header {
  padding: 12px 18px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-back-btn {
  display: none;
}

.wa-contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.wa-contact-info {
  flex: 1;
  min-width: 0;
}

.wa-contact-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.wa-contact-phone {
  font-size: 12px;
  color: #94a3b8;
}

.wa-messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

.wa-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.wa-msg-bubble.received {
  align-self: flex-start;
  background: #1e293b;
  color: #f1f5f9;
  border-bottom-left-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.wa-msg-bubble.sent {
  align-self: flex-end;
  background: #065f46;
  color: #ecfdf5;
  border-bottom-right-radius: 2px;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.wa-msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  text-align: right;
  margin-top: 4px;
  display: block;
}

.wa-msg-media-preview {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.wa-msg-media-preview img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 6px;
  cursor: pointer;
  display: block;
}

.wa-msg-doc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.wa-msg-doc-icon {
  font-size: 22px;
  color: #ef4444;
}

.wa-quick-replies-bar {
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.wa-quick-chip {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wa-quick-chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

.wa-chat-input-bar {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 10px;
  align-items: center;
}

.wa-chat-input-bar input {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
}

.wa-chat-input-bar input:focus {
  border-color: #22c55e;
}

/* Modal de Medios */
.wa-modal-media-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.wa-media-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
}

.wa-media-card.selected {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
}

.wa-media-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.wa-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-media-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wa-media-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wa-media-role-select {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
}

.wa-media-name-input {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
}

.wa-media-name-input:focus {
  border-color: #38bdf8;
}

/* Reglas Responsivas para Móvil (Samsung Galaxy, etc.) */
@media (max-width: 768px) {
  .wa-hub-wrapper {
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
    min-height: auto;
    position: relative;
    border-radius: 0;
    border: none;
  }

  .wa-hub-sidebar {
    width: 100%;
    max-width: 100%;
    border-right: none;
  }

  .wa-hub-chat-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none;
  }

  .wa-hub-chat-area.mobile-open {
    display: flex;
  }

  .wa-back-btn {
    display: inline-flex !important;
  }

  .wa-msg-bubble {
    max-width: 88%;
  }

  .wa-media-inputs {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ==================================================
   DISEÑO INTRANET BALADO ABOGADOS & SISTEMA FLUIDO
   ================================================== */

/* Ocultar glow spheres para un look limpio y profesional */
.glow-container {
  display: none !important;
}

/* 1. BARRA SUPERIOR INSTITUCIONAL BALADO (INTRANET TOPBAR) */
.ba-intranet-topbar {
  background-color: #0b0f19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: 48px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}

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

.ba-firm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ba-monogram {
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #f8fafc;
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 7px;
  display: inline-block;
  line-height: 1.2;
}

.ba-brand-title {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.ba-firm-name {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.ba-firm-type {
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
}

.ba-sep {
  color: rgba(255, 255, 255, 0.2);
  font-size: 14px;
}

.ba-intranet-tag {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.ba-topbar-center {
  display: flex;
  align-items: center;
}

.ba-system-heading {
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.ba-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ba-user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

.ba-greeting {
  color: #94a3b8;
}

.ba-user-name {
  color: #ffffff;
  font-weight: 600;
}

.ba-avatar-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.ba-avatar-wrapper:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ba-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #334155;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ba-dropdown-arrow {
  color: #94a3b8;
  font-size: 10px;
}

.ba-user-dropdown-popover {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  padding: 6px 0;
  z-index: 1500;
}

.ba-user-dropdown-popover.show {
  display: block;
  animation: baFadeIn 0.15s ease-out;
}

@keyframes baFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ba-popover-header {
  padding: 10px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ba-popover-header strong {
  font-size: 13px;
  color: #ffffff;
}

.ba-popover-header small {
  font-size: 11px;
  color: #94a3b8;
}

.ba-popover-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.ba-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12.5px;
  color: #cbd5e1;
  text-decoration: none;
  transition: background 0.15s;
}

.ba-popover-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.ba-popover-logout {
  color: #f87171 !important;
}

.ba-popover-logout:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

/* 2. BARRA DE MÓDULOS SUPERIOR (HORIZONTAL PILLS) */
.ba-module-nav-bar {
  background-color: #0e1626;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 6px 24px;
}

.ba-module-pills-container {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ba-module-pills-container::-webkit-scrollbar {
  display: none;
}

.ba-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 6px;
  background: #192438;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.ba-nav-pill:hover {
  background: #22324e;
  color: #f1f5f9;
}

.ba-nav-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  font-weight: 600;
}

/* 3. LAYOUT DEL CONTENIDO Y SIDEBAR */
@media (min-width: 901px) {
  .sidebar {
    display: none !important;
  }
}

.dashboard-wrapper {
  min-height: calc(100vh - 92px);
}

.main-content {
  padding: 16px 24px 40px !important;
  max-width: 100% !important;
}

/* 4. ENCABEZADO DE SECCIÓN PRINCIPAL */
.ba-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ba-section-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ba-main-title {
  font-size: 18px !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
  letter-spacing: 0.2px !important;
  margin: 0 !important;
  text-transform: uppercase;
  background: none !important;
  -webkit-text-fill-color: initial !important;
}

.ba-title-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ba-tool-btn {
  min-width: 32px;
  height: 32px;
  width: auto;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ba-tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #94a3b8;
  color: var(--text-main);
}

.ba-tool-btn-explorer {
  background: rgba(56, 189, 248, 0.14) !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
  color: #38bdf8 !important;
  padding: 0 12px !important;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.ba-tool-btn-explorer:hover {
  background: rgba(56, 189, 248, 0.24) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

body.light-theme .ba-tool-btn-explorer {
  background: #f0f9ff !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-theme .ba-tool-btn-explorer:hover {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}

.ba-nav-pill-explorer {
  border-color: rgba(56, 189, 248, 0.3) !important;
}

.ba-nav-pill-explorer:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: #38bdf8 !important;
}

.ba-explorer-badge, .ba-pill-badge-retained {
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

.ba-tool-btn-sheets {
  background: rgba(16, 185, 129, 0.14) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  color: #34d399 !important;
  padding: 0 12px !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.ba-tool-btn-sheets:hover {
  background: rgba(16, 185, 129, 0.24) !important;
  border-color: #10b981 !important;
  color: #ecfdf5 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

body.light-theme .ba-tool-btn-sheets {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
}

body.light-theme .ba-tool-btn-sheets:hover {
  background: #d1fae5 !important;
  color: #065f46 !important;
}

.ba-search-wrap {
  position: relative;
  width: 300px;
}

.ba-search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

.ba-search-wrap input:focus {
  border-color: #0284c7;
}

.ba-search-wrap i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

/* 5. SUB-PESTAÑAS DE SERVICIOS (LÍNEA INFERIOR LIMPIA) */
.ba-subtabs-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ba-subtabs-row::-webkit-scrollbar {
  display: none;
}

.ba-subtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  bottom: -2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.ba-subtab:hover {
  color: var(--text-main);
}

.ba-subtab.active {
  color: #0284c7 !important;
  border-bottom-color: #0284c7 !important;
  font-weight: 700;
}

/* 6. BARRA OPERATIVA (BOTÓN PRIMARIO + SEMÁFORO + FILTROS) */
.ba-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ba-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ba-btn-primary {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
  transition: background 0.15s ease;
}

.ba-btn-primary:hover {
  background: #0369a1;
}

.ba-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ba-select-wrap select.ba-select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.ba-btn-secondary {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ba-btn-secondary:hover {
  border-color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
}

.sem-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-orange { background: #f97316; }
.dot-yellow { background: #eab308; }
.dot-green  { background: #22c55e; }

/* 7. ACCIONES SIMPLIFICADAS EN LA TABLA (MÁXIMO 3 ELEMENTOS) */
.actions-btn-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  justify-content: flex-end !important;
}

.btn-primary-clean {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(2, 132, 199, 0.45);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-primary-clean:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-secondary-clean {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-secondary-clean:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-warning-clean {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.45);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-success-clean {
  background: #10b981;
  color: #ffffff;
  border: 1px solid #059669;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-icon-clean {
  width: 27px;
  height: 27px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-clean:hover {
  border-color: #94a3b8;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* 8. MENÚ DESPLEGABLE DE MÁS ACCIONES (ROW ACTIONS DROPDOWN) */
.row-actions-dropdown {
  position: relative;
  display: inline-block;
}

.rad-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #162032;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  min-width: 195px;
  padding: 5px 0;
  z-index: 1000;
  text-align: left;
}

.rad-menu.show {
  display: block;
  animation: baFadeIn 0.12s ease-out;
}

.rad-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f0;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease;
  white-space: nowrap;
}

.rad-item:hover {
  background: rgba(2, 132, 199, 0.14);
  color: #38bdf8;
}

.rad-danger {
  color: #f87171 !important;
}

.rad-danger:hover {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #ef4444 !important;
}

.rad-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

/* 9. AJUSTES PARA TEMA CLARO (LIGHT THEME SUPPORT) */
body.light-theme .ba-intranet-topbar {
  background-color: #0f172a !important; /* Cabecera oscura consistente como la referencia */
  border-bottom: 1px solid #1e293b !important;
}

body.light-theme .ba-module-nav-bar {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .ba-nav-pill {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .ba-nav-pill:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .ba-nav-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

body.light-theme .ba-main-title {
  color: #0f172a !important;
}

body.light-theme .ba-tool-btn {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

body.light-theme .ba-tool-btn:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .ba-search-wrap input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .ba-subtabs-row {
  border-bottom-color: #e2e8f0 !important;
}

body.light-theme .ba-subtab {
  color: #64748b !important;
}

body.light-theme .ba-subtab:hover {
  color: #0f172a !important;
}

body.light-theme .ba-subtab.active {
  color: #0284c7 !important;
  border-bottom-color: #0284c7 !important;
}

body.light-theme .ba-select-wrap select.ba-select,
body.light-theme .ba-btn-secondary {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

body.light-theme .btn-secondary-clean {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

body.light-theme .btn-icon-clean {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #64748b !important;
}

body.light-theme .btn-icon-clean:hover {
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

body.light-theme .rad-menu {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .rad-item {
  color: #334155 !important;
}

body.light-theme .rad-item:hover {
  background: #f0f9ff !important;
  color: #0284c7 !important;
}

body.light-theme .rad-divider {
  background: #f1f5f9 !important;
}

/* ============================================================= */
/* EXPEDIENTE DIGITAL Y MULTIMEDIA CSS                           */
/* ============================================================= */
.btn-expediente-tramite {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border: 1px solid #38bdf8;
  font-weight: 700;
  border-radius: 8px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
  font-size: 12px;
  cursor: pointer;
}

.btn-expediente-tramite:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  border-color: #7dd3fc;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
  transform: translateY(-1px);
}

.exp-doc-item {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.exp-doc-item:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #475569;
}

.exp-doc-item.selected {
  border-color: #38bdf8;
  background: rgba(2, 132, 199, 0.12);
}

.wa-audio-player audio {
  max-width: 250px;
  height: 36px;
  border-radius: 20px;
  outline: none;
}

body.light-theme .exp-doc-item {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.light-theme .exp-doc-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.light-theme .exp-doc-item.selected {
  background: #e0f2fe;
  border-color: #38bdf8;
}


/* ==========================================================================
   CONTROLES INLINE EN BURBUJAS DE ARCHIVOS EN CHAT WHATSAPP HUB
   ========================================================================== */
.bubble-media-controls {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: opacity 0.2s ease;
}
.bubble-role-btn {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}
.bubble-role-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.bubble-role-btn.role-doc-active {
  background: #00a884 !important;
  color: #ffffff !important;
  border-color: #00a884 !important;
}
.bubble-role-btn.role-rec-active {
  background: #f59e0b !important;
  color: #111827 !important;
  border-color: #f59e0b !important;
}
.bubble-rename-input {
  width: 100%;
  font-size: 0.75rem;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  color: #f8fafc;
  box-sizing: border-box;
}
.bubble-rename-input:focus {
  outline: none;
  border-color: #38bdf8;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.3);
}

/* Acciones R?pidas en Cada Contacto de WhatsApp Hub (Ocultar / Restaurar / Eliminar) */
.wa-chat-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  flex-shrink: 0;
}
.wa-chat-item:hover .wa-chat-actions {
  display: flex;
}
.wa-chat-item:hover .wa-chat-time {
  display: none;
}
.btn-wa-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-wa-action:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.btn-wa-action.action-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #f87171;
}
.btn-wa-action.action-success:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
  color: #4ade80;
}
