/* PrimeFaces Lara Blue Theme — Alcaldia Indigena de Argueta */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:        #3B82F6;
  --primary-hover:  #2563EB;
  --primary-dark:   #1D4ED8;
  --primary-light:  #EFF6FF;
  --primary-text:   #ffffff;
  --focus-ring:     0 0 0 .2rem #BFDBFE;
  --surface-0:      #ffffff;
  --surface-50:     #f8f9fa;
  --surface-100:    #e9ecef;
  --surface-200:    #dee2e6;
  --surface-300:    #ced4da;
  --surface-600:    #6c757d;
  --surface-700:    #495057;
  --surface-900:    #212529;
  --verde:          #22C55E;
  --verde-dark:     #15803D;
  --verde-light:    #F0FDF4;
  --rojo:           #EF4444;
  --rojo-dark:      #B91C1C;
  --rojo-light:     #FEF2F2;
  --amarillo:       #F59E0B;
  --sidebar-w:      240px;
  --radius-sm:      4px;
  --radius:         6px;
  --radius-lg:      6px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition:     all .15s ease;
}

/* ── TEMA OSCURO: redefine las variables de superficie/texto ── */
html[data-theme="dark"] {
  --primary-light:  #1e3a5f;
  --surface-0:      #1e293b;   /* tarjetas, paneles, modales, inputs */
  --surface-50:     #0f172a;   /* fondo de la app */
  --surface-100:    #334155;   /* hover / separadores */
  --surface-200:    #334155;   /* bordes */
  --surface-300:    #475569;   /* bordes de inputs */
  --surface-600:    #94a3b8;   /* texto tenue */
  --surface-700:    #cbd5e1;   /* texto normal */
  --surface-900:    #f1f5f9;   /* texto fuerte */
  --focus-ring:     0 0 0 .2rem #1e40af;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.4);
  --shadow:         0 1px 3px rgba(0,0,0,.5);
  --shadow-md:      0 4px 8px rgba(0,0,0,.55);
  --shadow-lg:      0 10px 20px rgba(0,0,0,.6);
  color-scheme: dark;
}
/* Inputs/áreas de texto puestos con estilo en línea también se oscurecen */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--surface-0);
  color: var(--surface-700);
  border-color: var(--surface-300);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--surface-600); }
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .modal-content { background: var(--surface-0); }
html[data-theme="dark"] .login-divider { border-color: var(--surface-200); }
/* Logos sobre fondo oscuro: recuadro blanco redondeado para que luzcan limpios */
html[data-theme="dark"] .sidebar-logos img,
html[data-theme="dark"] .login-logos img {
  background: #fff; border-radius: 10px; padding: 4px;
}
/* Documentos con membrete (cuadre, informes, actas, vouchers, contratos): se ven
   como PAPEL BLANCO aunque la app esté en modo oscuro (logos limpios + igual que impreso). */
html[data-theme="dark"] #cuadre-print,
html[data-theme="dark"] #ic-print,
html[data-theme="dark"] #informe-print,
html[data-theme="dark"] #arq-acta,
html[data-theme="dark"] #voucher-print,
html[data-theme="dark"] .contrato,
html[data-theme="dark"] .nota-acta,
html[data-theme="dark"] .aviso-pago {
  background: #ffffff !important;
  color: #1f2937;
  --surface-0:   #ffffff;
  --surface-50:  #f8f9fa;
  --surface-100: #e9ecef;
  --surface-200: #dee2e6;
  --surface-300: #ced4da;
  --surface-600: #6c757d;
  --surface-700: #495057;
  --surface-900: #212529;
}
/* Barra de desplazamiento oscura */
html[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; border-radius: 6px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--surface-50);
  color: var(--surface-700);
  display: flex;
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface-0);
  border-right: 1px solid var(--surface-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--surface-200);
  text-align: center;
  background: var(--surface-0);
}
.sidebar-logo h1 {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--surface-900);
  letter-spacing: .01em;
}
.sidebar-logo p {
  font-size: 10px;
  color: var(--surface-600);
  margin-top: 3px;
  font-weight: 500;
}
.sidebar-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sidebar-logos img {
  height: 46px;
  width: auto;
  object-fit: contain;
}

.nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--surface-600);
  text-decoration: none;
  transition: var(--transition);
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1px 8px 1px 0;
}
.nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
}
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-link .icon { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-icon { width: 22px; text-align: center; flex-shrink: 0; }
.nav-icon .pi { font-size: 15px; }
.nav-link:hover .nav-icon .pi, .nav-link.active .nav-icon .pi { color: var(--primary); }

/* Grupos del menú (colapsables) */
.nav-grupo-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 16px; margin: 5px 8px 1px 0; cursor: pointer; user-select: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--surface-600); border-radius: 0 var(--radius) var(--radius) 0;
}
.nav-grupo-header:hover { color: var(--primary); background: var(--surface-50); }
.nav-grupo-header > span { display: flex; align-items: center; gap: 8px; }
.nav-grupo-header > span .pi { font-size: 13px; }
.nav-grupo-header .chevron { font-size: 11px; transition: transform .2s; color: var(--surface-300); }
.nav-grupo.colapsado .nav-grupo-items { display: none; }
.nav-grupo.colapsado .nav-grupo-header .chevron { transform: rotate(-90deg); }
.nav-grupo-items .nav-link { padding-left: 28px; font-size: 13px; }

/* Cards PrimeIcons */
.pi-card {
  display: flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
}
.pi-card .pi { font-size: 24px; }
.pi-card-blue   { background: #EFF6FF; color: #3B82F6; }
.pi-card-green  { background: #F0FDF4; color: #22C55E; }
.pi-card-red    { background: #FEF2F2; color: #EF4444; }
.pi-card-yellow { background: #FFFBEB; color: #F59E0B; }

/* Sidebar usuario */
.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--surface-100);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-50);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.user-info { overflow: hidden; }
.user-nombre {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--surface-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-rol { font-size: 11px; color: var(--surface-600); }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--surface-0);
  border-bottom: 1px solid var(--surface-200);
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.topbar-info { font-size: 13px; color: var(--surface-600); font-weight: 500; }
.topbar-saldo { font-size: 14px; font-weight: 700; color: var(--verde-dark); }

.btn-logout {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-200);
  background: transparent;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--surface-600);
  transition: var(--transition);
  font-family: inherit;
}
.btn-logout:hover { background: var(--rojo-light); color: var(--rojo); border-color: var(--rojo); }

#contenido { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--surface-900);
  letter-spacing: -.01em;
}
.fecha-hoy { font-size: 13px; color: var(--surface-600); }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.header-actions input,
.header-actions select {
  padding: 8px 12px;
  border: 1px solid var(--surface-300);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface-0);
  color: var(--surface-700);
  transition: var(--transition);
}
.header-actions input:hover,
.header-actions select:hover { border-color: var(--primary); }
.header-actions input:focus,
.header-actions select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }

/* ── Cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.card {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-200);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-saldo  { border-top: 3px solid var(--primary); }
.card-ingreso{ border-top: 3px solid var(--verde); }
.card-egreso { border-top: 3px solid var(--rojo); }
.card-mes    { border-top: 3px solid var(--amarillo); }
.card-icon   { font-size: 26px; }
.card-label  { font-size: 11px; font-weight: 600; color: var(--surface-600); text-transform: uppercase; letter-spacing: .05em; }
.card-value  { font-size: 20px; font-weight: 800; color: var(--surface-900); margin-top: 2px; }
.card-sub    { font-size: 12px; color: var(--surface-600); margin-top: 2px; }

/* ── Dashboard ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ── Panel ── */
.panel {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-200);
  margin-bottom: 4px;
}
.panel h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--surface-700);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--surface-100);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Tabla ── */
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th {
  background: var(--surface-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--surface-200);
  color: var(--surface-600);
}
.tabla td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-100);
  vertical-align: middle;
  color: var(--surface-700);
}
.tabla tbody tr { transition: background .1s; }
.tabla tbody tr:hover { background: var(--surface-100); }
.tabla tfoot td, .tabla .total-row td {
  font-weight: 700;
  background: var(--surface-50);
  color: var(--surface-900);
}
.tabla .grupo-header td {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .03em;
}
.tabla .subtotal-row td {
  background: var(--primary-light);
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 12.5px;
}
.tabla .row-ingreso { border-left: 3px solid var(--verde); }
.tabla .row-egreso  { border-left: 3px solid var(--rojo); }
.fila-arrastre { opacity: .45; background: var(--primary-light) !important; }
.drag-handle { font-size: 14px; }
.drag-handle:active { cursor: grabbing; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-ingreso { background: var(--verde-light); color: var(--verde-dark); }
.badge-egreso  { background: var(--rojo-light);  color: var(--rojo-dark); }
.monto-ingreso { color: var(--verde-dark); font-weight: 600; }
.monto-egreso  { color: var(--rojo-dark);  font-weight: 600; }

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: inherit;
  letter-spacing: .01em;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .65; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--rojo); color: #fff; }
.btn-danger:hover { background: var(--rojo-dark); }
.btn-danger:focus-visible { box-shadow: 0 0 0 .2rem #FECACA; }
.btn-block { width: 100%; justify-content: center; padding: 11px 16px; font-size: 14.5px; }
.btn-sm {
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--surface-200);
  background: var(--surface-0);
  transition: var(--transition);
  font-family: inherit;
  font-weight: 500;
}
.btn-sm:hover { background: var(--surface-50); border-color: var(--surface-300); }
.btn-sm:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-sm.btn-danger { border-color: #FCA5A5; color: var(--rojo); background: var(--rojo-light); }
.btn-sm.btn-danger:hover { background: #FEE2E2; }
.btn-sm.btn-primary { border-color: var(--primary); color: #fff; background: var(--primary); }
.btn-sm.btn-primary:hover { background: var(--primary-hover); }

/* ── Formularios ── */
.form-card {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-200);
  max-width: 920px;
  margin-bottom: 20px;
}
.form-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--surface-100);
  color: var(--surface-700);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--surface-600);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--surface-300);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  transition: var(--transition);
  background: var(--surface-0);
  color: var(--surface-700);
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--primary); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.form-group input::placeholder { color: var(--surface-600); opacity: .65; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Tipo selector (Ingreso/Egreso) ── */
.tipo-selector { display: flex; gap: 12px; margin-bottom: 20px; }
.tipo-btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid var(--surface-200);
  transition: var(--transition);
  color: var(--surface-600);
  gap: 8px;
}
.tipo-btn input { display: none; }
.tipo-ingreso.activo { border-color: var(--verde); background: var(--verde-light); color: var(--verde-dark); }
.tipo-egreso.activo  { border-color: var(--rojo);  background: var(--rojo-light);  color: var(--rojo-dark); }
.tipo-ingreso:hover  { border-color: var(--verde); }
.tipo-egreso:hover   { border-color: var(--rojo); }

/* ── Cuadre e Informe ── */
.cuadre { max-width: 940px; }
.cuadre-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-200);
  box-shadow: var(--shadow);
}
.cuadre-header h1 { font-size: 17px; text-transform: uppercase; font-weight: 800; letter-spacing: .02em; }
.cuadre-header h2 { font-size: 13px; color: var(--surface-600); margin-top: 4px; }
.cuadre-header h3 { font-size: 12px; color: var(--surface-600); }
.cuadre-header p  { font-size: 13px; margin-top: 6px; color: var(--surface-700); }
.cuadre-seccion {
  margin-bottom: 10px;
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-200);
}
.cuadre-titulo {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ingreso-titulo { background: var(--verde-light); color: var(--verde-dark); }
.egreso-titulo  { background: var(--rojo-light);  color: var(--rojo-dark); }
.cuadre-tabla   { font-size: 12.5px; line-height: 1.25; }
.cuadre-tabla td, .cuadre-tabla th { padding: 3px 12px; }
.cuadre-tabla .grupo-header td, .cuadre-tabla .subtotal-row td, .cuadre-tabla .total-row td { padding: 4px 12px; }
.cuadre-resumen {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-200);
}
.resumen-tabla { max-width: 420px; margin: 0 auto; }
.resumen-tabla td { padding: 5px 12px; border-bottom: 1px solid var(--surface-100); font-size: 13px; }
.cuadre-firmas {
  display: flex;
  justify-content: space-around;
  margin-top: 48px;
  padding: 0 40px;
}
.firma { text-align: center; width: 200px; font-size: 13px; color: var(--surface-700); }
.firma-linea { border-top: 1px solid var(--surface-700); margin-bottom: 6px; }
/* Contrato de transporte */
.contrato {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface-0);
  border: 1px solid var(--surface-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 48px;
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 13.5px;
  line-height: 1.4;
  color: #1a1a1a;
}
.contrato p { margin: 0; }

.informe-columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 800px) { .informe-columnas { grid-template-columns: 1fr; } }

/* ── Plantillas Actas ── */
.plantillas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.plantilla-card {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--surface-200);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.plantilla-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.plantilla-icon  { font-size: 30px; margin-bottom: 10px; }
.plantilla-nombre{ font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.plantilla-desc  { font-size: 12px; color: var(--surface-600); }
.acta-texto {
  white-space: pre-wrap;
  font-family: 'Times New Roman', serif;
  font-size: 14px;
  line-height: 1.9;
  background: #FAFAF5;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-200);
}

/* ── Recordatorios ── */
.recordatorios-lista { display: flex; flex-direction: column; gap: 10px; }
.recordatorio-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--surface-200);
  background: var(--surface-0);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.rec-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rec-fecha { font-size: 12px; color: var(--surface-600); }
.rec-estado { font-weight: 600; font-size: 13px; }
.recordatorio-vencido { border-color: var(--rojo);    background: var(--rojo-light); }
.recordatorio-hoy     { border-color: var(--amarillo); background: #FFFBEB; }
.recordatorio-proximo { border-color: #F97316;         background: #FFF7ED; }
.recordatorio-ok      { border-color: var(--verde);    background: var(--verde-light); }
/* Modo oscuro: tintes oscuros para que el texto claro se lea bien */
html[data-theme="dark"] .recordatorio-vencido { background: rgba(239,68,68,.13); }
html[data-theme="dark"] .recordatorio-hoy     { background: rgba(245,158,11,.13); }
html[data-theme="dark"] .recordatorio-proximo { background: rgba(249,115,22,.13); }
html[data-theme="dark"] .recordatorio-ok      { background: rgba(34,197,94,.13); }

/* ── Planillas ── */
.tipos-planilla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.tipo-planilla-card {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  border: 1.5px solid var(--surface-200);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.tipo-planilla-card.clickable { cursor: pointer; }
.tipo-planilla-card.clickable:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── Caja Chica Upload ── */
.upload-area {
  border: 2px dashed var(--surface-300);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface-50);
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }

/* ── Basura firmas ── */
.basura-firmas { display: flex; justify-content: space-around; margin-top: 50px; padding: 0 20px; }
.basura-firmas .firma { text-align: center; width: 180px; font-size: 12px; }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal .15s ease;
}
.modal.hidden { display: none; }
@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,.05);
  animation: slideUpModal .2s ease;
}
@keyframes slideUpModal { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-large { max-width: 820px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-50);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--surface-900); }
.modal-header button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--surface-600);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.modal-header button:hover { background: var(--surface-200); color: var(--surface-900); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--surface-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Misc ── */
code {
  background: var(--surface-100);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--primary-dark);
  border: 1px solid var(--surface-200);
}
.empty {
  color: var(--surface-600);
  font-style: italic;
  padding: 32px;
  text-align: center;
  font-size: 13.5px;
}
.resultado-count { font-size: 12px; color: var(--surface-600); margin-top: 10px; text-align: right; }
.badge-cobrador {
  background: #EEF2FF;
  color: #4338CA;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.rol-badge  { color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.rol-select { padding: 5px 10px; border-radius: var(--radius); border: 1.5px solid var(--surface-200); font-size: 13px; font-family: inherit; }

/* ── Login ── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 9000;
  overflow: hidden;
}
.login-screen.hidden { display: none; }

.login-card {
  width: 420px;
  flex-shrink: 0;
  background: var(--surface-0);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 48px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
  overflow-y: auto;
}
.login-foto {
  flex: 1;
  background-color: var(--primary-dark);
  position: relative;
  overflow: hidden;
}
.login-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.login-foto::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(29,78,216,.35) 0%, rgba(15,23,42,.5) 100%);
  z-index: 1;
}
.login-foto-texto {
  position: absolute;
  bottom: 48px;
  left: 48px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.login-foto-texto h2 { font-size: 22px; font-weight: 800; margin-bottom: 5px; }
.login-foto-texto p  { font-size: 13.5px; opacity: .9; }

.login-logos { display: flex; justify-content: center; align-items: center; gap: 16px; margin-bottom: 20px; }
.login-logos img { height: 60px; width: auto; object-fit: contain; }
.login-titulo {
  font-size: 18px;
  font-weight: 800;
  color: var(--surface-900);
  margin-bottom: 3px;
  text-align: center;
  letter-spacing: -.01em;
}
.login-sub { font-size: 12.5px; color: var(--surface-600); margin-bottom: 32px; text-align: center; }
#login-form .form-group { text-align: left; margin-bottom: 16px; }
.login-error {
  background: var(--rojo-light);
  color: var(--rojo-dark);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.login-error.hidden { display: none; }
.login-version { font-size: 11.5px; color: var(--surface-300); margin-top: 28px; text-align: center; }
.login-divider { border: none; border-top: 1px solid var(--surface-100); margin: 20px 0; }

/* ── App principal ── */
#app-principal { display: flex; height: 100vh; width: 100%; }
#app-principal.hidden { display: none; }

/* ── Responsive: tablet y teléfono ── */
.topbar-menu-btn { display: none; }
.app-overlay { display: none; }

@media (max-width: 980px) {
  .topbar-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: none; background: transparent;
    font-size: 24px; cursor: pointer; color: var(--surface-700);
    border-radius: var(--radius); margin-right: 4px; flex-shrink: 0;
  }
  .topbar-menu-btn:active { background: var(--surface-100); }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 264px;
    transform: translateX(-100%); transition: transform .25s ease; z-index: 1200;
  }
  .sidebar.abierto { transform: translateX(0); box-shadow: var(--shadow-lg); }

  .app-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1100; }
  .app-overlay.visible { display: block; }

  #app-principal { display: block; }
  .main { width: 100%; height: 100vh; }
  .topbar { padding: 0 12px; }
  .topbar-info { font-size: 12px; }
  #contenido { padding: 14px; }

  .page-header { margin-bottom: 14px; }
  .page-header h2 { font-size: 18px; }
  .header-actions { width: 100%; }
  .header-actions select, .header-actions input[type="date"], .header-actions input[type="number"] { flex: 1 1 auto; min-width: 0; }
  .header-actions .btn { flex: 1 1 auto; justify-content: center; }

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

  /* Filas de cobro más altas y casillas grandes para tocar con el dedo */
  #cb-tabla td, #tp-tabla td { padding: 14px 8px; }
  #cb-tabla input[type="checkbox"] { width: 28px; height: 28px; }
  #cb-tabla tbody tr { cursor: pointer; }
  #cb-tabla tbody tr:active { background: var(--primary-light); }
}

@media (max-width: 600px) {
  .cards-grid { grid-template-columns: 1fr; }
  .login-screen { flex-direction: column; }
  .login-card { width: 100%; padding: 40px 26px; }
  .login-foto { display: none; }
  .tabla th, .tabla td { padding: 9px 8px; font-size: 12.5px; }
  .page-header h2 { font-size: 17px; }
  .btn { padding: 9px 14px; }
  .modal-content { max-width: 100% !important; }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .page-header .btn, .page-header .header-actions,
  .btn-logout, .no-print { display: none !important; }
  body { display: block; background: #fff; }
  .main { overflow: visible; }
  #contenido { padding: 0; overflow: visible; }
  .cuadre, #informe-print { max-width: 100%; }
  .contrato { box-shadow: none !important; border: none !important; max-width: 100%; padding: 0; }
  .basura-firmas { margin-top: 60px; }
  .solo-impresion { display: block !important; }
  .panel, .cuadre-seccion, .cuadre-header, .cuadre-resumen {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE — refuerzo integral (tableta y teléfono)
   ════════════════════════════════════════════════════════════════════ */

/* Tabletas y menores */
@media (max-width: 980px) {
  /* Tablas anchas: se desplazan en horizontal en lugar de aplastarse
     (la tabla sigue siendo tabla, así se conserva la alineación de columnas). */
  .panel, .cuadre, .modal-body,
  #cuadre-contenido, #tr-contenido, #cobro-contenido,
  #informe-contenido, #cc-contenido, #basura-contenido,
  #tp-contenido, #lista-tickets, #mis-tickets-lista {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tabla { min-width: max-content; }

  /* Encabezado de página apilado (título arriba, acciones abajo) */
  .page-header { flex-direction: column; align-items: stretch; gap: 8px; }
  .header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

  /* Botones de acción de formularios a lo ancho */
  .form-actions { flex-wrap: wrap; gap: 8px; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Teléfonos */
@media (max-width: 600px) {
  #contenido { padding: 12px; }
  .modal { padding: 10px; }
  .modal-content { width: 100%; max-height: 94vh; }

  /* Formularios a una sola columna */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Firmas del cuadre apiladas */
  .cuadre-firmas { flex-wrap: wrap; gap: 26px; padding: 0; margin-top: 30px; }
  .firma { width: 100%; }

  /* Tarjetas de plantillas: 2 por fila */
  .plantillas-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .plantilla-nombre { font-size: 13.5px; }
  .plantilla-desc { font-size: 11.5px; }

  /* Campos con fuente >=16px para evitar el zoom automático en iPhone */
  input, select, textarea { font-size: 16px; }

  .btn { padding: 10px 14px; }
  .header-actions .btn { font-size: 13px; }

  /* Cobro de Miércoles / Cobro mensual: que QUEPAN sin scroll horizontal
     (la casilla "Pagó" debe verse siempre) y con filas COMPACTAS. */
  #cb-tabla, #tp-tabla { min-width: 0; width: 100%; }
  /* ocultar "Varas" y "Cuota" en teléfono → el Nombre ocupa el ancho y cabe en 1 línea */
  #cb-tabla th:nth-child(3), #cb-tabla td:nth-child(3),
  #cb-tabla th:nth-child(4), #cb-tabla td:nth-child(4) { display: none; }
  #cb-tabla td, #tp-tabla td { padding: 8px 6px !important; }
  #cb-tabla th, #tp-tabla th { padding: 8px 6px; }
  #cb-tabla td:nth-child(2) { font-size: 12.5px; line-height: 1.25; }  /* nombre compacto */
  #cb-tabla input[type="checkbox"] { width: 22px; height: 22px; }
}

/* Fila marcada como PAGADA queda sombreada (verde) mientras la casilla esté activa */
#cb-tabla tbody tr:has(input[type="checkbox"]:checked) { background: #ecfdf5; }
#cb-tabla tbody tr:has(input[type="checkbox"]:checked) td { font-weight: 600; }
/* En modo OSCURO: verde oscuro con texto verde claro (si no, el nombre se ve lavado) */
html[data-theme="dark"] #cb-tabla tbody tr:has(input[type="checkbox"]:checked) { background: #14532d !important; }
html[data-theme="dark"] #cb-tabla tbody tr:has(input[type="checkbox"]:checked) td { color: #dcfce7 !important; }

/* Teléfonos pequeños */
@media (max-width: 400px) {
  .plantillas-grid { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 16px; }
  .login-card { padding: 30px 18px; }
  .modal-header h3 { font-size: 15px; }
}
