/* =====================================================================
   NXT · Gestión de eventos — Componentes base
   Requiere tokens.css antes. Clases sin prefijo de framework, listas
   para copiar al demo. Todos los colores salen de tokens semánticos.
   ===================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  font-variant-numeric: var(--num);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* Grano de película muy leve sobre toda la app */
.grain::after {
  content: ""; position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background-image: var(--grain); background-size: 180px;
  opacity: var(--grain-opacity); mix-blend-mode: overlay;
}
::selection { background: var(--accent-tint-2); color: var(--text); }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); border-radius: inherit; }

/* ---------- Texto ---------- */
.display {
  font-family: var(--font-display); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-display); line-height: var(--lh-tight);
}
.overline {
  font-family: var(--font-ui); font-stretch: var(--stretch-wide);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3);
}
.num { font-variant-numeric: var(--num); font-feature-settings: "tnum" 1, "lnum" 1; }
.muted { color: var(--text-3); }
.gold-text {
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Íconos ---------- */
.icon {
  width: var(--icon-md); height: var(--icon-md); flex: none;
  display: inline-block; vertical-align: middle;
  color: inherit; overflow: visible;
}
.icon--xs { width: var(--icon-xs); height: var(--icon-xs); --icon-stroke: 2; }
.icon--sm { width: var(--icon-sm); height: var(--icon-sm); --icon-stroke: 1.9; }
.icon--lg { width: var(--icon-lg); height: var(--icon-lg); }
.icon--xl { width: var(--icon-xl); height: var(--icon-xl); --icon-stroke: 1.6; }
.icon--2xl { width: var(--icon-2xl); height: var(--icon-2xl); --icon-stroke: 1.4; }
.icon--hero { width: var(--icon-hero); height: var(--icon-hero); --icon-stroke: 1.25; }
/* Trazo que se dibuja (ok/error a pantalla completa) */
.icon--draw { stroke-dasharray: 64; stroke-dashoffset: 64; animation: draw var(--dur-5) var(--ease-out) var(--dur-2) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Botones ---------- */
.btn {
  --btn-h: var(--tap-pc);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--btn-h); padding: 0 var(--sp-5);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text);
  font: var(--fw-semibold) var(--fs-md)/1 var(--font-ui); font-stretch: var(--stretch-wide);
  letter-spacing: .02em; text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform var(--dur-1) var(--ease-out), background var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), color var(--dur-2);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-gold); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .38; pointer-events: none; filter: saturate(.3); }

.btn--primary {
  background: var(--accent-grad); color: var(--text-on-gold); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 20px -8px rgba(30,140,116,.6);
}
.btn--primary:hover { background: var(--accent-grad); filter: brightness(1.06); border-color: transparent; }
/* Barrido de luz al pasar (detalle de "placa de luz") */
.btn--primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform 700ms var(--ease-out);
}
.btn--primary:hover::before { transform: translateX(120%); }

.btn--confirm { background: var(--ok); color: var(--text-on-state); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 24px -10px rgba(94,220,142,.7); }
.btn--confirm:hover { background: var(--ok-strong); border-color: transparent; }
.btn--danger { background: var(--err-tint); color: var(--err); border-color: var(--err-line); }
.btn--danger:hover { background: var(--err); color: var(--text-on-state); border-color: transparent; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }

.btn--lg { --btn-h: var(--tap-min); font-size: var(--fs-lg); padding: 0 var(--sp-6); border-radius: var(--r-lg); }
.btn--hero {
  --btn-h: var(--tap-hero); width: 100%;
  font: var(--fw-bold) var(--fs-lg)/1 var(--font-display); letter-spacing: .04em;
  border-radius: var(--r-lg); gap: var(--sp-3);
}
.btn--hero .icon { width: 28px; height: 28px; --icon-stroke: 2; }
.btn--icon { --btn-h: var(--tap-pc); width: var(--btn-h); padding: 0; border-radius: var(--r-md); }
.btn--icon.btn--lg { --btn-h: var(--tap-min); }
/* Cargando: puntos escalonados */
.btn[aria-busy="true"] { color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 6px; height: 6px; border-radius: 2px;
  background: var(--text-on-gold); left: 50%; top: 50%; margin: -3px 0 0 -3px;
  box-shadow: -14px 0 0 currentColor, 14px 0 0 currentColor;
  animation: busy 900ms var(--ease-in-out) infinite;
}
.btn--confirm[aria-busy="true"]::after { background: var(--text-on-state); }
@keyframes busy { 0%,100% { box-shadow: -14px 4px 0 var(--text-on-gold), 14px -4px 0 var(--text-on-gold); } 50% { box-shadow: -14px -4px 0 var(--text-on-gold), 14px 4px 0 var(--text-on-gold); } }

/* Onda de toque (agregada por JS en .js-ripple) */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 0;
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: radial-gradient(circle, rgba(78,228,171,.55), rgba(78,228,171,0) 70%);
  animation: ripple 560ms var(--ease-out) forwards;
}
@keyframes ripple { to { transform: scale(26); opacity: 0; } }

/* ---------- Tarjetas ---------- */
.card {
  position: relative; background: var(--surface-1);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-1);
}
/* Firma de marca: escalón azul en la esquina superior derecha. Una por pantalla. */
.card--signature::before {
  content: ""; position: absolute; top: 14px; right: 14px; width: 18px; height: 18px;
  pointer-events: none; background: var(--blue-grad); opacity: .95;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath d='M0 0h28v28h-8v-8h-8v-8H0z'/%3E%3C/svg%3E") no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath d='M0 0h28v28h-8v-8h-8v-8H0z'/%3E%3C/svg%3E") no-repeat;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card__title { display: flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-semibold); font-size: var(--fs-md); margin: 0; }
.card__title .icon { color: var(--accent); }

/* ---------- KPI ---------- */
.kpi { display: flex; flex-direction: column; gap: var(--sp-2); min-height: 152px; }
.kpi__label { display: flex; align-items: center; gap: var(--sp-2); }
.kpi__label .icon { color: var(--accent); }
.kpi__value {
  font-family: var(--font-display); font-weight: var(--fw-medium);
  font-size: clamp(1.5rem, 2.3vw, var(--fs-3xl)); line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: var(--num); white-space: nowrap;
}
.kpi__value small { font-size: .5em; font-weight: var(--fw-regular); color: var(--text-3); margin-left: .15em; letter-spacing: 0; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: auto; font-size: var(--fs-sm); color: var(--text-3); }
.kpi__meter { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.kpi__meter > i { display: block; height: 100%; width: var(--v, 0%); background: var(--accent-grad); border-radius: inherit; transition: width var(--dur-5) var(--ease-out); }
.spark { width: 100%; height: 36px; color: var(--accent); }
.spark path.area { fill: url(#spark-fill); stroke: none; }
.spark path.line { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); font-stretch: 108%; letter-spacing: .03em; white-space: nowrap;
}
.chip .icon { width: 16px; height: 16px; --icon-stroke: 2.1; }
.chip--ok   { color: var(--ok);   background: var(--ok-tint);   border-color: var(--ok-line); }
.chip--warn { color: var(--warn); background: var(--warn-tint); border-color: var(--warn-line); }
.chip--err  { color: var(--err);  background: var(--err-tint);  border-color: var(--err-line); }
.chip--info { color: var(--info); background: var(--info-tint); border-color: var(--info-line); }
.chip--gold { color: var(--accent); background: var(--accent-tint); border-color: var(--line-gold); }
.chip--live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 currentColor; animation: live 1.8s var(--ease-out) infinite;
}
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.chip--lg { height: 36px; padding: 0 14px 0 10px; font-size: var(--fs-sm); }
.chip--lg .icon { width: 20px; height: 20px; }
/* Tipos de entrada: color fijo */
.tk { --tk: var(--tk-general); color: var(--tk); background: color-mix(in srgb, var(--tk) 11%, transparent); border-color: color-mix(in srgb, var(--tk) 36%, transparent); }
.tk--vip { --tk: var(--tk-vip); } .tk--backstage { --tk: var(--tk-backstage); } .tk--cortesia { --tk: var(--tk-cortesia); }

/* ---------- Tecla de producto (comandera) ---------- */
.keys { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: var(--sp-2); }
.key {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; justify-items: start; gap: 6px;
  min-height: var(--tap-key); padding: 10px 12px 10px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  color: var(--text); text-align: left; cursor: pointer; font: inherit;
  box-shadow: var(--hairline-top);
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-2), box-shadow var(--dur-2), background var(--dur-2);
}
.key:active { transform: scale(.955); }
.key:focus-visible { box-shadow: var(--focus-ring); }
.key__icon { width: 32px; height: 32px; --icon-stroke: 1.6; color: var(--accent); }
.key__name { font-weight: var(--fw-semibold); font-size: var(--fs-md); line-height: 1.15; align-self: end; }
.key__price { font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: var(--num); }
.key__count {
  position: absolute; top: 8px; right: 8px; min-width: 30px; height: 30px; padding: 0 8px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--accent-grad); color: var(--text-on-gold);
  font: var(--fw-bold) var(--fs-sm)/1 var(--font-display); font-variant-numeric: var(--num);
  transform: scale(0); transition: transform var(--dur-3) var(--ease-spring);
}
.key.is-on { border-color: var(--line-gold); box-shadow: var(--glow-gold); }
.key.is-on .key__count { transform: scale(1); }
.key.bump .key__count { animation: bump var(--dur-3) var(--ease-spring); }
@keyframes bump { 40% { transform: scale(1.28); } }
.key--cortesia .key__icon { color: var(--tk-cortesia); }
.key--out { opacity: .45; pointer-events: none; }
.key--out .key__price { color: var(--err); }

/* ---------- Control segmentado (Efectivo / QR) ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: calc(var(--tap-min) - 8px);
  border: 0; border-radius: calc(var(--r-lg) - 4px); background: transparent; color: var(--text-3);
  font: var(--fw-semibold) var(--fs-md)/1 var(--font-ui); font-stretch: var(--stretch-wide); cursor: pointer;
  transition: background var(--dur-2), color var(--dur-2), box-shadow var(--dur-2);
}
.seg button[aria-pressed="true"] { background: var(--surface-4); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-gold), var(--shadow-1); }
.seg button[aria-pressed="true"] .icon { color: var(--accent); }
.seg button:focus-visible { box-shadow: var(--focus-ring); }

/* ---------- Campos ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-medium); }
.input {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap-pc); padding: 0 var(--sp-3);
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text-3);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.input input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; outline: none; font-variant-numeric: var(--num); }
.input input::placeholder { color: var(--text-4); }
.input:focus-within { border-color: var(--gold-300); box-shadow: 0 0 0 3px var(--accent-tint-2), 0 0 22px -4px rgba(78,228,171,.35); }
.input--err { border-color: var(--err-line); }
.field__hint { font-size: var(--fs-xs); color: var(--text-3); }
.field__hint--err { color: var(--err); display: flex; align-items: center; gap: 4px; }

/* ---------- Tabla ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th {
  text-align: left; padding: 10px 14px; position: sticky; top: 0; background: var(--surface-1);
  font-stretch: var(--stretch-wide); font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr { transition: background var(--dur-2); }
.table tbody tr:hover { background: var(--surface-2); }
.table .r { text-align: right; font-variant-numeric: var(--num); }
.table .prod { display: flex; align-items: center; gap: 10px; font-weight: var(--fw-medium); color: var(--text); }
.table .prod .icon { color: var(--accent); }
.bar-inline { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.bar-inline > i { display: block; height: 100%; width: var(--v); border-radius: inherit; background: var(--c, var(--accent)); }

/* ---------- Gráfico de barras horizontal ---------- */
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 132px 1fr 76px; align-items: center; gap: 12px; font-size: var(--fs-sm); }
.hbar__label { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.hbar__label .icon { width: 20px; height: 20px; color: var(--text-3); }
.hbar__track { height: 14px; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--data-grid) 0 1px, transparent 1px 20%); position: relative; }
.hbar__fill {
  display: block; height: 100%; width: 0; border-radius: 4px; background: var(--c, var(--data-1));
  box-shadow: 0 0 18px -6px var(--c, var(--data-1));
  transition: width var(--dur-5) var(--ease-out);
}
.hbar__val { text-align: right; font-variant-numeric: var(--num); font-weight: var(--fw-semibold); }
.hbar:first-child .hbar__label { color: var(--text); }
.hbar:first-child .hbar__label .icon { color: var(--accent); }

/* ---------- Navegación PC ---------- */
.nav-pc {
  width: var(--nav-pc-w); display: flex; flex-direction: column; gap: 2px; padding: var(--sp-5) var(--sp-3);
  background: linear-gradient(180deg, var(--surface-1), var(--bg)); border-right: 1px solid var(--line);
}
.nav-pc__brand { padding: 4px 12px 20px; }
.nav-pc__brand img { height: 18px; display: block; }
.nav-pc__group { margin: 16px 12px 6px; }
.nav-pc__item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: var(--tap-pc); padding: 0 12px;
  border-radius: var(--r-md); color: var(--text-3); text-decoration: none; font-weight: var(--fw-medium); font-size: var(--fs-sm);
  transition: background var(--dur-2), color var(--dur-2);
}
.nav-pc__item:hover { background: var(--surface-2); color: var(--text); }
.nav-pc__item[aria-current="page"] { background: var(--accent-tint); color: var(--text); }
.nav-pc__item[aria-current="page"] .icon { color: var(--accent); }
.nav-pc__item[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent-grad); box-shadow: 0 0 12px rgba(78,228,171,.6);
}
.nav-pc__item .badge { margin-left: auto; }
.nav-pc__item:focus-visible { box-shadow: var(--focus-ring); }
.badge {
  min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); font-variant-numeric: var(--num);
  background: var(--warn); color: var(--text-on-state);
}
/* Barra superior PC con filete de horizonte */
.topbar { position: relative; display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); border-bottom: 1px solid var(--line); }
.horizon { position: relative; }
.horizon::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--horizon-grad); opacity: .85; }

/* ---------- Navegación celular (barra inferior) ---------- */
.nav-mobile {
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr);
  height: var(--nav-mobile-h); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface-glass); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.nav-mobile__item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: var(--tap-min); border-radius: var(--r-md); color: var(--text-3); text-decoration: none;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); font-stretch: 110%; letter-spacing: .02em;
  transition: color var(--dur-2);
}
.nav-mobile__item .icon { width: 26px; height: 26px; transition: transform var(--dur-3) var(--ease-spring); }
.nav-mobile__item[aria-current="page"] { color: var(--accent); }
.nav-mobile__item[aria-current="page"] .icon { transform: translateY(-2px); }
.nav-mobile__item[aria-current="page"]::before {
  content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--accent-grad); box-shadow: 0 0 14px rgba(78,228,171,.7);
}

/* ---------- Pantalla completa de puerta ---------- */
.door {
  --door: var(--ok); --door-fill: var(--ok-fill);
  position: absolute; inset: 0; z-index: var(--z-door); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4);
  padding: var(--sp-7) var(--sp-5); text-align: center;
  background: radial-gradient(120% 70% at 50% 42%, color-mix(in srgb, var(--door) var(--door-mix, 26%), var(--door-fill)), var(--door-fill) 60%, var(--bg-deep));
  color: var(--text);
  animation: door-in var(--dur-4) var(--ease-out);
}
:root[data-theme="light"] .door { /* la puerta es siempre nocturna, también en tema claro */
  --text: #F4F4F2; --text-2: #CBCBC8; --text-3: #9E9E9B; --text-on-state: #08080A;
  --ok: #5EDC8E; --warn: #F7DC4A; --err: #FF6A5E; --bg-deep: #060607;
  --surface-2: #18181C; --surface-3: #1F1F24; --line-strong: rgba(244,244,242,.16); --line-gold: rgba(78,228,171,.32);
  --tk-vip: #4EE4AB; --tk-cortesia: #C9C9C6; --tk-general: #CBCBC8;
}
.door--err  { --door: var(--err);  --door-fill: var(--err-fill); }
.door--warn { --door: var(--warn); --door-fill: var(--warn-fill); --door-mix: 12%; }
.door .btn { font-size: var(--fs-md); }
/* Abanico de haces de luz (escenario) */
.door::before {
  content: ""; position: absolute; left: -40%; right: -40%; bottom: 0; height: 120%;
  color: var(--door); background: var(--fan-rays); opacity: .1;
  -webkit-mask: radial-gradient(100% 100% at 50% 100%, #000 30%, transparent 75%); mask: radial-gradient(100% 100% at 50% 100%, #000 30%, transparent 75%);
}
.door > * { position: relative; }
.door__icon { color: var(--door); filter: drop-shadow(0 0 24px color-mix(in srgb, var(--door) 60%, transparent)); }
.door__ring { position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 2px solid var(--door); opacity: 0; animation: ring 1.4s var(--ease-out) var(--dur-3) 2; }
.door__title { font: var(--fw-bold) var(--fs-4xl)/1 var(--font-display); letter-spacing: .01em; color: var(--door); text-transform: uppercase; margin: 0; }
.door__sub { font-size: var(--fs-xl); font-weight: var(--fw-semibold); margin: 0; }
.door__meta { color: var(--text-2); font-size: var(--fs-md); margin: 0; }
.door__timer { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--door); animation: timer 2.5s linear forwards; }
@keyframes door-in { from { opacity: 0; transform: scale(1.04); } }
@keyframes ring { 0% { opacity: .7; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes timer { from { width: 100%; } to { width: 0; } }
.door--err .door__icon { animation: shake 420ms var(--ease-in-out) var(--dur-3); }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* ---------- Modal ---------- */
.scrim { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--sp-4); background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade var(--dur-3) var(--ease-out); }
.scrim[hidden] { display: none; }
.modal {
  position: relative; width: min(460px, 100%); padding: var(--sp-6);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  animation: rise var(--dur-3) var(--ease-spring);
}
.modal::after { content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 1px; background: var(--horizon-grad); }
.modal__icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: var(--r-lg); background: var(--accent-tint); color: var(--accent); margin-bottom: var(--sp-4); border: 1px solid var(--line-gold); }
.modal__title { font: var(--fw-semibold) var(--fs-xl)/1.2 var(--font-display); margin: 0 0 var(--sp-2); }
.modal__body { color: var(--text-2); margin: 0 0 var(--sp-6); }
.modal__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.modal__close { position: absolute; top: 12px; right: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Aviso breve (toast) ---------- */
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; min-height: var(--tap-min);
  border-radius: var(--r-lg); background: var(--surface-glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); font-weight: var(--fw-medium);
}
.toast .icon { flex: none; }
.toast--ok .icon { color: var(--ok); } .toast--ok { border-color: var(--ok-line); }
.toast--err .icon { color: var(--err); } .toast--err { border-color: var(--err-line); }
.toast--warn .icon { color: var(--warn); } .toast--warn { border-color: var(--warn-line); }
.toast small { display: block; color: var(--text-3); font-weight: var(--fw-regular); }

/* ---------- Estado vacío ---------- */
.empty {
  position: relative; overflow: hidden; display: grid; justify-items: center; gap: var(--sp-3); text-align: center;
  padding: var(--sp-9) var(--sp-6); border-radius: var(--r-lg); border: 1px dashed var(--line-strong);
}
.empty::before {
  content: ""; position: absolute; inset: 0; color: var(--accent); background: var(--fan-rays); opacity: .05;
  -webkit-mask: radial-gradient(70% 90% at 50% 100%, #000, transparent 70%); mask: radial-gradient(70% 90% at 50% 100%, #000, transparent 70%);
}
.empty > * { position: relative; }
.empty__art { width: 88px; height: 88px; display: grid; place-items: center; border-radius: 26px; color: var(--accent); background: radial-gradient(circle at 50% 30%, var(--accent-tint-2), transparent 70%); border: 1px solid var(--line-gold); }
.empty__title { font: var(--fw-semibold) var(--fs-lg)/1.2 var(--font-display); margin: 0; }
.empty__text { color: var(--text-3); margin: 0; max-width: 34ch; }

/* ---------- Utilidades de composición ---------- */
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.stack { display: grid; gap: var(--sp-3); }
.divider-steps {
  height: 12px; color: var(--line-strong);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='12'%3E%3Cpath d='M0 11.5h12v-4h6v-4h12v4h6v4h12' fill='none' stroke='%23F4EEE2' stroke-opacity='.16'/%3E%3C/svg%3E") repeat-x center;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
