/* ═══════════════════════════════════════════════════════════════
   SegúriRed — Sistema (admin + portal)
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --brand-600: #1A3A6B;
  --brand-500: #2E6DA4;
  --brand-400: #5B92DF;
  --brand-100: #D6E4F7;
  --brand-50:  #EBF2FB;

  --gray-900: #111827; --gray-800: #1F2937; --gray-700: #374151;
  --gray-600: #4B5563; --gray-500: #6B7280; --gray-400: #9CA3AF;
  --gray-300: #D1D5DB; --gray-200: #E5E7EB; --gray-100: #F3F4F6;
  --gray-50:  #F9FAFB; --white: #FFFFFF;

  --green-600: #16A34A; --green-100: #DCFCE7; --green-800: #166534;
  --red-600:   #DC2626; --red-100:   #FEE2E2; --red-800:   #991B1B;
  --yellow-500:#EAB308; --yellow-100:#FEF9C3; --yellow-800:#854D0E;
  --orange-500:#F97316; --orange-100:#FFEDD5; --orange-800:#9A3412;
  --blue-500:  #3B82F6; --blue-100:  #DBEAFE; --blue-800:  #1E40AF;

  --sidebar-w: 240px;
  --header-h:  60px;
  --radius:    8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --transition: 180ms ease;
  --font: 'Inter', system-ui, sans-serif;
}

html { font-size: 15px; }
body { font-family: var(--font); color: var(--gray-700); background: var(--gray-100); -webkit-font-smoothing: antialiased; }
a    { color: inherit; text-decoration: none; }
img  { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Layout principal ─────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--brand-600);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 50;
  transition: transform var(--transition);
}
.sidebar__logo {
  display: flex; align-items: center; gap: .5rem;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1);
  font-size: 1.1rem; font-weight: 700; color: var(--white); flex-shrink: 0;
}
.sidebar__logo span { color: var(--brand-400); }
.sidebar__user {
  padding: .9rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: .65rem;
}
.sidebar__avatar {
  width: 34px; height: 34px; background: var(--brand-500);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: .75rem; font-weight: 700;
  color: var(--white); flex-shrink: 0;
}
.sidebar__user-info { min-width: 0; }
.sidebar__user-name { font-size: .82rem; font-weight: 600; color: var(--white); truncate: ellipsis; overflow: hidden; white-space: nowrap; }
.sidebar__user-rol  { font-size: .72rem; color: var(--brand-200, #ADC9EF); }

.sidebar__nav { padding: .75rem 0; flex: 1; }
.sidebar__section-label {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,255,255,.4);
  padding: .75rem 1.25rem .25rem;
}
.sidebar__nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1.25rem; font-size: .85rem; font-weight: 500;
  color: rgba(255,255,255,.75);
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}
.sidebar__nav a:hover { background: rgba(255,255,255,.08); color: var(--white); }
.sidebar__nav a.active {
  background: rgba(255,255,255,.12); color: var(--white);
  border-left-color: var(--brand-400);
}
.sidebar__nav a .icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar__footer {
  padding: .75rem 1.25rem; border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar__footer a {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; color: rgba(255,255,255,.6);
  transition: color var(--transition);
}
.sidebar__footer a:hover { color: var(--white); }

/* Área de contenido */
.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}

/* Header de página */
.page-header {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: .9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 40;
}
.page-header__left h1 { font-size: 1.1rem; font-weight: 600; color: var(--gray-900); }
.page-header__left .breadcrumb { font-size: .75rem; color: var(--gray-400); margin-top: 1px; }
.page-header__actions { display: flex; align-items: center; gap: .6rem; }

/* Área de contenido inner */
.content { padding: 1.5rem; flex: 1; }

/* ── Cards y estadísticas ─────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
}
.card__header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card__header h2 { font-size: .95rem; font-weight: 600; color: var(--gray-900); }
.card__body  { padding: 1.25rem; }
.card__footer {
  padding: .75rem 1.25rem; border-top: 1px solid var(--gray-200);
  background: var(--gray-50); border-radius: 0 0 var(--radius) var(--radius);
}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-card__icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-card__icon--blue   { background: var(--blue-100);   }
.stat-card__icon--green  { background: var(--green-100);  }
.stat-card__icon--yellow { background: var(--yellow-100); }
.stat-card__icon--red    { background: var(--red-100);    }
.stat-card__label { font-size: .78rem; color: var(--gray-500); margin-bottom: .2rem; }
.stat-card__value { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); line-height: 1; }

/* ── Tablas ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.sr-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sr-table th {
  background: var(--gray-50); text-align: left;
  padding: .65rem 1rem; font-size: .75rem; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
.sr-table td {
  padding: .75rem 1rem; border-bottom: 1px solid var(--gray-100);
  vertical-align: middle; color: var(--gray-700);
}
.sr-table tr:last-child td { border-bottom: none; }
.sr-table tr:hover td { background: var(--gray-50); }
.sr-table .td-actions { display: flex; gap: .4rem; align-items: center; }

/* ── Formularios ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; font-size: .82rem; font-weight: 500;
  color: var(--gray-700); margin-bottom: .4rem;
}
.form-label .req { color: var(--red-600); }
.form-control {
  width: 100%; padding: .6rem .85rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .9rem; color: var(--gray-900); background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(91,146,223,.15);
}
.form-control.is-invalid { border-color: var(--red-600); }
.form-error { font-size: .78rem; color: var(--red-600); margin-top: .3rem; }
.form-hint  { font-size: .78rem; color: var(--gray-400); margin-top: .3rem; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: var(--radius);
  font-size: .85rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700, #142D54); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-300); }
.btn-success { background: var(--green-600); color: var(--white); }
.btn-success:hover:not(:disabled) { background: #15803D; }
.btn-danger  { background: var(--red-600); color: var(--white); }
.btn-danger:hover:not(:disabled)  { background: #B91C1C; }
.btn-outline {
  background: transparent; border-color: var(--gray-300); color: var(--gray-700);
}
.btn-outline:hover:not(:disabled) { border-color: var(--brand-400); color: var(--brand-600); background: var(--brand-50); }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-icon { padding: .4rem; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .65rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
}
.badge-green  { background: var(--green-100);  color: var(--green-800);  }
.badge-red    { background: var(--red-100);    color: var(--red-800);    }
.badge-yellow { background: var(--yellow-100); color: var(--yellow-800); }
.badge-orange { background: var(--orange-100); color: var(--orange-800); }
.badge-blue   { background: var(--blue-100);   color: var(--blue-800);   }
.badge-gray   { background: var(--gray-100);   color: var(--gray-500);   }

/* ── Alertas flash ───────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem; border-radius: var(--radius);
  font-size: .88rem; margin-bottom: 1.25rem;
  display: flex; align-items: flex-start; gap: .65rem;
}
.alert-success { background: var(--green-100); color: var(--green-800); border: 1px solid #BBF7D0; }
.alert-error   { background: var(--red-100);   color: var(--red-800);   border: 1px solid #FECACA; }
.alert-warning { background: var(--yellow-100);color: var(--yellow-800);border: 1px solid #FEF08A; }
.alert-info    { background: var(--blue-100);  color: var(--blue-800);  border: 1px solid #BFDBFE; }

/* ── Paginación ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius);
  font-size: .82rem; border: 1px solid var(--gray-200);
  color: var(--gray-600); transition: background var(--transition);
}
.pagination a:hover { background: var(--brand-50); color: var(--brand-600); }
.pagination .active { background: var(--brand-600); color: var(--white); border-color: var(--brand-600); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Modales ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: 12px;
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal__header {
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal__header h3 { font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.modal__body   { padding: 1.25rem; }
.modal__footer {
  padding: .9rem 1.25rem; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: .6rem;
}

/* ── Página de login ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--gray-100); padding: 1.5rem;
}
.login-card {
  background: var(--white); border-radius: 12px;
  box-shadow: var(--shadow-md); width: 100%; max-width: 400px;
  overflow: hidden;
}
.login-card__header {
  background: var(--brand-600); padding: 2rem 2rem 1.5rem;
  text-align: center;
}
.login-card__logo {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-size: 1.3rem; font-weight: 700; color: var(--white); margin-bottom: .4rem;
}
.login-card__logo span { color: var(--brand-400); }
.login-card__subtitle { font-size: .82rem; color: rgba(255,255,255,.7); }
.login-card__body { padding: 1.75rem 2rem; }
.login-card__footer {
  padding: 1rem 2rem 1.5rem; text-align: center;
  font-size: .8rem; color: var(--gray-400);
}
.login-card__footer a { color: var(--brand-500); }

/* ── Filtros y búsqueda ──────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.search-input {
  flex: 1; min-width: 200px; max-width: 320px;
  padding: .55rem .85rem .55rem 2.2rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .88rem; background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239CA3AF' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat .7rem center;
  outline: none; transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--brand-400); }

/* ── Avatar de texto ─────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-600);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 1rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════════════
   MODO OSCURO — SegúriRed System
   Activado agregando class="dark-mode" al elemento <html>
   ═══════════════════════════════════════════════════════════════ */

:root.dark-mode {
  /* Fondos */
  --dm-bg:        #0F172A;
  --dm-surface:   #1E293B;
  --dm-surface2:  #253148;
  --dm-sidebar:   #0B1220;

  /* Bordes */
  --dm-border:    #334155;
  --dm-border2:   #475569;

  /* Texto */
  --dm-text:      #E2E8F0;
  --dm-text-mid:  #94A3B8;
  --dm-text-soft: #64748B;

  /* Marca */
  --dm-brand:     #3B82F6;
  --dm-brand2:    #60A5FA;
  --dm-accent:    #1E3A5F;

  /* Badges */
  --dm-green-bg:  #14532D; --dm-green-t:  #86EFAC;
  --dm-red-bg:    #450A0A; --dm-red-t:    #FCA5A5;
  --dm-yellow-bg: #422006; --dm-yellow-t: #FDE68A;
  --dm-orange-bg: #431407; --dm-orange-t: #FDBA74;
  --dm-blue-bg:   #1E3A5F; --dm-blue-t:   #93C5FD;
  --dm-gray-bg:   #1E293B; --dm-gray-t:   #94A3B8;

  /* Input */
  --dm-input-bg:  #0F172A;
}

/* ── Body y layout ─────────────────────────────────────────────── */
html.dark-mode body          { background: var(--dm-bg); color: var(--dm-text); }
html.dark-mode .main-content { background: var(--dm-bg); }
html.dark-mode .content      { background: var(--dm-bg); }

/* ── Sidebar ───────────────────────────────────────────────────── */
html.dark-mode .sidebar { background: var(--dm-sidebar); }

/* ── Page header ───────────────────────────────────────────────── */
html.dark-mode .page-header {
  background: var(--dm-surface);
  border-bottom-color: var(--dm-border);
}
html.dark-mode .page-header__left h1    { color: var(--dm-text); }
html.dark-mode .page-header__left .breadcrumb { color: var(--dm-text-soft); }

/* ── Cards ─────────────────────────────────────────────────────── */
html.dark-mode .card {
  background: var(--dm-surface);
  border-color: var(--dm-border);
}
html.dark-mode .card__header {
  border-bottom-color: var(--dm-border);
}
html.dark-mode .card__header h2 { color: var(--dm-text); }
html.dark-mode .card__body      { color: var(--dm-text-mid); }
html.dark-mode .card__footer {
  background: var(--dm-surface2);
  border-top-color: var(--dm-border);
}

/* ── Stats ─────────────────────────────────────────────────────── */
html.dark-mode .stat-card {
  background: var(--dm-surface);
  border-color: var(--dm-border);
}
html.dark-mode .stat-card__label { color: var(--dm-text-soft); }
html.dark-mode .stat-card__value { color: var(--dm-text); }

/* ── Tablas ─────────────────────────────────────────────────────── */
html.dark-mode .sr-table th {
  background: var(--dm-bg);
  color: var(--dm-text-soft);
  border-bottom-color: var(--dm-border);
}
html.dark-mode .sr-table td {
  color: var(--dm-text-mid);
  border-bottom-color: var(--dm-border2);
}
html.dark-mode .sr-table tr:hover td { background: var(--dm-surface2); }

/* ── Formularios ────────────────────────────────────────────────── */
html.dark-mode .form-label  { color: var(--dm-text-mid); }
html.dark-mode .form-hint   { color: var(--dm-text-soft); }
html.dark-mode .form-control {
  background: var(--dm-input-bg);
  border-color: var(--dm-border2);
  color: var(--dm-text);
}
html.dark-mode .form-control:focus {
  border-color: var(--dm-brand);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
html.dark-mode select.form-control option { background: var(--dm-surface); }

/* ── Botones ─────────────────────────────────────────────────────── */
html.dark-mode .btn-primary  { background: var(--dm-brand); }
html.dark-mode .btn-primary:hover:not(:disabled) { background: #2563EB; }
html.dark-mode .btn-secondary { background: var(--dm-surface2); color: var(--dm-text-mid); }
html.dark-mode .btn-secondary:hover:not(:disabled) { background: var(--dm-border); }
html.dark-mode .btn-outline {
  border-color: var(--dm-border2);
  color: var(--dm-text-mid);
  background: transparent;
}
html.dark-mode .btn-outline:hover:not(:disabled) {
  border-color: var(--dm-brand);
  color: var(--dm-brand2);
  background: var(--dm-accent);
}

/* ── Badges ─────────────────────────────────────────────────────── */
html.dark-mode .badge-green  { background: var(--dm-green-bg);  color: var(--dm-green-t);  }
html.dark-mode .badge-red    { background: var(--dm-red-bg);    color: var(--dm-red-t);    }
html.dark-mode .badge-yellow { background: var(--dm-yellow-bg); color: var(--dm-yellow-t); }
html.dark-mode .badge-orange { background: var(--dm-orange-bg); color: var(--dm-orange-t); }
html.dark-mode .badge-blue   { background: var(--dm-blue-bg);   color: var(--dm-blue-t);   }
html.dark-mode .badge-gray   { background: var(--dm-gray-bg);   color: var(--dm-gray-t);   }

/* ── Alertas ─────────────────────────────────────────────────────── */
html.dark-mode .alert-success { background: var(--dm-green-bg);  color: var(--dm-green-t);  border-color: #166534; }
html.dark-mode .alert-error   { background: var(--dm-red-bg);    color: var(--dm-red-t);    border-color: #7F1D1D; }
html.dark-mode .alert-warning { background: var(--dm-yellow-bg); color: var(--dm-yellow-t); border-color: #78350F; }
html.dark-mode .alert-info    { background: var(--dm-blue-bg);   color: var(--dm-blue-t);   border-color: #1E40AF; }

/* ── Modales ─────────────────────────────────────────────────────── */
html.dark-mode .modal-overlay { background: rgba(0,0,0,.65); }
html.dark-mode .modal {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
}
html.dark-mode .modal__header {
  border-bottom-color: var(--dm-border);
}
html.dark-mode .modal__header h3 { color: var(--dm-text); }
html.dark-mode .modal__footer {
  border-top-color: var(--dm-border);
  background: var(--dm-surface2);
}

/* ── Filtros ─────────────────────────────────────────────────────── */
html.dark-mode .search-input {
  background: var(--dm-input-bg);
  border-color: var(--dm-border2);
  color: var(--dm-text);
}

/* ── Paginación ──────────────────────────────────────────────────── */
html.dark-mode .pagination a,
html.dark-mode .pagination span {
  background: var(--dm-surface);
  border-color: var(--dm-border);
  color: var(--dm-text-mid);
}
html.dark-mode .pagination a:hover { background: var(--dm-accent); color: var(--dm-brand2); }
html.dark-mode .pagination .active { background: var(--dm-brand); border-color: var(--dm-brand); color: white; }

/* ── Login page ──────────────────────────────────────────────────── */
html.dark-mode .login-page   { background: var(--dm-bg); }
html.dark-mode .login-card   {
  background: var(--dm-surface);
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
html.dark-mode .login-card__body  { color: var(--dm-text); }
html.dark-mode .login-card__footer { color: var(--dm-text-soft); }
html.dark-mode .login-card__footer a { color: var(--dm-brand2); }

/* ── Avatar ──────────────────────────────────────────────────────── */
html.dark-mode .avatar { background: var(--dm-accent); color: var(--dm-brand2); }

/* ── Toggle de modo oscuro en el sidebar ────────────────────────── */
.dark-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.dark-mode-row .dark-mode-icon  { font-size: .9rem; }
.dark-mode-row .dark-mode-label { font-size: .78rem; color: rgba(255,255,255,.6); flex: 1; margin: 0 .5rem; }

/* Switch CSS */
.dm-switch {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.dm-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.dm-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.2);
  border-radius: 10px;
  cursor: pointer;
  transition: background .25s;
}
.dm-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform .25s;
  pointer-events: none;
}
.dm-switch input:checked + .dm-track { background: var(--brand-400, #5B92DF); }
.dm-switch input:checked + .dm-track + .dm-thumb { transform: translateX(16px); }

/* Textos generales en dark mode */
html.dark-mode p,
html.dark-mode span,
html.dark-mode div,
html.dark-mode label { color: inherit; }
html.dark-mode a { color: var(--dm-brand2); }
html.dark-mode .sidebar a,
html.dark-mode .sidebar span,
html.dark-mode .sidebar div { color: inherit; }


/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Correcciones de contraste de texto
   Necesario para sobreescribir colores inline del HTML
   ═══════════════════════════════════════════════════════════════ */

/* Textos generales */
html.dark-mode,
html.dark-mode body,
html.dark-mode .content,
html.dark-mode .main-content { color: var(--dm-text) !important; }

/* Todos los textos dentro de cards y tablas */
html.dark-mode .card *,
html.dark-mode .stat-card *,
html.dark-mode .table-wrap *,
html.dark-mode .card__body *,
html.dark-mode .card__header * { color: var(--dm-text); }

/* Excepciones: elementos que deben mantener su propio color */
html.dark-mode .card .badge,
html.dark-mode .card .btn,
html.dark-mode .stat-card .badge { color: inherit; }

/* Textos con colores inline explícitos — sobreescribir */
html.dark-mode [style*="color:var(--gray-900)"],
html.dark-mode [style*="color: var(--gray-900)"] { color: var(--dm-text) !important; }

html.dark-mode [style*="color:var(--gray-700)"],
html.dark-mode [style*="color: var(--gray-700)"] { color: var(--dm-text-mid) !important; }

html.dark-mode [style*="color:var(--gray-600)"],
html.dark-mode [style*="color: var(--gray-600)"] { color: var(--dm-text-mid) !important; }

html.dark-mode [style*="color:var(--gray-500)"],
html.dark-mode [style*="color: var(--gray-500)"] { color: var(--dm-text-soft) !important; }

html.dark-mode [style*="color:var(--gray-400)"],
html.dark-mode [style*="color: var(--gray-400)"] { color: var(--dm-text-soft) !important; }

/* Fondos con colores inline */
html.dark-mode [style*="background:var(--gray-50)"],
html.dark-mode [style*="background: var(--gray-50)"],
html.dark-mode [style*="background:var(--gray-100)"],
html.dark-mode [style*="background: var(--gray-100)"] { background: var(--dm-surface2) !important; }

html.dark-mode [style*="background:var(--brand-50)"],
html.dark-mode [style*="background: var(--brand-50)"] { background: var(--dm-accent) !important; }

/* Bordes inline */
html.dark-mode [style*="border-top:1px solid var(--gray-200)"],
html.dark-mode [style*="border-bottom:1px solid var(--gray-200)"],
html.dark-mode [style*="border:1px solid var(--gray-200)"],
html.dark-mode [style*="border-color:var(--gray-200)"] {
  border-color: var(--dm-border) !important;
}

/* Links */
html.dark-mode a:not(.btn):not(.nav-item):not(.sidebar__nav a) {
  color: var(--dm-brand2);
}

/* Textos de colores de marca */
html.dark-mode [style*="color:var(--brand-600)"],
html.dark-mode [style*="color: var(--brand-600)"],
html.dark-mode [style*="color:var(--brand-500)"],
html.dark-mode [style*="color: var(--brand-500)"] { color: var(--dm-brand2) !important; }

/* Monospace (números de factura, etc.) */
html.dark-mode [style*="font-family:monospace"],
html.dark-mode [style*="font-family: monospace"] { color: var(--dm-brand2) !important; }

/* Headers de sección */
html.dark-mode h1, html.dark-mode h2,
html.dark-mode h3, html.dark-mode h4 { color: var(--dm-text) !important; }

/* Stat card valores */
html.dark-mode .stat-card__value { color: var(--dm-text) !important; }
html.dark-mode .stat-card__label { color: var(--dm-text-soft) !important; }

/* Breadcrumb */
html.dark-mode .breadcrumb,
html.dark-mode .breadcrumb * { color: var(--dm-text-soft) !important; }

/* Ficha cliente — columna izquierda */
html.dark-mode .card__footer,
html.dark-mode .card__footer * { color: var(--dm-text-mid); }

/* Tabla table-wrap — asegurar contraste en celdas */
html.dark-mode td { color: var(--dm-text-mid) !important; }
html.dark-mode td strong,
html.dark-mode td b,
html.dark-mode td [style*="font-weight:600"],
html.dark-mode td [style*="font-weight: 600"],
html.dark-mode td [style*="font-weight:700"],
html.dark-mode td [style*="font-weight: 700"] { color: var(--dm-text) !important; }

/* Login card */
html.dark-mode .login-card__body *  { color: var(--dm-text); }
html.dark-mode .login-card__footer  { color: var(--dm-text-soft) !important; }

/* Dark mode row en sidebar */
html.dark-mode .dark-mode-row { border-top-color: rgba(255,255,255,.08); }
html.dark-mode .dark-mode-label { color: rgba(255,255,255,.6) !important; }

/* Modal */
html.dark-mode .modal * { color: var(--dm-text); }
html.dark-mode .modal .btn,
html.dark-mode .modal .badge { color: inherit; }

/* Charts en reportes */
html.dark-mode .bar-chart__label { color: var(--dm-text-soft) !important; }

/* Tooltip barchart */
html.dark-mode .bar-chart__bar .tooltip {
  background: var(--dm-surface);
  color: var(--dm-text);
  border: 1px solid var(--dm-border);
}

/* Chat en tickets */
html.dark-mode .chat-admin   { background: var(--dm-accent); border-color: var(--dm-border); }
html.dark-mode .chat-cliente { background: var(--dm-surface2); border-color: var(--dm-border); }
html.dark-mode .chat-meta    { color: var(--dm-text-soft) !important; }

/* Scrollbar en dark mode */
html.dark-mode ::-webkit-scrollbar       { background: var(--dm-bg); }
html.dark-mode ::-webkit-scrollbar-thumb { background: var(--dm-border2); border-radius: 4px; }


/* ── Stat cards — textos más grandes ──────────────────────────── */
.stat-card__label { font-size: .88rem; }   /* era .78rem */
.stat-card__value { font-size: 1.7rem;  }   /* era 1.4rem */
