/* =========================================================
   AdminFPO - Estilos (diseño original del dashboard)
   Nota: este proyecto perdió el archivo styles.css en disco.
   Este archivo restaura el look&feel esperado por los módulos
   en /public/modules y los scripts en /public/*.js
   ========================================================= */

:root {
  --sidebar-width: 220px;
  --navbar-height: 60px;
  --sidebar-bg: #0f172a;

  --bg: #f5f7fb;
    --bg-white: #ffffff;
  --border: #e5e7eb;
  --border-soft: #eef2f7;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --primary-color: #3b82f6;
  --primary-600: #2563eb;
  --danger: #ef4444;
  --success: #16a34a;
  --warning: #f59e0b;

  --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
  --shadow-sm: 0 2px 8px rgba(17, 24, 39, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
    color: var(--text-primary);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ==================== LAYOUT ==================== */
.app-layout {
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
    width: var(--sidebar-width);
  background: var(--sidebar-bg, #0f172a);
  color: #e5e7eb;
    display: flex;
    flex-direction: column;
  z-index: 200;
}

.sidebar-header {
  padding: 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.sidebar-user {
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
  color: #fff;
}

.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-info .name {
    font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-info .role {
  font-size: 12px;
  color: rgba(229, 231, 235, 0.75);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
  padding: 12px 0;
  overflow: auto;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

.sidebar-nav.loaded { opacity: 1; }

.nav-item { list-style: none; }
.nav-link {
    display: flex;
    align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 2px 8px;
  border-radius: 8px;
  color: rgba(229, 231, 235, 0.92);
  font-size: 13px;
  transition: all 0.15s ease;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-link.active .nav-icon { opacity: 1; }

.nav-link:hover {
  background: rgba(255, 255, 255, 0.10);
  transform: translateX(3px);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.22);
  color: #fff;
}

.submenu {
    display: none;
  padding: 4px 0 8px 0;
}

.submenu.active { display: block; }

.submenu a {
    display: flex;
    align-items: center;
    gap: 8px;
  padding: 8px 14px;
  margin: 2px 14px 2px 20px;
  border-radius: 6px;
  color: rgba(229, 231, 235, 0.82);
  font-size: 12px;
}

.submenu a:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
}

.submenu a.active {
    background: var(--primary-color);
  color: #fff;
}

/* Sidebar footer/logout */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Main area */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Navbar */
.navbar {
  height: var(--navbar-height);
  background: var(--bg-white);
    padding: 12px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
  position: sticky;
  top: 0;
  z-index: 150;
    }
    
    .navbar-left h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.content {
  padding: 18px 22px;
    flex: 1;
}

.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ==================== BOTONES ==================== */
.btn-primary, .btn-secondary, .btn-danger {
    border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
    font-size: 13px;
  font-weight: 650;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }

.btn-secondary { background: #f3f4f6; color: #111827; border-color: #e5e7eb; }
.btn-secondary:hover { background: #e5e7eb; }

.btn-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 6px 10px; border-radius: 8px; font-size: 12px; }

/* ==================== FORM CONTROLS ==================== */
.form-group { margin-bottom: 14px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 6px; }
.form-help { display:block; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.required { color: #ef4444; }

.form-input, .form-select, .form-textarea {
    width: 100%;
  padding: 10px 12px;
    border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
    font-size: 13px;
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

/* ==================== MÓDULOS ==================== */
.module { display: none; }
.module.active { display: block; }

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
        gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.module-header h2 {
    margin: 0;
  font-size: 16px;
  font-weight: 650;
}
.module-content { padding: 16px; }

/* Inicio */
.welcome-section {
    padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(99,102,241,0.08) 100%);
  border: 1px solid rgba(59,130,246,0.16);
    margin-bottom: 16px;
}
.welcome-section h2 { margin: 0 0 6px; font-size: 18px; }
.welcome-section p { margin: 0; color: var(--text-secondary); font-size: 13px; }

.stats-grid {
    display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
    display: flex;
    gap: 12px;
    align-items: center;
}
.stat-icon {
  width: 42px;
  height: 42px;
    border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-content h3 { margin: 0; font-size: 13px; color: var(--text-secondary); font-weight: 650; }
.stat-number { margin: 2px 0 0; font-size: 18px; font-weight: 750; }

.user-info-card {
  background:#fff;
  border:1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.user-info-card h2 { margin: 0 0 12px; font-size: 15px; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
}
.info-item label { display:block; font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.info-item span { font-size: 13px; color: var(--text-primary); font-weight: 600; }

.badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 4px 10px;
  border-radius: 999px;
    font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #f3f4f6;
}
.badge.si { background: rgba(22,163,74,.12); border-color: rgba(22,163,74,.25); color: #166534; }
.badge.no { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.25); color: #991b1b; }
.badge-success { background: rgba(22,163,74,.15); border-color: rgba(22,163,74,.3); color: #166534; }

/* ==================== PERFILES (modal) ==================== */
.perfil-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
}
.perfil-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.perfil-modal-content {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.perfil-modal-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
}
.perfil-modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}
.btn-close-modal {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-close-modal:hover { background: #f3f4f6; }
.btn-close-modal svg { width: 18px; height: 18px; }
.perfil-modal-body {
  padding: 14px;
  overflow: auto;
}

/* ==================== MODALES (genérico) ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 950;
}
.modal-content {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}
.modal-body { padding: 14px; }
.btn-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-close:hover { background: #f3f4f6; }
.btn-close svg { width: 18px; height: 18px; }

/* Botones formato WhatsApp (negrita, cursiva, etc.) */
.btn-format-whatsapp,
.btn-format-whatsapp-plantilla {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-format-whatsapp:hover,
.btn-format-whatsapp-plantilla:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
}

/* ==================== BOTONES extra ==================== */
.btn-success { background: rgba(22,163,74,.12); color: #166534; border-color: rgba(22,163,74,.25); }
.btn-success:hover { background: rgba(22,163,74,.18); }
.btn-warning { background: rgba(245,158,11,.12); color: #92400e; border-color: rgba(245,158,11,.25); }
.btn-warning:hover { background: rgba(245,158,11,.18); }

/* ==================== WHATSAPP (sesiones) ==================== */
.header-actions { display:flex; align-items:center; gap:8px; }

.wa-actions {
  margin-bottom: 12px;
  text-align: center;
  padding: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.wa-action-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  min-width: 220px;
  justify-content: center;
}
.wa-action-btn svg {
  width: 16px;
  height: 16px;
}

.sessions-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px;
}
.sessions-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 750;
  color: var(--text-primary);
}

.tabs-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.tab-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .12s ease;
}
.tab-button:hover { background: #f3f4f6; }
.tab-button.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}
.tab-badge {
  background: #f3f4f6;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.sessions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 10px;
}

.session-list-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
}
.session-list-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.10);
}
.session-list-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.session-list-name {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.session-list-name strong { font-size: 13px; }
.session-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--border);
  background: #f3f4f6;
  color: var(--text-secondary);
}
.session-status.connected { background: rgba(22,163,74,.10); border-color: rgba(22,163,74,.25); color:#166534; }
.session-status.qr_ready { background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.25); color:#1d4ed8; }
.session-status.connecting,
.session-status.reconnecting { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.25); color:#92400e; }
.session-status.disconnected,
.session-status.saved { background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.22); color:#991b1b; }

.session-list-details {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.session-detail-item {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}
.session-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 240px;
}
.session-list-actions .btn-sm {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
}
.session-list-actions .btn-sm svg { width: 16px; height: 16px; }
.session-list-actions .btn-sm span { display:none; }
@media (min-width: 1100px) {
  .session-list-actions .btn-sm span { display:inline; }
}

.no-sessions {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 22px 14px;
  color: var(--text-secondary);
  text-align: center;
  background: #fafafa;
}
.no-sessions svg { width: 42px; height: 42px; opacity: .45; margin: 0 auto 10px; display:block; }
.no-sessions p { margin: 0; font-weight: 650; }

.qr-panel {
  margin-top: 12px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.qr-panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.qr-panel-header h3 { margin:0; font-size: 14px; font-weight: 750; }
.qr-panel-body { padding: 14px; }
.qr-status {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 10px;
}
.qr-container {
  border: 1px dashed var(--border);
  background: #fafafa;
  border-radius: 14px;
  padding: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 280px;
}

/* Listas (modal WhatsApp) */
.wa-list-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
}
.wa-list-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.10);
}

/* Tablas */
.table-wrapper { overflow: auto; }
.data-table, .report-table, .usuarios-table {
    width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.data-table th, .data-table td,
.report-table th, .report-table td,
.usuarios-table th, .usuarios-table td {
        padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
        font-size: 13px;
  text-align: left;
  vertical-align: middle;
}
.data-table th, .report-table th, .usuarios-table th {
  color: var(--text-secondary);
  font-weight: 750;
    font-size: 12px;
  background: #fafafa;
  position: sticky;
        top: 0;
  z-index: 1;
}

/* ==================== CHAT (base) ==================== */
    #module-chat {
        position: fixed;
  top: var(--navbar-height);
  left: var(--sidebar-width);
        right: 0;
        bottom: 0;
  z-index: 1;
  background: #fff;
}

.chat-container { display: flex; height: 100%; }
    .chat-sidebar {
  width: 360px;
  border-right: 1px solid var(--border);
  display:flex;
    flex-direction: column;
}
.chat-main { flex: 1; display:flex; flex-direction: column; }
.chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
    justify-content: space-between;
}
.chat-header h3 { margin: 0; font-size: 14px; font-weight: 750; }
.chat-header-actions { display:flex; gap: 6px; }
.btn-refresh, .btn-new-chat, .btn-manage-messages {
  width: 34px; height: 34px;
    border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
    cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-refresh:hover, .btn-new-chat:hover, .btn-manage-messages:hover { background:#f3f4f6; }
.btn-refresh svg, .btn-new-chat svg, .btn-manage-messages svg { width: 18px; height: 18px; }

.chats-list { overflow:auto; padding: 6px; flex:1; }
.no-chats { padding: 22px 14px; color: var(--text-secondary); text-align:center; }

/* ==================== CHAT (mejorado) ==================== */
.session-selector {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-selector label {
  font-size: 12px;
  font-weight: 750;
  color: var(--text-secondary);
}
.session-selector select {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
}

.chat-filter-tabs {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-filter-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .12s ease;
}
.chat-filter-tab svg { width: 16px; height: 16px; }
.chat-filter-tab:hover { background:#f3f4f6; }
.chat-filter-tab.active {
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.25);
}
.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #991b1b;
}

.chat-search-container {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.chat-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.chat-search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.chat-search-input {
  width: 100%;
  padding: 8px 34px 8px 32px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  outline: none;
  font-size: 13px;
}
.chat-search-input:focus {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.btn-clear-search {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-clear-search:hover { background: #f3f4f6; }
.btn-clear-search svg { width: 16px; height: 16px; }

.chat-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s ease;
}
.chat-item:hover { background: #f3f4f6; }
.chat-item.active {
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.20);
}
.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 auto;
  background: #eef2ff;
  border: 1px solid var(--border-soft);
  display:flex;
  align-items:center;
  justify-content:center;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-info { flex: 1; min-width: 0; }
.chat-name-wrapper { display:flex; justify-content: space-between; align-items:flex-start; gap: 8px; }
.chat-name {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.favorite-indicator { margin-right: 6px; }
.chat-name-actions { display:flex; gap: 6px; align-items:center; }
.btn-toggle-favorite, .btn-edit-chat-name {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-toggle-favorite:hover, .btn-edit-chat-name:hover { background: #f3f4f6; }
.btn-toggle-favorite svg, .btn-edit-chat-name svg { width: 16px; height: 16px; }
.chat-last-message {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-meta {
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}
.chat-time { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.chat-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #10b981;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.chat-placeholder {
  flex: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  background: radial-gradient(1200px 600px at 40% 20%, rgba(16,185,129,.07), transparent 60%),
              radial-gradient(1000px 500px at 80% 60%, rgba(59,130,246,.06), transparent 55%),
              #fff;
}
.placeholder-content {
  text-align: center;
  max-width: 420px;
  padding: 18px;
  color: var(--text-secondary);
}
.placeholder-content svg { width: 54px; height: 54px; opacity: .45; margin: 0 auto 10px; display:block; }
.placeholder-content h3 { margin: 0 0 6px; color: var(--text-primary); font-size: 16px; font-weight: 800; }
.placeholder-content p { margin: 0; font-size: 13px; }

.chat-header-active {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
}
.chat-contact-info { display:flex; align-items:center; gap: 10px; min-width: 0; }
.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: #eef2ff;
  flex: 0 0 auto;
}
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; }
.contact-details { min-width:0; }
.contact-details h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-details p { margin: 3px 0 0; font-size: 12px; color: var(--text-secondary); }
.chat-actions { display:flex; gap: 6px; }
.btn-action {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-action:hover { background: #f3f4f6; }
.btn-action svg { width: 18px; height: 18px; }

.chat-messages {
  flex: 1;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  display: block;
}
.messages-container {
  height: 100%;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Evitar que los mensajes se estiren a todo el ancho */
  align-items: flex-start;
}
.message {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: min(720px, 86%);
  width: fit-content;
  min-width: 0;
}
.message.sent { align-self: flex-end; align-items: flex-end; }
.message.received { align-self: flex-start; align-items: flex-start; }
.message-sender {
  font-size: 11px;
  font-weight: 900;
  color: #7c3aed;
  margin-left: 6px;
  margin-right: 6px;
}
.message-bubble {
  /* Burbuja compacta (evita que se estire) */
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 11px;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-size: 12.5px;
}
.message.sent .message-bubble {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.18);
}
.message-footer {
  display:flex;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 3px;
}
.message.received .message-footer {
  justify-content: flex-start;
}
.message-footer .message-time { white-space: nowrap; }
.message-status { font-size: 11px; }
.message-media .image-container { position: relative; }

/* Imágenes en histórico: compactas y sin expandir la burbuja */
.message-media {
  --chat-media-max: 190px;
  display: inline-block;
  max-width: var(--chat-media-max);
}
.message-media .image-container {
  display: inline-block;
  max-width: var(--chat-media-max);
  border-radius: 12px;
  overflow: hidden;
}
.message-image {
  width: auto;
  height: auto;
  max-width: var(--chat-media-max);
  max-height: 160px;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}
.image-caption { margin: 6px 0 0; font-size: 12px; color: var(--text-secondary); }

/* Overlays en previsualización (evita que agreguen altura) */
.image-container { position: relative; }
.image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .12s ease;
  pointer-events: none;
}
.media-download-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  opacity: 0;
  transition: opacity .12s ease;
}
.image-container:hover .image-overlay,
.image-container:hover .media-download-overlay {
  opacity: 1;
}

/* Previsualizaciones multimedia (evitar “gigantes” en histórico) */
.custom-video-player,
.custom-audio-player {
  width: min(230px, 100%);
  max-width: 230px;
}
.custom-video-player {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: #0b1220;
}
.custom-video-element {
  width: 100%;
  max-height: 170px;
  display: block;
  object-fit: cover;
  background: #0b1220;
}

.message-file {
  max-width: min(380px, 100%);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.message-file .file-icon { width: 22px; height: 22px; flex: 0 0 auto; color: var(--text-secondary); }
.message-file-info { min-width: 0; }
.message-file-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.message-file-size { font-size: 11px; color: var(--text-muted); }
.btn-download-file {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-download-file:hover { background:#f3f4f6; }
.btn-download-file svg { width: 16px; height: 16px; }

.message-file-caption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-input-container {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 10px 12px;
}
.chat-input-wrapper {
  display:flex;
  align-items: flex-end;
  gap: 8px;
}
.btn-attach, .btn-quick-messages, .btn-emoji {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-attach:hover, .btn-quick-messages:hover, .btn-emoji:hover { background: #f3f4f6; }
.btn-attach svg, .btn-quick-messages svg, .btn-emoji svg { width: 18px; height: 18px; }
.message-input-wrapper {
  flex: 1;
  display:flex;
  align-items:flex-end;
  gap: 6px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 6px 8px;
  background: #fff;
}
.message-input {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  font-size: 13px;
  min-height: 24px;
  max-height: 140px;
  line-height: 1.35;
  background: transparent;
  cursor: text;
  position: relative;
  z-index: 1;
  -webkit-user-select: text;
  user-select: text;
}
.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: #10b981;
  color: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-send:hover { background: #059669; }
.btn-send svg { width: 18px; height: 18px; }

.quick-messages-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 10px;
}
.quick-messages-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  gap: 8px;
}
.quick-messages-header h4 { margin: 0; font-size: 13px; font-weight: 900; }
.btn-close-panel {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-close-panel:hover { background: #f3f4f6; }
.btn-close-panel svg { width: 16px; height: 16px; }
.quick-messages-search { padding: 10px 12px; border-bottom: 1px solid var(--border); position: relative; }
.quick-messages-search-input {
  width: 100%;
  padding: 8px 34px 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  outline: none;
  font-size: 13px;
}
.btn-clear-search-quick {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-clear-search-quick:hover { background:#f3f4f6; }
.btn-clear-search-quick svg { width: 16px; height: 16px; }
.quick-messages-list { max-height: 220px; overflow:auto; padding: 8px; }
.quick-message-category { padding: 8px 10px; font-size: 11px; font-weight: 900; color: var(--text-muted); text-transform: uppercase; }
.quick-message-item {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  display:flex;
  align-items:flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.quick-message-item:hover { background:#f9fafb; }
.quick-message-title { font-weight: 900; font-size: 12px; color: var(--text-primary); }
.quick-message-text { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.quick-message-type-badge {
  display:inline-flex;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  font-size: 11px;
  font-weight: 900;
  color: var(--text-secondary);
}
.btn-use-message {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-use-message:hover { background:#f3f4f6; }

/* ==================== MENSAJES PREDETERMINADOS (MODAL SELECTOR) ==================== */
.quick-picker-modal .qm-modal-content {
  max-width: 920px;
  width: min(920px, calc(100vw - 28px));
}
.quick-picker-modal .qm-modal-header h3 {
  font-size: 14px;
  font-weight: 950;
}
.qm-modal-body { padding: 14px; }
.qm-toolbar {
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 12px;
}
.qm-search { flex: 1; }
.qm-search-input {
  width: 100%;
  border-radius: 12px;
}
.qm-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
  min-height: 420px;
}
.qm-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: auto;
  padding: 10px;
  max-height: 520px;
}
.qm-category {
  padding: 10px 10px 6px;
  font-size: 11px;
  font-weight: 950;
  color: var(--text-muted);
  text-transform: uppercase;
}
.qm-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  display:flex;
  align-items:flex-start;
  gap: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.qm-item:hover { background:#f9fafb; }
.qm-item.selected {
  border-color: rgba(59,130,246,.55);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.qm-item-title { font-weight: 950; font-size: 12px; color: var(--text-primary); }
.qm-item-text { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.qm-muted { color: var(--text-muted); }
.qm-item-meta { margin-top: 8px; display:flex; gap: 6px; flex-wrap: wrap; }
.qm-pill {
  display:inline-flex;
  align-items:center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  font-size: 11px;
  font-weight: 950;
  color: var(--text-secondary);
}
.qm-pill-soft { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.qm-item-action {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.qm-item-action svg { width: 16px; height: 16px; }

.qm-preview {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: auto;
  padding: 12px;
  max-height: 520px;
}
.qm-preview-empty {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fbfbfd;
}
.qm-preview-card { display:flex; flex-direction: column; gap: 10px; }
.qm-preview-title { font-weight: 950; font-size: 13px; }
.qm-preview-meta { display:flex; gap: 6px; flex-wrap: wrap; }
.qm-preview-text {
  white-space: pre-wrap;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.35;
}
.qm-preview-media { border-radius: 14px; overflow: hidden; border: 1px solid var(--border-soft); background:#0b1220; }
.qm-preview-image { width: 100%; max-height: 320px; object-fit: contain; background:#0b1220; display:block; }
.qm-preview-video { width: 100%; max-height: 320px; background:#0b1220; display:block; }
.qm-preview-audio { width: 100%; }
.qm-preview-file { padding: 10px; background: #f1f5f9; border-radius: 12px; }

.qm-modal-footer {
  display:flex;
  justify-content:flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.qm-empty { padding: 16px; color: var(--text-secondary); }
.qm-empty-title { font-weight: 950; color: var(--text-primary); margin-bottom: 4px; }
.qm-empty-actions { margin-top: 10px; }

@media (max-width: 900px) {
  .qm-grid { grid-template-columns: 1fr; }
  .qm-list, .qm-preview { max-height: 44vh; }
}

/* Close button usado en algunos modales del chat */
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { background:#f3f4f6; }

/* ==================== ICONOS (ajustes globales) ==================== */
/* Icono de zoom sobre imágenes (chat y otros módulos) */
.zoom-icon {
  width: 14px !important;
  height: 14px !important;
}

/* Iconos de descarga en overlays (chat/media) */
.btn-download-media svg {
  width: 14px !important;
  height: 14px !important;
}
.btn-download-media {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.35);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-download-media:hover {
  background: rgba(0,0,0,0.48);
}

/* ==================== BARRA DE FILTROS (Malla / Eficiencia) ==================== */
.report-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 18px;
}
.report-filters-bar .filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 180px;
  min-width: 150px;
}
.report-filters-bar .filter-item--date {
  flex: 0 1 160px;
  min-width: 140px;
}
.report-filters-bar label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.report-filters-bar .form-select,
.report-filters-bar .form-input {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
}

/* Selectores legacy (eficiencia) */
.eficiencia-selectors {
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 18px;
}
.eficiencia-selectors .selectors-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}
.eficiencia-selectors .selectors-row:last-child {
  margin-bottom: 0;
}
.eficiencia-selectors .selector-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 160px;
  min-width: 140px;
}
.eficiencia-selectors label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.eficiencia-selectors .form-select,
.eficiencia-selectors .form-input {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
}

/* ==================== KPI CARDS ==================== */
.kpi-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
}
.kpi-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}
.kpi-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0;
  white-space: nowrap;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.2;
}

/* ==================== CHARTS ==================== */
.charts-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.chart-card h3,
.chart-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 12px 0;
}
.chart-card canvas {
  max-height: 300px;
}

/* ==================== REPORT LOADING ==================== */
.report-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #64748b;
}
.report-loading p {
  margin-top: 14px;
  font-size: 14px;
}
.loader-big {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary-color, #3b82f6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== DATA TABLE (Reportes) ==================== */
.table-container {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}
.table-container h3 {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 12px 0;
}
.table-wrapper {
  overflow-x: auto;
}
.data-table, .report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th, .report-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table td, .report-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.data-table tr:hover, .report-table tr:hover {
  background: #f8fafc;
}

/* ==================== EFICIENCIA: Results / Data Section ==================== */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.results-header h3 {
  margin: 0;
  font-size: 16px;
  color: #1e293b;
}
.results-info {
  font-size: 12px;
  color: #64748b;
}
.data-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}
.data-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 12px 0;
}
.data-table-container {
  overflow-x: auto;
}

/* Efficiency badges */
.efficiency-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.efficiency-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.efficiency-chip.efficiency-high { background: #dcfce7; color: #166534; }
.efficiency-chip.efficiency-medium { background: #fef3c7; color: #92400e; }
.efficiency-chip.efficiency-low { background: #fee2e2; color: #991b1b; }
.efficiency-value { font-weight: 600; }
.efficiency-value.efficiency-high { color: #16a34a; }
.efficiency-value.efficiency-medium { color: #d97706; }
.efficiency-value.efficiency-low { color: #dc2626; }

/* ==================== MÓDULO CEDENTES ==================== */
.cedente-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 500px;
}
.cedente-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cedente-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.cedente-panel .panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}
.cedente-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.cedente-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.cedente-item:hover { background: #f1f5f9; }
.cedente-item.active {
  background: #eff6ff;
  border-color: #3b82f6;
}
.cedente-item.inactive { opacity: 0.55; }
.cedente-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.cedente-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cedente-item-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-soft { background: rgba(59, 130, 246, 0.12); color: #1e40af; border-color: rgba(59, 130, 246, 0.25); }
.cedente-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}
.btn-icon-sm {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.btn-icon-sm:hover { background: #e2e8f0; }
.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
}
.productos-content {
  flex: 1;
  overflow: auto;
  padding: 12px;
}
.row-inactive { opacity: 0.5; }
.actions-cell { white-space: nowrap; }
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
}
.loading-small {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: #64748b;
  font-size: 13px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-header h3 { margin: 0; font-size: 16px; color: #1e293b; }
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #f1f5f9; color: #334155; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Notificación */
.cedente-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.cedente-notification.show { opacity: 1; transform: translateY(0); }
.notif-success { background: #16a34a; }
.notif-error { background: #dc2626; }
.notif-info { background: #2563eb; }

@media (max-width: 768px) {
  .cedente-layout { grid-template-columns: 1fr; }
}

/* ==================== TREE VIEW (Árbol de Gestión) ==================== */
.tree-view { padding: 4px 0; }
.tree-node { margin-bottom: 1px; }
.tree-node--inactive { opacity: 0.45; }
.tree-node-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.12s;
}
.tree-node-row:hover { background: #f1f5f9; }
.tree-toggle {
  width: 18px;
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  cursor: default;
  flex-shrink: 0;
  user-select: none;
}
.tree-toggle.has-children { cursor: pointer; color: #3b82f6; }
.tree-toggle.has-children:hover { color: #1d4ed8; }
.tree-node-name {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tree-node-meta {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}
.tree-node-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.tree-node-row:hover .tree-node-actions { opacity: 1; }

/* ==================== MÓDULO VACÍO (Placeholder) ==================== */
.empty-module-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: #64748b;
}
.empty-module-placeholder .empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-module-placeholder h3 {
  font-size: 18px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 8px 0;
}
.empty-module-placeholder p {
  font-size: 14px;
  color: #94a3b8;
  max-width: 400px;
  line-height: 1.5;
  margin: 0;
}

/* ==================== MÓDULO GESTIÓN TABS ==================== */
.module-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  pointer-events: auto;
}
.module-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  pointer-events: auto;
}
.module-tab:hover {
  color: #334155;
  background: #f1f5f9;
}
.module-tab.active {
  color: #2563eb;
  background: #eff6ff;
}
.module-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #2563eb;
}
.gestion-tab-content {
  padding: 20px;
}

/* ==================== MÓDULO EMPRESA ==================== */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 12px 12px 0 0;
}
.module-header h2 { margin: 0; font-size: 20px; color: #1e293b; }
.header-actions { display: flex; gap: 8px; }

.table-container {
  padding: 16px 24px 24px;
}
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  background: #f1f5f9;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.data-table tbody tr:hover { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: #64748b;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: #f1f5f9; color: #0f172a; }
.btn-edit { color: #3b82f6; }
.btn-edit:hover { background: #eff6ff; color: #1d4ed8; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-width: 480px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-header h3 { margin: 0; font-size: 16px; color: #1e293b; }
.modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer; color: #94a3b8;
  line-height: 1; padding: 0 2px;
}
.modal-close:hover { color: #334155; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
}
.btn-primary {
  padding: 9px 18px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #2563eb; }
.btn-secondary {
  padding: 9px 18px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: #e2e8f0; }

.empresa-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10001;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s, transform .3s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.empresa-notification.show { opacity: 1; transform: translateY(0); }
.empresa-notification.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.empresa-notification.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.empresa-notification.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.loading-small { text-align: center; padding: 24px; color: #94a3b8; }

/* ==================== MÓDULO CARGA ==================== */
.carga-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  border-radius: 12px 12px 0 0;
}
.carga-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.carga-title svg { opacity: 0.8; }

.carga-seleccion {
  padding: 20px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.carga-seleccion-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.carga-field {
  flex: 1;
  min-width: 240px;
}
.carga-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.carga-label svg { color: #64748b; }
.carga-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  font-weight: 500;
}
.carga-select:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}
.carga-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f1f5f9;
}

/* Tabs bar */
.carga-tabs-bar {
  display: flex;
  gap: 0;
  padding: 0 24px;
  background: #fff;
  border-bottom: 2px solid #e2e8f0;
}
.carga-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .15s;
  white-space: nowrap;
}
.carga-tab svg { flex-shrink: 0; }
.carga-tab:hover {
  color: #334155;
  background: #f8fafc;
}
.carga-tab.active {
  color: #0f766e;
  border-bottom-color: #0f766e;
}
.carga-tab.active svg { color: #0f766e; }

.carga-btn-archivo {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #0f766e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.carga-btn-archivo:hover { background: #0d9488; }
.carga-btn-sm { padding: 8px 14px; font-size: 12px; }

/* ========= Wizard Steps ========= */
.wiz-steps {
    display: flex; align-items: center; justify-content: center;
    padding: 16px 24px; gap: 0; border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}
.wiz-step {
    display: flex; align-items: center; gap: 8px; cursor: default; opacity: 0.45; transition: all 0.3s;
}
.wiz-step.active { opacity: 1; }
.wiz-step.completed { opacity: 0.75; }
.wiz-step-num {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    background: #e2e8f0; color: #64748b; transition: all 0.3s;
}
.wiz-step.active .wiz-step-num { background: #0d9488; color: #fff; box-shadow: 0 0 0 4px rgba(13,148,136,.15); }
.wiz-step.completed .wiz-step-num { background: #10b981; color: #fff; }
.wiz-step-label { font-size: 13px; font-weight: 600; color: #475569; }
.wiz-step.active .wiz-step-label { color: #0d9488; }
.wiz-step.completed .wiz-step-label { color: #10b981; }
.wiz-step--clickable { cursor: pointer; }
.wiz-step--clickable:hover .wiz-step-num { transform: scale(1.1); }
.wiz-step--clickable:hover .wiz-step-label { text-decoration: underline; }
.wiz-step-line {
    flex: 0 0 60px; height: 2px; background: #e2e8f0; margin: 0 12px; border-radius: 2px; transition: background 0.3s;
}
.wiz-step-line.completed { background: #10b981; }

/* Wizard Content */
.wiz-content { animation: wizFadeIn 0.25s ease; }
@keyframes wizFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Wizard Step Info Card */
.wiz-step-info {
    display: flex; align-items: flex-start; gap: 16px;
    padding: 20px; border-radius: 12px;
    background: linear-gradient(135deg, #f0fdfa 0%, #f0f9ff 100%);
    border: 1px solid #ccfbf1; margin-bottom: 20px;
}
.wiz-step-info h4 { margin: 0 0 6px; font-size: 16px; color: #0f172a; font-weight: 700; }
.wiz-step-info p { margin: 0; font-size: 13px; color: #64748b; line-height: 1.5; }
.wiz-step-info-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wiz-icon--base { background: #ccfbf1; color: #0d9488; }
.wiz-icon--oper { background: #dbeafe; color: #2563eb; }

/* Wizard Summary */
.wiz-summary {
    display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.wiz-summary-item {
    flex: 1 1 180px; display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
}
.wiz-summary-lbl { font-size: 13px; color: #64748b; }
.wiz-summary-val { font-size: 18px; font-weight: 700; color: #0f172a; }

/* Wizard Result Cards */
.wiz-result-card {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px 20px; border-radius: 10px; margin-top: 12px;
}
.wiz-result--ok { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.wiz-result--ok svg { color: #16a34a; flex-shrink: 0; margin-top: 2px; }
.wiz-result--ok strong { color: #15803d; }
.wiz-errores { margin-top: 8px; }
.wiz-errores summary { cursor: pointer; font-size: 12px; color: #64748b; }
.wiz-errores ul { margin: 6px 0 0 16px; font-size: 12px; color: #94a3b8; }

/* Result detail grid */
.wiz-result-detail strong { display: block; margin-bottom: 10px; font-size: 14px; }
.wiz-result-grid {
    display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px;
}
.wiz-result-lbl { color: #64748b; font-weight: 500; }
.wiz-summary--grid { display: flex; flex-wrap: wrap; gap: 10px; }

/* Wizard No Data Warning */
.wiz-no-data {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-radius: 10px;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
    font-size: 13px; line-height: 1.5; margin-bottom: 16px;
}
.wiz-no-data svg { color: #f59e0b; flex-shrink: 0; }

/* Wizard Progress Bar */
.wiz-progress { padding: 16px 0; }
.wiz-progress-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #475569; margin-bottom: 10px;
}
.wiz-progress-bar {
    height: 12px; background: #e2e8f0; border-radius: 8px; overflow: hidden; position: relative;
}
.wiz-progress-fill {
    height: 100%; border-radius: 8px; transition: width 0.3s ease;
    background: linear-gradient(90deg, #0d9488 0%, #10b981 100%);
    position: relative;
}
.wiz-progress-fill::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: wizShimmer 1.5s infinite;
}
@keyframes wizShimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.wiz-progress-pct {
    text-align: center; font-size: 14px; font-weight: 700; color: #0d9488; margin-top: 8px;
}

/* Footer for wizard */
.modal-footer .btn-primary svg,
.modal-footer .btn-secondary svg { vertical-align: middle; }
#btnWizPrev { display: inline-flex; align-items: center; gap: 4px; }
#btnWizNext { display: inline-flex; align-items: center; gap: 4px; }

/* ========= Modal Carga Ampliado ========= */
.carga-modal-wide { max-width: 920px; }
.carga-modal-body { max-height: 75vh; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 0; }
.carga-modal-info-row { display: flex; gap: 12px; flex-wrap: wrap; }
.carga-modal-info-row .form-group { min-width: 140px; }
.carga-modal-file-section { margin-top: 18px; }
.carga-modal-divider { height: 1px; background: #e2e8f0; margin: 18px 0; }

/* === Custom Config Bar === */
.custom-config-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
    border: 1px solid #d8b4fe;
    border-radius: 10px;
    flex-wrap: wrap;
}
.custom-config-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}
.custom-config-icon {
    color: #7c3aed;
    flex-shrink: 0;
}
.custom-config-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #5b21b6;
    white-space: nowrap;
}
.custom-config-select {
    flex: 1;
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid #c4b5fd;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    color: #374151;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.custom-config-select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, .15);
}
.custom-config-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.custom-config-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.custom-config-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.custom-config-btn--load {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #6d28d9;
}
.custom-config-btn--load:not(:disabled):hover {
    background: #ddd6fe;
    border-color: #8b5cf6;
}
.custom-config-btn--save {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}
.custom-config-btn--save:hover {
    background: #bfdbfe;
    border-color: #60a5fa;
}
.custom-config-btn--del {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
    padding: 5px 7px;
}
.custom-config-btn--del:not(:disabled):hover {
    background: #fee2e2;
    border-color: #f87171;
}

/* Config loaded indicator */
.custom-config-bar--loaded {
    border-color: #86efac;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}
.custom-config-bar--loaded .custom-config-icon { color: #16a34a; }
.custom-config-bar--loaded .custom-config-label { color: #15803d; }
.custom-config-loaded-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 600;
    color: #15803d;
    white-space: nowrap;
}
.custom-config-loaded-tag svg { flex-shrink: 0; }

/* === Source Tabs (Local / SFTP) === */
.src-tabs {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    margin-bottom: 12px;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 10px;
}
.src-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: background .2s, color .2s, box-shadow .2s;
}
.src-tab:hover { color: #334155; background: rgba(255,255,255,.5); }
.src-tab--active {
    background: #fff;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.src-tab--active svg { stroke: #0d9488; }
.src-panel { animation: srcFadeIn .25s ease; }
@keyframes srcFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* === SFTP Panel === */
.sftp-profiles-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}
.sftp-profile-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    color: #334155;
    background: #fff;
}
.sftp-profile-save-btn, .sftp-profile-del-btn {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border: 1px solid #cbd5e1; border-radius: 6px;
    background: #fff; cursor: pointer; color: #64748b;
    transition: background .15s, color .15s;
}
.sftp-profile-save-btn:hover { background: #f0fdfa; color: #0d9488; border-color: #99f6e4; }
.sftp-profile-del-btn:hover { background: #fef2f2; color: #ef4444; border-color: #fecaca; }
.sftp-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
}
.sftp-form-row {
    display: flex; gap: 10px; margin-bottom: 8px;
}
.sftp-form-row:last-of-type { margin-bottom: 0; }
.sftp-field { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.sftp-field--host { flex: 3; }
.sftp-field--port { flex: 1; max-width: 90px; }
.sftp-field label {
    font-size: 11px; font-weight: 600; color: #475569;
}
.sftp-form-actions {
    display: flex; align-items: center; gap: 12px;
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}
.sftp-connect-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; font-size: 13px;
}
.sftp-status {
    font-size: 12px; color: #64748b;
}
.sftp-status--loading { color: #f59e0b; }
.sftp-status--ok { color: #16a34a; font-weight: 600; }
.sftp-status--error { color: #ef4444; }

/* SFTP Browser */
.sftp-browser {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    animation: srcFadeIn .3s ease;
}
.sftp-browser-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
}
.sftp-browser-path {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px; font-weight: 600;
    color: #475569; background: #e2e8f0;
    padding: 2px 8px; border-radius: 4px;
}
.sftp-browser-count { color: #64748b; margin-left: auto; }
.sftp-browser-refresh {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border: none;
    background: #fff; border-radius: 4px;
    cursor: pointer; color: #64748b;
    transition: background .15s, color .15s;
}
.sftp-browser-refresh:hover { background: #e0e7ff; color: #4f46e5; }
.sftp-browser-list {
    max-height: 240px;
    overflow-y: auto;
}
.sftp-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s;
}
.sftp-file-row:hover { background: #f8fafc; }
.sftp-file-row--selected { background: #f0fdfa; }
.sftp-file-row--selected:hover { background: #e6fffa; }
.sftp-file-check {
    width: 16px; height: 16px;
    accent-color: #0d9488;
    flex-shrink: 0;
}
.sftp-file-info {
    display: flex; flex-direction: column; flex: 1; min-width: 0;
}
.sftp-file-name {
    font-size: 13px; font-weight: 500; color: #1e293b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sftp-file-meta { font-size: 11px; color: #94a3b8; }
.sftp-empty {
    padding: 24px; text-align: center;
    color: #94a3b8; font-size: 13px;
}
.sftp-browser-actions {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.sftp-selected-count { font-size: 12px; color: #64748b; font-weight: 500; }
.sftp-download-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; font-size: 12px;
}
.sftp-download-btn:disabled { opacity: .5; cursor: not-allowed; }

/* === Drag & Drop Zone === */
.carga-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 24px;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    transition: border-color .2s, background .2s, box-shadow .2s, padding .3s;
    text-align: center;
}
.carga-dropzone:hover {
    border-color: #0d9488;
    background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
}
.carga-dropzone--hover {
    border-color: #0d9488 !important;
    background: linear-gradient(135deg, #ccfbf1 0%, #d1fae5 100%) !important;
    box-shadow: 0 0 0 4px rgba(13,148,136,.12), inset 0 0 20px rgba(13,148,136,.05);
    transform: scale(1.005);
}
.carga-dropzone--hover .carga-dropzone-ring {
    border-color: #0d9488;
    background: rgba(13,148,136,.1);
    transform: scale(1.1);
}
.carga-dropzone--hover .carga-dropzone-icon { stroke: #0d9488; }
.carga-dropzone--drop {
    animation: dz-pulse .5s ease;
}
@keyframes dz-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(13,148,136,.3); }
    50%  { box-shadow: 0 0 0 10px rgba(13,148,136,.08); }
    100% { box-shadow: 0 0 0 0 rgba(13,148,136,0); }
}
.carga-dropzone--compact {
    padding: 14px 18px;
    flex-direction: row;
    gap: 12px;
}
.carga-dropzone--compact .carga-dropzone-ring { width: 32px; height: 32px; }
.carga-dropzone--compact .carga-dropzone-ring svg { width: 18px; height: 18px; }
.carga-dropzone--compact .carga-dropzone-text { font-size: 12px; }
.carga-dropzone--compact .carga-dropzone-text strong { font-size: 12px; }
.carga-dropzone--compact .carga-dropzone-formats { display: none; }

.carga-dropzone-ring {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 2px dashed #94a3b8;
    display: flex; align-items: center; justify-content: center;
    background: rgba(148,163,184,.06);
    transition: border-color .2s, background .2s, transform .2s;
    flex-shrink: 0;
}
.carga-dropzone-icon { stroke: #94a3b8; transition: stroke .2s; }
.carga-dropzone-text { display: flex; flex-direction: column; gap: 2px; }
.carga-dropzone-text strong { font-size: 14px; color: #1e293b; }
.carga-dropzone-text span { font-size: 12px; color: #64748b; }
.carga-dropzone-browse {
    background: none; border: none; color: #0d9488; font-weight: 600;
    cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline;
    text-underline-offset: 2px;
}
.carga-dropzone-browse:hover { color: #0f766e; }
.carga-dropzone-formats {
    font-size: 11px; color: #94a3b8;
    background: rgba(148,163,184,.08); border-radius: 20px;
    padding: 3px 12px;
}

/* === File Cards v2 === */
.carga-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.carga-file-card2 {
    display: flex;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    animation: fc-slideIn .3s ease;
}
@keyframes fc-slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.carga-file-card2:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.carga-file-card2--active {
    border-color: var(--fc-border);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--fc-dot) 15%, transparent);
}
.carga-file-card2-color {
    width: 5px;
    flex-shrink: 0;
    background: var(--fc-dot, #94a3b8);
    transition: width .2s;
}
.carga-file-card2--active .carga-file-card2-color { width: 5px; }
.carga-file-card2-body {
    flex: 1;
    padding: 10px 14px;
    min-width: 0;
}
.carga-file-card2-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.carga-file-card2-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.carga-file-card2-name {
    font-weight: 600; font-size: 13px; color: #1e293b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carga-file-card2--active .carga-file-card2-name { color: var(--fc-text); }
.carga-file-card2-meta { font-size: 11px; color: #64748b; }
.carga-file-card2-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.carga-file-card2-editing {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    color: var(--fc-text); background: var(--fc-bg); border: 1px solid var(--fc-border);
    padding: 2px 8px; border-radius: 10px; letter-spacing: .5px;
}
.carga-file-card2-mapbtn {
    font-size: 11px; font-weight: 600; color: #475569;
    background: #f1f5f9; border: 1px solid #cbd5e1;
    padding: 3px 10px; border-radius: 6px; cursor: pointer;
    transition: background .15s, color .15s;
}
.carga-file-card2-mapbtn:hover { background: #e2e8f0; color: #0f172a; }
.carga-file-card2-delbtn {
    background: none; border: none; color: #94a3b8;
    cursor: pointer; padding: 2px; border-radius: 4px;
    transition: color .15s, background .15s;
    display: flex; align-items: center;
}
.carga-file-card2-delbtn:hover { color: #ef4444; background: #fef2f2; }

/* File ext badges */
.carga-fext {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 800; letter-spacing: .5px;
    padding: 4px 6px; border-radius: 5px; flex-shrink: 0;
    min-width: 32px; text-align: center;
}
.carga-fext--xlsx { background: #dcfce7; color: #166534; }
.carga-fext--xls  { background: #d1fae5; color: #065f46; }
.carga-fext--csv  { background: #dbeafe; color: #1e40af; }

/* Field badges inside file cards */
.carga-file-badges {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.carga-fbadge {
    font-size: 10px; padding: 2px 7px; border-radius: 4px;
    background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
    white-space: nowrap;
}
.carga-fbadge--req { background: #f0fdfa; color: #0d9488; border-color: #99f6e4; font-weight: 600; }
.carga-fbadge--grp { background: #eff6ff; color: #3b82f6; border-color: #bfdbfe; }
.carga-fbadge--more { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; font-style: italic; }

/* Previous load file indicator */
.carga-file-item--prev {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; background: #f1f5f9;
    border: 1.5px solid #cbd5e1; border-radius: 8px;
    cursor: default; opacity: .75;
}
.carga-file-item--prev .carga-file-icon { color: #94a3b8; flex-shrink: 0; }
.carga-file-item--prev .carga-file-details { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.carga-file-item--prev .carga-file-name {
    font-weight: 600; font-size: 13px; color: #64748b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carga-file-item--prev .carga-file-size { font-size: 11px; color: #94a3b8; }

/* Mapeo file badge */
.carga-mapeo-fbadge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 600;
    padding: 2px 10px; border-radius: 12px;
    border: 1px solid;
    margin-left: 8px;
    vertical-align: middle;
}

/* === Merge Indicator === */
.carga-merge-indicator { margin-top: 12px; }
.carga-merge-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border: 1.5px solid #e0e7ff;
    border-radius: 12px;
    padding: 14px 16px;
}
.carga-merge-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; color: #334155;
    margin-bottom: 12px;
}
.carga-merge-title svg { color: #6366f1; flex-shrink: 0; }
.carga-merge-key {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    background: #dcfce7; color: #166534; border-radius: 10px;
    padding: 2px 8px; letter-spacing: .3px; margin-left: auto;
}
.carga-merge-warn {
    font-size: 10px; font-weight: 600;
    color: #dc2626; margin-left: auto;
}
.carga-merge-flow {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.carga-merge-file {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 6px 10px;
    background: #fff; border: 1px solid var(--fc-border, #e2e8f0);
    border-radius: 8px; font-size: 12px;
}
.carga-merge-file-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--fc-dot, #94a3b8); flex-shrink: 0;
}
.carga-merge-file-name {
    font-weight: 600; color: #334155; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.carga-merge-file-fields {
    flex: 1; color: #64748b; font-size: 11px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carga-merge-arrow {
    display: flex; align-items: center; justify-content: center;
    padding: 2px 0;
}
.carga-merge-result {
    display: flex; align-items: center; gap: 6px;
    width: 100%; padding: 8px 12px;
    background: linear-gradient(90deg, #eff6ff, #f0fdfa);
    border: 1.5px solid #a5b4fc;
    border-radius: 8px; font-size: 12px; color: #334155;
}
.carga-merge-result svg { color: #6366f1; flex-shrink: 0; }

/* Resumen */
.carga-resumen {
  display: flex;
  gap: 24px;
  margin-top: 18px;
  padding: 14px 18px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  flex-wrap: wrap;
}
.carga-resumen-item { display: flex; align-items: center; gap: 6px; }
.carga-resumen-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.carga-resumen-value {
  font-size: 14px;
  font-weight: 600;
  color: #0f766e;
}

/* Notificación carga */
.carga-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10001;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s, transform .3s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.carga-notification.show { opacity: 1; transform: translateY(0); }
.carga-notification.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.carga-notification.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.carga-notification.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Mapeo de columnas */
.carga-mapeo { margin-top: 20px; }
.carga-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  margin: 0 0 6px;
}
.carga-section-desc { font-size: 13px; color: #64748b; margin: 0 0 14px; }
/* Mapeo header con acciones */
.carga-mapeo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.carga-mapeo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.carga-mapeo-saved-select {
  padding: 6px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  max-width: 200px;
  outline: none;
}
.carga-mapeo-saved-select:focus { border-color: #0d9488; }
.carga-btn-mapeo {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #0f766e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.carga-btn-mapeo:hover { background: #0d9488; }
/* Sección adicional colapsable */
.carga-mapeo-adic-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background .15s;
  margin-top: 6px;
}
.carga-mapeo-adic-header:hover { background: #f1f5f9; }
.carga-mapeo-adic-arrow { font-size: 10px; color: #94a3b8; }
.carga-mapeo-adic-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
}
.carga-mapeo-adic-body {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 10px 0 0;
}
.carga-mapeo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.carga-mapeo-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.carga-mapeo-item label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.carga-mapeo-item.required label { color: #0f766e; }
.carga-mapeo-item.required label::after { content: ''; }
.carga-mapeo-select {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #f8fafc;
  cursor: pointer;
}
.carga-mapeo-select:focus { border-color: #0d9488; outline: none; box-shadow: 0 0 0 2px rgba(13,148,136,.1); }

/* Preview */
.carga-preview { margin-top: 20px; }
.carga-preview-count {
  font-weight: 500;
  color: #64748b;
  font-size: 12px;
  margin-left: 6px;
}
.carga-preview-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.carga-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.carga-preview-table thead th {
  background: #f1f5f9;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.carga-preview-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.carga-preview-table tbody tr:hover { background: #f0fdfa; }

/* Acciones */
.carga-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.carga-btn-procesar {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Resultado */
.carga-result-card {
  text-align: center;
  padding: 40px 24px;
  border-radius: 12px;
}
.carga-result--success { background: #f0fdf4; border: 1px solid #86efac; }
.carga-result-icon { color: #22c55e; margin-bottom: 12px; }
.carga-result-card h3 { margin: 0 0 6px; font-size: 20px; color: #15803d; }
.carga-result-card p { margin: 0 0 20px; color: #475569; font-size: 14px; }
.carga-result-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 14px;
}
.carga-result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.carga-result-stat .num { font-size: 28px; font-weight: 800; color: #15803d; }
.carga-result-stat .lbl { font-size: 12px; color: #64748b; text-transform: uppercase; font-weight: 600; }
.carga-result-stat--warn .num { color: #dc2626; }
.carga-errores-detail {
  text-align: left;
  margin-top: 12px;
  background: #fef2f2;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.carga-errores-detail summary { cursor: pointer; font-size: 13px; color: #991b1b; font-weight: 600; }
.carga-errores-detail ul { margin: 8px 0 0; padding-left: 20px; font-size: 12px; color: #7f1d1d; }

/* Historial */
.carga-historial {
  background: #fff;
  border-top: 1px solid #e2e8f0;
  padding-bottom: 0;
}
.carga-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.carga-hist-count {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 6px;
}
.carga-hist-search {
  position: relative;
  display: flex;
  align-items: center;
}
.carga-hist-search-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
}
.carga-hist-search-input {
  padding: 8px 12px 8px 32px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #f8fafc;
  min-width: 220px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.carga-hist-search-input:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}
.carga-hist-search-input::placeholder { color: #94a3b8; }
.carga-hist-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Tabs filtro estado historial */
.carga-hist-tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 2px solid #e2e8f0;
}
.carga-hist-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.carga-hist-tab:hover { color: #0f766e; }
.carga-hist-tab.active {
  color: #0f766e;
  border-bottom-color: #0f766e;
}
.carga-hist-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
}
.carga-hist-tab.active .carga-hist-tab-badge {
  background: #ccfbf1;
  color: #0f766e;
}
.carga-hist-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.carga-hist-tab-dot--active { background: #22c55e; }
.carga-hist-tab-dot--inactive { background: #94a3b8; }
.th-center { text-align: center; }
.td-center { text-align: center; }
.carga-historial-table-wrap {
  overflow-x: auto;
  padding: 0 24px;
}
.carga-hist-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
  flex-wrap: wrap;
  gap: 10px;
}
.carga-historial-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.carga-historial-table thead th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid #e2e8f0;
}
.carga-historial-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.carga-historial-table tbody tr:hover { background: #f8fafc; }

/* ==================== MÓDULO USUARIOS ==================== */
.modal-box-lg { max-width: 640px; width: 95%; }

/* Header */
.usr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  gap: 12px;
}
.usr-header-left { display: flex; align-items: center; }
.usr-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.usr-title svg { opacity: 0.8; }
.usr-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Toolbar búsqueda y filtros */
.usr-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.usr-search-bar {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.usr-search-bar-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.usr-search-bar-input {
  width: 100%;
  padding: 10px 120px 10px 42px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.usr-search-bar-input::placeholder { color: #94a3b8; }
.usr-search-bar-input:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59,130,246,.1);
}
.usr-search-bar-hint {
  position: absolute;
  right: 14px;
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  background: #eff6ff;
  padding: 3px 10px;
  border-radius: 6px;
  display: none;
  pointer-events: none;
}
.usr-toolbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.usr-filter-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.usr-filter-select-light {
  padding: 9px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
  font-weight: 500;
}
.usr-filter-select-light:focus { border-color: #3b82f6; }
.usr-btn-nuevo {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.usr-btn-nuevo:hover { background: #2563eb; transform: translateY(-1px); }
.usr-btn-nuevo:active { transform: translateY(0); }

/* Stats */
.usr-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.usr-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: box-shadow .2s, transform .15s;
}
.usr-stat:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); transform: translateY(-1px); }
.usr-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.usr-stat--total .usr-stat-icon { background: #eff6ff; color: #2563eb; }
.usr-stat--active .usr-stat-icon { background: #f0fdf4; color: #16a34a; }
.usr-stat--inactive .usr-stat-icon { background: #fef2f2; color: #dc2626; }
.usr-stat--admin .usr-stat-icon { background: #faf5ff; color: #9333ea; }
.usr-stat-data { display: flex; flex-direction: column; }
.usr-stat-num { font-size: 22px; font-weight: 800; color: #0f172a; line-height: 1.1; }
.usr-stat-lbl { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; }

/* Table Card */
.usr-table-card {
  background: #fff;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}
.usr-table-wrapper { overflow-x: auto; }
.usr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.usr-table thead th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.usr-table thead th.th-check { width: 48px; text-align: center; }
.usr-table thead th.th-center { text-align: center; }
.usr-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}
.usr-table tbody tr { transition: background .15s; }
.usr-table tbody tr:hover { background: #f0f7ff; }
.td-num { text-align: center; color: #94a3b8; font-size: 12px; font-weight: 600; }
.td-center { text-align: center; }
.td-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* User cell */
.usr-user-cell { display: flex; align-items: center; gap: 10px; }
.usr-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: .5px;
}
.usr-user-info { display: flex; flex-direction: column; min-width: 0; }
.usr-user-name { font-weight: 600; color: #0f172a; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usr-user-ci { font-size: 11px; color: #94a3b8; }
.usr-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .5px;
  flex-shrink: 0;
  margin-left: 4px;
}
.usr-badge--admin { background: #dbeafe; color: #1e40af; }
.usr-badge--super { background: #fae8ff; color: #86198f; }
.usr-username {
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-weight: 500;
}
.usr-perfil-tag {
  display: inline-block;
  padding: 3px 8px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.usr-muted { color: #cbd5e1; }

/* Estado button */
.usr-estado-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all .15s;
}
.usr-estado-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.usr-estado--on {
  background: #dcfce7;
  color: #15803d;
}
.usr-estado--on .usr-estado-dot { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.usr-estado--on:hover { background: #bbf7d0; }
.usr-estado--off {
  background: #fee2e2;
  color: #991b1b;
}
.usr-estado--off .usr-estado-dot { background: #ef4444; }
.usr-estado--off:hover { background: #fecaca; }

/* Row inactive */
.usr-row-inactive td { opacity: 0.5; }
.usr-row-inactive:hover td { opacity: 0.75; }

/* Actions */
.usr-actions { display: flex; gap: 4px; justify-content: center; }
.usr-action-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
}
.usr-action--edit:hover { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.usr-action--key:hover { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.usr-action--deactivate { color: #dc2626; border-color: #fca5a5; background: #fef2f2; }
.usr-action--deactivate:hover { background: #fee2e2; color: #b91c1c; border-color: #f87171; }
.usr-action--activate { color: #16a34a; border-color: #86efac; background: #f0fdf4; }
.usr-action--activate:hover { background: #dcfce7; color: #15803d; border-color: #4ade80; }
.usr-action--empty { color: #ea580c; border-color: #fdba74; background: #fff7ed; }
.usr-action--empty:hover { background: #ffedd5; color: #c2410c; border-color: #fb923c; }
.usr-action--empty:disabled { opacity: .35; cursor: not-allowed; }
.usr-action--empty:disabled:hover { background: #fff7ed; color: #ea580c; border-color: #fdba74; }
.td-actions-group { display: flex; align-items: center; justify-content: center; gap: 4px; }

/* Loading & Empty */
.usr-loading {
  text-align: center;
  padding: 48px 20px;
  color: #94a3b8;
  font-size: 14px;
}
.usr-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: usr-spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes usr-spin { to { transform: rotate(360deg); } }
.usr-empty {
  text-align: center;
  padding: 56px 20px;
  color: #94a3b8;
  font-size: 14px;
}
.usr-empty svg { display: block; margin: 0 auto 12px; }
.usr-empty span { display: block; }

/* Paginación */
.usr-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
  flex-wrap: wrap;
  gap: 10px;
}
.usr-pag-info {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}
.usr-pag-controls { display: flex; align-items: center; gap: 4px; }
.usr-pag-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.usr-pag-btn:hover:not(:disabled):not(.usr-pag-active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.usr-pag-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.usr-pag-active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.usr-pag-active:hover { background: #2563eb; }
.usr-pag-num { min-width: 32px; }
.usr-pag-dots {
  padding: 0 2px;
  color: #94a3b8;
  font-size: 14px;
  user-select: none;
}

/* Form sections (shared) */
.form-section { margin-bottom: 18px; }
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}
.form-check-inline { display: flex; align-items: center; }
.form-check-inline label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  font-weight: 500;
}
.form-check-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
}

/* Notificación usuarios */
.usuarios-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10001;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s, transform .3s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.usuarios-notification.show { opacity: 1; transform: translateY(0); }
.usuarios-notification.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.usuarios-notification.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.usuarios-notification.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Responsive stats */
@media (max-width: 640px) {
  .usr-stats { grid-template-columns: repeat(2, 1fr); }
  .usr-header { flex-direction: column; align-items: stretch; }
  .usr-header-right { flex-direction: column; }
  .usr-search-input { min-width: 100%; }
}

/* ==================== PANEL ASIGNACIÓN ==================== */
.asig-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.asig-resumen {
  margin-bottom: 18px;
}
.asig-kpis {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.asig-kpi {
  flex: 1;
  min-width: 120px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  transition: box-shadow .2s;
}
.asig-kpi:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.asig-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}
.asig-kpi-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}
.asig-kpi--money .asig-kpi-value { color: #2563eb; }
.asig-kpi--ok .asig-kpi-value { color: #059669; }
.asig-kpi--warn .asig-kpi-value { color: #d97706; }

/* Layout sidebar + main */
.asig-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.asig-users-sidebar {
  width: 280px;
  min-width: 250px;
  flex-shrink: 0;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: 600px;
  position: sticky;
  top: 16px;
}
/* Formulario campaña en sidebar */
.asig-camp-form {
  padding: 12px 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 12px 12px 0 0;
}
.asig-camp-field { margin-bottom: 6px; }
.asig-camp-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.asig-camp-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: #1f2937;
  box-sizing: border-box;
}
.asig-camp-input:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.asig-camp-row {
  display: flex;
  gap: 6px;
}
.asig-camp-row .asig-camp-field { flex: 1; }
.asig-users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid #e5e7eb;
}
.asig-users-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}
.asig-users-count {
  font-size: 11px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 10px;
}
.asig-users-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 10px 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 8px;
}
.asig-users-search svg { color: #9ca3af; flex-shrink: 0; }
.asig-users-search-input {
  border: none;
  outline: none;
  font-size: 12px;
  padding: 6px 4px;
  width: 100%;
  background: transparent;
}
.asig-users-check-all {
  padding: 6px 14px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
  color: #6b7280;
}
.asig-users-check-all label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.asig-users-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px;
}
.asig-users-loading {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 12px;
}
.asig-user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  font-size: 13px;
}
.asig-user-item:hover { background: #e0e7ff; }
.asig-user-item.asig-user-item--checked { background: #eff6ff; }
.asig-user-item input[type="checkbox"] { flex-shrink: 0; cursor: pointer; }
.asig-user-item-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.asig-user-item-info { flex: 1; min-width: 0; }
.asig-user-item-name {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asig-user-item-meta {
  font-size: 10px;
  color: #9ca3af;
}
.asig-user-item-badge {
  font-size: 10px;
  font-weight: 700;
  background: #d1fae5;
  color: #065f46;
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.asig-users-footer {
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.asig-main-content {
  flex: 1;
  min-width: 0;
}

/* Actions Bar */
.asig-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 10px;
  margin-bottom: 12px;
}
.asig-actions-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.asig-check-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}
.asig-selected-count {
  font-size: 12px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 3px 10px;
  border-radius: 12px;
}
.asig-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.asig-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.asig-btn--assign {
  background: #2563eb;
  color: #fff;
}
.asig-btn--assign:hover:not(:disabled) { background: #1d4ed8; }
.asig-btn--auto {
  background: #7c3aed;
  color: #fff;
}
.asig-btn--auto:hover { background: #6d28d9; }
.asig-btn--remove {
  background: #fee2e2;
  color: #dc2626;
  padding: 5px 10px;
  font-size: 12px;
}
.asig-btn--remove:hover { background: #fecaca; }
.asig-btn--full {
  width: 100%;
  justify-content: center;
  padding: 8px 12px;
}
.asig-separator {
  width: 1px;
  height: 24px;
  background: #d1d5db;
  margin: 0 4px;
}

/* View Tabs */
.asig-view-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.asig-view-tab {
  padding: 7px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.asig-view-tab:hover { border-color: #2563eb; color: #2563eb; }
.asig-view-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.asig-view-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}
.asig-view-tab:not(.active) .asig-view-badge {
  background: #e5e7eb;
  color: #6b7280;
}
.asig-view-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 10px;
}
.asig-search-input {
  border: none;
  outline: none;
  font-size: 13px;
  padding: 7px 4px;
  width: 220px;
  background: transparent;
}
.asig-filtro-estado {
  padding: 7px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: #374151;
}

/* Tabla operaciones */
.asig-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.asig-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.asig-table thead {
  background: #f8fafc;
}
.asig-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
.asig-th-check { width: 40px; text-align: center; }
.asig-th-right { text-align: right; }
.asig-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
}
.asig-table tr:hover { background: #f0f9ff; }
.asig-table tr.asig-row-selected { background: #eff6ff; }
.asig-table .asig-td-check { text-align: center; }
.asig-table .asig-td-deuda { text-align: right; font-weight: 600; color: #2563eb; }
.asig-badge-asignado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #d1fae5;
  color: #065f46;
}
.asig-badge-sin {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
}
/* Paginación */
.asig-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 14px 0 4px;
}
.asig-pagination button {
  padding: 5px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  color: #374151;
  transition: all .15s;
}
.asig-pagination button:hover { background: #f3f4f6; }
.asig-pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.asig-pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* Vista por Usuarios (cards) */
.asig-usuarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.asig-user-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  transition: box-shadow .2s;
}
.asig-user-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.asig-user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.asig-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.asig-user-info { flex: 1; }
.asig-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}
.asig-user-username {
  font-size: 11px;
  color: #6b7280;
}
.asig-user-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.asig-user-stat {
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}
.asig-user-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}
.asig-user-stat-lbl {
  font-size: 10px;
  color: #6b7280;
  text-transform: uppercase;
}
.asig-user-actions {
  display: flex;
  gap: 6px;
}
.asig-user-actions .asig-btn { flex: 1; justify-content: center; font-size: 12px; padding: 6px 8px; }

/* Modal Auto-Asignación */
.asig-auto-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.asig-auto-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  font-size: 13px;
  color: #374151;
}
.asig-auto-option:hover { border-color: #7c3aed; background: #f5f3ff; }
.asig-auto-option input:checked + span { color: #7c3aed; font-weight: 600; }
.asig-auto-users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
  font-size: 13px;
  color: #374151;
}
.asig-auto-count {
  font-size: 12px;
  color: #6b7280;
}
.asig-auto-users-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.asig-auto-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  font-size: 13px;
}
.asig-auto-user-item:hover { background: #f3f4f6; }
.asig-auto-user-item input { flex-shrink: 0; }
.asig-auto-user-name { flex: 1; color: #1f2937; }
.asig-auto-user-email { font-size: 11px; color: #9ca3af; }

/* Header resumen con botón nueva */
.asig-resumen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.asig-btn-nueva {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.asig-btn-nueva:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  transform: translateY(-1px);
}
.asig-btn-nueva svg { flex-shrink: 0; }

/* ===== Modal Wizard Asignación ===== */
.asig-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: asigOverlayIn .3s ease-out;
}
@keyframes asigOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.asig-modal {
  background: #ffffff;
  border-radius: 20px;
  width: 94vw;
  max-width: 1100px;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.04),
    0 8px 16px rgba(0,0,0,.08),
    0 24px 64px rgba(0,0,0,.16);
  animation: asigModalIn .35s cubic-bezier(.16,1,.3,1);
  overflow: hidden;
}
@keyframes asigModalIn {
  from { opacity: 0; transform: scale(.97) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
.asig-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: #fff;
  padding: 16px 24px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.asig-modal-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}
.asig-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  letter-spacing: -.01em;
}
.asig-modal-subtitle {
  font-size: 13px;
  opacity: .75;
  font-weight: 500;
}
.asig-modal-close {
  margin-left: auto;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  transition: all .2s;
  position: relative;
  z-index: 1;
}
.asig-modal-close:hover {
  background: rgba(255,255,255,.25);
  transform: scale(1.05);
}

/* ── Stepper ── */
.awiz-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 14px 40px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.awiz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  cursor: default;
  min-width: 64px;
}
.awiz-step-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2.5px solid #cbd5e1;
  background: #fff;
  color: #94a3b8;
  transition: all .35s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.awiz-step.active .awiz-step-circle {
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.35), 0 0 0 4px rgba(37,99,235,.1);
  transform: scale(1.08);
}
.awiz-step.done .awiz-step-circle {
  border-color: #10b981;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.25);
}
.awiz-step-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: color .3s;
}
.awiz-step.active .awiz-step-label { color: #2563eb; font-weight: 700; }
.awiz-step.done .awiz-step-label { color: #059669; }
.awiz-step-line {
  flex: 1;
  max-width: 80px;
  min-width: 30px;
  height: 2.5px;
  background: #e2e8f0;
  margin: 0 8px;
  margin-bottom: 20px;
  border-radius: 4px;
  transition: all .4s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
}
.awiz-step-line.done {
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* ── Modal body ── */
.asig-modal-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
  position: relative;
  background: #f8fafc;
}

/* ── Wizard pages ── */
.awiz-page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  animation: awizPageIn .35s cubic-bezier(.16,1,.3,1);
}
@keyframes awizPageIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
.awiz-page-inner {
  padding: 28px 32px;
  max-width: 100%;
}
.awiz-page-inner.awiz-page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px 32px;
}

/* ── Card centrada (pasos 1 y 4) ── */
.awiz-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 28px 32px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
.awiz-card--wide {
  max-width: 720px;
}
.awiz-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.awiz-card-icon--confirm {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}
.awiz-card-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.02em;
}
.awiz-card-desc {
  margin: 0 0 28px;
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
}

/* Paso 1: header compacto */
.awiz-s1-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}
.awiz-s1-header .awiz-creator-info {
  padding: 8px 12px;
  font-size: 12px;
}
.awiz-s1-header .awiz-creator-avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
  border-radius: 8px;
}
.awiz-s1-header .awiz-creator-name { font-size: 12px; }
.awiz-s1-header .awiz-creator-meta { font-size: 10.5px; }

/* Paso 1: grid 2 columnas */
.awiz-s1-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.awiz-s1-col .awiz-form-group { margin-bottom: 14px; }
.awiz-s1-col .awiz-form-group:last-child { margin-bottom: 0; }

/* ── Formulario wizard ── */
.awiz-form-group {
  margin-bottom: 16px;
}
.awiz-form-group:last-child { margin-bottom: 0; }
.awiz-form-row {
  display: flex;
  gap: 12px;
}
.awiz-form-row .awiz-form-group { flex: 1; }
.awiz-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.awiz-req { color: #ef4444; font-size: 13px; }
.awiz-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13.5px;
  color: #0f172a;
  background: #fff;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  box-sizing: border-box;
}
.awiz-input--sm {
  padding: 8px 12px;
  font-size: 13px;
}
.awiz-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.awiz-input:hover { border-color: #94a3b8; }
.awiz-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.1);
}
.awiz-input.awiz-input--error {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.08);
  animation: awizShake .4s ease-in-out;
}
@keyframes awizShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.awiz-hint {
  display: block;
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Method selector ── */
.awiz-method-options {
  display: flex;
  gap: 14px;
}
.awiz-method-opt {
  flex: 1;
  cursor: pointer;
}
.awiz-method-opt input[type="radio"] { display: none; }
.awiz-method-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fff;
  position: relative;
}
.awiz-method-card:hover {
  border-color: #93c5fd;
  background: #fafbff;
}
.awiz-method-card svg { color: #64748b; transition: color .2s; }
.awiz-method-card strong {
  font-size: 12.5px;
  color: #334155;
  font-weight: 700;
}
.awiz-method-card span {
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.35;
}
.awiz-method-opt input:checked + .awiz-method-card {
  border-color: #2563eb;
  background: linear-gradient(135deg, #eff6ff, #f0f7ff);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1), 0 4px 12px rgba(37,99,235,.08);
}
.awiz-method-opt input:checked + .awiz-method-card svg { color: #2563eb; }
.awiz-method-opt input:checked + .awiz-method-card strong { color: #1d4ed8; }
.awiz-method-opt input:checked + .awiz-method-card::before {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ── Creator info ── */
.awiz-creator-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1.5px solid #a7f3d0;
  border-radius: 14px;
}
.awiz-creator-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(5,150,105,.2);
}
.awiz-creator-details { flex: 1; min-width: 0; }
.awiz-creator-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #065f46;
}
.awiz-creator-meta {
  font-size: 11.5px;
  color: #6b7280;
  margin-top: 1px;
}

/* ── Auto options ── */
.awiz-auto-opts {
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 4px;
}
.awiz-radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #334155;
  padding: 3px 0;
  cursor: pointer;
  transition: color .15s;
}
.awiz-radio-label:hover { color: #1d4ed8; }
.awiz-radio-label input[type="radio"] { accent-color: #2563eb; }

/* ── Paso 2: Users ── */
.awiz-page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.awiz-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -.01em;
}
.awiz-section-title svg { color: #2563eb; }
.awiz-selection-badge {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid #93c5fd;
}
.awiz-users-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.awiz-users-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 9px 14px;
  flex: 1;
  min-width: 200px;
  transition: all .2s;
}
.awiz-users-search-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}
.awiz-users-search-wrap svg { flex-shrink: 0; color: #94a3b8; }
.awiz-users-search {
  border: none;
  outline: none;
  font-size: 13.5px;
  flex: 1;
  background: transparent;
  color: #0f172a;
}
.awiz-check-all-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 500;
}
.awiz-check-all-label input { accent-color: #2563eb; }
.awiz-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: calc(100vh - 390px);
  overflow-y: auto;
  padding-right: 4px;
}
.awiz-users-grid::-webkit-scrollbar { width: 5px; }
.awiz-users-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.awiz-users-grid::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.awiz-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  background: #fff;
}
.awiz-user-item:hover {
  border-color: #93c5fd;
  background: #f8faff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,.06);
}
.awiz-user-item.selected {
  border-color: #2563eb;
  background: linear-gradient(135deg, #eff6ff, #f0f7ff);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08), 0 4px 12px rgba(37,99,235,.06);
}
.awiz-user-item.selected .awiz-user-check { accent-color: #2563eb; }
.awiz-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(99,102,241,.2);
}
.awiz-user-info { flex: 1; min-width: 0; }
.awiz-user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.awiz-user-email {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.awiz-user-check {
  width: 20px;
  height: 20px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}
.awiz-users-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px;
  color: #94a3b8;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* ── Paso 3: Operations ── */
.awiz-ops-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.awiz-ops-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 9px 14px;
  flex: 1;
  min-width: 200px;
  transition: all .2s;
}
.awiz-ops-search-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}
.awiz-ops-search-wrap svg { flex-shrink: 0; color: #94a3b8; }
.awiz-ops-search {
  border: none;
  outline: none;
  font-size: 13.5px;
  flex: 1;
  background: transparent;
  color: #0f172a;
}
.awiz-ops-filter {
  padding: 9px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-size: 13px;
  color: #334155;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s;
}
.awiz-ops-filter:focus { border-color: #2563eb; outline: none; }

/* ── Paso 4: Summary ── */
.awiz-confirm-card { max-width: 640px; }
.awiz-summary {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 4px 0;
  overflow: hidden;
}
.awiz-sum-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #f1f5f9;
  gap: 16px;
  transition: background .15s;
}
.awiz-sum-row:hover { background: #f1f5f9; }
.awiz-sum-row:last-child { border-bottom: none; }
.awiz-sum-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  min-width: 130px;
  flex-shrink: 0;
}
.awiz-sum-value {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  text-align: right;
  flex: 1;
}
.awiz-sum-value--highlight {
  color: #2563eb;
  font-weight: 700;
}
.awiz-sum-users-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.awiz-sum-user-tag {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid #93c5fd;
}
.awiz-sum-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-top: 16px;
  border: 1px solid #fcd34d;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

/* ── Footer wizard ── */
.awiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
.awiz-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.awiz-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border: none;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  letter-spacing: -.01em;
}
.awiz-btn--cancel {
  background: transparent;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
}
.awiz-btn--cancel:hover { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.awiz-btn--back {
  background: #f1f5f9;
  color: #334155;
  border: 1.5px solid #e2e8f0;
}
.awiz-btn--back:hover { background: #e2e8f0; }
.awiz-btn--next {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.2), 0 0 0 1px rgba(37,99,235,.1);
}
.awiz-btn--next:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  box-shadow: 0 6px 20px rgba(37,99,235,.3);
  transform: translateY(-1px);
}
.awiz-btn--next:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.awiz-btn--submit {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5,150,105,.2), 0 0 0 1px rgba(5,150,105,.1);
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 700;
}
.awiz-btn--submit:hover {
  background: linear-gradient(135deg, #047857, #059669);
  box-shadow: 0 6px 20px rgba(5,150,105,.3);
  transform: translateY(-1px);
}
.awiz-btn--submit:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Scrollbar para wizard pages ── */
.awiz-page::-webkit-scrollbar { width: 6px; }
.awiz-page::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.awiz-page::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Historial Asignaciones */
.asig-hist {
  margin-top: 20px;
  border-top: 2px solid #e5e7eb;
  padding-top: 18px;
}
.asig-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.asig-hist-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.asig-hist-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 10px;
}
.asig-hist-search-wrap svg { color: #9ca3af; }
.asig-hist-search-input {
  border: none;
  outline: none;
  font-size: 13px;
  padding: 7px 4px;
  width: 200px;
  background: transparent;
}
.asig-hist-count {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}
.asig-hist-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.asig-hist-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all .15s;
}
.asig-hist-tab:hover { border-color: #2563eb; color: #2563eb; }
.asig-hist-tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.asig-hist-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
}
.asig-hist-tab:not(.active) .asig-hist-badge { background: #e5e7eb; color: #6b7280; }
.asig-hist-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.asig-hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.asig-hist-table thead { background: #f8fafc; }
.asig-hist-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
.asig-hist-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
}
.asig-hist-table tr:hover { background: #f0f9ff; }
.asig-hist-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 12px 0 4px;
}
.asig-hist-pagination button {
  padding: 5px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  color: #374151;
  transition: all .15s;
}
.asig-hist-pagination button:hover { background: #f3f4f6; }
.asig-hist-pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.asig-hist-pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ==================== PANEL PAGOS ==================== */
.pagos-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.pagos-resumen { margin-bottom: 18px; }
.pagos-resumen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.pagos-btn-nuevo {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
}
.pagos-btn-nuevo:hover { background: #1d4ed8; }
.pagos-kpis {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.pagos-kpi {
  flex: 1;
  min-width: 120px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  transition: box-shadow .2s;
}
.pagos-kpi:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.pagos-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}
.pagos-kpi-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}
.pagos-kpi--money .pagos-kpi-value { color: #2563eb; }
.pagos-kpi--ok .pagos-kpi-value { color: #059669; }
.pagos-kpi--warn .pagos-kpi-value { color: #d97706; }

/* Modal Pagos */
.pagos-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.pagos-modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pagos-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pagos-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.pagos-modal-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-left: auto;
}
.pagos-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
}
.pagos-modal-close:hover { color: #1f2937; }
.pagos-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.pagos-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.pagos-btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.pagos-btn--primary { background: #2563eb; color: #fff; }
.pagos-btn--primary:hover { background: #1d4ed8; }
.pagos-btn--secondary { background: #f3f4f6; color: #374151; }
.pagos-btn--secondary:hover { background: #e5e7eb; }
.pagos-btn--success { background: #059669; color: #fff; }
.pagos-btn--success:hover { background: #047857; }

/* Formulario Pagos */
.pagos-form { margin-bottom: 20px; }
.pagos-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.pagos-form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pagos-form-group label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}
.pagos-input, .pagos-select, .pagos-textarea {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color .2s, box-shadow .2s;
}
.pagos-input:focus, .pagos-select:focus, .pagos-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.pagos-textarea { resize: vertical; min-height: 60px; }

/* Carga Masiva Pagos */
.pagos-masivo {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 16px;
}
.pagos-masivo-header h6 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pagos-masivo-drop {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #f9fafb;
}
.pagos-masivo-drop:hover, .pagos-masivo-drop.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}
.pagos-masivo-drop p {
  margin: 10px 0 4px;
  font-size: 13px;
  color: #6b7280;
}
.pagos-masivo-formats {
  font-size: 11px;
  color: #9ca3af;
}
.pagos-masivo-info {
  margin-top: 12px;
}
.pagos-masivo-file {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 6px;
}
.pagos-masivo-filename {
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
}
.pagos-masivo-filesize {
  font-size: 12px;
  color: #6b7280;
  margin-left: auto;
}
.pagos-masivo-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.pagos-masivo-preview-table th,
.pagos-masivo-preview-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
}
.pagos-masivo-preview-table th {
  background: #f8fafc;
  font-weight: 500;
}

/* Wizard Pagos */
.awiz-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}
.awiz-step {
  display: flex;
  align-items: center;
  gap: 8px;
}
.awiz-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}
.awiz-step.active .awiz-step-circle {
  background: #2563eb;
  color: #fff;
}
.awiz-step.done .awiz-step-circle {
  background: #059669;
  color: #fff;
}
.awiz-step-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.awiz-step.active .awiz-step-label {
  color: #2563eb;
}
.awiz-step.done .awiz-step-label {
  color: #059669;
}
.awiz-step-line {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin: 0 12px;
  min-width: 40px;
}

/* Paso procesar */
.pagos-procesar {
  text-align: center;
}
.pagos-procesar-resumen {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}
.pagos-procesar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pagos-procesar-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
}
.pagos-procesar-value {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}
.pagos-procesar-preview {
  text-align: left;
}
.pagos-procesar-preview h6 {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}
.pagos-procesar-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.pagos-procesar-preview th,
.pagos-procesar-preview td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
}
.pagos-procesar-preview th {
  background: #f8fafc;
}

/* Historial Pagos */
.pagos-hist { margin-top: 20px; }
.pagos-hist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.pagos-hist-header-right {
  display: flex;
  gap: 10px;
}
.pagos-hist-search-wrap {
  position: relative;
}
.pagos-hist-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}
.pagos-hist-search-input {
  padding: 8px 12px 8px 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  width: 220px;
}
.pagos-hist-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.pagos-hist-tab {
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.pagos-hist-tab:hover { background: #e5e7eb; }
.pagos-hist-tab.active {
  background: #2563eb;
  color: #fff;
}
.pagos-hist-tab-badge {
  background: rgba(0,0,0,.15);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
}
.pagos-hist-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.pagos-hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pagos-hist-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}
.pagos-hist-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
}
.pagos-hist-table tr:hover { background: #f9fafb; }
.pagos-td-deuda {
  font-weight: 600;
  color: #059669;
}
.pagos-hist-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding: 0 4px;
}
.pagos-hist-pagination button {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.pagos-hist-pagination button:hover { background: #f3f4f6; }
.pagos-hist-pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagos-hist-pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.active { transform: translateX(0); width: 260px; }
  .main { margin-left: 0; }
  #module-chat { left: 0; }
}
@media (max-width: 768px) {
  .report-filters-bar { flex-direction: column; }
  .report-filters-bar .filter-item,
  .report-filters-bar .filter-item--date { flex: 1 1 100%; }
  .charts-container { grid-template-columns: 1fr; }
  .kpi-container { grid-template-columns: repeat(2, 1fr); }
}

