@import url("./marca/tokens.css");

/* Portero · estilos de la app. Mismo lenguaje que la web de portero.eu: cabecera y barras en gris pizarra,
   fondo claro, tarjetas blancas con sombra suave, títulos en Bricolage y botones en píldora (dorado con texto
   oscuro). La marca no tiene modo oscuro: la app es siempre clara, como la web. Colores: marca/tokens.css. */
:root {
  color-scheme: light;
  --pt-sobre-oscuro: #E7EAEC;   /* texto sobre pizarra (como la web) */
  --pt-sobre-oscuro-2: #C3C9CE; /* texto secundario sobre pizarra */
  --pt-ink-2: #565D63;          /* el de la web: más contraste sobre el papel que el del manual */
  --pt-dorado-suave: rgba(232, 178, 58, 0.16);
}

* { box-sizing: border-box; }
a, button, summary { -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--pt-paper);
  color: var(--pt-ink);
  font: 400 var(--pt-fs-1)/1.6 var(--pt-font-text);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

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

/* Títulos y textos */
h1, h2, h3 {
  font-family: var(--pt-font-display);
  font-weight: 700;
  color: var(--pt-ink);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 0.45em;
}
h1 { font-size: var(--pt-fs-3); }
h2 { font-size: var(--pt-fs-3); }
h3 { font-size: var(--pt-fs-2); }
p { margin: 0 0 0.9em; color: var(--pt-ink-2); }
p:last-child { margin-bottom: 0; }
a { color: var(--pt-steel); text-underline-offset: 3px; }
strong { color: var(--pt-ink); }

/* Cabecera: pizarra con el logo, como la web */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--pt-night);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pt-s2);
  min-height: 64px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
}
.cabecera-logo { display: flex; align-items: center; text-decoration: none; }
.cabecera-logo img { height: 36px; width: auto; display: block; }
.cabecera-estado { display: flex; align-items: center; }

/* Contenido */
.principal {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--pt-s3) max(16px, env(safe-area-inset-left)) var(--pt-s5);
  display: flex;
  flex-direction: column;
  gap: var(--pt-s2);
}

/* Tarjetas */
.tarjeta {
  background: var(--pt-surface);
  border: 1px solid var(--pt-line);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  padding: var(--pt-s3);
}
.tarjeta > :last-child { margin-bottom: 0; }
.tarjeta h2 { font-size: var(--pt-fs-3); }
.tarjeta h3 { font-size: 1.25rem; }

/* Tarjeta destacada: el bloque pizarra de la portada de la web */
.tarjeta-destacada {
  background: var(--pt-night);
  border-color: var(--pt-night);
  color: #fff;
  box-shadow: 0 12px 32px rgba(58, 64, 71, 0.22);
}
.tarjeta-destacada h2, .tarjeta-destacada h3, .tarjeta-destacada strong { color: #fff; }
.tarjeta-destacada p { color: var(--pt-sobre-oscuro); }
.tarjeta-destacada a { color: var(--pt-accent); }

/* Avisos: calmados, sin rojo de sirena */
.aviso-caja, .aviso-ok, .aviso-error {
  border-left: 4px solid var(--pt-accent);
}
.aviso-caja { background: var(--pt-surface); }
.aviso-ok { border-left-color: var(--pt-ok); }
.aviso-error { border-left-color: var(--pt-error); }

/* Etiquetas: píldoras como la de la portada */
.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--pt-radius-pill);
  font: 700 var(--pt-fs-0)/1.3 var(--pt-font-text);
  letter-spacing: 0.02em;
  background: var(--pt-mist);
  color: var(--pt-ink);
  white-space: nowrap;
}
.etiqueta-ok { background: rgba(27, 122, 75, 0.12); color: var(--pt-ok); }
.etiqueta-aviso { background: var(--pt-dorado-suave); color: var(--pt-accent-ink); }
.etiqueta-peligro { background: rgba(179, 38, 30, 0.1); color: var(--pt-error); }
.cabecera .etiqueta { background: rgba(255, 255, 255, 0.12); color: var(--pt-sobre-oscuro); }
.cabecera .etiqueta-ok { background: rgba(27, 122, 75, 0.35); color: #fff; }
.cabecera .etiqueta-aviso { background: var(--pt-dorado-suave); color: var(--pt-accent); }
.cabecera .etiqueta-peligro { background: rgba(179, 38, 30, 0.35); color: #fff; }

/* Botones en píldora, como la web */
.boton, button, .pt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: var(--pt-radius-pill);
  border: 0;
  box-shadow: inset 0 0 0 2px var(--pt-night);
  background: transparent;
  color: var(--pt-night);
  font: 700 var(--pt-fs-1)/1.1 var(--pt-font-text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.boton:active, button:active { transform: scale(0.98); }
.boton[disabled], button[disabled] { opacity: 0.45; cursor: default; }
.boton-primario { background: var(--pt-accent); color: var(--pt-ink); box-shadow: none; }
.boton-primario:hover { background: #D4A02E; }
.boton-oscuro { background: var(--pt-night); color: #fff; box-shadow: none; }
.boton-ok { background: var(--pt-ok); color: #fff; box-shadow: none; }
.boton-aviso { background: var(--pt-dorado-suave); color: var(--pt-accent-ink); box-shadow: none; }
.boton-peligro { background: transparent; color: var(--pt-error); box-shadow: inset 0 0 0 2px var(--pt-error); }
.boton-ancho { width: 100%; }
.boton-grupo { display: flex; flex-wrap: wrap; gap: var(--pt-s1); }
.boton-grupo .boton { flex: 1 1 auto; min-height: 44px; padding: 10px 16px; font-size: 0.95rem; }
.tarjeta-destacada .boton:not(.boton-primario) { color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }

/* Formularios */
form.campo { display: flex; flex-direction: column; gap: var(--pt-s2); }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label, label {
  font: 700 var(--pt-fs-0)/1.3 var(--pt-font-text);
  color: var(--pt-ink);
}
input[type="text"], input[type="password"], input[type="tel"], input[type="email"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--pt-line);
  border-radius: var(--pt-radius-sm);
  background: var(--pt-surface);
  color: var(--pt-ink);
  font: 400 1rem/1.3 var(--pt-font-text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pt-steel); box-shadow: 0 0 0 3px rgba(64, 89, 106, 0.18); }
input::placeholder { color: #8A9096; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--pt-night); }

/* Aparatos: filas sobre niebla, como el móvil de la portada */
.lista-aparatos { display: flex; flex-direction: column; gap: 10px; margin-top: var(--pt-s1); }
.fila-aparato {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--pt-mist);
  border-radius: 12px;
  padding: 12px;
}
.aparato-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 200px; }
.aparato-info strong, .aparato-info a { font-size: 1rem; color: var(--pt-ink); text-decoration: none; }
.aparato-icono {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--pt-surface);
  color: var(--pt-night);
  display: flex;
  align-items: center;
  justify-content: center;
}
.aparato-icono svg { width: 26px; height: 26px; }
.fila-aparato .boton-grupo { flex: 1 1 100%; }

/* Barra de pestañas: pizarra, la pestaña activa en dorado */
.navegacion {
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: var(--pt-night);
  color: var(--pt-sobre-oscuro);
  display: flex;
  justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.nav-enlace {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  min-width: 64px;
  padding: 6px 8px;
  border-radius: var(--pt-radius-sm);
  color: var(--pt-sobre-oscuro-2);
  text-decoration: none;
  font: 700 var(--pt-fs-0)/1.2 var(--pt-font-text);
}
.nav-enlace svg, .nav-icono svg { width: 24px; height: 24px; stroke: currentColor; }
.nav-enlace.activo { color: var(--pt-accent); }

/* Pie */
.pie {
  background: var(--pt-night);
  color: var(--pt-sobre-oscuro-2);
  text-align: center;
  font-size: var(--pt-fs-0);
  padding: var(--pt-s2) var(--pt-s2) calc(var(--pt-s2) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.pie a { color: #fff; }

/* Ventana del código de 6 cifras: casillas como las de la portada */
.modal-fondo {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(30, 35, 39, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.modal-cuerpo {
  width: 100%;
  max-width: 420px;
  background: var(--pt-surface);
  border-radius: 24px;
  padding: var(--pt-s3);
  padding-bottom: calc(var(--pt-s3) + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
@media (min-height: 700px) { .modal-fondo { align-items: center; } }
.teclado-pin { text-align: center; }
.teclado-pin h3 { font-size: var(--pt-fs-2); }
.pin-visor { display: flex; justify-content: center; gap: 8px; margin: var(--pt-s2) 0 var(--pt-s3); }
.pin-punto {
  width: 34px;
  height: 42px;
  border-radius: 9px;
  border: 2px solid var(--pt-line);
  background: var(--pt-surface);
  transition: background-color 0.12s, border-color 0.12s;
}
.pin-punto.lleno { background: var(--pt-night); border-color: var(--pt-night); }
.teclado-rejilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: var(--pt-s2); }
.tecla-pin {
  min-height: 58px;
  border-radius: 14px;
  box-shadow: none;
  background: var(--pt-mist);
  color: var(--pt-ink);
  font: 700 1.5rem/1 var(--pt-font-display);
}
.tecla-pin:active { background: var(--pt-line); }

/* Etiqueta pequeña sobre los títulos, como la de la portada de la web */
.eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--pt-radius-pill);
  background: var(--pt-dorado-suave);
  color: var(--pt-accent);
  font: 700 var(--pt-fs-0)/1.3 var(--pt-font-text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* En la fila de un aparato ya decidido, «Detalles» va pequeño a la derecha */
.fila-aparato > .boton { flex: none; min-height: 40px; padding: 8px 16px; font-size: 0.95rem; }
.fila-aparato { flex-wrap: nowrap; }
.fila-aparato:has(.boton-grupo) { flex-wrap: wrap; }
