/* ══════════════════════════════════════════════════════════════════════════
   ORBITA SaaS — Brand Identity v2.0 CYAN
   Diseño: Minimalismo Premium
   Paleta: Cyan Vibrante (#00BCD4) + Blanco (#FFFFFF)
   Tipografía: Poppins 800 (Display) + Open Sans 400 (Body)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── IMPORTAR FUENTES BRAND ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&family=Open+Sans:wght@300;400;500;600;700&display=swap');

/* ── TOKENS DE DISEÑO (BRAND IDENTITY v2.0) ───────────────────────────── */
:root {
  /* Paleta Oficial ORBITA Cyan */
  --cyan-vibrant:   #00BCD4;
  --teal-dark:      #006064;   /* sidebar ORBITA */
  --teal-darker:    #004D52;   /* hover sidebar */
  --white-pure:     #FFFFFF;
  --gray-dark:      #424242;
  --gray-light:     #EEEEEE;
  --gray-medium:    #757575;
  --gray-bg:        #FAFAFA;

  /* Colores Funcionales */
  --bg-primary:     var(--white-pure);
  --bg-secondary:   var(--gray-bg);
  --bg-card:        var(--white-pure);
  --bg-sidebar:     var(--teal-dark);
  --sidebar-text:   #ffffff;
  
  --text-primary:   var(--gray-dark);
  --text-secondary: var(--gray-medium);
  --text-muted:     #9E9E9E;
  
  --accent:         var(--cyan-vibrant);
  --accent-hover:   #00ACC1;
  --accent-light:   #E0F7FA;
  
  --border:         var(--gray-light);
  --border-focus:   var(--cyan-vibrant);
  
  /* Estados */
  --success:        #4CAF50;
  --warning:        #FF9800;
  --danger:         #F44336;
  --info:           var(--cyan-vibrant);
  
  /* Sombras Limpias */
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow:         0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg:      0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-cyan:    0 4px 24px rgba(0, 188, 212, 0.2);
  
  /* Dimensiones */
  --sidebar-w:      280px;
  --header-h:       72px;
  
  /* Bordes (Brand Guidelines) */
  --radius:         12px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --gap:            24px;
  
  /* Tipografía Brand */
  --font-display:   'Poppins', -apple-system, sans-serif;
  --font-body:      'Open Sans', -apple-system, sans-serif;
  --font-mono:      'SF Mono', 'Consolas', monospace;
}

/* ── RESET ────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   PANTALLAS
   ══════════════════════════════════════════════════════════════════════════ */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN - Minimalismo Premium
   ══════════════════════════════════════════════════════════════════════════ */
#loginScreen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f9fb 0%, #f0fafe 40%, #eaf4fb 100%);
  position: relative;
  overflow: hidden;
}

.login-card {
  backdrop-filter: blur(2px);
  box-shadow: 0 20px 60px rgba(0,188,212,0.12), 0 4px 20px rgba(0,0,0,0.06) !important;
}

.login-container {
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 48px;
  width: 440px;
  max-width: 95vw;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.login-logo i {
  font-size: 40px;
  color: var(--accent);
}

.login-logo span {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.login-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* ── FORMULARIO LOGIN ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--white-pure);
  outline: none;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* ── ALERTAS ──────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid;
}

.alert-error {
  background: #FFEBEE;
  border-color: #FFCDD2;
  color: #C62828;
}

.alert-success {
  background: #E8F5E9;
  border-color: #C8E6C9;
  color: #2E7D32;
}

/* ── BOTONES BRAND ────────────────────────────────────────────────────── */
.btn-primary {
  padding: 14px 28px;
  background: var(--accent);
  color: var(--white-pure);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-cyan);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 188, 212, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary i::before {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary i::before {
  width: 16px;
  height: 16px;
}

.btn-block {
  width: 100%;
  display: flex;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════════════════════════════════════════ */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-secondary);
}

/* ── SIDEBAR MINIMALISTA ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: var(--sidebar-text, var(--white-pure));
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 16px rgba(0,0,0,0.18);
  position: relative;
  z-index: 100;
  border-right: none;
}

.sidebar-header {
  padding: 28px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo i {
  font-size: 28px;
  color: var(--accent);
}

.sidebar-logo span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--sidebar-text, var(--white-pure));
}

/* ── NAVEGACIÓN ───────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  color: var(--sidebar-text, rgba(255,255,255,0.85));
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  opacity: 0.85;
}
.nav-item:not(.active):hover { opacity: 1; }

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

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: transform 0.2s;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  transform: scale(1.12);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white-pure);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Badge de mensajes no leídos en nav Chat ──────────────────────────── */
.nav-chat-badge {
  display: none;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  line-height: 1;
  flex-shrink: 0;
  animation: badge-pop 0.25s cubic-bezier(.4,0,.2,1);
}
.nav-chat-badge.visible {
  display: flex;
}
@keyframes badge-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1);   opacity: 1; }
}

.nav-item.active {
  background: var(--accent);
  color: var(--white-pure);
  box-shadow: var(--shadow-cyan);
  font-weight: 600;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── CONTENIDO PRINCIPAL ──────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px;
  overflow-y: auto;
  background: var(--bg-secondary);
  position: relative;
  position: relative;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  gap: 20px;
  background: var(--white-pure);
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0;
}

/* ── SECCIONES ────────────────────────────────────────────────────────── */
.content-section {
  display: none;
}

.content-section.active {
  display: block;
  position: relative; /* necesario para overlay flotante de guard de contexto */
  animation: fadeIn 0.3s ease;
}

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

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

.sync-spinning {
  animation: spin 0.9s linear infinite;
}

/* ── TABLAS MINIMALISTAS ──────────────────────────────────────────────── */
.table-container {
  background: var(--white-pure);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent);
}

.data-table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

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

.data-table td {
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ── MODALES MINIMALISTAS ─────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(66, 66, 66, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 600px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal form {
  padding: 28px;
}

/* ── EQUIPO SEARCHABLE SELECT ─────────────────────────────────────────── */
.equipo-search-wrap {
  position: relative;
}

.equipo-search-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white-pure);
  transition: all 0.2s;
  overflow: hidden;
}

.equipo-search-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.equipo-search-icon {
  padding: 0 10px 0 14px;
  color: var(--text-muted);
  font-size: 15px;
  flex-shrink: 0;
  line-height: 1;
}

.equipo-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 13px 4px;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
  font-family: inherit;
  min-width: 0;
}

.equipo-search-input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.equipo-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s;
}

.equipo-search-clear:hover { color: var(--text-primary); }

.equipo-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 9999;
  animation: dropIn 0.12s ease;
}

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

.equipo-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.equipo-option:last-child { border-bottom: none; }
.equipo-option:hover, .equipo-option.focused { background: var(--accent-light); }

.equipo-option-serial {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  white-space: nowrap;
  background: rgba(0,188,212,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.equipo-option-info {
  flex: 1;
  min-width: 0;
}

.equipo-option-nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.equipo-option-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.equipo-option-meta b { color: var(--text-secondary); }

.equipo-search-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.equipo-search-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-top: 6px;
  background: rgba(0,188,212,0.06);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius);
  font-size: 13px;
}

.equipo-search-selected-serial {
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
}

.equipo-search-selected-nombre {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
}

.equipo-search-selected-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.equipo-search-selected-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}
.equipo-search-selected-remove:hover { color: #F44336; }

.equipo-search-count {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 14px 6px;
  border-bottom: 1px solid var(--border);
}

/* ── MODAL FOOTER ─────────────────────────────────────────────────────── */
.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--white-pure);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.toast-msg {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── DASHBOARD STATS GRID ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.2s ease;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card.accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  box-shadow: 0 4px 16px var(--shadow-cyan);
}

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

.stat-card.accent .stat-label { color: rgba(255,255,255,0.85); }

.stat-value {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card.accent .stat-value  { color: #ffffff; }
.stat-card.warning .stat-value { color: #FF9800; }
.stat-card.info    .stat-value { color: var(--accent); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-card.accent .stat-sub { color: rgba(255,255,255,0.7); }

/* ── DASHBOARD CHARTS GRID ────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.chart-card {
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.chart-card canvas { max-height: 260px; }

/* ── SIDEBAR TRANSITION ───────────────────────────────────────────────── */
.sidebar {
  transition: background 0.4s ease;
}

/* ── TENANT BRANDING EN SIDEBAR ───────────────────────────────────────── */
.tenant-branding-bar {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  padding: 14px 0 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  gap: 8px;
}

.tenant-branding-divider {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 2px;
}

.tenant-branding-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.tenant-logo-img {
  width: auto;
  max-width: 180px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 10px;
  display: block;
}

.tenant-nombre {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ── NAV SEPARATOR ────────────────────────────────────────────────────── */
.nav-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 16px;
}

/* ── BRANDING SECTION ─────────────────────────────────────────────────── */
.branding-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.branding-preview-card {
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.branding-preview-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 32px;
  background: linear-gradient(135deg, #00BCD4 0%, #0097A7 100%);
  transition: background 0.4s ease;
  min-height: 180px;
}

.branding-preview-orbita {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.branding-preview-orbita span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.01em;
}

.branding-preview-label {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
}

.branding-preview-info {
  padding: 20px 24px;
}

.branding-preview-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

.branding-preview-info ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.branding-preview-info li {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
}

.branding-preview-info li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.branding-form-card {
  background: var(--white-pure);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.branding-form-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px;
  background: none;
}

.color-picker:hover {
  border-color: var(--accent);
}

.color-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-upload:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

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

/* ── BARRA DE FILTROS ─────────────────────────────────────────────────── */
.filtros-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filtros-bar--wrap {
  flex-wrap: wrap;
}

.filtro-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.filtro-input,
.filtro-select,
.filtro-date {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}
.filtro-input:focus,
.filtro-select:focus,
.filtro-date:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: #fff;
}
.filtro-select { padding-right: 28px; cursor: pointer; }
.filtro-date   { padding: 0 8px; min-width: 130px; }

.filtro-fecha-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filtro-fecha-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filtro-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.filtro-clear:hover {
  background: #FFEBEE;
  color: #C62828;
  border-color: #FFCDD2;
}

.filtro-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding-left: 4px;
}
.filtro-count.has-results {
  color: var(--accent);
}

/* Highlight filas que NO pasan el filtro → se ocultan */
.fila-oculta { display: none !important; }

@media (max-width: 900px) {
  .filtros-bar { flex-wrap: wrap; }
  .filtro-input { min-width: 140px; }
}

/* ── BOTONES DE ACCIÓN EN TABLAS (Editar / Borrar) ───────────────────── */
.acciones-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-edit {
  background: #E3F2FD;
  color: #1565C0;
  border-color: #BBDEFB;
}
.btn-edit:hover {
  background: #BBDEFB;
  border-color: #1565C0;
}

.btn-delete {
  background: #FFF8F8;
  color: #C62828;
  border-color: #FFCDD2;
}
.btn-delete:hover {
  background: #FFCDD2;
  border-color: #C62828;
}

.btn-view {
  background: #0097A7;
  color: #ffffff;
  border-color: #0097A7;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-view:hover {
  background: #00838F;
  border-color: #00838F;
  color: #ffffff;
}

.btn-pdf {
  background: #D32F2F;
  color: #ffffff;
  border-color: #D32F2F;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-pdf:hover {
  background: #B71C1C;
  border-color: #B71C1C;
  color: #ffffff;
}
.btn-pdf:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── UTILITIES ────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO: IMPORTACIÓN EXCEL
   ══════════════════════════════════════════════════════════════════════════ */

.import-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-secondary);
}
.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.import-dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.import-dropzone h3   { color: var(--text-primary);   margin-bottom: 6px; }
.import-dropzone p    { color: var(--text-secondary);  font-size: 13px; }
.import-dropzone-hint { color: var(--text-muted);      font-size: 11px; margin-top: 8px; }

.import-step {
  display: none;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  margin-top: 16px;
}

.import-mapeo-grid {
  display: grid;
  gap: 10px;
}
.import-mapeo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.import-mapeo-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.badge-req {
  color: var(--danger);
  font-weight: 700;
}

.import-result-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}
.import-stat      { text-align: center; }
.import-stat-val  { font-size: 28px; font-weight: 700; font-family: var(--font-display); }
.import-stat-label{ font-size: 12px; color: var(--text-secondary); }

/* Nuevo tipo de reporte — modal campo rows */
.nuevo-tipo-campo-fila {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.nuevo-tipo-campo-fila:focus-within {
  border-color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO: FIRMA MASIVA
   ══════════════════════════════════════════════════════════════════════════ */

.firma-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
}
.firma-toolbar-count {
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  font-size: 14px;
}

.badge-firma {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-firma.firmado   { background: #E8F5E9; color: #2E7D32; }
.badge-firma.pendiente { background: #FFF8E1; color: #F57F17; }
.badge-firma.borrador  { background: #F5F5F5; color: #616161; }

.fila-firmada {
  opacity: 0.6;
  background: var(--bg-secondary) !important;
}
.fila-firmada td { color: var(--text-muted); }

.tipo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
  text-transform: capitalize;
}

/* Tabs de firma */
.firma-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.firma-tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: all 0.2s;
}
.firma-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.firma-tab-panel        { display: none; }
.firma-tab-panel.active { display: block; }

/* Integridad */
.integridad-ok, .integridad-fail {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  margin-bottom: 16px;
}
.integridad-ok   { background: #E8F5E9; color: #2E7D32; }
.integridad-fail { background: #FFEBEE; color: #C62828; }

.integridad-row {
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.integridad-row.ok   { border-color: #A5D6A7; background: #F9FBE7; }
.integridad-row.fail { border-color: #EF9A9A; background: #FFEBEE; }
.integridad-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  margin-left: auto;
}
.integridad-row.ok   .integridad-badge { background: #E8F5E9; color: #2E7D32; }
.integridad-row.fail .integridad-badge { background: #FFEBEE; color: #C62828; }

/* Dashboard de firmas (stats en sección firmas) */
.firma-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .firma-stats-row   { grid-template-columns: repeat(2, 1fr); }
  .import-mapeo-row  { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .main-content {
    padding: 20px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  #saChartGrid { grid-template-columns: 1fr !important; }
}

@media (max-width: 600px) {
  .stats-grid  { grid-template-columns: 1fr; }
  #saChartGrid { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   ICONOS SVG INLINE - Paleta Cyan
   ══════════════════════════════════════════════════════════════════════════ */

.nav-item i::before,
.sidebar-logo i::before,
.btn-primary i::before,
.btn-secondary i::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Dashboard Icon */
.ph-bold.ph-house::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M224 120v96a8 8 0 0 1-8 8H160a8 8 0 0 1-8-8v-52a4 4 0 0 0-4-4h-40a4 4 0 0 0-4 4v52a8 8 0 0 1-8 8H40a8 8 0 0 1-8-8v-96a16 16 0 0 1 4.69-11.31l80-80a16 16 0 0 1 22.62 0l80 80A16 16 0 0 1 224 120Z'/%3E%3C/svg%3E");
}

/* Equipos Icon */
.ph-bold.ph-hard-drives::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M208 40H48a24 24 0 0 0-24 24v64a24 24 0 0 0 24 24h160a24 24 0 0 0 24-24V64a24 24 0 0 0-24-24Zm0 104H48a24 24 0 0 0-24 24v24a24 24 0 0 0 24 24h160a24 24 0 0 0 24-24v-24a24 24 0 0 0-24-24Zm-24 48h-16a8 8 0 0 1 0-16h16a8 8 0 0 1 0 16Zm0-104h-16a8 8 0 0 1 0-16h16a8 8 0 0 1 0 16Z'/%3E%3C/svg%3E");
}

/* Reportes Icon */
.ph-bold.ph-file-text::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M213.66 82.34l-56-56A8 8 0 0 0 152 24H56a16 16 0 0 0-16 16v176a16 16 0 0 0 16 16h144a16 16 0 0 0 16-16V88a8 8 0 0 0-2.34-5.66ZM160 160H96a8 8 0 0 1 0-16h64a8 8 0 0 1 0 16Zm0-32H96a8 8 0 0 1 0-16h64a8 8 0 0 1 0 16Zm-8-56V44l44 44Z'/%3E%3C/svg%3E");
}

/* Clientes Icon */
.ph-bold.ph-users::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M125.18 156.94a64 64 0 1 0-82.36 0A100.23 100.23 0 0 0 3.39 207a8 8 0 1 0 13.22 9C27.49 199.73 52.47 184 80 184s52.51 15.73 63.39 32a8 8 0 1 0 13.22-9 100.23 100.23 0 0 0-31.43-50.06ZM44 108a36 36 0 1 1 36 36 36 36 0 0 1-36-36Zm206.1 97a8 8 0 0 1-11.07 2 57.13 57.13 0 0 0-52.06 0 8 8 0 0 1-9-13.3 72.55 72.55 0 0 1 33-14.64 40 40 0 1 0-27.93-75 8 8 0 1 1-13.86-8 56 56 0 1 1 77.82 86.1 73.28 73.28 0 0 1 5.13 11.84 8 8 0 0 1-2.03 11Z'/%3E%3C/svg%3E");
}

/* Tareas Icon */
.ph-bold.ph-check-square::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M208 32H48a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16Zm-34.34 77.66l-56 56a8 8 0 0 1-11.32 0l-24-24a8 8 0 0 1 11.32-11.32L112 148.69l50.34-50.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
}

/* Logo Icon */
.ph-bold.ph-circles-three-plus::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%2300BCD4' d='M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm56-88a8 8 0 0 1-8 8h-40v40a8 8 0 0 1-16 0v-40H80a8 8 0 0 1 0-16h40V80a8 8 0 0 1 16 0v40h40a8 8 0 0 1 8 8Z'/%3E%3C/svg%3E");
}

/* Sign Out Icon */
.ph-bold.ph-sign-out::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M120 216a8 8 0 0 1-8 8H48a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h64a8 8 0 0 1 0 16H48v160h64a8 8 0 0 1 8 8Zm109.66-93.66l-40-40a8 8 0 0 0-11.32 11.32L204.69 120H112a8 8 0 0 0 0 16h92.69l-26.35 26.34a8 8 0 0 0 11.32 11.32l40-40a8 8 0 0 0 0-11.32Z'/%3E%3C/svg%3E");
}

/* Sign In Icon */
.ph-bold.ph-sign-in::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%23FFFFFF' d='M141.66 133.66l-40 40a8 8 0 0 1-11.32-11.32L116.69 136H24a8 8 0 0 1 0-16h92.69L90.34 93.66a8 8 0 0 1 11.32-11.32l40 40a8 8 0 0 1 0 11.32ZM192 32h-64a8 8 0 0 0 0 16h64v160h-64a8 8 0 0 0 0 16h64a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16Z'/%3E%3C/svg%3E");
}

/* Plus Icon */
.ph-bold.ph-plus::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%23FFFFFF' d='M224 128a8 8 0 0 1-8 8h-80v80a8 8 0 0 1-16 0v-80H40a8 8 0 0 1 0-16h80V40a8 8 0 0 1 16 0v80h80a8 8 0 0 1 8 8Z'/%3E%3C/svg%3E");
}

/* X (Close) Icon */
.ph-bold.ph-x::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%23424242' d='M208.49 191.51a12 12 0 0 1-17 17L128 145l-63.51 63.49a12 12 0 0 1-17-17L111 128 47.51 64.49a12 12 0 0 1 17-17L128 111l63.51-63.52a12 12 0 0 1 17 17L145 128Z'/%3E%3C/svg%3E");
}

/* Sedes Icon (map-pin) */
.ph-bold.ph-map-pin::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M128 16a96 96 0 1 0 96 96A96.11 96.11 0 0 0 128 16Zm0 56a24 24 0 1 1-24 24 24 24 0 0 1 24-24Zm0 160a88.32 88.32 0 0 1-61.25-24.59C75.8 190.19 99 176 128 176s52.2 14.19 61.25 31.41A88.32 88.32 0 0 1 128 232Z'/%3E%3C/svg%3E");
}

/* Branding Icon (palette) */
.ph-bold.ph-palette::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M200.77 53.89A103.27 103.27 0 0 0 128 24h-1.07A104 104 0 0 0 25 128.75c.46 54.37 45.26 98.75 99.75 99.25H128a104 104 0 0 0 72.77-177.11ZM128 216a88 88 0 1 1 .75-176A88.12 88.12 0 0 1 216 128c0 48.6-39.4 88-88 88Zm16-96a16 16 0 1 1-16-16 16 16 0 0 1 16 16Zm-64-16a16 16 0 1 1-16 16 16 16 0 0 1 16-16Zm0 64a16 16 0 1 1 16-16 16 16 0 0 1-16 16Zm96-32a16 16 0 1 1-16-16 16 16 0 0 1 16 16Z'/%3E%3C/svg%3E");
}

/* ACTIVO: Mantener color blanco */
.nav-item.active .ph-bold::before {
  filter: brightness(0) invert(1);
}

/* ── BRAND DYNAMIC COLORS ─────────────────────────────────────────────── */
/* Estas clases permiten que el color de marca cambie dinámicamente via CSS var */
.brand-stroke { stroke: var(--accent) !important; }
.brand-fill   { fill:   var(--accent) !important; }
.brand-fill-faint { fill: var(--accent) !important; opacity: 0.7; }
.brand-bg     { background: var(--accent) !important; }

/* Botón primario ya usa var(--accent) — se actualiza solo */
/* Nav active item usa var(--accent) — se actualiza solo */

/* ══════════════════════════════════════════════════════════════════════════
   TEMPLATE BUILDER
   ══════════════════════════════════════════════════════════════════════════ */

/* Highlight al hacer scroll al panel de config PDF */
@keyframes tbConfigPulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--accent-rgb, 0,188,212), .4); }
  70%  { box-shadow: 0 0 0 12px rgba(var(--accent-rgb, 0,188,212), 0); }
  100% { box-shadow: none; }
}
.tb-config-highlight {
  animation: tbConfigPulse 1.2s ease-out;
  border-color: var(--accent) !important;
}

.tb-tipo-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}
.tb-tipo-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}
.tb-tipo-icono {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-size: 14px;
  flex-shrink: 0;
}

.tb-campo-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.tb-campo-card:hover { border-color: var(--accent); }
.tb-campo-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.tb-campo-card.dragging { opacity: 0.4; }
.tb-campo-drag {
  cursor: grab;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}
.tb-campo-body { flex: 1; min-width: 0; }
.tb-campo-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.tb-campo-tipo {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.tb-campo-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.tb-campo-required {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

/* PDF Preview page */
.tb-pdf-page {
  background: #fff;
  padding: 40px 50px;
  font-family: 'DM Sans', Arial, sans-serif;
  color: #1a1a1a;
  min-height: 1123px;
}
.tb-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.tb-pdf-logo { max-height: 60px; max-width: 180px; }
.tb-pdf-titulo {
  font-size: 20px;
  font-weight: 700;
  text-align: right;
}
.tb-pdf-footer {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  margin-top: 40px;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
}
.tb-pdf-campo {
  margin-bottom: 16px;
}
.tb-pdf-campo-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6b7280;
  margin-bottom: 4px;
}
.tb-pdf-campo-input {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  min-height: 36px;
  background: #f9fafb;
}
.tb-pdf-campo-firma {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 13px;
  background: #fafafa;
}
.tb-pdf-seccion {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 0 4px;
  margin: 16px 0 8px;
}
.tb-pdf-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Nav superadmin items */
.nav-superadmin {
  opacity: 0.7;
  border-left: 2px solid #F59E0B;
}
.nav-superadmin::after {
  content: 'SA';
  font-size: 9px;
  font-weight: 700;
  background: #F59E0B;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: auto;
}

/* Signature pad */
.firma-pad-container {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  position: relative;
}
.firma-pad-canvas {
  display: block;
  cursor: crosshair;
  width: 100%;
  touch-action: none;
}
.firma-pad-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.firma-hash-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: #D1FAE5;
  color: #065F46;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: monospace;
}

/* Users table */
.badge-rol {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-rol.admin      { background: #EDE9FE; color: #5B21B6; }
.badge-rol.tecnico    { background: #DBEAFE; color: #1D4ED8; }
.badge-rol.viewer     { background: #F3F4F6; color: #6B7280; }
.badge-rol.cliente    { background: #FEF3C7; color: #92400E; }
.badge-rol.superadmin { background: #FCE7F3; color: #9D174D; }
.badge-activo   { background: #D1FAE5; color: #065F46; }
.badge-inactivo { background: #FEE2E2; color: #991B1B; }

/* ════════════════════════════════════════════════════════════════════════
   FIRMA DIGITAL — Modal Crear Sobre (canvas + imagen)
   ════════════════════════════════════════════════════════════════════════ */

/* Canvas de firma en el modal */
#envFirmaCanvas {
  cursor: crosshair;
  touch-action: none;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: #ffffff;
  display: block;
  width: 100%;
  max-height: 160px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#envFirmaCanvas:hover,
#envFirmaCanvas:active {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Radio label tipo firma */
label[id^="envTipoFirma"] {
  transition: all 0.2s ease;
  user-select: none;
}
label[id^="envTipoFirma"]:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Preview imagen firma */
#envFirmaImagenPreview img {
  border: 2px solid var(--accent-light);
  border-radius: 6px;
  padding: 6px;
  background: #fff;
  max-height: 90px;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* Previsualización de firma en modal confirmación */
#fmFirmaPreview img {
  max-height: 60px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════
   EMAIL — Envío masivo de reportes
   ══════════════════════════════════════════════════════════════════════════ */

/* Botón Enviar por correo */
.email-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border, #e5e7eb);
  background: var(--bg, #fff);
  color: var(--text, #374151);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.email-send-btn:hover {
  border-color: var(--accent, #00BCD4);
  color: var(--accent, #00BCD4);
  background: var(--accent-light, #e0f7fa);
}

/* Badge de conteo seleccionados */
.email-sel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent, #00BCD4);
  color: #fff;
  line-height: 1;
}

/* Barra de contexto de cliente (solo superadmin — display manejado por JS) */
.admin-context-bar {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
}
.admin-context-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-context-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  padding: 4px 12px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
}

/* Fila seleccionada en la tabla */
.rep-row-selected {
  background: var(--accent-light, #e0f7fa) !important;
}
.rep-row-selected:hover {
  background: var(--accent-light, #e0f7fa) !important;
  filter: brightness(0.97);
}

/* Checkbox de fila — alineación vertical */
.rep-chk {
  vertical-align: middle;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════════════
   LEAFLET — fix para que los tiles no sean aplastados por CSS del app
   ════════════════════════════════════════════════════════════════════════ */
/* Único override necesario: evitar que max-width:100% comprima los tiles */
.leaflet-container img {
  max-width: none !important;
  max-height: none !important;
}



/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO UBICACIÓN — Mapa en tiempo real de técnicos
   ════════════════════════════════════════════════════════════════════════ */

/* Layout principal: mapa + panel lateral */


/* Evitar scroll de página cuando hay secciones a pantalla completa */
body:has(#sec-ubicacion.active),
body:has(#sec-chat.active) {
  overflow: hidden;
}

/* Ubicación: sin animación de entrada (interfiere con Leaflet) */
#sec-ubicacion.active {
  animation: none !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--bg-secondary, #fafafa);
  margin: 0;
  padding: 0;
}

/* ── Cabecera profesional ── */
.ub-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border, #eee);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ub-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ub-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent, #00BCD4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ub-header-title {
  font-family: var(--font-display, sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -.01em;
}
.ub-header-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}
.ub-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Botones de capa (Técnicos / Reportes) en la cabecera */
.ub-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ub-toggle-btn.activo {
  background: var(--accent-light, #e0f7fa);
  border-color: var(--accent, #00BCD4);
  color: var(--accent, #00acc1);
}
.ub-toggle-btn.inactivo {
  background: var(--bg-secondary, #f4f6f8);
  border-color: var(--border, #eee);
  color: var(--text-secondary, #9ca3af);
}
.ub-toggle-btn:hover { filter: brightness(.96); }
/* Botón Actualizar (icono solo) */
.ub-refresh-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border, #eee);
  background: var(--bg-card, #fff);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ub-refresh-btn:hover {
  background: var(--accent-light, #e0f7fa);
  color: var(--accent, #00BCD4);
}
/* .ub-layout es el bloque que contiene mapa + barra lateral */
.ub-layout {
  flex: 1;
  min-height: 0;
  position: relative;   /* containing block para mapa y sidebar absolutos */
  overflow: hidden;
  background: var(--bg-card, #fff);
}
/* Mapa Leaflet: ocupa todo excepto los 268px de la sidebar */
.ub-mapa {
  position: absolute;
  top: 0;
  left: 0;
  right: 268px;
  bottom: 0;
  overflow: hidden;
}
/* Controles flotantes sobre el mapa */
.ub-mapa-controles {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ub-ctrl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.ub-ctrl-btn:active { transform: scale(.97); }
.ub-ctrl-btn.activo { opacity: 1; }
.ub-ctrl-btn.inactivo { opacity: .45; }
.ub-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 268px;
  bottom: 0;
  background: var(--bg-card, #fff);
  border-left: 1px solid var(--border, #e5e7eb);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
}
.ub-sidebar-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.ub-panel {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.ub-tec-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border, #f0f0f0);
  transition: background .15s;
}
.ub-tec-card:hover {
  background: var(--bg-secondary, #f8fafc);
}
.ub-tec-card:last-child { border-bottom: none; }
.ub-ini {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a7f7f;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}
.ub-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid #22c55e;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  position: relative;
}
.ub-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.ub-rep-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(59,130,246,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ub-rep-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #ef4444;
  border: 1.5px solid #fff;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}
.ub-leyenda {
  padding: 12px 14px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.ub-ley-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-secondary, #6b7280);
}
.ub-ley-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ub-sede-marker {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #8b5cf6;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* Mobile — apila mapa arriba y sidebar abajo */
@media (max-width: 700px) {
  .ub-layout  { position: relative; }
  .ub-mapa    { position: relative; height: 300px; right: 0; }
  .ub-sidebar { position: relative; width: 100%; height: 260px;
                border-left: none; border-top: 1px solid var(--border); }
}

/* ══════════════════════════════════════════════════════════════════════════
   TAREAS — Tabs Activas / Historial
   ════════════════════════════════════════════════════════════════════════ */

.tareas-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border, #e5e7eb);
  margin-bottom: 16px;
}
.tareas-tab {
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tareas-tab:hover { color: var(--accent, #00BCD4); }
.tareas-tab.activa-tab {
  color: var(--accent, #00BCD4);
  border-bottom-color: var(--accent, #00BCD4);
}
.tareas-tab.historial-tab.activa-tab {
  color: #16a34a;
  border-bottom-color: #16a34a;
}
.tareas-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent, #00BCD4);
  color: #fff;
  line-height: 1;
}
.tareas-tab.historial-tab .tareas-tab-badge {
  background: #16a34a;
}
/* Tarjeta completada — estilo verde */
.tarea-card-completada {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}
.tarea-card-completada:hover {
  border-color: #4ade80 !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO CHAT — Mensajería en tiempo real
   ════════════════════════════════════════════════════════════════════════ */

/* Layout principal: lista izquierda + conversación derecha */
#sec-chat.active {
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 280px);
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--bg-card, #fff);
  margin: 0;
  padding: 0;
}
.chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0;
}

/* ── Panel izquierdo ── */
.chat-left {
  width: 290px;
  min-width: 250px;
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
}
.chat-left-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 10px;
  flex-shrink: 0;
}
.chat-left-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #111);
}
.chat-new-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  transition: background .15s, color .15s;
}
.chat-new-btn:hover { background: var(--accent-light, #e0f7fa); color: var(--accent, #00BCD4); }
.chat-search-wrap { padding: 0 10px 8px; flex-shrink: 0; }
.chat-search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 11px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-secondary, #f8fafc);
  outline: none;
  color: var(--text-primary, #111);
}
.chat-search:focus { border-color: var(--accent, #00BCD4); }
.chat-lista { flex: 1; overflow-y: auto; min-height: 0; }
.chat-lista-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.6;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border, #f0f0f0);
  cursor: pointer;
  transition: background .12s;
}
.chat-item:hover  { background: var(--bg-secondary, #f8fafc); }
.chat-item.activo { background: var(--accent-light, #e0f7fa); }
.chat-item:last-child { border-bottom: none; }

/* ── Panel derecho ── */
.chat-right {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #f8fafc);
  position: relative;
}
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* ── Área de mensajes ── */
.chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.chat-msg-loading {
  text-align: center;
  color: var(--text-secondary, #6b7280);
  font-size: 13px;
  padding: 32px 0;
}
.chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.chat-msg-row.propio  { flex-direction: row-reverse; }
.chat-msg-grupo { display: flex; flex-direction: column; max-width: 68%; }
.chat-msg-row.propio .chat-msg-grupo { align-items: flex-end; }
.chat-msg-nombre {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 3px;
  padding: 0 4px;
}
.chat-burbuja {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px 14px 14px 3px;
  padding: 9px 13px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  word-break: break-word;
}
.chat-burbuja.propio {
  background: var(--accent, #00BCD4);
  border-color: transparent;
  border-radius: 14px 14px 3px 14px;
  color: #fff;
}
.chat-burbuja-texto { font-size: 13px; line-height: 1.5; }
.chat-hora {
  font-size: 10px;
  opacity: .6;
  margin-top: 4px;
  text-align: right;
}
.chat-burbuja-img img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
}
.chat-burbuja-archivo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 180px;
  max-width: 240px;
}
.chat-burbuja.propio .chat-hora  { color: rgba(255,255,255,.7); }

/* ── Input de mensaje ── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13px;
  resize: none;
  outline: none;
  line-height: 1.4;
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-primary, #111);
  font-family: inherit;
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
}
.chat-input:focus { border-color: var(--accent, #00BCD4); background: var(--bg-card, #fff); }
.chat-attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border, #e5e7eb);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.chat-attach-btn:hover { background: var(--accent-light, #e0f7fa); color: var(--accent, #00BCD4); border-color: var(--accent, #00BCD4); }
.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent, #00BCD4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  box-shadow: 0 2px 6px rgba(0,188,212,.3);
}
.chat-send-btn:hover  { background: var(--accent-hover, #0097a7); }
.chat-send-btn:active { transform: scale(.93); }

/* ── Modal overlay genérico (usado por chat y otros módulos dinámicos) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(66, 66, 66, 0.55);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
.modal-box {
  background: var(--bg-card, #fff);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.22s cubic-bezier(.4,0,.2,1);
}
.modal-box .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border, #eee);
}
.modal-box .modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #111);
  margin: 0;
}
.modal-box .modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--bg-secondary, #f4f6f8);
  color: var(--text-secondary, #6b7280);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.modal-box .modal-close:hover { background: var(--border, #eee); }
.modal-box .modal-body  { padding: 16px 20px; }
.modal-box .modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border, #eee);
}

/* ── Hover photo preview tooltip ── */
#orbitaFotoPreview {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: #111827;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  border: 2px solid rgba(255,255,255,.12);
  display: none;
  transition: opacity .15s ease;
}
#orbitaFotoPreview img {
  display: block;
  max-width: 280px;
  max-height: 220px;
  border-radius: 8px;
  object-fit: contain;
}
.orbita-foto-thumb {
  cursor: zoom-in;
  transition: transform .15s, box-shadow .15s;
}
.orbita-foto-thumb:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}

/* ── Modal nuevo chat ── */
.chat-modal-usuarios {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--bg-card, #fff);
}

/* ── Chat Mobile — panel deslizante estilo WhatsApp ─────────────────── */
@media (max-width: 768px) {

  /* El layout ocupa exactamente el espacio disponible */
  .chat-layout {
    flex-direction: row;
    position: relative;
    overflow: hidden;
    height: 100%;
  }

  /* Panel lista: ocupa 100% de ancho, se oculta cuando hay chat abierto */
  .chat-left {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-right: none;
    border-bottom: none;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
    transform: translateX(0);
    z-index: 2;
    min-width: 0;
  }

  /* Panel conversación: ocupa 100% de ancho, empieza oculto a la derecha */
  .chat-right {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
    z-index: 3;
  }

  /* Cuando hay una conversación abierta: deslizar */
  .chat-layout.conv-abierta .chat-left  { transform: translateX(-100%); }
  .chat-layout.conv-abierta .chat-right { transform: translateX(0); }

  /* Botón volver — solo visible en mobile cuando hay conv abierta */
  .chat-back-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--accent, #00BCD4);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 4px 0 0;
    flex-shrink: 0;
  }
}

/* Ocultar botón volver en desktop */
@media (min-width: 769px) {
  .chat-back-btn { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SUSCRIPCIONES — Badges, Plan Cards, Tabla
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Badges de plan ──────────────────────────────────────────────────── */
.sub-badge-plan {
  display:        inline-block;
  padding:        3px 10px;
  border-radius:  99px;
  font-size:      12px;
  font-weight:    700;
  letter-spacing: .3px;
  white-space:    nowrap;
}

/* ── Badges de estado ────────────────────────────────────────────────── */
.sub-badge-status {
  display:        inline-block;
  padding:        3px 10px;
  border-radius:  99px;
  font-size:      12px;
  font-weight:    600;
  white-space:    nowrap;
}

/* ── Plan cards (selector visual) ───────────────────────────────────── */
.plan-card {
  cursor:         pointer;
  border-radius:  12px;
  padding:        16px;
  text-align:     center;
  transition:     border-color 0.15s, background 0.15s, transform 0.1s;
  user-select:    none;
}
.plan-card:hover {
  transform:      translateY(-2px);
  box-shadow:     0 4px 12px rgba(0,0,0,0.1);
}
.plan-card.selected {
  box-shadow:     0 0 0 2px currentColor;
}

/* ── Trial banner ────────────────────────────────────────────────────── */
#trialBanner {
  display:        none;
  align-items:    center;
  gap:            12px;
  background:     #FEF3C7;
  border-bottom:  2px solid #F59E0B;
  padding:        10px 24px;
  font-size:      13px;
  color:          #92400E;
  flex-shrink:    0;
  position:       sticky;
  top:            0;
  z-index:        100;
}

/* ── Blocked screen ──────────────────────────────────────────────────── */
#planBlockedScreen {
  display:        none;
  position:       fixed;
  inset:          0;
  background:     rgba(0,0,0,0.75);
  z-index:        9000;
  align-items:    center;
  justify-content:center;
}

/* ── Sub eval banner ─────────────────────────────────────────────────── */
#subsEvalBanner {
  display:        none;
  align-items:    center;
  gap:            10px;
  background:     #FEF3C7;
  border:         1px solid #F59E0B;
  border-radius:  8px;
  padding:        10px 16px;
  margin-bottom:  16px;
  font-size:      13px;
  color:          #92400E;
}

/* ── Responsive plan cards ───────────────────────────────────────────── */
@media (max-width: 600px) {
  #nTenantPlanSelector,
  #eSubPlanSelector {
    grid-template-columns: 1fr;
  }
  #nTenantFeaturesDesc,
  #eSubFeaturesDesc {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓDULO INDUCCIÓN EXPRESS
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tabs de sección ─────────────────────────────────────────────────────── */
.ind-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.ind-tab:hover   { color: var(--text-primary); }
.ind-tab.active  { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tarjetas de puestos ─────────────────────────────────────────────────── */
.ind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.ind-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 14px;
  padding: 20px;
  transition: box-shadow 0.15s;
}
.ind-card:hover { box-shadow: var(--shadow-md); }

.ind-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.ind-badge-ok  { background: #D1FAE5; color: #065F46; }
.ind-badge-off { background: #F3F4F6; color: #6B7280; }

.ind-stat {
  background: var(--gray-bg, #fafafa);
  border-radius: 8px;
  padding: 8px 12px;
}
.ind-stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 2px; }
.ind-stat-val   { font-size: 14px; font-weight: 700; }

/* ── Estado vacío ────────────────────────────────────────────────────────── */
.ind-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.ind-empty h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.ind-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Panel de configuración del certificado ──────────────────────────────── */
.ind-config-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.ind-config-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text-primary);
}

/* ── Zona de carga de imágenes ───────────────────────────────────────────── */
.ind-upload-zone {
  border: 2px dashed var(--border-color, #e5e7eb);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.ind-upload-zone:hover {
  border-color: var(--accent);
  background-color: var(--accent-light, #E0F7FA);
}

/* ── Toggle de Inducción en tabla superadmin ─────────────────────────────── */
.ind-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ind-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.ind-toggle input { display: none; }
.ind-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 99px;
  transition: background 0.2s;
}
.ind-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ind-toggle input:checked + .ind-toggle-slider { background: #00BCD4; }
.ind-toggle input:checked + .ind-toggle-slider::before { transform: translateX(18px); }

@media (max-width: 768px) {
  .ind-grid { grid-template-columns: 1fr; }
  #ind-content > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — iPhone / Samsung / Motorola
   Breakpoints: 768px (tablet), 480px (phone)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── TOPBAR MÓVIL ─────────────────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 300;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.mobile-topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.mobile-topbar-brand span {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── HAMBURGER BUTTON ─────────────────────────────────────────────────── */
.mobile-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mobile-hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.mobile-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── SIDEBAR OVERLAY ──────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   BREAKPOINT 768px — Tablets y móviles grandes
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Mostrar topbar móvil */
  .mobile-topbar { display: flex; }

  /* App container: columna en vez de fila */
  .app-container {
    flex-direction: column;
    padding-top: 56px; /* espacio para topbar fija */
  }

  /* Sidebar: drawer lateral */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    z-index: 200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
  }

  /* Contenido principal: ancho completo */
  .main-content {
    padding: 16px 12px;
    min-height: calc(100dvh - 56px);
    overflow-x: hidden;
  }

  /* Page header: compacto */
  .page-header {
    padding: 16px;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .page-header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Botones: touch-friendly (min 44px) */
  .btn-primary, .btn-secondary {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
  }

  /* Form controls: touch-friendly */
  .form-control, select, input[type="text"],
  input[type="email"], input[type="number"],
  input[type="date"], textarea {
    min-height: 44px;
    font-size: 16px !important; /* evita zoom en iOS */
  }

  /* Tablas: scroll horizontal */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 600px;
  }

  .data-table th, .data-table td {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Filtros: wrap en mobile */
  .filtros-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .filtro-input, .filtro-select, .filtro-date {
    min-width: 0;
    flex: 1 1 140px;
    height: 44px;
    font-size: 16px !important; /* evita zoom en iOS */
  }

  .filtro-group {
    flex: 1 1 auto;
  }

  .filtro-fecha-group {
    flex-wrap: wrap;
  }

  /* Modales: full-screen en móvil */
  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    animation: slideUpModal 0.3s cubic-bezier(0.4,0,0.2,1);
  }

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

  .modal-header {
    padding: 18px 20px;
  }

  .modal form {
    padding: 18px 20px;
  }

  /* Form rows: siempre 1 columna */
  .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Stats grid: 2 columnas */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Cards */
  .stat-card { padding: 16px; }

  /* Page header actions: stack vertical */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Grids de configuración: 1 columna */
  .branding-layout,
  .ind-grid,
  .charts-grid { grid-template-columns: 1fr !important; }

  /* Acciones en tabla: icono touch más grande */
  .acciones-cell { gap: 8px; }
  .btn-tabla { min-width: 36px; min-height: 36px; }

  /* Chat: corregir left fijo */
  #sec-chat.active {
    left: 0 !important;
    top: 56px !important;
    height: calc(100dvh - 56px) !important;
  }

  /* Secciones de inducción */
  .ind-config-section { padding: 14px; }

  /* Ocultar texto de etiquetas largas en nav item activo */
  .superadmin-tenant-selector-wrap { padding: 8px 10px 4px; }

  /* Tenant selector en sidebar: más compacto */
  #superadminTenantSelector { padding: 8px 12px; }
  #ctxTenantSelect { font-size: 13px; }

  /* Firma y mapeo: 1 columna */
  .firma-stats-row { grid-template-columns: repeat(2, 1fr); }
  .import-mapeo-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   BREAKPOINT 480px — Teléfonos pequeños (SE, Moto G, Galaxy A)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  .main-content { padding: 12px 8px; }

  .page-header { padding: 14px 12px; }
  .page-header h1 { font-size: 18px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-card .stat-value { font-size: 28px; }

  /* Tablas aún más compactas */
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }

  /* Botones full-width en formularios */
  .modal form .btn-primary,
  .modal form .btn-secondary { width: 100%; justify-content: center; }

  /* Firma stats: 1 columna */
  .firma-stats-row { grid-template-columns: 1fr; }

  /* Filtros fecha: stack */
  .filtro-fecha-group { flex-direction: column; align-items: flex-start; }
  .filtro-date { width: 100%; }

  /* Login */
  .login-card { padding: 32px 20px; }
  .login-logo span { font-size: 28px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SAFE AREA — iPhone con notch / Dynamic Island
   ══════════════════════════════════════════════════════════════════════════ */
@supports (padding: env(safe-area-inset-top)) {
  .mobile-topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
  }
  @media (max-width: 768px) {
    .app-container { padding-top: calc(56px + env(safe-area-inset-top)); }
    .sidebar {
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
    }
    #sec-chat.active { top: calc(56px + env(safe-area-inset-top)) !important; }
    /* Área de input del chat: no queda bajo el home indicator en iPhone */
    .chat-input-area {
      padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    /* Modales: no quedan bajo el home indicator */
    .modal-content {
      padding-bottom: env(safe-area-inset-bottom);
    }
    /* Main content: no se corta por el home indicator */
    .main-content {
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
  }
}

/* ── Touch improvements ───────────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  /* Quitar hover states en touch (evitan estados "pegados") */
  .nav-item:hover { background: transparent; color: rgba(255,255,255,0.7); border-color: transparent; }
  .nav-item.active { background: var(--accent) !important; color: #fff !important; }
  .btn-primary:hover { filter: none; }
  .data-table tbody tr:hover { background: transparent; }

  /* Tap highlight */
  * { -webkit-tap-highlight-color: transparent; }
  button, a, [role="button"] { touch-action: manipulation; }
}

/* ── GPU compositing: sidebar + modales + toast en su propia capa ─────── */
.sidebar          { will-change: transform; }
.modal-overlay    { will-change: opacity; }
.modal-content    { will-change: transform, opacity; }
#toast-container  { will-change: transform; }
.toast            { will-change: opacity, transform; }

/* ── content-visibility: renderizar solo secciones visibles ──────────── */
.section-content:not(.active) {
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}

/* ── prefers-reduced-motion: respetar configuración de accesibilidad ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .sk-line, .sk-chart {
    animation: none;
    background: #e8e8e8;
  }
  .optimistic-pending  { animation: none; opacity: 1; transform: none; }
  .optimistic-deleting { animation: none; opacity: 0.3; }
}


/* ══════════════════════════════════════════════════════════════════════════
   SKELETON LOADERS — Placeholders animados mientras cargan datos
   ══════════════════════════════════════════════════════════════════════════ */

/* Animación shimmer base */
@keyframes sk-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.sk-line {
  display: inline-block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 600px 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

.sk-line--lg  { height: 28px; border-radius: 8px; }
.sk-line--xl  { height: 40px; border-radius: 10px; }

/* Fila skeleton en tabla — sin hover ni border */
.sk-row td    { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.sk-row:hover { background: transparent !important; }

/* Skeleton para gráficos */
.sk-chart {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  background: linear-gradient(90deg,
    #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 600px 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

/* Skeleton para stat-card value */
.stat-card .sk-line--lg {
  display: block;
  width: 40%;
  height: 36px;
  margin: 8px 0;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .sk-line, .sk-chart {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 600px 100%;
  }
}


/* ══════════════════════════════════════════════════════════════════════════
   OPTIMISTIC UI — Estados visuales para acciones en vuelo
   ══════════════════════════════════════════════════════════════════════════ */

/* Fila recién añadida de forma optimista — pulso sutil */
@keyframes optimistic-pulse {
  0%   { opacity: 0.5; transform: translateX(-4px); }
  100% { opacity: 1;   transform: translateX(0);    }
}

.optimistic-pending {
  animation: optimistic-pulse 0.25s ease-out forwards;
  background: rgba(0, 188, 212, 0.06) !important;
  border-left: 3px solid var(--accent);
}

/* Fila confirmada por el servidor — flash verde */
@keyframes optimistic-confirm-flash {
  0%   { background: rgba(76, 175, 80, 0.18); }
  100% { background: transparent; }
}

.optimistic-confirmed {
  animation: optimistic-confirm-flash 0.6s ease-out forwards;
}

/* Fila en proceso de eliminación */
@keyframes optimistic-delete-out {
  0%   { opacity: 1;   max-height: 60px; }
  100% { opacity: 0;   max-height: 0;    overflow: hidden; }
}

.optimistic-deleting {
  animation: optimistic-delete-out 0.2s ease-in forwards;
  pointer-events: none;
}

/* Fila con error de rollback — flash rojo */
@keyframes optimistic-error-flash {
  0%   { background: rgba(244, 67, 54, 0.18); }
  100% { background: transparent; }
}

.optimistic-error {
  animation: optimistic-error-flash 0.6s ease-out forwards;
}


/* ══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS — Micro-notificaciones flotantes
   ══════════════════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  max-width: 320px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  background: #374151;
}

.toast--visible  { opacity: 1; transform: translateX(0); }
.toast--hiding   { opacity: 0; transform: translateX(20px); }

.toast--success  { background: #065f46; border-left: 3px solid #10b981; }
.toast--error    { background: #7f1d1d; border-left: 3px solid #ef4444; }
.toast--warning  { background: #78350f; border-left: 3px solid #f59e0b; }
.toast--info     { background: #1e3a5f; border-left: 3px solid var(--accent); }

.toast__icon { font-size: 15px; flex-shrink: 0; }
.toast__msg  { line-height: 1.4; }

@media (max-width: 480px) {
  #toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
  .toast { max-width: 100%; }
}
