/* =====================================================================
   Plataforma: planos de recinto, butacas, compra, entradas con aura,
   control de acceso, sala de control, panel de demos e instalador.
   Se carga en todas las superficies después de pages.css.
   ===================================================================== */

[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---------- Aviso de demostración ---------- */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; padding: 8px 16px; background: #1c1a10; color: #f2efe7; font-size: 0.8rem; text-align: center; border-bottom: 1px solid #3a3620; }
.demo-banner a { color: #D4FF3A; font-weight: 700; }

/* =====================================================================
   Plano del recinto (panel y escaparate)
   ===================================================================== */
.vplan { margin: 0; }
.vplan-canvas { position: relative; width: 100%; border-radius: 18px; overflow: hidden; background: #f1f0ec; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.vplan-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; pointer-events: none; }
.vplan-zones { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vzone polygon { fill: var(--zone); fill-opacity: 0.92; stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; transition: fill-opacity 0.15s, filter 0.15s; }
.vzone.is-low polygon { fill-opacity: 0.92; }
.vzone.is-sold_out polygon, .vzone.is-off polygon { fill: #b9b5ad; fill-opacity: 0.75; }
.vplan.is-interactive .vzone[role="button"] { cursor: pointer; }
.vplan.is-interactive .vzone[role="button"]:hover polygon, .vzone.is-hover polygon { fill-opacity: 1; filter: brightness(1.08) saturate(1.1); stroke-width: 3.5; }
.vzone:focus { outline: none; }
.vzone:focus-visible polygon { stroke: #111; stroke-width: 5; }
.vplan.has-selection .vzone:not(.is-selected) polygon { fill-opacity: 0.45; }
.vzone.is-selected polygon { fill-opacity: 1; stroke: #111; stroke-width: 4.5; }
.vplan-tip { position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 14px)); display: flex; gap: 10px; align-items: flex-start; min-width: 180px; max-width: 260px; padding: 10px 12px; border-radius: 12px; background: #141317; color: #f4f1ea; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35); pointer-events: none; font-size: 0.82rem; line-height: 1.35; }
.vplan-tip::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: inherit; transform: rotate(45deg); }
.vplan-tip-sw { flex: none; width: 12px; height: 12px; margin-top: 3px; border-radius: 4px; }
.vplan-tip-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vplan-tip-body strong { font-size: 0.92rem; }
.vplan-tip-body > span { color: #b6b2a8; }
.vplan-tip-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.vplan-tip-row b { color: #fff; }
.vplan-tip-row em { font-style: normal; color: #9be29b; }
.vplan-hint { margin-top: 10px; font-size: 0.8rem; color: var(--sf-muted, var(--color-text-muted)); }

/* ---------- Plano en el panel: ventas por zona ---------- */
.plan-card { padding: var(--space-4); }
.plan-card-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: var(--space-5); align-items: start; }
.zone-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.zone-legend li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); }
.zone-legend li:hover { background: var(--color-surface-2); }
.zone-legend .grow { display: flex; flex-direction: column; min-width: 0; }
.zone-legend-sw { flex: none; width: 14px; height: 14px; border-radius: 4px; }
@media (max-width: 900px) { .plan-card-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Formulario de recinto: plantillas de plano ---------- */
.venue-form { max-width: 980px; }
.plan-templates { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: var(--space-3); }
.plan-template { position: relative; display: block; cursor: pointer; }
.plan-template input { position: absolute; opacity: 0; pointer-events: none; }
.plan-template-body { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 10px 10px 14px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface); transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); }
.plan-template:hover .plan-template-body { transform: translateY(-1px); border-color: var(--color-text-subtle); }
.plan-template input:checked + .plan-template-body { border-color: var(--color-text); box-shadow: 0 0 0 1px var(--color-text), 0 0 0 5px var(--color-accent-soft); }
.plan-template input:focus-visible + .plan-template-body { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.plan-template-thumb { display: grid; place-items: center; aspect-ratio: 10 / 7; border-radius: 10px; overflow: hidden; background: #f1f0ec; }
.plan-template-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plan-template-thumb.is-empty { color: var(--color-text-subtle); background: var(--color-surface-2); }
.plan-template-title { font-weight: 650; font-size: 0.9rem; padding: 0 4px; }
.plan-template-text { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.4; padding: 0 4px; }

/* ---------- Editor de zonas ---------- */
.zone-editor-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: var(--space-5); padding: var(--space-4); align-items: start; }
.zone-stage { position: sticky; top: 76px; display: flex; flex-direction: column; gap: var(--space-3); }
.zone-canvas { position: relative; width: 100%; border-radius: 14px; overflow: hidden; background: #f1f0ec; }
.zone-canvas img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.zone-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: manipulation; }
.zone-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.zone-tools [data-drawing-label] { flex: 1 1 100%; }
.zone-list { display: flex; flex-direction: column; gap: 10px; }
.zone-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.zone-row.is-active { border-color: var(--color-text); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.zone-row-head { display: flex; gap: 8px; align-items: center; }
.zone-row-head .input { flex: 1; min-width: 0; }
.zone-color { flex: none; width: 36px; height: 36px; padding: 2px; border: 1px solid var(--color-border-strong); border-radius: 8px; background: var(--color-surface); cursor: pointer; }
.zone-row-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.zone-row-fields .select { width: auto; flex: 1 1 140px; }
.zone-num { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }
.zone-num .input { width: 86px; }
@media (max-width: 960px) {
  .zone-editor-grid { grid-template-columns: minmax(0, 1fr); padding: var(--space-3); }
  .zone-stage { position: static; }
}

/* =====================================================================
   Escaparate: plano, entradas y butacas
   ===================================================================== */
.sf-plan-block .vplan-canvas { background: #f1f0ec; }
.sf-plan-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.sf-plan-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; margin: 12px 0 0; padding: 0; font-size: 0.8rem; color: var(--sf-muted); }
.sf-plan-legend li { display: inline-flex; align-items: center; gap: 8px; }
.sf-plan-legend span { width: 14px; height: 14px; border-radius: 4px; }
.sf-plan-legend .is-on { background: linear-gradient(135deg, var(--brand), #C9A15B); }
.sf-plan-legend .is-low { background: linear-gradient(135deg, #E07A5F, #B5527A); }
.sf-plan-legend .is-out { background: #b9b5ad; }
.sf-ev-layout.has-plan { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr); }
@media (max-width: 960px) {
  .sf-ev-layout.has-plan { grid-template-columns: minmax(0, 1fr); }
  .sf-ev-layout.has-plan .sf-ev-aside { order: 0; position: static; }
}
.sf-tt-sw { display: inline-block; width: 11px; height: 11px; margin-right: 8px; border-radius: 3px; vertical-align: 1px; }
.sf-tt.is-picked .sf-tt-name { color: var(--brand); }
.sf-tt.is-flash { animation: sf-flash 0.9s var(--ease-out, ease); }
@keyframes sf-flash { 30% { background: color-mix(in srgb, var(--brand) 18%, transparent); } }
.sf-tt-action { flex: none; display: flex; }
.sf-tt-seats { font-size: 0.78rem; font-weight: 700; color: var(--brand); }
.sf-btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.85rem; border-radius: 12px; }
.sf-assure { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.8rem; color: var(--sf-muted); }
.sf-assure li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.sf-assure .icon { flex: none; margin-top: 1px; }
.sf-tickets .field-error { margin: 6px 0; padding: 10px 12px; border-radius: 10px; background: rgba(217, 65, 43, 0.15); color: #ffb4a6; font-size: 0.85rem; }
.sf-escena .sf-tickets .field-error { color: #9a2a17; }
.sf-nav-tickets { color: var(--sf-text) !important; }
@media (max-width: 480px) { .sf-tt { flex-wrap: wrap; } .sf-tt-action { width: 100%; } .sf-tt-action .sf-btn { width: 100%; } }

/* ---------- Selector de butacas ---------- */
.sf-seat-dialog { width: min(980px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--sf-line); border-radius: 22px; background: var(--sf-surface); color: var(--sf-text); box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5); overflow: hidden; }
.sf-seat-dialog[open] { display: flex; flex-direction: column; }
.sf-seat-dialog::backdrop { background: rgba(5, 5, 6, 0.7); backdrop-filter: blur(4px); }
.sf-seat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 6px; }
.sf-icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--sf-line); background: transparent; color: var(--sf-text); }
.sf-seat-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 4px 20px 10px; font-size: 0.8rem; color: var(--sf-muted); }
.sf-seat-legend li { display: inline-flex; align-items: center; gap: 6px; }
.sf-seat-legend span { width: 14px; height: 14px; border-radius: 50%; }
.sf-seat-legend .is-free { background: #5fbf8a; }
.sf-seat-legend .is-mine { background: var(--brand); box-shadow: 0 0 0 2px var(--sf-surface), 0 0 0 4px var(--brand); }
.sf-seat-legend .is-taken { background: #4a4844; }
.sf-escena .sf-seat-legend .is-taken { background: #cfcabd; }
.sf-seat-stage { margin: 0 20px; padding: 8px; border-radius: 0 0 40px 40px / 0 0 22px 22px; background: linear-gradient(#2d2a33, #121116); color: #f1efea; text-align: center; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.4em; text-transform: uppercase; }
.sf-seatmap { flex: 1 1 auto; min-height: 220px; overflow: auto; padding: 14px 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sf-seatmap svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.sf-seat { cursor: pointer; transition: transform 0.12s; transform-box: fill-box; transform-origin: center; }
.sf-seat.is-free { fill: #5fbf8a; }
.sf-seat.is-free:hover { fill: #79d6a2; transform: scale(1.15); }
.sf-seat.is-mine { fill: var(--brand); stroke: var(--sf-text); stroke-width: 2; }
.sf-seat.is-taken { fill: #4a4844; cursor: not-allowed; }
.sf-escena .sf-seat.is-taken { fill: #d8d3c6; }
.sf-seat:focus-visible { outline: none; stroke: var(--sf-text); stroke-width: 3; }
.sf-row-label { fill: var(--sf-subtle); font: 700 11px/1 var(--font-sans); text-anchor: middle; }
.sf-seat-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px 18px; border-top: 1px solid var(--sf-line); }
.sf-seat-foot p { margin: 0; flex: 1 1 220px; color: var(--sf-muted); }
@media (max-width: 600px) {
  .sf-seat-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .sf-seat-foot .sf-btn { width: 100%; }
}

/* =====================================================================
   Pago, pedido y «Mis entradas»
   ===================================================================== */
.sf-checkout { padding-top: 28px; padding-bottom: 64px; }
.sf-checkout-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.sf-countdown { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--sf-surface-2); border: 1px solid var(--sf-line); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.sf-countdown.is-warning { background: rgba(229, 72, 77, 0.18); border-color: rgba(229, 72, 77, 0.6); }
.sf-checkout-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr); gap: 24px; align-items: start; margin-top: 18px; }
.sf-panel { padding: clamp(18px, 3vw, 28px); border-radius: calc(var(--sf-radius) + 2px); background: var(--sf-surface); border: 1px solid var(--sf-line); }
.sf-order-summary { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) {
  .sf-checkout-grid { grid-template-columns: minmax(0, 1fr); }
  .sf-order-summary { position: static; order: -1; }
}
.sf-form { display: flex; flex-direction: column; gap: 14px; }
.sf-section-gap { margin-top: 26px; }
.sf-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
.sf-span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .sf-fields { grid-template-columns: minmax(0, 1fr); } }
.sf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sf-field label { font-size: 0.85rem; font-weight: 650; }
.sf-input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--sf-line); background: var(--sf-bg); color: var(--sf-text); font: inherit; font-size: 1rem; }
.sf-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.sf-input[aria-invalid="true"] { border-color: #e5484d; }
.sf .field-error { margin: 0; font-size: 0.8rem; color: #ff8f80; }
.sf-escena .field-error { color: #b42318; }
.sf-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 0.9rem; line-height: 1.45; cursor: pointer; }
.sf-check input { flex: none; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); }
.sf-holders { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sf-holder { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--sf-surface-2); }
.sf-holder-meta { display: flex; gap: 12px; align-items: center; font-size: 0.9rem; min-width: 0; }
.sf-holder-n { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: 0.85rem; }
@media (max-width: 560px) { .sf-holder { grid-template-columns: minmax(0, 1fr); } }
.sf-paybox { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 14px; border: 1px dashed var(--sf-line); background: var(--sf-surface-2); }
.sf-paybox p { margin: 4px 0 0; }
.sf-pay-btn { margin-top: 14px; }
.sf-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.sf-lines li { display: flex; justify-content: space-between; gap: 12px; }
.sf-lines .sf-discount { color: #79d6a2; font-weight: 700; }
.sf-escena .sf-lines .sf-discount { color: #1f7a4b; }
.sf-summary-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px solid var(--sf-line); font-weight: 700; }
.sf-summary-total strong { font-size: 1.5rem; }
.sf-discount-form { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--sf-line); }
.sf-inline { display: flex; gap: 8px; }
.sf-inline .sf-input { flex: 1; min-width: 0; text-transform: uppercase; }
.sf-link { padding: 0; border: 0; background: none; color: var(--sf-muted); font: inherit; text-decoration: underline; cursor: pointer; }
.sf-link:hover { color: var(--sf-text); }
.sf-center { display: grid; place-items: center; min-height: 60vh; }
.sf-narrow { max-width: 520px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sf-narrow .sf-form { width: 100%; text-align: left; }
.sf-big-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand); }
.sf-success { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; margin-bottom: 18px; border-radius: 14px; background: rgba(95, 191, 138, 0.15); border: 1px solid rgba(95, 191, 138, 0.5); font-size: 0.92rem; }
.sf-success .icon { flex: none; color: #79d6a2; }

/* ---------- Entradas: QR dinámico con aura ---------- */
.sf-order { padding-top: 28px; padding-bottom: 64px; }
.sf-order-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.sf-passes { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 4px 18px; margin: 0 -4px; }
.sf-pass { flex: 0 0 min(360px, 86vw); scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 18px 18px; border-radius: 28px; background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--brand) 26%, var(--sf-surface)) 0%, var(--sf-surface) 62%); border: 1px solid var(--sf-line); text-align: center; }
.sf-pass-top { display: flex; flex-direction: column; gap: 3px; }
.sf-pass-name { font-size: 1.25rem; line-height: 1.2; }
.sf-pass-type { font-size: 0.85rem; color: var(--sf-muted); }
.sf-pass-seat { margin-top: 4px; display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: 0.85rem; }
.sf-pass-foot { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sf-pass-bar { width: 70%; height: 4px; border-radius: 4px; background: var(--sf-line); overflow: hidden; }
.sf-pass-bar span { display: block; height: 100%; background: var(--brand); transform-origin: left; }
.sf-pass-code { margin: 0; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; color: var(--sf-subtle); }
.sf-pass.is-void { opacity: 0.6; }

@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.aura { --size: min(64vw, 248px); position: relative; width: calc(var(--size) + 40px); height: calc(var(--size) + 40px); display: grid; place-items: center; margin: 14px 0 10px; }
.aura-glow { position: absolute; inset: -22px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 55%, transparent), transparent 78%); filter: blur(16px); animation: aura-breathe 3.2s ease-in-out infinite; }
.aura-ring { position: absolute; inset: 0; border-radius: 34px; padding: 5px; background: conic-gradient(from var(--angle), var(--brand), #ffd27a, #fff6e0, #ffd27a, var(--brand), color-mix(in srgb, var(--brand) 40%, #000), var(--brand)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: aura-angle 4s linear infinite; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--brand) 80%, transparent)); }
.aura-orbit { position: absolute; inset: 0; animation: aura-spin 5s linear infinite; }
.aura-orbit span { position: absolute; top: -5px; left: 50%; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px 4px #fff6e0, 0 0 28px 10px var(--brand); }
.aura-qr { position: relative; width: var(--size); height: var(--size); border-radius: 22px; background: #fff; padding: 10px; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45); }
.aura-qr canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.aura-shine { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 210, 122, 0.35) 50%, transparent 65%); transform: translateX(-120%); animation: aura-shine 3.6s ease-in-out infinite; pointer-events: none; }
.aura.is-refresh .aura-qr { animation: aura-refresh 0.6s ease-out; }
.aura-stamp { position: absolute; left: 10px; right: 10px; top: 50%; transform: translateY(-50%) rotate(-8deg); padding: 10px; border: 3px solid #e5484d; border-radius: 10px; color: #e5484d; font: 800 17px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; background: rgba(255, 255, 255, 0.9); }
.aura-stamp.is-ok { border-color: #1f7a4b; color: #1f7a4b; }
.sf-pass.is-used .aura-ring, .sf-pass.is-used .aura-glow, .sf-pass.is-used .aura-orbit, .sf-pass.is-void .aura-ring, .sf-pass.is-void .aura-glow, .sf-pass.is-void .aura-orbit { filter: grayscale(1); opacity: 0.35; }
@keyframes aura-angle { to { --angle: 360deg; } }
@keyframes aura-spin { to { transform: rotate(360deg); } }
@keyframes aura-breathe { 50% { transform: scale(1.08); opacity: 0.75; } }
@keyframes aura-shine { 0%, 30% { transform: translateX(-120%); } 70%, 100% { transform: translateX(120%); } }
@keyframes aura-refresh { 0% { transform: scale(0.94); filter: brightness(1.4); } 100% { transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) {
  /* El aura se mantiene porque es una medida antifraude; solo se ralentiza. */
  .aura-ring { animation-duration: 8s; }
  .aura-orbit { animation-duration: 10s; }
  .aura-glow, .aura-shine { animation-duration: 6s; }
}
.sf-order-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 12px; }
@media (max-width: 760px) { .sf-order-info { grid-template-columns: minmax(0, 1fr); } }
.sf-steps { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; color: var(--sf-muted); line-height: 1.5; }
.sf-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 16px; font-size: 0.9rem; }
.sf-dl dt { color: var(--sf-muted); }
.sf-dl dd { margin: 0; text-align: right; font-weight: 650; }

/* ---------- Mis entradas ---------- */
.sf-my-head { margin-bottom: 20px; }
.sf-my-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 8px; }
.sf-my-list.is-past { opacity: 0.7; }
.sf-my-order { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; background: var(--sf-surface); border: 1px solid var(--sf-line); text-decoration: none; transition: border-color var(--dur-fast), transform var(--dur-fast); }
.sf-my-order:hover { border-color: var(--brand); transform: translateY(-1px); }
.sf-my-cover { flex: none; display: grid; place-items: center; width: 88px; height: 66px; border-radius: 12px; overflow: hidden; background: var(--sf-surface-2); font-weight: 800; }
.sf-my-cover img { width: 100%; height: 100%; object-fit: cover; }
.sf-my-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sf-my-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-my-go { flex: none; color: var(--sf-muted); }
.sf-tag { align-self: flex-start; margin-top: 4px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--sf-text); font-size: 0.75rem; font-weight: 700; }
.sf-tag.is-off { background: var(--sf-surface-2); color: var(--sf-muted); }
@media (max-width: 480px) { .sf-my-cover { width: 64px; height: 56px; } }

/* =====================================================================
   Panel: listados, ventas y control de acceso
   ===================================================================== */
.kpi-strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) {
  .kpi-strip-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi-strip-3 .kpi-cell + .kpi-cell { border-left: 0; border-top: 1px solid var(--color-border); }
}
.split-layout { display: grid; grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr); gap: var(--space-5); align-items: start; }
@media (max-width: 960px) { .split-layout { grid-template-columns: minmax(0, 1fr); } }
.access-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.access-title { margin: 4px 0 0; font-size: 1.1rem; }
.live-pill { display: inline-flex; align-items: center; gap: 4px; color: #1f9d55; font-weight: 700; }
.live-pill.is-off { color: var(--color-text-subtle); }
.cr-bar { height: 6px; border-radius: 6px; background: var(--color-surface-3); overflow: hidden; margin-top: 6px; }
.cr-bar span { display: block; height: 100%; background: #1f9d55; transition: width 0.6s; }
.cr-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .cr-grid { grid-template-columns: minmax(0, 1fr); } }
.cr-chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.cr-chart span { flex: 1; min-width: 2px; border-radius: 4px 4px 0 0; background: linear-gradient(var(--color-accent), color-mix(in srgb, var(--color-accent) 50%, #1f9d55)); transition: height 0.5s; }
.cr-zone-bar { height: 4px; margin-top: 6px; border-radius: 4px; background: var(--color-surface-3); overflow: hidden; }
.cr-zone-bar span { display: block; height: 100%; background: #1f9d55; }
.cr-feed .list-item { border-left: 3px solid transparent; }
.cr-feed .is-valid { border-left-color: #1f9d55; }
.cr-feed .is-duplicate, .cr-feed .is-expired_code { border-left-color: #f5a524; }
.cr-feed .is-invalid, .cr-feed .is-cancelled, .cr-feed .is-wrong_event { border-left-color: #e5484d; }

/* =====================================================================
   Escáner (pantalla completa en el móvil)
   ===================================================================== */
.scanner-body { margin: 0; background: #0b0b0d; color: #f2efe7; overscroll-behavior: none; }
.scanner { display: flex; flex-direction: column; height: 100dvh; min-height: 100vh; }
.scanner-top { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; background: #141317; border-bottom: 1px solid #26252b; }
.scanner-back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: inherit; background: #201f24; flex: none; }
.scanner-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.scanner-title strong { font-size: 0.95rem; }
.scanner-net { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: #8ee2a9; }
.scanner-net span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.scanner-net.is-off { color: #f5a524; }
.scanner-gate input { width: 108px; min-height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid #34333a; background: #201f24; color: inherit; font: inherit; font-size: 0.85rem; }
.scanner-view { position: relative; flex: 1; overflow: hidden; background: #000; }
.scanner-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; left: 50%; top: 50%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; }
.scanner-frame span { position: absolute; width: 44px; height: 44px; border: 4px solid #D4FF3A; }
.scanner-frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.scanner-frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.scanner-frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.scanner-frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.scanner-start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: radial-gradient(80% 60% at 50% 40%, #1d1c22, #0b0b0d); }
.scanner-start p { max-width: 320px; margin: 0; color: #b6b2a8; }
.scanner-start-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: #D4FF3A; color: #121211; }
.scanner-result { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; animation: scan-in 0.18s ease-out; }
.scanner-result.is-ok { background: rgba(23, 128, 70, 0.96); }
.scanner-result.is-warn { background: rgba(196, 120, 0, 0.96); }
.scanner-result.is-ko { background: rgba(190, 38, 44, 0.96); }
.scanner-result-icon { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); font-size: 3.2rem; font-weight: 900; }
.scanner-result-label { font-size: 2rem; line-height: 1.1; }
.scanner-result-holder { font-size: 1.35rem; font-weight: 700; }
.scanner-result-where { font-size: 1rem; opacity: 0.9; }
.scanner-result-msg { font-size: 0.95rem; opacity: 0.85; }
@keyframes scan-in { from { opacity: 0; transform: scale(0.97); } }
.scanner-bottom { padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px); background: #141317; border-top: 1px solid #26252b; display: flex; flex-direction: column; gap: 10px; }
.scanner-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.scanner-stats div { display: flex; flex-direction: column; padding: 6px 2px; border-radius: 10px; background: #1c1b20; }
.scanner-stats strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.scanner-stats span { font-size: 0.66rem; color: #a3a097; }
.scanner-manual { display: flex; gap: 8px; }
.scanner-manual input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid #34333a; background: #201f24; color: inherit; font: inherit; font-family: var(--font-mono); font-size: 0.85rem; }

/* =====================================================================
   Panel de demos e instalador
   ===================================================================== */
.demo-body { min-height: 100vh; background: var(--color-bg); }
.demo-top { display: flex; align-items: center; gap: 12px; padding: 14px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--color-border); }
.demo-top .brand { margin-right: auto; }
.demo-main { max-width: 1180px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px) 64px; }
.demo-hero { max-width: 820px; margin-bottom: 32px; }
.demo-hero .eyebrow { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-subtle); }
.demo-hero h1 { margin: 8px 0 12px; font-size: clamp(2rem, 1.2rem + 3vw, 3.4rem); line-height: 1.02; letter-spacing: -0.03em; }
.demo-hero h1 em { font-family: var(--font-serif); font-weight: 400; font-style: italic; }
.demo-hero .lead { font-size: 1.05rem; color: var(--color-text-muted); line-height: 1.55; }
.demo-roles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.demo-role { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.demo-role-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--color-accent); color: var(--color-on-accent, #121211); }
.demo-role-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.demo-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.demo-grid > :last-child { grid-column: 1 / -1; }
@media (max-width: 900px) { .demo-grid { grid-template-columns: minmax(0, 1fr); } }
.demo-qr { align-self: center; width: min(240px, 70vw); padding: 10px; border-radius: 16px; background: #fff; }
.demo-qr svg { display: block; width: 100%; height: auto; }
.demo-empty { max-width: 560px; }
@media (max-width: 480px) { .demo-role { flex-wrap: wrap; } .demo-role .btn { width: 100%; } }

.install { width: min(760px, 100%); margin: 0 auto; }
.install-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.install-head .brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--color-accent); color: #121211; }
.install-code { margin: 0; padding: 12px 14px; border-radius: var(--radius-md); background: var(--color-surface-2); font-family: var(--font-mono); font-size: 0.8rem; white-space: pre-wrap; word-break: break-all; }
.sf-btn-outline { border-color: var(--brand); color: var(--sf-text); background: transparent; }
.sf-btn-outline:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); filter: none; }

/* Ficha con plano: plano y entradas arriba (también en móvil), descripción debajo. */
.sf-ev-layout.has-plan { grid-template-areas: "plan aside" "main aside"; }
.sf-ev-layout.has-plan > .sf-plan-block { grid-area: plan; margin: 0; }
.sf-ev-layout.has-plan > .sf-ev-main { grid-area: main; }
.sf-ev-layout.has-plan > .sf-ev-aside { grid-area: aside; }
@media (max-width: 960px) { .sf-ev-layout.has-plan { grid-template-areas: "plan" "aside" "main"; } }
@media (max-width: 560px) {
  .sf-nav-tickets { font-size: 0; gap: 0 !important; }
  .sf-nav-tickets .icon { width: 22px; height: 22px; }
  .sf .sf-organizer { flex-wrap: wrap; }
  .sf .sf-organizer > div { flex: 1 1 180px; }
  .sf .sf-organizer > .sf-btn { width: 100%; }
}

/* Tablas apiladas en móvil: la tabla ocupa el ancho de la pantalla y los valores largos se recortan dentro. */
@media (max-width: 720px) {
  .table-stack, .table-stack tbody { display: block; width: 100%; }
  .table-stack td { align-items: baseline; }
  .table-stack td > * { min-width: 0; max-width: 70%; text-align: right; }
  .table-stack td[data-label]::before { flex: none; }
  .table-stack td .cell-main, .table-stack td .cell-sub { display: block; }
}
