
:root{
  --ui-bg:#f5f6f8;
  --ui-card:#ffffff;
  --ui-text:#202631;
  --ui-muted:#77808f;
  --ui-line:#e7e9ee;
  --ui-soft:#f7f8fa;
  --ui-red:#c9131f;
  --ui-red-dark:#aa1019;
  --ui-red-soft:#fff4f4;
  --ui-dark:#242a33;
  --ui-blue:#315fc7;
  --ui-green:#197a4a;
  --ui-amber:#a96b00;
  --ui-radius:16px;
  --ui-shadow:0 8px 26px rgba(24,32,45,.055);
}

/* =========================================================
   BASE GLOBAL
========================================================= */
html{background:var(--ui-bg);}
body{
  background:var(--ui-bg)!important;
  color:var(--ui-text)!important;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif!important;
  -webkit-font-smoothing:antialiased;
}
*{box-sizing:border-box;}
a{transition:opacity .15s ease,background .15s ease,border-color .15s ease,transform .15s ease;}
a:active{opacity:.72;}
input,select,textarea,button{font-family:inherit!important;}
input,select,textarea{
  border:1px solid #dfe3e9!important;
  border-radius:11px!important;
  background:#fff!important;
  color:var(--ui-text)!important;
  min-height:42px;
}
input:focus,select:focus,textarea:focus{
  outline:none!important;
  border-color:#aeb5c0!important;
  box-shadow:0 0 0 3px rgba(36,42,51,.05)!important;
}
button,.btn{
  border-radius:10px!important;
  font-weight:800!important;
  box-shadow:none!important;
}
.btn-rojo,.btn.red,.red,.primary,
button[type="submit"]:not(.btn-dark):not(.btn-light):not(.read){
  background:var(--ui-red)!important;
  border-color:var(--ui-red)!important;
  color:#fff!important;
}
.btn-rojo:hover,.btn.red:hover,.red:hover,.primary:hover{
  background:var(--ui-red-dark)!important;
}
.btn-gris,.btn-claro,.btn.light,.light{
  background:#f0f2f5!important;
  color:var(--ui-text)!important;
  border-color:#e4e7eb!important;
}
.btn-oscuro,.btn.dark,.dark{
  background:var(--ui-dark)!important;
  color:#fff!important;
}

/* =========================================================
   CABECERAS / NAVEGACIÓN
========================================================= */
body > .header,
body > .top,
body > header.header,
.header{
  background:rgba(255,255,255,.94)!important;
  color:var(--ui-text)!important;
  border-bottom:1px solid var(--ui-line)!important;
  box-shadow:none!important;
}
.header a,.top a,.header-inner a,.header-in a{
  color:var(--ui-text)!important;
}
.header-inner,.header-in,.topin{
  max-width:1260px!important;
}
.header-sub{color:var(--ui-muted)!important;}
.marca{color:var(--ui-text)!important;}
.logout-link,.cambiar-pass-link{
  background:#fff!important;
  border:1px solid var(--ui-line)!important;
  color:var(--ui-text)!important;
  border-radius:10px!important;
}
.logout-link:hover,.cambiar-pass-link:hover{background:#f6f7f9!important;}

/* =========================================================
   CONTENEDORES Y TARJETAS
========================================================= */
.panel,.card,.hero,.header-card,.section-card,
.cal-panel,.notif-panel,.recordatorios-wrap,.vencidos-panel,
.filtros,.resumen-card,.kpi,.cuenta-card,.cliente-card{
  background:var(--ui-card)!important;
  border:1px solid var(--ui-line)!important;
  border-radius:var(--ui-radius)!important;
  box-shadow:var(--ui-shadow)!important;
}
.muted,.meta,.cal-panel-sub,.vencidos-resumen,
.encabezado p,.hero .muted,.field span{
  color:var(--ui-muted)!important;
}

/* =========================================================
   INICIO
========================================================= */
.container{max-width:1260px!important;}
.bienvenida{
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  padding:8px 2px 18px!important;
}
.bienvenida h1{
  letter-spacing:-.6px!important;
  font-size:34px!important;
}
.rol-badge{
  background:#eceff3!important;
  color:#596170!important;
  border-radius:999px!important;
}
.acciones-usuario{gap:8px!important;}

.seccion-titulo{
  margin:24px 2px 10px!important;
  color:#8a919d!important;
  font-size:12px!important;
  letter-spacing:.08em!important;
  text-transform:uppercase!important;
}
.grid{
  gap:12px!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
}
.tile{
  min-height:128px!important;
  background:#fff!important;
  border:1px solid var(--ui-line)!important;
  border-left:1px solid var(--ui-line)!important;
  border-radius:16px!important;
  box-shadow:0 4px 16px rgba(24,32,45,.035)!important;
  padding:17px!important;
}
.tile:hover{
  transform:translateY(-1px)!important;
  box-shadow:0 9px 22px rgba(24,32,45,.07)!important;
}
.tile-icon{
  display:grid!important;
  place-items:center!important;
  width:38px!important;
  height:38px!important;
  border-radius:12px!important;
  background:#f1f3f6!important;
  margin-bottom:13px!important;
  font-size:19px!important;
}
.tile strong{font-size:17px!important;letter-spacing:-.2px!important;}
.tile p{font-size:13px!important;line-height:1.4!important;margin-top:7px!important;}
.tile-contador{
  background:var(--ui-red)!important;
  color:#fff!important;
}
.tile-pendiente{opacity:.52!important;}

.notif-panel,.cal-panel,.recordatorios-wrap,.vencidos-panel{
  overflow:hidden!important;
}
.notif-head,.cal-panel-head,.recordatorios-cabecera,.vencidos-cabecera{
  background:#fff!important;
  border-bottom:1px solid var(--ui-line)!important;
}
.notif-head h2,.cal-panel-head h2,.recordatorios-cabecera h2,.vencidos-cabecera h2{
  font-size:18px!important;
}
.notif-count{
  background:var(--ui-red)!important;
  color:#fff!important;
}
.notif-item,.cal-item,.recordatorio,.vencido-item{
  border-bottom:1px solid #f0f1f3!important;
}
.notif-item:hover,.cal-item:hover,.recordatorio:hover,.vencido-item:hover{
  background:#fafbfc!important;
}
.cal-resumen,.resumen-recordatorios{
  gap:9px!important;
}
.cal-resumen-box,.resumen-box{
  background:#f7f8fa!important;
  border:1px solid #eef0f3!important;
  border-radius:13px!important;
  box-shadow:none!important;
}

/* =========================================================
   CALENDARIO
========================================================= */
body .top{
  padding:13px 20px!important;
  min-height:58px!important;
}
.wrap{max-width:1260px!important;}
.view-switch{
  background:#f0f2f5!important;
  border-radius:12px!important;
  padding:4px!important;
  gap:4px!important;
}
.view-switch a{
  border-radius:9px!important;
  color:#4b5563!important;
  background:transparent!important;
  border:0!important;
}
.view-switch a.active{
  background:#fff!important;
  color:var(--ui-text)!important;
  box-shadow:0 1px 5px rgba(0,0,0,.07)!important;
}
.nav .btn,.period-head .btn{
  min-height:40px!important;
}
.month-grid{
  border-color:var(--ui-line)!important;
  border-radius:14px!important;
  overflow:hidden!important;
}
.month-day{
  background:#fff!important;
  border-color:var(--ui-line)!important;
}
.month-day.other{background:#fafbfc!important;}
.event{
  border-radius:9px!important;
  border:0!important;
  font-weight:700!important;
}
.event.realizada{
  opacity:.46!important;
  filter:saturate(.45)!important;
}
.event.visita{background:#eef4ff!important;color:#315fc7!important;}
.event.entrega{background:#edf9f2!important;color:#197a4a!important;}
.event.actividad_especial{background:#fff4ec!important;color:#a85e2f!important;}
.edit-box{background:#f8f9fb!important;border-color:var(--ui-line)!important;}

/* =========================================================
   CLIENTES / TABLAS / FORMULARIOS
========================================================= */
table{
  border-collapse:separate!important;
  border-spacing:0!important;
}
th{
  background:#f7f8fa!important;
  color:#616a78!important;
  font-size:12px!important;
  letter-spacing:.01em!important;
}
td,th{border-color:#e9ebef!important;}
tbody tr:hover td{background:#fbfcfd!important;}
.btn-danger{
  background:var(--ui-red)!important;
  border-radius:9px!important;
}
.btn-ver,.btn-editar{
  border-radius:9px!important;
  box-shadow:none!important;
}
.prioridad-alta,.badge.alta{background:#fff0f0!important;color:#a82323!important;}
.prioridad-media,.badge.media{background:#fff6da!important;color:#986100!important;}
.prioridad-baja,.badge.baja{background:#ecf8f0!important;color:#197a4a!important;}

/* =========================================================
   ASISTENCIA
========================================================= */
.filtros,.pdfbox{
  gap:10px!important;
}
.kpis{gap:10px!important;}
.kpi{
  background:#f7f8fa!important;
  box-shadow:none!important;
}
.badge.ok,.biometria-ok,.estado-presente{
  background:#edf9f2!important;
  color:#197a4a!important;
}
.badge.warn{background:#fff7e6!important;color:#9a6500!important;}
.badge.bad{background:#fff0f0!important;color:#a82323!important;}
.badge.info{background:#eef4ff!important;color:#315fc7!important;}

/* =========================================================
   COBRANZAS
========================================================= */
.cuenta{
  background:#fff!important;
  border:1px solid var(--ui-line)!important;
  border-left:3px solid #e2e5e9!important;
  border-radius:14px!important;
  box-shadow:none!important;
}
.cuenta.alerta,.cuenta.contactar{
  border-left-color:var(--ui-red)!important;
  background:#fffafa!important;
}
.badge-contactar,.contactar-hoy{
  background:#fff0f0!important;
  color:var(--ui-red)!important;
}
.resumen,.stats,.cards-resumen{gap:10px!important;}

/* =========================================================
   MAPA
========================================================= */
#map,.mapa,.leaflet-container{
  border-radius:14px!important;
}
.leyenda,.filters,.filtros-mapa{
  background:#fff!important;
  border:1px solid var(--ui-line)!important;
  border-radius:14px!important;
}

/* =========================================================
   MÓVIL / SMARTPHONE
========================================================= */
@media(max-width:800px){
  .container,.wrap,.contenedor,.main{
    width:auto!important;
    max-width:none!important;
    margin-left:auto!important;
    margin-right:auto!important;
    padding-left:12px!important;
    padding-right:12px!important;
  }
  .header-inner,.header-in,.topin{
    padding-left:14px!important;
    padding-right:14px!important;
  }
  .bienvenida h1{font-size:28px!important;}
  .grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
  }
  .tile{
    min-height:116px!important;
    padding:14px!important;
  }
  .tile-icon{
    width:34px!important;height:34px!important;
    border-radius:10px!important;
    margin-bottom:10px!important;
  }
  .tile strong{font-size:15px!important;line-height:1.25!important;}
  .tile p{font-size:12px!important;}
  .cal-resumen,.resumen-recordatorios,.agenda-summary{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  .cal-resumen-box,.resumen-box{padding:10px!important;}
  .month-grid{
    font-size:12px!important;
  }
  .month-day{
    min-height:72px!important;
    padding:6px!important;
  }
  .event{
    padding:4px 5px!important;
    font-size:10px!important;
    line-height:1.15!important;
  }
  .form-grid,.filtros,.pdfbox{
    grid-template-columns:1fr!important;
  }
  .acciones,.top-actions,.head-actions{
    flex-wrap:wrap!important;
  }
  .table-wrap{
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }
  table{
    min-width:760px!important;
  }
  button,.btn,a.btn{
    min-height:42px!important;
  }
}

@media(max-width:430px){
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .tile p{display:none!important;}
  .tile{min-height:96px!important;}
  .acciones-usuario{flex-direction:column!important;align-items:stretch!important;}
  .cal-panel-head,.notif-head,.recordatorios-cabecera,.vencidos-cabecera{
    align-items:flex-start!important;
  }
  .view-switch a{font-size:12px!important;padding:9px 6px!important;}
}
