/* ============================================================================
   pluo-ui.css — Sistema de diseño compartido de PLUO (single source of truth).
   Importado por login, unidades, equipo y admin. Antes cada página repetía sus
   tokens inline y el sistema se desviaba (el login quedó afuera). Acá viven los
   tokens + los componentes base para que las 4 superficies sean coherentes.
   Solo presentación: no cambia ninguna lógica.
   ============================================================================ */

:root {
  /* Marca / paleta (contrastes ajustados a WCAG AA para legibilidad al sol) */
  --azul:        #1565C0;   /* header dueño (un punto más oscuro que el viejo #1976D2 para AA en blanco) */
  --azul-claro:  #E8F2FB;
  --teal:        #00796B;   /* header admin (AA sobre blanco) */
  --teal-claro:  #E0F2F1;
  --cian:        #06BCEB;   /* cian del logo PLUO */
  --verde:       #1E8E3E;   /* estado OK (AA) */
  --ambar:       #B26A00;   /* advertencia (AA) */
  --alerta:      #C5221F;   /* error/peligro (AA) */
  --gris:        #9AA7AD;
  --texto:       #17262E;
  --texto-tenue: #566A73;   /* AA sobre --fondo */
  --blanco:      #FFFFFF;
  --fondo:       #F4F7F9;
  --borde:       #E1E7EA;
  --borde-fuerte:#CBD4D8;

  /* Layout */
  --radio:   10px;
  --radio-lg:14px;
  --sombra:  0 2px 8px rgba(23,38,46,0.08);
  --sombra-flotante: 0 10px 30px rgba(23,38,46,0.18);
  --anillo-foco: 0 0 0 3px rgba(21,101,192,0.35);
  --tap: 44px;              /* touch target mínimo */

  /* Por página se sobreescribe --header-bg (azul dueño / teal admin) */
  --header-bg: var(--azul);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--fondo);
  color: var(--texto);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Foco visible y accesible en TODO lo interactivo (teclado) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--anillo-foco);
  border-radius: var(--radio);
}

.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;
}

/* ---- Logo en placa blanca (se ve bien sobre azul, teal y blanco) ---- */
.pl-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 5px; flex-shrink: 0;
  background: var(--blanco); border-radius: 12px;
  box-shadow: 0 0 0 0.5px rgba(23,38,46,0.08), 0 1px 3px rgba(23,38,46,0.18);
}
.pl-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pl-logo--sm { width: 36px; height: 36px; padding: 4px; border-radius: 10px; }
.pl-logo--lg { width: 64px; height: 64px; padding: 7px; border-radius: 16px; }

/* ---- Header ---- */
.pl-header {
  background: var(--header-bg); color: var(--blanco);
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 30;
}
.pl-header .pl-titulos { flex: 1; min-width: 0; }
.pl-header h1 { font-size: 17px; margin: 0; font-weight: 700; }
.pl-header p  { font-size: 12px; margin: 0; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Botones ---- */
.pl-btn {
  min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radio); border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.pl-btn:active { transform: scale(0.98); }
.pl-btn--primary { background: var(--azul); color: #fff; }
.pl-btn--primary:hover { background: #0f4f9c; }
.pl-btn--teal { background: var(--teal); color: #fff; }
.pl-btn--teal:hover { background: #005f54; }
.pl-btn--ghost { background: var(--blanco); color: var(--texto); border-color: var(--borde-fuerte); }
.pl-btn--ghost:hover { background: var(--fondo); }
.pl-btn--danger { background: #FCECEC; color: var(--alerta); border-color: #F1B9B8; }
.pl-btn--danger:hover { background: #F8DCDC; }
/* Botón sobre header de color */
.pl-btn--on-header { min-height: 40px; background: rgba(255,255,255,0.16); color: #fff; padding: 8px 14px; font-size: 13px; }
.pl-btn--on-header:hover { background: rgba(255,255,255,0.28); }
.pl-btn__icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---- Campos con label visible (nunca placeholder-only) ---- */
.pl-field { display: block; margin-bottom: 14px; }
.pl-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--texto); margin-bottom: 6px; }
.pl-input {
  width: 100%; min-height: var(--tap); padding: 11px 12px;
  border: 1px solid var(--borde-fuerte); border-radius: var(--radio);
  font-family: inherit; font-size: 15px; color: var(--texto); background: #fff;
}
.pl-input::placeholder { color: var(--gris); }
.pl-input:hover { border-color: var(--gris); }
/* Casilla auxiliar bajo un campo (ej. "dejar este valor vacío"). El label envuelve al input
   para que tocar el texto también marque la casilla: en un teléfono, apuntarle a 16 px de
   casilla es pedir demasiado. */
.pl-check {
  display: flex; align-items: center; gap: 8px; min-height: var(--tap);
  font-size: 13px; color: var(--gris-oscuro, var(--gris)); cursor: pointer;
}
.pl-check > input { width: 18px; height: 18px; }

/* ---- Tarjeta / panel ---- */
.pl-card {
  background: var(--blanco); border-radius: var(--radio-lg);
  box-shadow: var(--sombra); padding: 16px 18px;
}

/* ---- Estados: badge, vacío, carga (skeleton), error ---- */
.pl-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; }
.pl-badge--ok   { background: var(--teal-claro); color: var(--teal); }
.pl-badge--warn { background: #FFF3E0; color: var(--ambar); }
.pl-badge--bad  { background: #FDECEA; color: var(--alerta); }
.pl-badge__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.pl-empty { text-align: center; color: var(--texto-tenue); padding: 48px 20px; }
.pl-empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 10px; }
.pl-empty p { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--texto); }
.pl-empty small { font-size: 13px; }

.pl-skeleton { position: relative; overflow: hidden; background: #E9EEF1; border-radius: var(--radio); }
.pl-skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: pl-shimmer 1.2s infinite;
}
@keyframes pl-shimmer { 100% { transform: translateX(100%); } }

.pl-error { color: var(--alerta); font-size: 13px; font-weight: 600; min-height: 18px; }

/* Confirmación tranquila (no es una alerta): "te mandamos el correo", "guardado". */
.pl-ok { color: var(--ok, #0d7a4f); font-size: 13px; font-weight: 600; line-height: 1.5; }

/* Acción secundaria con aspecto de enlace, pero que sigue siendo un <button> para que responda
   al teclado y a los lectores de pantalla igual que cualquier otro control. */
.pl-link {
  background: none; border: 0; padding: 4px 2px; font: inherit; font-size: 13px;
  font-weight: 600; color: var(--primario, #0f6f8c); text-decoration: underline;
  cursor: pointer; border-radius: 6px;
}
.pl-link:hover { opacity: 0.8; }
.pl-link:focus-visible { outline: 2px solid var(--primario, #0f6f8c); outline-offset: 2px; }

/* ---- Diálogo in-page (reemplaza confirm()/alert() nativos) ---- */
.pl-dialog-overlay {
  position: fixed; inset: 0; background: rgba(23,38,46,0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.pl-dialog-overlay[hidden] { display: none; }
.pl-dialog {
  background: #fff; border-radius: var(--radio-lg); box-shadow: var(--sombra-flotante);
  max-width: 380px; width: 100%; padding: 22px;
}
.pl-dialog h3 { margin: 0 0 8px; font-size: 17px; }
.pl-dialog p { margin: 0 0 18px; font-size: 14px; color: var(--texto-tenue); line-height: 1.5; }
.pl-dialog__acciones { display: flex; gap: 10px; justify-content: flex-end; }
.pl-dialog__cred {
  background: var(--fondo); border: 1px solid var(--borde); border-radius: 8px; padding: 12px;
  font-size: 13px; font-family: 'IBM Plex Mono', monospace; white-space: pre-wrap; word-break: break-all;
  margin: 0 0 16px;
}

/* ---- Toast efímero (reemplaza alert() informativos) ---- */
.pl-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--texto); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; max-width: min(92vw, 460px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 120;
}
.pl-toast.visible { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
