/* ============================================================
   Catálogo R.E.C · estilos compartidos (tienda + panel)
   Marca tomada del logo: azul marino #0A2342 y oro #C9A227.
   Contrastes medidos (WCAG 2.1):
     #0A2342 sobre blanco .......... 15,77:1   (relleno de botón)
     #154C7C sobre blanco ........... 8,91:1   (enlaces y texto de acción)
     #5B6472 sobre blanco ........... 5,98:1   (texto secundario)
     #8A93A0 sobre blanco ........... 3,11:1   (bordes de campos)
     #E0B84A sobre #0A2342 .......... 8,35:1   (oro sobre marino)
   El oro NUNCA se usa como texto sobre fondo claro (2,42:1).
   ============================================================ */

:root {
  /* marca */
  --marino: #0A2342;
  --marino-claro: #154C7C;
  --oro: #C9A227;
  --oro-claro: #E0B84A;

  /* superficies */
  --blanco: #ffffff;
  --pergamino: #f5f5f7;
  --linea: #e0e0e0;

  /* texto */
  --tinta: #1d1d1f;
  --tinta-suave: #5B6472;
  --borde-control: #8A93A0;

  /* estados */
  --verde: #1C6B4A;
  --rojo: #B3261E;
  --ambar: #8A5B00;

  /* escala Apple */
  --r-0: 0; --r-1: 8px; --r-2: 11px; --r-3: 18px; --r-pastilla: 999px;
  --sombra: rgba(0, 0, 0, .22) 3px 5px 30px;
  --tipo: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

/* `hidden` tiene que ganarle a cualquier display de más abajo (el panel de
   clave es display:grid y se quedaba en pantalla después de entrar). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--tipo);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  color: var(--tinta);
  background: var(--blanco);
}

h1, h2, h3 { font-weight: 600; letter-spacing: -.015em; text-wrap: balance; margin: 0; }
h1 { font-size: 34px; }
h2 { font-size: 28px; }
h3 { font-size: 21px; letter-spacing: -.01em; }
p { margin: 0 0 12px; text-wrap: pretty; }

a { color: var(--marino-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

/* toda cifra que se compara va en cifras tabulares */
.cifra, .precio, input[type="number"], td.num { font-variant-numeric: tabular-nums; }

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--marino-claro);
  outline-offset: 2px;
}

/* ---------- botones ---------- */
.btn {
  font: inherit;
  font-size: 17px;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: var(--r-pastilla);
  background: var(--marino);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: #0d2c53; }
.btn:active { transform: scale(.95); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.btn-fantasma {
  background: transparent;
  color: var(--marino-claro);
  border: 1px solid var(--borde-control);
}
.btn-fantasma:hover { background: var(--pergamino); }

.btn-peligro { background: var(--rojo); }
.btn-peligro:hover { background: #8e1e17; }

.btn-chico { font-size: 15px; min-height: 36px; padding: 6px 14px; }

/* ---------- campos ---------- */
label { display: block; font-size: 14px; color: var(--tinta-suave); margin-bottom: 4px; }

input, select, textarea {
  font: inherit;
  font-size: 17px;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  color: var(--tinta);
  background: #fff;
  border: 1px solid var(--borde-control);
  border-radius: var(--r-1);
}
input:focus, select:focus, textarea:focus { border-color: var(--marino-claro); }
textarea { min-height: 88px; resize: vertical; }

/* ---------- insignias de estado ---------- */
.insignia {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 3px 10px;
  border-radius: var(--r-pastilla);
  border: 1px solid currentColor;
}
.insignia-si { color: var(--verde); }
.insignia-no { color: var(--rojo); }
.insignia-encargo { color: var(--ambar); }

/* ---------- barra global de marca ---------- */
.barra-marca {
  background: var(--marino);
  color: #fff;
  font-size: 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 6px 16px;
  text-align: center;
}
.barra-marca a { color: var(--oro-claro); }

/* ---------- contenedor ---------- */
.ancho { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- diálogos ---------- */
dialog {
  border: 0;
  border-radius: var(--r-3);
  padding: 0;
  max-width: 560px;
  width: calc(100% - 32px);
  color: var(--tinta);
}
dialog::backdrop { background: rgba(0, 0, 0, .42); backdrop-filter: blur(3px); }

.dlg-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--linea);
}
.dlg-cuerpo { padding: 20px; }
.dlg-pie { padding: 16px 20px; border-top: 1px solid var(--linea); display: flex; gap: 10px; justify-content: flex-end; }

.cerrar {
  border: 0;
  background: var(--pergamino);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--tinta);
}

/* ---------- avisos flotantes ---------- */
#avisos {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 90;
  width: min(520px, calc(100% - 32px));
}
.aviso {
  background: var(--marino);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r-2);
  font-size: 15px;
  box-shadow: var(--sombra);
}
.aviso.err { background: var(--rojo); }
.aviso.ok { background: var(--verde); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
