/* =========================================================
   cronoanapoima.aguasdeltequendama.com
   Paleta institucional ERAT (ver skill web-erat-institucional)
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --erat-900: #0D47A1;   /* primario: navbar, títulos, botones */
  --erat-600: #1976D2;   /* hover, acentos */
  --erat-300: #42A5F5;   /* SOLO fondos decorativos, nunca texto sobre blanco */
  --erat-050: #E3F2FD;   /* fondos de sección alternos */
  --acento:   #FFC107;   /* foco visible, CTA secundario, turno activo */
  --texto:    #1A2332;
  --gris-borde: #E2E8F0;
  --exito: #2E7D32;
  --blanco: #FFFFFF;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto);
  background: var(--blanco);
}

h1, h2, h3, .brand-text strong {
  font-family: 'Sora', 'Work Sans', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 .5rem;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.9rem); }

.mono, .turno-badge, .hora { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

a { color: var(--erat-900); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--acento);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--erat-900);
  color: #fff;
  padding: .75rem 1rem;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* Topbar GOV.CO */
.topbar {
  background: var(--texto);
  color: #fff;
  font-size: .8rem;
  padding: .35rem 1rem;
  text-align: center;
}
.topbar a { color: #fff; text-decoration: underline; }
.topbar-sep { margin: 0 .5rem; opacity: .6; }

/* Header */
.site-header {
  background: var(--erat-900);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; }
.brand-logo-wrap {
  background: #fff;
  border-radius: 8px;
  padding: .4rem .65rem;
  display: flex;
  align-items: center;
  line-height: 0;
}
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; color: #fff; margin: 0; }
.brand-text small { color: var(--erat-050); font-size: .78rem; }

.main-nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav-user { color: var(--erat-050); font-size: .85rem; margin-right: .5rem; }
.nav-link {
  color: #fff;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  padding: .5rem .8rem;
  border-radius: 8px;
  transition: background-color .15s ease;
}
.nav-link:hover { background: var(--erat-600); }
.nav-login { background: var(--acento); color: var(--texto); }
.nav-login:hover { background: #ffca28; }
.nav-logout { background: rgba(255,255,255,.12); }

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--erat-050) 0%, #fff 100%);
  padding: 2.25rem 1.25rem 1.5rem;
  text-align: center;
}
.hero-inner { max-width: 780px; margin: 0 auto; }
.hero p.lead { color: #4A5568; font-size: 1.05rem; }
.hero .actualizacion-global {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 999px;
  padding: .4rem .9rem;
  font-size: .82rem;
  color: #4A5568;
  margin-top: .5rem;
}
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--exito);
  box-shadow: 0 0 0 0 rgba(46,125,50,.6);
  animation: pulso 2s infinite;
}
@keyframes pulso {
  0% { box-shadow: 0 0 0 0 rgba(46,125,50,.55); }
  70% { box-shadow: 0 0 0 8px rgba(46,125,50,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }
}

/* Grid de cronogramas */
.cronogramas {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card-cronograma {
  border: 1px solid var(--gris-borde);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.card-cronograma-head {
  background: var(--erat-900);
  color: #fff;
  padding: 1rem 1.15rem;
  border-top: 4px solid var(--acento);
}
.card-cronograma-head h2 { color: #fff; font-size: 1.1rem; margin-bottom: .25rem; }
.card-cronograma-head .meta { font-size: .78rem; color: var(--erat-050); display: flex; flex-wrap: wrap; gap: .6rem; }

.turno-actual-box {
  padding: 1.1rem 1.15rem;
  background: var(--erat-050);
  border-bottom: 1px solid var(--gris-borde);
}
.turno-actual-box .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--erat-900); font-weight: 700; }
.turno-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  height: 3.2rem;
  border-radius: 10px;
  background: var(--acento);
  color: var(--texto);
  font-weight: 700;
  font-size: 1.5rem;
  margin-top: .35rem;
}
.turno-badge.sin-definir {
  background: var(--gris-borde);
  color: #64748B;
  font-size: 1rem;
  min-width: auto;
  height: auto;
  padding: .5rem .8rem;
  border-radius: 8px;
}
.turno-actual-box .sector-activo { margin-top: .5rem; font-size: .92rem; color: var(--texto); font-weight: 600; }
.turno-actual-box .actualizado { margin-top: .35rem; font-size: .78rem; color: #4A5568; }

.novedad-alerta {
  margin-top: .75rem;
  padding: .65rem .8rem;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-left: 4px solid #DC2626;
  border-radius: 6px;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.novedad-alerta .icono { color: #DC2626; font-weight: 700; line-height: 1; }
.novedad-alerta .texto { font-size: .86rem; color: #7F1D1D; font-weight: 600; }

.novedad-box { margin-top: .25rem; padding-top: .75rem; border-top: 1px dashed var(--gris-borde); }
.novedad-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.novedad-form select { padding: .4rem .5rem; border-radius: 6px; border: 1px solid var(--gris-borde); font-size: .88rem; }

.tabla-sectores {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.tabla-sectores th, .tabla-sectores td {
  padding: .55rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--gris-borde);
  vertical-align: top;
}
.tabla-sectores th {
  background: #F8FAFC;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748B;
  position: sticky;
  top: 0;
}
.tabla-sectores td.col-turno { font-weight: 700; color: var(--erat-900); white-space: nowrap; }
.tabla-sectores tr.fila-activa td { background: #FFF8E1; }
.tabla-sectores tr.fila-activa td.col-turno { color: #B45309; }
.sectores-scroll { max-height: 340px; overflow-y: auto; }

/* Formularios (login, panel) */
.form-card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem;
  border: 1px solid var(--gris-borde);
  border-radius: 14px;
}
.form-card h1 { text-align: center; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field input, .field select {
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--gris-borde);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--erat-900);
  color: #fff;
  border: none;
  padding: .7rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--erat-600); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-secundario { background: #fff; color: var(--erat-900); border: 1.5px solid var(--erat-900); }
.btn-secundario:hover { background: var(--erat-050); }
.btn-peligro { background: #C62828; }
.btn-peligro:hover { background: #B71C1C; }

.alerta { padding: .8rem 1rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.alerta-error { background: #FFEBEE; color: #B71C1C; border: 1px solid #FFCDD2; }
.alerta-exito { background: #E8F5E9; color: #1B5E20; border: 1px solid #C8E6C9; }
.alerta-info { background: var(--erat-050); color: var(--erat-900); border: 1px solid #BBDEFB; }

/* Panel operadores */
.panel-wrap { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.panel-cronograma {
  border: 1px solid var(--gris-borde);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.panel-cronograma h2 { font-size: 1.05rem; }
.panel-cronograma .estado-actual { font-size: .88rem; color: #4A5568; margin-bottom: .9rem; }
.turnos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: .5rem;
}
.turno-btn {
  border: 1.5px solid var(--gris-borde);
  background: #fff;
  border-radius: 8px;
  padding: .75rem .4rem;
  width: 4.2rem;
  flex: 0 0 auto;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all .12s ease;
  text-align: center;
}
.turno-btn:hover { border-color: var(--erat-600); color: var(--erat-600); }
.turno-btn.activo { background: var(--acento); border-color: var(--acento); color: var(--texto); }

/* Lista de turnos: botón compacto T1 + nombre de sector en texto plano */
.turnos-lista {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: .25rem;
}
.turno-fila {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .25rem 0;
}
.turno-fila-texto {
  font-size: .78rem;
  color: var(--texto);
  line-height: 1.3;
}
.turno-fila.activo .turno-fila-texto { font-weight: 700; color: var(--erat-900); }

/* Tablas admin */
.tabla-admin { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 1rem; }
.tabla-admin th, .tabla-admin td { padding: .6rem .75rem; border-bottom: 1px solid var(--gris-borde); text-align: left; }
.tabla-admin th { background: #F8FAFC; font-size: .74rem; text-transform: uppercase; color: #64748B; }
.badge-rol { font-size: .72rem; padding: .2rem .55rem; border-radius: 999px; font-weight: 700; }
.badge-admin { background: #E3F2FD; color: var(--erat-900); }
.badge-operador { background: #F1F8E9; color: #33691E; }
.badge-inactivo { background: #FAFAFA; color: #9E9E9E; }

/* Footer */
.site-footer {
  background: var(--texto);
  color: #CBD5E1;
  padding: 2rem 1.25rem;
  font-size: .85rem;
}
.site-footer-inner { max-width: 1100px; margin: 0 auto; }
.site-footer strong { color: #fff; }
.footer-meta { color: #94A3B8; font-size: .8rem; }

@media (max-width: 640px) {
  .site-header-inner { flex-direction: column; align-items: flex-start; }
  .nav-user { display: none; }
}
