/* =====================================================================
   PESETILLA · estilos comunes
   Paleta: asfalto, papel, verde "Libre" del piloto del taxi y latón
   de peseta como acento mínimo.
   ===================================================================== */
:root {
  --asfalto: #1C2430;
  --asfalto-2: #2B3544;
  --texto: #1C2430;
  --texto-2: #566173;
  --texto-3: #7A8494;
  --linea: #DDE2E8;
  --linea-2: #C9D0D9;
  --papel: #FFFFFF;
  --fondo: #F3F5F7;
  --libre: #12A150;
  --libre-oscuro: #0B7A3B;
  --libre-claro: #E4F5EB;
  --laton: #B8862B;
  --laton-claro: #F7EFDD;
  --rojo: #C2382F;
  --rojo-claro: #FBE9E7;
  --ambar: #9A6A00;
  --ambar-claro: #FFF4D6;

  --fuente: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 18px;
  --sombra: 0 1px 2px rgba(28, 36, 48, .06), 0 8px 24px -12px rgba(28, 36, 48, .18);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.55;
  color: var(--texto);
  background: var(--papel);
  font-feature-settings: 'ss01';
}
img, svg { max-width: 100%; display: block; }
a { color: var(--libre-oscuro); text-underline-offset: 3px; }
a:hover { color: var(--asfalto); }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.015em; font-weight: 700; }
p { margin: 0 0 1em; }
.cifra, table td.n, table th.n { font-variant-numeric: tabular-nums; }
.oculto-visual { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--libre); outline-offset: 2px; border-radius: 4px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 20px;
  font: 600 15px/1 var(--fuente);
  color: #fff; background: var(--asfalto);
  border: 1px solid var(--asfalto); border-radius: var(--r-s);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--asfalto-2); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-libre { background: var(--libre); border-color: var(--libre); }
.btn-libre:hover { background: var(--libre-oscuro); border-color: var(--libre-oscuro); }
.btn-sec { background: var(--papel); color: var(--texto); border-color: var(--linea-2); }
.btn-sec:hover { background: var(--fondo); color: var(--texto); }
.btn-peligro { background: var(--rojo); border-color: var(--rojo); }
.btn-peligro:hover { background: #9E2B24; }
.btn-txt { background: none; border: 0; color: var(--libre-oscuro); padding: 0 6px; min-height: 36px; text-decoration: underline; text-underline-offset: 3px; }
.btn-txt:hover { background: none; color: var(--asfalto); }
.btn-peq { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn[aria-busy="true"]::after {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: 6px; margin-bottom: 16px; }
.campo label, .etiqueta { font-weight: 600; font-size: 14px; color: var(--texto); }
.campo .ayuda { font-size: 13px; color: var(--texto-3); }
input, select, textarea {
  font: 16px/1.4 var(--fuente); color: var(--texto);
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--papel); border: 1px solid var(--linea-2); border-radius: var(--r-s);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--libre); box-shadow: 0 0 0 3px rgba(18, 161, 80, .18); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--libre); }
.fila { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.error-form { color: var(--rojo); background: var(--rojo-claro); padding: 10px 12px; border-radius: var(--r-s); font-size: 14px; margin-bottom: 16px; }
.error-form:empty { display: none; }
.ok-form { color: var(--libre-oscuro); background: var(--libre-claro); padding: 10px 12px; border-radius: var(--r-s); font-size: 14px; margin-bottom: 16px; }

/* ---------- Avisos flotantes ---------- */
#toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--asfalto); color: #fff; padding: 12px 16px; border-radius: var(--r-m); box-shadow: var(--sombra); font-weight: 500; transition: opacity .4s, transform .4s; }
.toast-error { background: var(--rojo); }
.toast.fuera { opacity: 0; transform: translateY(8px); }

/* ---------- Diálogos ---------- */
.dlg { border: 0; border-radius: var(--r-l); padding: 28px; width: min(92vw, 460px); box-shadow: var(--sombra); color: var(--texto); background: var(--papel); }
.dlg::backdrop { background: rgba(28, 36, 48, .45); }
.dlg h2 { font-size: 20px; }
.dlg p { color: var(--texto-2); }
.dlg-acc { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.dlg-ancho { width: min(94vw, 720px); }

/* ---------- Píldoras de estado ---------- */
.pild { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pild::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pild-ok { color: var(--libre-oscuro); background: var(--libre-claro); }
.pild-mal { color: var(--rojo); background: var(--rojo-claro); }
.pild-av { color: var(--ambar); background: var(--ambar-claro); }
.pild-neutra { color: var(--texto-2); background: var(--fondo); }

/* ---------- Banda de modo demo ---------- */
.banda-demo { background: var(--laton-claro); color: #5C4210; font-size: 14px; padding: 8px 16px; text-align: center; border-bottom: 1px solid #EAD9B3; }
.banda-demo b { font-weight: 700; }
.banda-demo code { background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- Marca ---------- */
.marca { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--texto); text-decoration: none; }
.marca svg { width: 30px; height: 30px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
[hidden] { display: none !important; }
