/* ============================================================================
   ByeFila — Design System v2.2 (TEMA HÍBRIDO por contexto físico, mobile-first)
   Tokens semánticos + primitivos .fc-* compartidos por landing / app / registro.
   Solo CSS: no toca la lógica JS existente (ids y clases emitidas por JS se
   conservan; aquí solo se estilizan). Fuente de dirección: DESIGN.md.

   TEMA HÍBRIDO (decisión de producto, 2026-09-12):
   · DARK  = :root. Lo heredan el panel del negocio (#view-negocio, operación
     en interior) y landing.html (marca). Sin cambios visuales respecto a v2.1.
   · PAPER = scope "paper" (rampa clara "Paper & Signal", limpiada a AA). Lo
     recibe todo lo que el CLIENTE ve en la calle a pleno sol: la vista
     #view-cliente de app.html y registro.html completa. Bajo sol directo un
     fondo oscuro se lava y compite con la poca luz del cel; el papel refleja
     el sol a favor. El ticket ya era papel blanco = misma física.
   · Cómo se activa el scope (sin JS, sin ids nuevos):
       body[data-theme="paper"]                     → registro.html (atributo en <body>)
       body:has(#view-cliente:not(.fc-hidden))      → app.html mientras la vista
                                                      cliente está visible; el JS
                                                      ya la oculta con .fc-hidden
                                                      cuando ?owner=1 → vuelve dark.
     Se scopea a nivel <body> (no solo la sección) para que header, fondo,
     toasts y pie sean del MISMO tema y no quede una franja dark asomándose.
     Fallback: un navegador sin :has() ignora esa rama y el cliente ve el dark
     de siempre (nunca un estado mixto roto).
   · Los componentes consumen tokens por ROL (--primary-ink, --field-line,
     --grad-text, --ticket-shadow…). En dark cada alias resuelve al valor
     v2.1 exacto; en paper se re-tona. Así el dark queda byte-idéntico en
     render y el claro no repite reglas.

   Técnica firma — "terminal silencioso":
   números tabulares Space Grotesk + hairlines como estructura + UN solo acento.

   Principios (best practices dark UI 2026):
   - Elevación = superficies MÁS CLARAS + hairline firme, no sombras pesadas.
   - Texto off-white (no #fff puro) sobre gris-azul profundo (no #000): sin halación.
   - Acento retonado para fondo oscuro. El acento (--primary) es TEXTO/ICONO/RING;
     la SUPERFICIE del botón primario es una derivada más profunda (--primary-deep)
     para que el texto blanco cumpla AA (>= 4.5:1) con cualquier accentColor.
   - Tokens por ROL (surface / ink / line / accent) para que --primary por negocio
     (accentColor, lo pinta el JS con applyAccent) propague a todo vía color-mix.
   - El TICKET es la excepción intencional: papel blanco SIEMPRE, número gigante
     en tinta sólida (nunca gradiente: se lava al sol).
   - Estado = color + texto + forma. Touch >= 44px. prefers-reduced-motion respetado.
   ============================================================================ */

:root {
  color-scheme: dark;
  /* --- Superficies (rampa de elevación: base → raised → overlay) --- */
  --bg:        #090C15;
  --bg-2:      #0C1019;
  --surface:   #11162A;   /* card */
  --surface-2: #0C1020;   /* hundido: inputs / rows */
  --surface-3: #181E36;   /* raised: hover / toolbar */
  --surface-4: #212947;   /* overlay: popover / active */

  /* --- Líneas (hairline = estructura primaria en dark) --- */
  --line:        rgba(164,178,232,.14);
  --line-soft:   rgba(164,178,232,.08);
  --line-strong: rgba(164,178,232,.26);
  --field-line:  var(--line);   /* borde de input/select (paper lo sube a >=3:1) */

  /* --- Texto (AA probado sobre bg, surface y surface-2) --- */
  --ink:    #F2F4FB;   /* primario (off-white) */
  --ink-2:  #C8CFE6;   /* secundario fuerte */
  --muted:  #9CA6CE;   /* secundario  (7.5:1 sobre surface) */
  --faint:  #7683B2;   /* terciario / placeholders (4.8:1 sobre surface) */

  /* --- Marca y acentos (Teal Cercano — conecta con el verde de WhatsApp; retonados para dark) --- */
  --primary:   #2DD4BF;   /* acento teal claro: texto, iconos, rings (AA sobre bg dark) */
  --primary-2: #34D399;   /* 2º stop del gradiente de marca (wordmark, bandas) — verde-teal */
  --grad: linear-gradient(100deg, var(--primary), var(--primary-2));
  /* Superficie de botón primario: cada stop se profundiza 22% hacia negro. Con
     el acento por defecto el gradiente queda #556FC7 → #7A62C7 y el texto blanco
     mide 4.68:1 en su punto más claro (AA texto normal). Como deriva de
     --primary, sigue al accentColor del negocio conservando su hue. */
  --primary-deep:   color-mix(in srgb, var(--primary) 78%, #000);
  --primary-2-deep: color-mix(in srgb, var(--primary-2) 78%, #000);
  --grad-btn: linear-gradient(100deg, var(--primary-deep), var(--primary-2-deep));
  --primary-soft: color-mix(in srgb, var(--primary) 16%, transparent);
  --primary-line: color-mix(in srgb, var(--primary) 45%, transparent);
  /* Alias por ROL (el tema paper los re-tona; en dark = valor v2.1 exacto).
     --primary-ink: el acento cuando es TEXTO/ICONO/RING (en dark el acento ya es
     legible sobre bg; en paper se profundiza para AA sobre blanco). */
  --primary-ink:      var(--primary);
  --grad-text:        var(--grad);       /* wordmark / h1 con gradiente-texto */
  --grad-chip:        var(--grad);       /* avatar del negocio, marca del logo */
  --pill-waiting-ink: color-mix(in srgb, var(--primary) 70%, #fff);
  --halo-1: 18%; --halo-2: 10%;          /* intensidad del halo del fondo */
  --ok:   #35E4A1;  --ok-soft:   rgba(53,228,161,.14);  --ok-line:   rgba(53,228,161,.42);
  --warn: #FFBE4D;  --warn-soft: rgba(255,190,77,.14);  --warn-line: rgba(255,190,77,.42);
  --bad:  #FF6F7D;  --bad-soft:  rgba(255,111,125,.14); --bad-line:  rgba(255,111,125,.42);
  --wa:   #25D366;  --wa-ink: #063D20;
  --live-pulse: rgba(53,228,161,.5);     /* anillo del punto "en vivo" */

  /* --- Ticket: papel blanco SIEMPRE (legible a pleno sol) --- */
  --paper:       #FFFFFF;
  --paper-2:     #F5F7FC;
  --paper-ink:   #0B1020;
  --paper-muted: #5A6480;              /* 5.9:1 sobre papel */
  --paper-line:  rgba(11,16,32,.12);
  --paper-bad:   #B4262F;              /* 6.0:1 sobre paper-2 */

  /* --- Tipografía --- */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px; --fs-16: 16px;
  --fs-18: 18px; --fs-20: 20px; --fs-24: 24px; --fs-28: 28px; --fs-32: 32px;
  --fs-40: 40px; --fs-56: 56px; --fs-72: 72px; --fs-88: 88px;
  --tr-tight: -.018em;   /* headings */
  --tr-display: -.04em;  /* números gigantes / h1 */
  --tr-caps: .09em;      /* eyebrows / labels uppercase */
  --lh-tight: 1.1; --lh-body: 1.5;

  /* --- Espaciado 4pt --- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* --- Radios --- */
  --r-xs: 8px; --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

  /* --- Sombras (sutiles; la elevación la lleva la superficie) --- */
  --sh-inset: inset 0 1px 0 rgba(255,255,255,.06);          /* highlight superior = "vidrio" */
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 10px 30px -10px rgba(0,0,0,.6);
  --sh-3: 0 24px 60px -20px rgba(0,0,0,.7);
  --sh-primary: 0 8px 24px -8px color-mix(in srgb, var(--primary) 60%, transparent);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 38%, transparent);
  --ticket-shadow: var(--sh-3);                          /* el ticket sobre dark flota por sombra */
  --perf-shadow:   inset 0 1px 3px rgba(0,0,0,.35);      /* muescas del boleto */
  --shimmer:       rgba(255,255,255,.05);                /* brillo del skeleton */
  /* Chevron del <select> (al quitar appearance se pierde el nativo). Color = --muted. */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%239CA6CE' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");

  /* --- Movimiento (spring para montaje; solo transform/opacity) --- */
  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.4,.64,1);
  --dur: 180ms; --dur-slow: 320ms;
  --stagger: 40ms;
}

/* ---------------------------------------------------------------------------
   TEMA PAPER ("Paper & Signal", limpiado a AA) — lado del CLIENTE al sol.
   Se aplica al <body> entero (header, fondo, toasts, pie) cuando:
     · registro.html declara <body data-theme="paper">, o
     · en app.html la vista #view-cliente está visible (:has). Cuando el JS la
       oculta con .fc-hidden (?owner=1 → panel) el body vuelve al dark de :root.
   :is() es una lista "perdonadora": si el navegador no soporta :has(), esa rama
   se ignora sin invalidar la regla → registro sigue claro, el cliente ve dark.
   Especificidad (1,1,1) > :root (0,1,0): los tokens de aquí ganan a los de :root
   pero NO a los que el JS pone inline en <html> (--primary/--primary-2/--grad
   por accentColor), que se heredan intactos → el acento del negocio propaga.
   Todo lo que no se redefine aquí (tipografía, espaciado, radios, movimiento,
   --paper-*, --wa) es idéntico en ambos temas.

   Contraste WCAG medido (fórmula 1.4.3) sobre blanco / bg #F3F5FA / surface-2:
     ink #0B1020            18.9 / 17.4 / 17.5
     ink-2 #2B3350          12.4 / 11.4 / 11.5
     muted #525B74           6.8 /  6.2 /  6.3   (AA texto normal)
     faint #646E8A           5.1 /  4.7 /  4.7   (AA; placeholders, hints 12px)
     primary-ink (65%)       6.3 /  5.8 /  5.8   con el acento por defecto #6D8EFF
     ok #0A7A3C              5.4 /  5.0 /  5.0   (4.7 sobre ok-soft)
     warn #8A5300            6.3 /  5.8 /  5.9   (5.7 sobre warn-soft)
     bad #B4262F             6.4 /  5.9 /  6.0
     botón primario: blanco sobre primary-deep 72% = #4E66B8 → 5.36:1 (stop 2
       #705AB8 → 5.46:1). El 78% del dark (4.68) también pasa, pero sobre papel
       el botón necesita más cuerpo para leerse como "señal", no como pastel.
     borde de campo rgba(16,24,48,.48) ≈ 3.2:1 sobre blanco (UI 1.4.11 ≥ 3:1).
   Los valores que traía el respaldo y FALLABAN AA se corrigieron: faint #8590A9
   (3.2), ok #0E9F4F (3.45), warn #B26A00 (4.2), acento-texto al 82% (4.3).
--------------------------------------------------------------------------- */
body:is([data-theme="paper"], :has(#view-cliente:not(.fc-hidden))) {
  color-scheme: light;   /* selects, color picker y scrollbars nativos en claro */

  /* --- Superficies (papel frío; elevación por tono + sombra suave) --- */
  --bg:        #F3F5FA;
  --bg-2:      #EAEEF7;
  --surface:   #FFFFFF;   /* card */
  --surface-2: #F4F6FB;   /* hundido: inputs / rows */
  --surface-3: #E9EDF6;   /* raised: hover / toolbar */
  --surface-4: #DFE4F1;   /* overlay: toast / active */

  /* --- Líneas (hairlines frías; el borde de campo sube a 3:1 para verse al sol) --- */
  --line:        rgba(16,24,48,.12);
  --line-soft:   rgba(16,24,48,.07);
  --line-strong: rgba(16,24,48,.24);
  --field-line:  rgba(16,24,48,.48);

  /* --- Tinta (casi negra, nunca #000 puro: sin halación) --- */
  --ink:    #0B1020;
  --ink-2:  #2B3350;
  --muted:  #525B74;
  --faint:  #646E8A;

  /* --- Acento: MISMO --primary del negocio (heredado), re-tonado por rol ---
     Como texto/icono se profundiza al 65%; como superficie de botón al 72%. */
  --primary:   #0D9488;   /* teal-600: base del acento en claro (AA sobre papel) */
  --primary-2: #059669;   /* emerald-600: 2º stop del gradiente de marca en claro */
  --primary-ink:      color-mix(in srgb, var(--primary) 65%, #000);
  --primary-deep:     color-mix(in srgb, var(--primary) 72%, #000);
  --primary-2-deep:   color-mix(in srgb, var(--primary-2) 72%, #000);
  /* OJO spec CSS Variables: var() se sustituye en el elemento que DECLARA la
     propiedad. --grad-btn de :root ya lleva incrustado el 78% del dark, así que
     hay que re-declararlo aquí para que tome el 72% de este scope. */
  --grad-btn: linear-gradient(100deg, var(--primary-deep), var(--primary-2-deep));
  --grad-text:        var(--grad-btn);   /* wordmark/h1: gradiente profundo (5.4:1), no pastel (3.0:1) */
  --grad-chip:        var(--grad-btn);
  --pill-waiting-ink: var(--primary-ink);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, transparent);
  --primary-line: color-mix(in srgb, var(--primary) 35%, transparent);
  --halo-1: 14%; --halo-2: 8%;

  /* --- Semánticos como TEXTO sobre papel (AA) + tintes suaves --- */
  --ok:   #0A7A3C;  --ok-soft:   rgba(14,159,79,.12);   --ok-line:   rgba(14,159,79,.45);
  --warn: #8A5300;  --warn-soft: rgba(230,150,0,.13);   --warn-line: rgba(230,150,0,.50);
  --bad:  #B4262F;  --bad-soft:  rgba(214,48,63,.10);   --bad-line:  rgba(214,48,63,.40);
  --live-pulse: rgba(14,159,79,.40);

  /* --- Sombras (frías, suaves: en claro la elevación sí la lleva la sombra) --- */
  --sh-inset: inset 0 1px 0 rgba(255,255,255,.22);   /* solo se nota en botón/chips de acento */
  --sh-1: 0 1px 2px rgba(16,24,48,.06), 0 1px 1px rgba(16,24,48,.04);
  --sh-2: 0 10px 30px -12px rgba(16,24,48,.16), 0 2px 6px -2px rgba(16,24,48,.06);
  --sh-3: 0 30px 70px -24px rgba(16,24,48,.26), 0 8px 20px -10px rgba(16,24,48,.10);
  --sh-primary: 0 10px 26px -10px color-mix(in srgb, var(--primary) 45%, transparent);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
  /* Ticket blanco sobre papel: se distingue por un anillo hairline + sombra
     suave (el anillo va en box-shadow para no mover el layout ni las muescas). */
  --ticket-shadow: 0 0 0 1px var(--paper-line), var(--sh-3);
  --perf-shadow:   inset 0 1px 2px rgba(16,24,48,.12);
  --shimmer:       rgba(16,24,48,.05);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23525B74' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------------------
   Base
--------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: var(--lh-body);
  font-size: var(--fs-16);
  min-height: 100dvh;
}
::selection { background: color-mix(in srgb, var(--primary) 40%, transparent); color: var(--ink); }
/* Focus ring visible en el acento, en cualquier superficie (dark o papel). */
:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; border-radius: var(--r-xs); }
img, svg { display: inline-block; vertical-align: middle; }
button { font-family: inherit; }

/* Fondo: glow del acento arriba + viñeta. .fc-bg--grid añade blueprint grid (landing). */
body.fc-bg::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1000px 480px at 50% -10%, color-mix(in srgb, var(--primary) var(--halo-1), transparent), transparent 70%),
    radial-gradient(800px 420px at 100% 0%, color-mix(in srgb, var(--primary-2) var(--halo-2), transparent), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
}
body.fc-bg--grid::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(164,178,232,.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(164,178,232,.07) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 100%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 100%);
}

/* ---------------------------------------------------------------------------
   Utilidades tipográficas
--------------------------------------------------------------------------- */
.fc-display { font-family: var(--font-display); letter-spacing: var(--tr-display); }
.fc-grad-text {
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Todo número que el usuario compara va tabular (no "baila" al actualizarse). */
.fc-tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.fc-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--tr-caps); text-transform: uppercase;
  color: var(--primary-ink);
}
.fc-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px var(--primary-soft); }
.fc-h1 { font-family: var(--font-display); font-size: clamp(var(--fs-32), 6vw, var(--fs-56)); font-weight: 700; letter-spacing: var(--tr-display); line-height: var(--lh-tight); }
.fc-h2 { font-size: var(--fs-20); font-weight: 700; letter-spacing: var(--tr-tight); line-height: 1.25; }
.fc-sub { color: var(--muted); font-size: var(--fs-14); line-height: 1.55; }
.fc-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------------------------------------------------------------------------
   Botones
--------------------------------------------------------------------------- */
.fc-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-size: var(--fs-15); font-weight: 650; letter-spacing: -.01em; line-height: 1;
  border: 1px solid transparent; border-radius: var(--r-md); cursor: pointer;
  padding: 0 18px; min-height: 48px;
  color: var(--ink); background: var(--surface-3);
  text-decoration: none; white-space: nowrap; user-select: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              opacity var(--dur) var(--ease);
}
.fc-btn:hover { background: var(--surface-4); }
.fc-btn:active { transform: scale(.97); }
.fc-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.fc-btn:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }

/* Primario: superficie profunda (AA con texto blanco), el acento vivo queda en el
   glow exterior y el highlight de vidrio; hover por elevación, NO por brillo
   (subir el brillo rompería el contraste recién ganado). */
.fc-btn--primary {
  width: 100%; color: #fff; background: var(--grad-btn);
  box-shadow: var(--sh-inset), var(--sh-primary);
}
.fc-btn--primary:hover { background: var(--grad-btn); transform: translateY(-1px); box-shadow: var(--sh-inset), 0 14px 30px -10px color-mix(in srgb, var(--primary) 70%, transparent); }
.fc-btn--primary:active { transform: translateY(0) scale(.98); }

.fc-btn--ghost { background: var(--surface-3); border-color: var(--line); box-shadow: var(--sh-inset); font-weight: 600; }
.fc-btn--ghost:hover { background: var(--surface-4); border-color: var(--line-strong); }

.fc-btn--ok   { color: var(--ok);   border-color: var(--ok-line); }
.fc-btn--ok:hover   { background: var(--ok-soft); }
.fc-btn--warn { color: var(--warn); border-color: var(--warn-line); }
.fc-btn--warn:hover { background: var(--warn-soft); }
.fc-btn--bad  { color: var(--bad);  border-color: var(--bad-line); }
.fc-btn--bad:hover  { background: var(--bad-soft); }

/* Acción principal del operador (Llamar siguiente): verde sólido, 8.9:1. */
.fc-btn--success { color: #03301B; background: var(--ok); border-color: transparent; box-shadow: var(--sh-inset), 0 8px 24px -8px rgba(53,228,161,.55); font-weight: 750; }
.fc-btn--success:hover { background: #4DEBB0; transform: translateY(-1px); }

.fc-btn--icon { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: var(--fs-16); border-radius: var(--r-sm); flex: 0 0 auto; }
.fc-btn--sm { min-height: 44px; padding: 0 14px; font-size: var(--fs-14); border-radius: var(--r-sm); }
.fc-btn--lg { min-height: 56px; padding: 0 26px; font-size: var(--fs-16); border-radius: var(--r-lg); }

/* Botón para superficies CLARAS (modal QR sobre fondo blanco) — buen contraste. */
.fc-btn--light { background: #F1F3FA; color: #1A2033; border: 1px solid #D3D9EA; font-weight: 700; box-shadow: none; }
.fc-btn--light:hover { background: #E5E9F5; }

.fc-btn__spin { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: fc-spin .7s linear infinite; }
@keyframes fc-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
   Inputs
--------------------------------------------------------------------------- */
.fc-label { display: block; font-size: var(--fs-13); color: var(--ink-2); font-weight: 600; margin: var(--s-4) 0 var(--s-2); letter-spacing: -.005em; }
.fc-label .opt { color: var(--faint); font-weight: 500; }
.fc-input, .fc-select {
  width: 100%; font-family: inherit; font-size: var(--fs-16); color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--field-line); border-radius: var(--r-sm);
  padding: 0 15px; box-shadow: var(--sh-inset);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  /* iOS Safari da a <select> una métrica de alto/centrado distinta a <input>,
     lo que desfasa la lada respecto al número. Forzamos alto y line-height
     idénticos y quitamos el estilo nativo para que ambos alineen su base. */
  height: 48px; line-height: 1.2; -webkit-appearance: none; appearance: none;
}
.fc-input:hover, .fc-select:hover { border-color: var(--line-strong); }
/* Flecha propia para el select (al quitar appearance se pierde la nativa). */
.fc-select {
  background-image: var(--select-chevron);
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.fc-input::placeholder { color: var(--faint); }
.fc-input:focus, .fc-select:focus { outline: 0; border-color: var(--primary-ink); box-shadow: var(--ring); background: var(--surface); }
.fc-input--error { border-color: var(--bad); }
input[type="number"].fc-input { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input[type="number"].fc-input::-webkit-outer-spin-button, input[type="number"].fc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fc-field-row { display: flex; gap: var(--s-2); }
.fc-hint { color: var(--faint); font-size: var(--fs-12); margin-top: var(--s-2); }

/* ---------------------------------------------------------------------------
   Card / superficies (montaje con spring + stagger; solo transform/opacity)
--------------------------------------------------------------------------- */
.fc-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: var(--s-5); box-shadow: var(--sh-inset), var(--sh-2);
  animation: fc-rise var(--dur-slow) var(--ease-spring) both;
}
.fc-card:nth-child(2) { animation-delay: var(--stagger); }
.fc-card:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.fc-card--raised { background: var(--surface-3); }
.fc-card__head { display: flex; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-4); }
.fc-card__head .fc-h2 { flex: 1; min-width: 0; }
.fc-divider { height: 1px; background: var(--line); margin: var(--s-5) 0; border: 0; }

/* Avatar/inicial de negocio */
.fc-avatar {
  width: 44px; height: 44px; border-radius: var(--r-md); flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 800; font-size: var(--fs-18); color: #fff;
  background: var(--grad-chip); box-shadow: var(--sh-inset), var(--sh-primary);
}

/* KPI stat — número display tabular, etiqueta uppercase */
.fc-stat {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 12px; box-shadow: var(--sh-inset);
}
.fc-stat b { display: block; font-family: var(--font-display); font-size: var(--fs-28); font-weight: 700; letter-spacing: var(--tr-display); line-height: 1; font-variant-numeric: tabular-nums; }
.fc-stat small { display: block; margin-top: 6px; color: var(--muted); font-size: var(--fs-11); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; }

/* Indicador "en vivo" (micro-motion perpetuo SOLO en datos vivos) */
.fc-live { display: inline-flex; align-items: center; gap: 7px; color: var(--ok); font-size: var(--fs-12); font-weight: 700; letter-spacing: .02em; }
.fc-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--live-pulse); animation: fc-live 1.6s ease-out infinite; }
@keyframes fc-live { 70% { box-shadow: 0 0 0 7px rgba(53,228,161,0); } 100% { box-shadow: 0 0 0 0 rgba(53,228,161,0); } }

/* ---------------------------------------------------------------------------
   Ticket (boarding-pass): la pantalla "tu turno".
   PAPEL BLANCO SIEMPRE (excepción intencional al dark: máxima legibilidad al
   sol). Número gigante en tinta sólida, nunca gradiente. La banda superior
   lleva el color del negocio.
--------------------------------------------------------------------------- */
.fc-ticket {
  position: relative; background: var(--paper); color: var(--paper-ink);
  border-radius: var(--r-xl); box-shadow: var(--ticket-shadow); overflow: hidden;
  animation: fc-rise var(--dur-slow) var(--ease-spring) both;
}
.fc-ticket::before { /* banda de marca superior (accentColor del negocio) */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad);
}
.fc-card > .fc-ticket { animation: none; } /* la card ya monta con spring; no duplicar */
.fc-ticket__top { padding: 28px 22px 22px; text-align: center; }
.fc-ticket__bottom { padding: 18px 22px 22px; background: var(--paper); }
/* Perforación con muescas laterales (el fondo de página "corta" el papel) */
.fc-ticket__perf { position: relative; height: 0; margin: 0 22px; border-top: 2px dashed var(--paper-line); }
.fc-ticket__perf::before, .fc-ticket__perf::after {
  content: ""; position: absolute; top: -12px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg); box-shadow: var(--perf-shadow);
}
.fc-ticket__perf::before { left: -35px; } .fc-ticket__perf::after { right: -35px; }
.fc-ticket__lbl { color: var(--paper-muted); font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--tr-caps); text-transform: uppercase; }
.fc-ticket__num {
  font-family: var(--font-display); font-size: clamp(72px, 22vw, 88px); font-weight: 700;
  letter-spacing: var(--tr-display); line-height: 1; margin: 6px 0 10px; color: var(--paper-ink);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.fc-ticket__meta { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; color: var(--paper-muted); font-size: var(--fs-14); }
.fc-ticket__meta b { color: var(--paper-ink); font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
/* Sobre papel, todo gradiente-texto se vuelve tinta sólida (se lava al sol). */
.fc-ticket .fc-grad-text { background: none; -webkit-text-fill-color: var(--paper-ink); color: var(--paper-ink); }
/* Primitivos dark que viven dentro del ticket → variante papel */
.fc-ticket .fc-progress { background: var(--paper-2); border-color: var(--paper-line); }
.fc-ticket .fc-progress__fill { box-shadow: none; }
.fc-ticket .fc-progress__ends { color: var(--paper-muted); }
.fc-ticket .fc-pill--WAITING  { background: color-mix(in srgb, var(--primary) 12%, #fff); color: color-mix(in srgb, var(--primary) 70%, #000); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.fc-ticket .fc-pill--NOTIFIED { background: #FFF3DB; color: #7A4A00; border-color: rgba(230,150,0,.5); }
.fc-ticket .fc-pill--CALLED   { background: #DDF7E8; color: #0A6B36; border-color: rgba(14,159,79,.5); }
.fc-ticket .fc-pill--CALLED::before { box-shadow: 0 0 0 0 rgba(14,159,79,.5); }
.fc-ticket .fc-btn--ghost { background: var(--paper-2); border-color: var(--paper-line); color: var(--paper-ink); box-shadow: none; }
.fc-ticket .fc-btn--ghost:hover { background: #ECEFF7; border-color: rgba(11,16,32,.2); }
.fc-ticket .fc-btn--bad { color: var(--paper-bad); }
.fc-ticket .fc-btn--bad:hover { background: rgba(180,38,47,.08); }
.fc-ticket .fc-called {
  background: linear-gradient(135deg, #DDF7E8, color-mix(in srgb, var(--primary) 10%, #fff));
  border-color: rgba(14,159,79,.5); color: #0A6B36;
}
@keyframes fc-pulse-paper { 0%,100% { box-shadow: 0 0 0 0 rgba(14,159,79,.35); } 50% { box-shadow: 0 0 0 10px rgba(14,159,79,0); } }
.fc-ticket .fc-called { animation-name: fc-pulse-paper; }

/* ---------------------------------------------------------------------------
   Opt-in WhatsApp (abre ventana 24h: avisos gratis). Vive dentro del ticket
   (papel) → tinta oscura; el verde WhatsApp #25D366 se conserva.
--------------------------------------------------------------------------- */
.wa-optin { padding: 14px; border: 1px solid rgba(37,211,102,.45); border-radius: var(--r-md); background: rgba(37,211,102,.10); color: var(--paper-ink); }
.wa-optin__row { display: flex; gap: 12px; align-items: flex-start; }
.wa-optin__logo { flex: 0 0 auto; margin-top: 1px; }
.wa-optin__txt b { display: block; font-size: var(--fs-14); font-weight: 700; color: var(--paper-ink); letter-spacing: -.01em; }
.wa-optin__txt small { display: block; color: var(--paper-muted); font-size: var(--fs-12); margin-top: 3px; line-height: 1.4; }
.fc-btn--wa { width: 100%; margin-top: 12px; background: var(--wa); color: var(--wa-ink); font-weight: 750; border: 0; text-align: center; text-decoration: none; box-shadow: var(--sh-inset); }
.fc-btn--wa:hover { background: #20BD5A; }
.wa-optin--done { background: #F1FBF5; border-color: rgba(37,211,102,.5); }
.wa-optin--done .fc-btn--wa { background: #DDF7E8; color: #0A6B36; pointer-events: none; box-shadow: none; }

/* ---------------------------------------------------------------------------
   Pills de estado (color + texto + punto)
--------------------------------------------------------------------------- */
.fc-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); font-size: var(--fs-12); font-weight: 750; letter-spacing: .04em; border: 1px solid transparent; white-space: nowrap; }
.fc-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.fc-pill--WAITING  { background: var(--primary-soft); color: var(--pill-waiting-ink); border-color: var(--primary-line); }
.fc-pill--NOTIFIED { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.fc-pill--CALLED   { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.fc-pill--CALLED::before { animation: fc-live 1.2s ease-out infinite; box-shadow: 0 0 0 0 rgba(53,228,161,.5); }
.fc-pill--neutral  { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.fc-pill--ok   { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.fc-pill--warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }

/* ---------------------------------------------------------------------------
   Header + logo + tabs
--------------------------------------------------------------------------- */
.fc-header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--s-3);
  padding: 12px var(--s-4); background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
}
.fc-logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-20); letter-spacing: var(--tr-tight); color: var(--ink); text-decoration: none; }
.fc-logo__mark { width: 26px; height: 26px; border-radius: 8px; background: var(--grad-chip); display: grid; place-items: center; box-shadow: var(--sh-inset), var(--sh-primary); flex: 0 0 auto; }
.fc-logo__mark svg { width: 16px; height: 16px; }
.fc-tabs { margin-left: auto; display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.fc-tab { min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: var(--fs-14); font-weight: 700; font-family: inherit; transition: color var(--dur), background var(--dur); }
.fc-tab.is-active { background: var(--grad-btn); color: #fff; }

/* ---------------------------------------------------------------------------
   Progreso de posición
--------------------------------------------------------------------------- */
.fc-progress { position: relative; height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; border: 1px solid var(--line-soft); }
.fc-progress__fill { height: 100%; background: var(--grad); border-radius: var(--r-pill); transition: width 600ms var(--ease-out); box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 60%, transparent); }
.fc-progress__ends { display: flex; justify-content: space-between; margin-top: 8px; color: var(--faint); font-size: var(--fs-11); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; }

/* ---------------------------------------------------------------------------
   Skeleton: silueta EXACTA de una fila (número · nombre · estado), no spinner.
--------------------------------------------------------------------------- */
.fc-skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--line-soft); }
.fc-skel::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--surface-4), var(--surface-4)) 14px 50% / 46px 22px no-repeat,
    linear-gradient(var(--surface-4), var(--surface-4)) 78px 18px / 38% 12px no-repeat,
    linear-gradient(var(--surface-4), var(--surface-4)) 78px 38px / 22% 10px no-repeat;
  opacity: .7;
}
.fc-skel::after { content:""; position:absolute; inset:0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--shimmer), transparent); animation: fc-shimmer 1.3s infinite; }
@keyframes fc-shimmer { 100% { transform: translateX(100%); } }

/* ---------------------------------------------------------------------------
   Banner "te toca" con pulso/glow (variante dark; en ticket se vuelve papel)
--------------------------------------------------------------------------- */
.fc-called {
  margin-top: var(--s-4); padding: 16px 18px; border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(53,228,161,.22), color-mix(in srgb, var(--primary) 16%, transparent));
  border: 1px solid var(--ok-line); color: var(--ok); font-weight: 750; font-size: var(--fs-18); letter-spacing: -.01em; line-height: 1.25;
  animation: fc-pulse 1.5s ease-in-out infinite;
}
@keyframes fc-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(53,228,161,.35); } 50% { box-shadow: 0 0 0 10px rgba(53,228,161,0); } }

/* ---------------------------------------------------------------------------
   Toasts (reemplazan alert/prompt)
--------------------------------------------------------------------------- */
.fc-toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: var(--s-2); width: min(440px, 92vw); pointer-events: none; }
.fc-toast { display: flex; align-items: flex-start; gap: var(--s-3); background: var(--surface-4); border: 1px solid var(--line-strong); border-left: 3px solid var(--primary-ink); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--sh-inset), var(--sh-3); font-size: var(--fs-14); font-weight: 500; color: var(--ink); animation: fc-toast-in var(--dur-slow) var(--ease-spring); pointer-events: auto; }
.fc-toast--ok  { border-left-color: var(--ok); }
.fc-toast--err { border-left-color: var(--bad); }
.fc-toast--warn{ border-left-color: var(--warn); }
.fc-toast.is-out { animation: fc-toast-out var(--dur) var(--ease) forwards; }
@keyframes fc-toast-in { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
@keyframes fc-toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* ---------------------------------------------------------------------------
   Modal
--------------------------------------------------------------------------- */
.fc-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(4,6,12,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fc-fade var(--dur) var(--ease); }
.fc-modal__panel { width: 100%; max-width: 380px; animation: fc-rise var(--dur-slow) var(--ease-spring); }
@keyframes fc-fade { from { opacity: 0; } }
@keyframes fc-rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }

/* ---------------------------------------------------------------------------
   Lista de fila (operador). El JS emite .row > .n + .who(.nm, small>.fc-pill) + .acts
   Vista de datos = filas con hairline, no cards; números tabulares; el
   siguiente en pasar lleva el acento. Sin animación de montaje: la lista se
   re-renderiza cada 4 s y animarla sería ruido.
--------------------------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); background: transparent; transition: background var(--dur) var(--ease); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-3); }
.row .n { font-family: var(--font-display); font-size: var(--fs-24); font-weight: 700; letter-spacing: var(--tr-display); min-width: 54px; text-align: center; color: var(--ink); -webkit-text-fill-color: var(--ink); background: none; font-variant-numeric: tabular-nums; }
.row:first-child .n { color: var(--primary-ink); -webkit-text-fill-color: var(--primary-ink); }
.row .who { flex: 1; min-width: 0; }
.row .who .nm { display: block; font-weight: 650; font-size: var(--fs-16); line-height: 1.3; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .who .nm small { font-weight: 500; font-size: var(--fs-13); }
.row .who > small { color: var(--muted); display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; margin-top: 4px; font-size: var(--fs-13); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .who > small .fc-pill { flex: 0 0 auto; padding: 3px 9px; font-size: var(--fs-11); }
.row .acts { display: flex; gap: 6px; }
.row .acts .fc-btn--icon { width: 44px; height: 44px; min-height: 44px; font-size: var(--fs-18); font-weight: 800; }

/* ---------------------------------------------------------------------------
   Estado vacío / error de carga (el JS emite .empty y .fc-empty)
--------------------------------------------------------------------------- */
.fc-empty, .empty { text-align: center; color: var(--muted); padding: 34px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-14); }
.fc-empty b { display: block; color: var(--ink); font-size: var(--fs-16); margin-bottom: 4px; }

.fc-hidden { display: none !important; }
.fc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Movimiento reducido: sin montajes, sin pulsos perpetuos, sin scroll suave. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
