/* El Atajo · base: tokens, reset, tipografía y componentes compartidos */
:root {
  --papel: #F2EFEB;
  --papel-2: #E9E4DE;
  --tinta: #1C1714;
  --tinta-suave: #5E5550;
  --tinta-tenue: #8C827C;
  --rojo: #FF3131;
  --rojo-hondo: #C81E1E;
  --naranja: #FF914D;
  --marca: linear-gradient(90deg, #FF3131, #FF914D);
  --noche: #170C0A;
  --noche-2: #241512;
  --blanco: #FFFFFF;
  --linea: rgba(28, 23, 20, .12);
  --linea-fuerte: rgba(28, 23, 20, .22);
  --verde: #1F8A4C;
  --verde-claro: #E3F3E8;
  --ambar: #C27A00;
  --ambar-claro: #FBF0D9;
  --rojo-claro: #FFE6E3;
  --oro-1: #FF3131; --oro-2: #FF914D;
  --plata: #1C1714;
  --bronce: #9A6B4F;

  --f: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --r-s: .55rem;
  --r-m: .9rem;
  --r-l: 1.4rem;
  --sombra: 0 .9rem 2rem -1.4rem rgba(70, 25, 10, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 4.4rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh;
  background: var(--papel); color: var(--tinta);
  font-family: var(--f); font-size: 1rem; line-height: 1.5;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 .9em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--rojo); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tipografía: grotesca gruesa y apretada ---------- */
h1, h2, h3, h4 {
  font-weight: 860; font-variation-settings: "wdth" 84;
  letter-spacing: -0.035em; line-height: .98; margin: 0 0 .45em; text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h3 { font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1.08; }
h4 { font-size: 1.05rem; letter-spacing: -0.01em; line-height: 1.15; }
.titular-gigante {
  font-size: clamp(2.6rem, 9vw, 5.6rem); font-weight: 900; font-variation-settings: "wdth" 72;
  letter-spacing: -0.045em; line-height: .9;
}
.num { font-variant-numeric: tabular-nums; font-variation-settings: "wdth" 78; font-weight: 880; letter-spacing: -0.04em; }
.suave { color: var(--tinta-suave); }
.peque { font-size: .875rem; }
.entradilla { font-size: 1.12rem; color: var(--tinta-suave); max-width: 38rem; }
strong, b { font-weight: 750; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 3.1rem; padding: .7rem 1.3rem; border-radius: var(--r-m); border: 0;
  background: var(--tinta); color: var(--papel); text-decoration: none;
  font-weight: 760; font-size: 1rem; letter-spacing: -0.01em; line-height: 1.15; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.boton:hover { background: #2c2420; }
.boton:active { transform: translateY(1px); }
.boton[disabled], .boton[aria-busy="true"] { opacity: .55; cursor: progress; }
.boton-marca {
  background: var(--marca); color: var(--blanco); text-shadow: 0 1px 2px rgba(150, 30, 0, .3);
  box-shadow: 0 .3rem 0 var(--rojo-hondo); min-height: 3.6rem; font-size: 1.1rem; font-weight: 820;
}
.boton-marca:hover { background: var(--marca); filter: brightness(1.05); }
.boton-marca:active { transform: translateY(.25rem); box-shadow: 0 .05rem 0 var(--rojo-hondo); }
.boton-linea { background: transparent; color: var(--tinta); box-shadow: inset 0 0 0 2px var(--tinta); }
.boton-linea:hover { background: rgba(28, 23, 20, .06); }
.boton-fantasma { background: transparent; color: var(--tinta); padding-inline: .8rem; min-height: 2.6rem; }
.boton-fantasma:hover { background: rgba(28, 23, 20, .07); }
.boton-peque { min-height: 2.4rem; padding: .45rem .85rem; font-size: .9rem; border-radius: var(--r-s); }
.boton-ancho { width: 100%; }
.boton svg { width: 1.15em; height: 1.15em; flex: none; }
.enlace { color: var(--rojo-hondo); font-weight: 650; text-underline-offset: .2em; }
.boton-icono {
  width: 2.6rem; height: 2.6rem; display: inline-grid; place-items: center; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; color: var(--tinta);
}
.boton-icono:hover { background: rgba(28, 23, 20, .08); }
.boton-icono svg { width: 1.3rem; height: 1.3rem; }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: .4rem; margin-bottom: 1.1rem; }
.campo > span, .etiqueta { font-weight: 700; font-size: .95rem; }
.campo small { color: var(--tinta-suave); font-size: .85rem; }
.entrada, .campo input:not([type="range"]):not([type="checkbox"]), .campo select, .campo textarea {
  width: 100%; min-height: 3.1rem; padding: .7rem .95rem;
  background: var(--blanco); border: 1.5px solid var(--linea-fuerte); border-radius: var(--r-m);
  font-size: 1rem; transition: border-color .15s, box-shadow .15s; appearance: none;
}
.campo textarea { min-height: 6rem; resize: vertical; line-height: 1.45; }
.campo select, select.entrada {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231C1714' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 1.1rem; padding-right: 2.4rem;
}
.entrada:focus, .campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--tinta); box-shadow: 0 0 0 4px rgba(255, 145, 77, .3);
}
.fila-campos { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .fila-campos { grid-template-columns: 1fr 1fr; } }
.error-campo { color: var(--rojo-hondo); font-size: .9rem; font-weight: 600; min-height: 1.2em; margin: .2rem 0 .6rem; }

input[type="range"] { width: 100%; accent-color: var(--rojo); height: 2rem; }
.casilla { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-weight: 600; font-size: .95rem; min-height: 2.4rem; }
.casilla input { width: 1.2rem; height: 1.2rem; accent-color: var(--rojo); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 2.3rem; padding: .35rem .85rem;
  border-radius: 999px; border: 1.5px solid var(--linea-fuerte); background: var(--blanco);
  font-size: .92rem; font-weight: 620; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--tinta); }
.chip[aria-pressed="true"] { background: var(--tinta); color: var(--papel); border-color: var(--tinta); }
.chip[aria-pressed="true"]::before {
  content: ""; width: .8rem; height: .8rem; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF914D' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.etiqueta-dato {
  display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px;
  background: var(--papel-2); font-size: .82rem; font-weight: 620; line-height: 1.3;
}

/* ---------- Superficies ---------- */
.panel { background: var(--blanco); border-radius: var(--r-l); padding: clamp(1.1rem, 3vw, 1.8rem); box-shadow: var(--sombra); }
.panel-plano { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r-l); padding: clamp(1rem, 3vw, 1.5rem); }
.destello { position: relative; isolation: isolate; }
.destello::before {
  content: ""; position: absolute; inset: -4rem 0 -2rem; z-index: -1; pointer-events: none;
  background:
    radial-gradient(18rem 10rem at 82% 40%, rgba(255, 145, 77, .30), transparent 72%),
    radial-gradient(14rem 8rem at 8% 85%, rgba(255, 145, 77, .14), transparent 72%);
}
.barra-marca { height: 4px; background: var(--marca); border-radius: 4px; }

/* ---------- Barras de medida ---------- */
.medidor { display: grid; gap: .3rem; }
.medidor-cab { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; font-weight: 650; }
.medidor-cab span:last-child { font-variant-numeric: tabular-nums; color: var(--tinta-suave); }
.medidor-pista { height: .5rem; border-radius: 999px; background: var(--papel-2); overflow: hidden; }
.medidor-pista i { display: block; height: 100%; border-radius: inherit; background: var(--marca); width: 0; transition: width .8s var(--ease); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); width: min(100% - 2rem, 26rem);
  display: grid; gap: .5rem; pointer-events: none;
}
@media (min-width: 960px) { .toasts { bottom: 1.5rem; left: auto; right: 1.5rem; transform: none; } }
.toast {
  pointer-events: auto; display: flex; gap: .7rem; align-items: flex-start;
  background: var(--noche); color: var(--papel); padding: .85rem 1rem; border-radius: var(--r-m);
  box-shadow: 0 1rem 2rem -1rem rgba(0, 0, 0, .6); font-size: .95rem; line-height: 1.4;
  border-left: 4px solid var(--naranja);
  animation: toast-entra .35s var(--ease);
}
.toast.error { border-left-color: var(--rojo); }
.toast.ok { border-left-color: #4CC27E; }
.toast.sale { animation: toast-sale .25s ease forwards; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(.8rem) scale(.97); } }
@keyframes toast-sale { to { opacity: 0; transform: translateY(.5rem); } }

/* ---------- Modal ---------- */
.velo {
  position: fixed; inset: 0; z-index: 80; background: rgba(23, 12, 10, .62);
  display: grid; place-items: end center; padding: 0;
  animation: aparece .25s ease; backdrop-filter: blur(3px);
}
@media (min-width: 640px) { .velo { place-items: center; padding: 1.5rem; } }
.modal {
  width: 100%; max-width: 32rem; max-height: 92svh; overflow: auto;
  background: var(--papel); border-radius: var(--r-l) var(--r-l) 0 0; padding: 1.6rem 1.25rem calc(1.4rem + env(safe-area-inset-bottom));
  animation: sube .35s var(--ease); position: relative;
}
@media (min-width: 640px) { .modal { border-radius: var(--r-l); padding: 2rem; } }
.modal-cerrar { position: absolute; top: .7rem; right: .7rem; }
@keyframes aparece { from { opacity: 0; } }
@keyframes sube { from { transform: translateY(2rem); opacity: 0; } }

/* ---------- Skeletons y estados ---------- */
.esqueleto {
  border-radius: var(--r-m); min-height: 1rem;
  background: linear-gradient(90deg, var(--papel-2) 0%, #F7F4F0 50%, var(--papel-2) 100%);
  background-size: 200% 100%; animation: brillo 1.3s linear infinite;
}
@keyframes brillo { to { background-position: -200% 0; } }
.vacio {
  text-align: center; padding: clamp(2rem, 7vw, 4rem) 1rem; border: 2px dashed var(--linea-fuerte);
  border-radius: var(--r-l); display: grid; justify-items: center; gap: .3rem;
}
.vacio h3 { margin: 0; }
.vacio p { color: var(--tinta-suave); max-width: 28rem; margin: 0 0 .8rem; }
.vacio-icono { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center; background: var(--marca); color: var(--blanco); margin-bottom: .6rem; }
.vacio-icono svg { width: 1.5rem; height: 1.5rem; }
.aviso {
  display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1rem; border-radius: var(--r-m);
  background: var(--ambar-claro); color: #5a3a00; font-size: .95rem; line-height: 1.4;
}
.aviso.error { background: var(--rojo-claro); color: #7a1414; }
.aviso.info { background: var(--blanco); color: var(--tinta); border: 1px solid var(--linea); }
.aviso svg { width: 1.2rem; height: 1.2rem; flex: none; margin-top: .1rem; }
.girando { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: gira .8s linear infinite; flex: none; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- Acordeón ---------- */
details.plegable { border-top: 1px solid var(--linea); }
details.plegable:last-child { border-bottom: 1px solid var(--linea); }
details.plegable > summary {
  list-style: none; cursor: pointer; padding: 1rem 2.2rem 1rem 0; position: relative; font-weight: 750; line-height: 1.3;
}
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary::after {
  content: ""; position: absolute; right: .3rem; top: 50%; width: .75rem; height: .75rem; margin-top: -.5rem;
  border-right: 2.5px solid var(--rojo); border-bottom: 2.5px solid var(--rojo); transform: rotate(45deg);
  transition: transform .2s var(--ease);
}
details.plegable[open] > summary::after { transform: rotate(-135deg); margin-top: -.15rem; }
details.plegable > .plegable-cuerpo { padding: 0 0 1.2rem; }

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