/* ASISTPRO PSI · sistema de diseño ASISTPRO (blanco y negro).
   Paleta y tipografía del kit de marca: hueso, papel, tinta, Inter.
   El coral (tierra) solo como acento mínimo, nunca en superficies grandes. */

:root {
  --bg: #FAFAF8;
  --papel: #FFFFFF;
  --tinta: #0F0F0E;
  --tinta-2: #2A2A28;
  --suave: #6E6E6A;
  --tenue: #9B9B96;
  --linea: #E4E3DE;
  --linea-2: #EFEEEA;
  --linea-fuerte: #111110;
  --tierra: #C15F3C;

  --ok: #2F6B45;     --ok-bg: #EEF5F0;
  --warn: #8A5A12;   --warn-bg: #FBF4E6;
  --mal: #A3261B;    --mal-bg: #FBEEEC;

  --r: 8px;
  --r-sm: 6px;
  --sombra: 0 1px 2px rgba(15,15,14,.04), 0 8px 24px rgba(15,15,14,.06);
  --ancho: 1120px;
  --fuente: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--tinta);
  font: 400 15px/1.6 var(--fuente);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
main { flex: 1; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
button { font: inherit; }

.contenedor { width: 100%; max-width: var(--ancho); margin: 0 auto; padding: 0 20px; }

/* ── Cabecera ─────────────────────────────────────────────────────────── */
.cab { position: sticky; top: 0; z-index: 20; background: rgba(250,250,248,.86); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--linea); }
.cab .contenedor { display: flex; align-items: center; gap: 16px; height: 60px; }
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.marca img { height: 22px; width: auto; display: block; }
.marca .sep { width: 1px; height: 18px; background: var(--linea); }
.marca .prod { font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.cab nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.cab nav a { font-size: 14px; color: var(--suave); text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); }
.cab nav a:hover { color: var(--tinta); background: var(--linea-2); }
.cab nav a.btn, .cab nav a.btn:hover { color: #fff; background: var(--tinta); }

/* ── Pie ──────────────────────────────────────────────────────────────── */
.pie { border-top: 1px solid var(--linea); margin-top: 64px; }
.pie .contenedor { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-top: 24px; padding-bottom: 32px; font-size: 13px; color: var(--suave); }
.pie a { color: var(--suave); }

/* ── Tipografía utilitaria ────────────────────────────────────────────── */
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--suave); }
.kicker::before { content: ''; width: 6px; height: 6px; border-radius: 1px; background: var(--tierra); }
.sub { color: var(--suave); }
.mono { font-variant-numeric: tabular-nums; }

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: var(--r-sm); border: 1px solid var(--tinta); background: var(--tinta); color: #fff; font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .15s, opacity .15s, transform .05s; }
.btn:hover { background: var(--tinta-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sec { background: var(--papel); color: var(--tinta); border-color: var(--linea); }
.btn.sec:hover { border-color: var(--tinta); background: var(--papel); }
.btn.chico { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.bloque { width: 100%; }
.btn .flecha { transition: transform .15s; }
.btn:hover .flecha { transform: translateX(2px); }

/* ── Tarjetas y formularios ───────────────────────────────────────────── */
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--r); }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo label { font-size: 13px; font-weight: 500; }
.campo input, .campo select {
  height: 44px; padding: 0 12px; border: 1px solid var(--linea); border-radius: var(--r-sm);
  background: var(--papel); color: var(--tinta); font: inherit; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.campo input:focus, .campo select:focus { border-color: var(--tinta); box-shadow: 0 0 0 3px rgba(15,15,14,.08); }
.campo input.err, .campo select.err { border-color: var(--mal); }
.campo .ayuda { font-size: 12px; color: var(--suave); }
.campo .error { display: none; font-size: 12px; color: var(--mal); }
.campo .error.on { display: block; }

.aviso { display: none; padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.aviso.on { display: block; }
.aviso.err { color: var(--mal); background: var(--mal-bg); border-color: #F1D3CF; }
.aviso.ok { color: var(--ok); background: var(--ok-bg); border-color: #D2E5D8; }

/* ── Estados de resultado ─────────────────────────────────────────────── */
.estado { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta-2); white-space: nowrap; }
.estado::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--tenue); }
.estado.favorable::before { background: var(--ok); }
.estado.revisar::before { background: #C08A2E; }
.estado.critico::before { background: var(--mal); }
.estado.reevaluar::before { background: var(--suave); }
.estado.liberado { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.estado.liberado::before { background: #fff; }

/* ── Carga y vacíos ───────────────────────────────────────────────────── */
.cargando { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: var(--bg); transition: opacity .2s; }
.cargando.fuera { opacity: 0; pointer-events: none; }
.giro { width: 22px; height: 22px; border: 2px solid var(--linea); border-top-color: var(--tinta); border-radius: 50%; animation: giro .7s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.vacio { padding: 48px 20px; text-align: center; color: var(--suave); font-size: 14px; }
.oculto { display: none !important; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-fondo { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15,15,14,.36); opacity: 0; transition: opacity .15s; }
.modal-fondo.on { opacity: 1; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 40px); overflow: auto; background: var(--papel); border-radius: 12px; box-shadow: var(--sombra); padding: 24px; transform: translateY(6px); transition: transform .15s; }
.modal-fondo.on .modal { transform: none; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal .cuerpo { font-size: 14px; color: var(--tinta-2); }
.modal .acciones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.filas { border-top: 1px solid var(--linea); margin-top: 12px; }
.fila { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--linea-2); font-size: 14px; }
.fila span:first-child { color: var(--suave); }
.fila strong { font-weight: 600; }

.barra { height: 4px; background: var(--linea-2); border-radius: 2px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--tinta); border-radius: 2px; transition: width .3s ease; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .cab nav a.ocultar-movil { display: none; }
  .marca img { height: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
