/* =====================================================================
   MT7 Combustibles — hoja de marca del kiosco
   Fuente de verdad: docs/marca/MANUAL_DE_MARCA.pdf  ·  Reglas: DESIGN.md
   Colores RGB oficiales del manual (equivalentes Pantone 286 C, Orange 021 C,
   116 C, Cool Gray 11 C y Cool Gray 5 C). No usar otros tonos de marca.
   ===================================================================== */

@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-wght-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Marca */
  --mt7-azul: #0033A0;
  --mt7-azul-hondo: #00267A;      /* presionado / hover del azul */
  --mt7-azul-tinte: #E8EDF8;      /* selección, fondos suaves */
  --mt7-naranjo: #FE5000;         /* blanco encima solo en números grandes (3,3:1) */
  --mt7-amarillo: #FFCD00;        /* siempre con tinta encima, nunca blanco */
  --mt7-amarillo-tinte: #FFF6D1;
  --mt7-gris: #53565A;
  --mt7-gris-claro: #B1B3B3;      /* solo bordes y adornos: como texto no da contraste */

  /* Superficies y tinta (tema claro, como el manual) */
  --paper: #F6F7F9;
  --card: #FFFFFF;
  --sunk: #ECEEF1;
  --line: #D9DCE0;
  --line-strong: var(--mt7-gris-claro);
  --ink: #1F2124;                 /* 15:1 sobre papel */
  --ink-2: var(--mt7-gris);       /* 6,9:1 */
  --ink-3: #66696D;               /* el más claro permitido para texto: 4,75:1 sobre hundido, 5,2:1 sobre papel */

  /* Estados (no son colores de marca: el naranjo nunca significa error) */
  --ok: #0B7A4B;  --ok-tint: #E3F4EC;
  --err: #B42318; --err-tint: #FCE9E8;
  --warn: #7A5200; --warn-tint: var(--mt7-amarillo-tinte);

  /* Forma */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow-1: 0 1px 2px rgb(31 33 36 / .06), 0 2px 6px rgb(31 33 36 / .06);
  --shadow-2: 0 2px 4px rgb(31 33 36 / .06), 0 12px 32px rgb(31 33 36 / .14);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* ---------- Base ---------- */
html, body { height: 100%; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
  background: var(--paper);
  color: var(--ink);
  font-feature-settings: "tnum" 0;
}
::selection { background: var(--mt7-amarillo); color: var(--ink); }
:focus-visible { outline: 3px solid var(--mt7-azul); outline-offset: 2px; }
.scroll-soft { scrollbar-width: thin; scrollbar-color: var(--mt7-gris-claro) transparent; }
.scroll-soft::-webkit-scrollbar { width: 8px; }
.scroll-soft::-webkit-scrollbar-thumb { background: var(--mt7-gris-claro); border-radius: 8px; }
.tabular-nums, .num { font-variant-numeric: tabular-nums; }
.num { font-weight: 800; letter-spacing: -0.02em; }
.font-mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.t-ink   { color: var(--ink); }
.t-muted { color: var(--ink-2); }
.t-faint { color: var(--ink-3); }
.t-brand { color: var(--mt7-azul); }
.t-ok    { color: var(--ok); }
.t-err   { color: var(--err); }
.t-warn  { color: var(--warn); }
/* Voz de marca: cursiva extra negrita, como el logotipo. Solo en etiquetas cortas y cifras. */
.brand-voice { font-style: italic; font-weight: 800; letter-spacing: -0.01em; }

/* ---------- Botones ---------- */
.btn {
  user-select: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: transform .06s ease, background-color .15s var(--ease-out), border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.b-primary { background: var(--mt7-azul); color: #fff; box-shadow: var(--shadow-1); }
.b-primary:hover { background: var(--mt7-azul-hondo); }
.b-secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow-1); }
.b-secondary:hover { border-color: var(--line-strong); }
.b-secondary:active { background: var(--sunk); }
.b-sun { background: var(--mt7-amarillo); color: var(--ink); box-shadow: var(--shadow-1); }
.b-sun:hover { background: #F2C200; }
.b-danger { background: var(--err); color: #fff; box-shadow: var(--shadow-1); }
.b-danger:hover { background: #961d14; }
.b-ok { background: var(--ok); color: #fff; box-shadow: var(--shadow-1); }
.b-quiet { background: transparent; color: var(--ink-2); }
.b-quiet:hover { background: var(--sunk); color: var(--ink); }

/* Tecla de teclado numérico */
.key {
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); border-bottom-width: 3px;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.key:hover { border-color: var(--line-strong); }
.key:active { background: var(--mt7-azul-tinte); border-color: var(--mt7-azul); }

/* Opción grande (Efectivo/Tarjeta, Boleta/Factura) */
.choice {
  background: var(--card); color: var(--ink);
  border: 2px solid var(--line); box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
}
.choice:hover { border-color: var(--mt7-azul); }
.choice:active { background: var(--mt7-azul-tinte); border-color: var(--mt7-azul); }
.choice .choice-icon { color: var(--mt7-azul); }
/* La opción que toma Enter (o el temporizador) se marca en azul. */
.choice.is-default { border-color: var(--mt7-azul); box-shadow: 0 0 0 3px var(--mt7-azul-tinte), var(--shadow-1); }

/* ---------- Superficies ---------- */
.card  { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.row   { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel { background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
.inset { background: var(--sunk); border-radius: var(--r-lg); }
.scrim { background: rgb(31 33 36 / .5); }
.rule  { border-color: var(--line); }

/* Campos */
.field {
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: .55rem .8rem; font-size: 1rem; font-weight: 500;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { outline: none; border-color: var(--mt7-azul); box-shadow: 0 0 0 3px var(--mt7-azul-tinte); }

/* Pestañas / control segmentado */
.seg { background: var(--sunk); border-radius: var(--r-md); padding: 4px; }
.seg-item { color: var(--ink-2); border-radius: var(--r-sm); font-weight: 700; white-space: nowrap; }
.seg-item:hover { color: var(--ink); }
.seg-item.is-on { background: var(--card); color: var(--mt7-azul); box-shadow: var(--shadow-1); }

/* Opción que se marca y desmarca (islas asignadas, filtros) */
.chip { background: var(--card); color: var(--ink-2); border: 1.5px solid var(--line); border-radius: var(--r-sm); font-weight: 700; }
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-on { background: var(--mt7-azul-tinte); color: var(--mt7-azul); border-color: var(--mt7-azul); }
.chip:disabled { opacity: .45; }

/* Avisos */
.note { border-radius: var(--r-md); padding: .6rem .8rem; font-size: .9rem; display: flex; gap: .5rem; align-items: flex-start; }
.note-warn { background: var(--warn-tint); color: var(--warn); box-shadow: inset 0 0 0 1px #F0D77A; }
.note-err  { background: var(--err-tint);  color: var(--err);  box-shadow: inset 0 0 0 1px #F2B8B5; }
.note-ok   { background: var(--ok-tint);   color: var(--ok);   box-shadow: inset 0 0 0 1px #A8DCC2; }
.note-info { background: var(--mt7-azul-tinte); color: var(--mt7-azul); box-shadow: inset 0 0 0 1px #C3D0EC; }

/* Etiquetas */
.badge { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .15rem .55rem; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.badge-ok   { background: var(--ok-tint); color: var(--ok); }
.badge-err  { background: var(--err-tint); color: var(--err); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }
.badge-info { background: var(--mt7-azul-tinte); color: var(--mt7-azul); }
.badge-neutral { background: var(--sunk); color: var(--ink-2); }
.dot-status { width: .55rem; height: .55rem; border-radius: 999px; background: currentColor; display: inline-block; }

/* Ícono en círculo (cabecera de modales y pantallas) */
.icon-disc { width: 4rem; height: 4rem; border-radius: 999px; display: grid; place-items: center; margin-inline: auto; }
.icon-disc.is-brand { background: var(--mt7-azul-tinte); color: var(--mt7-azul); }
.icon-disc.is-warn  { background: var(--warn-tint); color: var(--warn); }
.icon-disc.is-err   { background: var(--err-tint); color: var(--err); }
.icon-disc.is-ok    { background: var(--ok-tint); color: var(--ok); }

/* ---------- Firma de marca ---------- */
/* Franja bajo la cabecera: los tres colores del manual, en proporción. */
.brand-stripe { height: 4px; background: linear-gradient(90deg,
  var(--mt7-azul) 0 62%, var(--mt7-naranjo) 62% 86%, var(--mt7-amarillo) 86% 100%); }

/* Pantalla de inicio de sesión: grilla de puntos y cuarto de círculo naranjo, como la portada del manual. */
/* El contenedor ya es position: fixed (Overlay); los adornos no salen de sus bordes para no dar scroll. */
.brand-backdrop { background: var(--paper); isolation: isolate; }
.brand-backdrop::before {
  content: ""; position: absolute; z-index: -1; top: 28px; left: 28px; width: 224px; height: 112px;
  background-image: radial-gradient(var(--ink) 2px, transparent 2.5px);
  background-size: 28px 28px; opacity: .5;
}
.brand-backdrop::after {
  content: ""; position: absolute; z-index: -1; top: 0; right: 0; width: clamp(110px, 16vw, 180px); aspect-ratio: 1;
  border-bottom-left-radius: 100%; background: var(--mt7-naranjo);
}
@media (max-width: 640px) { .brand-backdrop::before { display: none; } }

/* Combustibles: los colores con que la estación identifica cada producto (93 naranjo, 95 blanco, 97 azul,
   Diésel negro), siempre con tokens de la marca. El 95 blanco lleva borde para distinguirse sobre la tarjeta. */
.fuel-93     { --fuel: var(--mt7-naranjo);  --fuel-ink: var(--ink); }
.fuel-95     { --fuel: #FFFFFF;             --fuel-ink: var(--ink); }
.fuel-97     { --fuel: var(--mt7-azul);     --fuel-ink: #fff; }
.fuel-diesel { --fuel: var(--ink);          --fuel-ink: #fff; }
.fuel-swatch.fuel-95, .fuel-95 .fuel-swatch { box-shadow: inset 0 0 0 2px var(--mt7-gris); }  /* 7,5:1 sobre blanco */
.fuel-other  { --fuel: var(--sunk);         --fuel-ink: var(--ink); }
.fuel-swatch { background: var(--fuel); color: var(--fuel-ink); }
.fuel-card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.fuel-card:hover { border-color: var(--line-strong); }
.fuel-card.is-on { border-color: var(--mt7-azul); box-shadow: 0 0 0 4px var(--mt7-azul-tinte), var(--shadow-1); }

/* Pantalla del PIN: una columna; en pantallas apaisadas bajas el teclado va a la derecha. */
.pin-layout { display: grid; gap: .75rem; justify-items: center; grid-template-areas: "info" "pad" "actions"; }
.pin-info { grid-area: info; } .pin-pad { grid-area: pad; } .pin-actions { grid-area: actions; }
@media (min-width: 700px) and (max-height: 620px) {
  .pin-layout { grid-template-columns: 1fr 1fr; grid-template-areas: "info pad" "actions pad"; align-items: center; column-gap: 2rem; }
  .pin-actions { align-self: start; }
  .login-logo { height: 5.5rem; }
}

/* Puntos del PIN */
.pin-slot { width: 1.1rem; height: 1.1rem; border-radius: 999px; border: 2px solid var(--line-strong); }
.pin-slot.is-full { background: var(--mt7-azul); border-color: var(--mt7-azul); }

@media (prefers-reduced-motion: reduce) {
  .btn, .btn:active { transition: none; transform: none; }
  .animate-pulse { animation: none; }
}

/* Configuración común desde el panel central (js/agent-state.js). Solo colores oficiales MT7:
   el amarillo y el naranjo llevan tinta encima, nunca blanco (contraste del manual). */
.accent-azul { background: var(--mt7-azul); color: #fff; }
.accent-naranjo { background: var(--mt7-naranjo); color: var(--ink); }
.accent-amarillo { background: var(--mt7-amarillo); color: var(--ink); }
html.font-grande { font-size: 112.5%; }
html.hc { --ink: #000000; --line: var(--mt7-gris); --line-strong: var(--mt7-gris); --card: #FFFFFF; }
