/* ==========================================================================
   Ticket ACP v2 — sistema visual "boleto de feria"
   Tinta de noche de feria, cinta roja→naranja de la ACP, mostaza de luces.
   ========================================================================== */
:root {
  --ink: #2A1630;
  --ink-2: #4A3552;
  --muted: #776681;
  --line: #E6DFEA;
  --bg: #F5F2F7;
  --paper: #FFFFFF;
  --red: #D7262E;
  --orange: #FF7A00;
  --gold: #FFC23D;
  --gold-soft: #FFF3D6;
  --ok: #137A38;   --ok-bg: #E4F4EA;
  --wait: #9A5200; --wait-bg: #FFF1DD;
  --bad: #B4232A;  --bad-bg: #FDE7E8;
  --ribbon: linear-gradient(90deg, var(--red), var(--orange));
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --shadow: 0 1px 0 rgba(42,22,48,.06), 0 8px 24px -12px rgba(42,22,48,.25);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); font-variation-settings: "wdth" 100; }
img { max-width: 100%; display: block; }
a { color: var(--red); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(560px, 100% - 2rem); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1.4fr 1fr; } }

/* Tipografía de cartel: la única extravagancia */
.poster {
  font-family: "Archivo", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", sans-serif;
  font-variation-settings: "wdth" 62; font-stretch: 62%; font-weight: 900; text-transform: uppercase;
  letter-spacing: -.005em; line-height: .88;
}

/* ---------- Cabecera pública ---------- */
.site-head { background: var(--ink); color: #fff; position: relative; z-index: 2; }
.site-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: var(--ribbon); }
.site-head .wrap { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.brand .logo { width: 30px; height: 34px; background: #fff; -webkit-mask: url(../img/acp-logo-g.png) center/contain no-repeat; mask: url(../img/acp-logo-g.png) center/contain no-repeat; }
.brand b { white-space: nowrap; font-variation-settings: "wdth" 75; font-weight: 800; font-size: 1.15rem; letter-spacing: .01em; }
.brand span { display: block; font-size: .72rem; opacity: .75; font-weight: 500; }
.site-nav { margin-left: auto; display: flex; gap: .25rem; align-items: center; }
.site-nav a, .site-nav button { white-space: nowrap; color: #fff; text-decoration: none; padding: .5rem .75rem; border-radius: var(--r-sm); font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; }
.site-nav a:hover, .site-nav button:hover { background: rgba(255,255,255,.1); }
.site-nav .cta { background: #fff; color: var(--ink); font-weight: 700; }
.site-nav .cta:hover { background: var(--gold); color: var(--ink); }
@media (max-width: 640px) { .brand span { display: none; } .site-nav a.hide-sm { display: none; } .site-nav { gap: 0; } .site-nav a { padding: .5rem .55rem; } }
@media (max-width: 400px) { .site-nav a.hide-xs { display: none; } }
.site-nav .show-sm { display: none; }
.site-nav form { margin: 0; }
@media (max-width: 640px) { .site-nav .show-sm { display: block; } .site-nav .logout { border: 1.5px solid rgba(255,255,255,.45); padding: .4rem .65rem; margin-left: .25rem; } }

main { padding-bottom: 4rem; }
.site-foot { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .9rem; }
.site-foot .row { justify-content: space-between; }

/* ---------- Hero tipo cartel ---------- */
.hero { background: var(--ink); color: #fff; padding: 3rem 0 3.5rem; overflow: hidden; position: relative; }
.hero .wrap { display: grid; gap: 2rem; align-items: end; }
@media (min-width: 860px) { .hero .wrap { grid-template-columns: 1.5fr 1fr; } }
.hero h1, .hero .poster { font-size: clamp(3rem, 10vw, 7.2rem); margin: .1em 0 .15em; color: #fff; }
.hero .when { font-variation-settings: "wdth" 75; font-weight: 700; font-size: clamp(1.1rem, 2.4vw, 1.5rem); color: var(--gold); }
.hero .lead { color: rgba(255,255,255,.82); max-width: 52ch; font-size: 1.05rem; }
.hero .art { aspect-ratio: 4/5; border-radius: var(--r-lg); overflow: hidden; background: #3a2342 center/cover; box-shadow: 0 30px 60px -30px #000; transform: rotate(1.5deg); border: 6px solid #fff; }
.hero .art img { width: 100%; height: 100%; object-fit: cover; }
.hero .art.empty { display: grid; place-items: center; background: var(--ribbon); }
.hero .art.empty i { width: 50%; aspect-ratio: 1; background: rgba(255,255,255,.9); -webkit-mask: url(../img/acp-logo-g.png) center/contain no-repeat; mask: url(../img/acp-logo-g.png) center/contain no-repeat; }
.hero .from { display: inline-flex; gap: .5rem; align-items: baseline; margin-top: 1rem; }
.hero .from strong { font-size: 1.6rem; }

/* ---------- Carrusel de eventos (hero) ---------- */
.hero.carousel { padding-bottom: 1.25rem; }
.carousel .slides { display: grid; }
.carousel .slide { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s; }
.carousel .slide.is-on { opacity: 1; visibility: visible; transition: opacity .6s ease; }
.carousel .slide .wrap { min-height: 100%; }
.btn.ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn.ghost-light:hover { background: #fff; color: var(--ink); }
.hero .facts-line { color: rgba(255,255,255,.7); font-size: .92rem; margin: -.25rem 0 1rem; }
.carousel-controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.14); }
.dots { display: flex; gap: .35rem; flex-wrap: wrap; min-width: 0; }
.dot { background: none; border: 0; color: rgba(255,255,255,.62); font: inherit; font-size: .9rem; font-weight: 600; padding: .45rem .2rem .55rem; margin-right: .9rem; cursor: pointer; position: relative; white-space: nowrap; }
.dot::after { content: ""; position: absolute; left: .2rem; right: .2rem; bottom: 0; height: 3px; border-radius: 2px; background: rgba(255,255,255,.18); }
.dot[aria-selected="true"] { color: #fff; }
.dot[aria-selected="true"]::after { background: var(--gold); }
.dot:hover { color: #fff; }
.arrows { display: flex; gap: .4rem; flex: none; }
.arrow { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.arrow:hover { background: #fff; color: var(--ink); }
.arrow[data-pause] { font-size: .7rem; letter-spacing: -.1em; }
@media (max-width: 700px) {
  .dot { margin-right: .1rem; padding: .6rem .35rem; }
  .dot span { display: none; }
  .dot::after { position: static; display: block; width: 22px; left: auto; right: auto; }
  .hero .art { max-width: 320px; }
}
@media (prefers-reduced-motion: reduce) { .carousel .slide { transition: none; } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2.5rem 0 1rem; }
.section-title h2 { margin: 0; }

/* ---------- Boleto (componente insignia) ---------- */
.stubs { display: grid; gap: 1rem; }
@media (min-width: 760px) { .stubs { grid-template-columns: repeat(2, 1fr); } }
.stub {
  --notch: 11px;
  display: grid; grid-template-columns: 92px 1fr; background: var(--paper); border-radius: var(--r);
  box-shadow: var(--shadow); position: relative; color: inherit; text-decoration: none; min-height: 128px;
  /* muescas laterales del boleto */
  -webkit-mask: radial-gradient(circle at 92px 0, transparent var(--notch), #000 calc(var(--notch) + .5px)) top/100% 51% no-repeat,
                radial-gradient(circle at 92px 100%, transparent var(--notch), #000 calc(var(--notch) + .5px)) bottom/100% 51% no-repeat;
          mask: radial-gradient(circle at 92px 0, transparent var(--notch), #000 calc(var(--notch) + .5px)) top/100% 51% no-repeat,
                radial-gradient(circle at 92px 100%, transparent var(--notch), #000 calc(var(--notch) + .5px)) bottom/100% 51% no-repeat;
  transition: transform .15s ease;
}
a.stub:hover { transform: translateY(-2px); color: inherit; }
.stub .date { display: grid; place-content: center; text-align: center; padding: .75rem .25rem; border-right: 2px dashed var(--line); background: var(--gold-soft); border-radius: var(--r) 0 0 var(--r); }
.stub .date .d { font-variation-settings: "wdth" 62; font-weight: 900; font-size: 2.6rem; line-height: .9; }
.stub .date .m { font-weight: 700; text-transform: lowercase; font-size: .95rem; }
.stub .date .w { font-size: .78rem; color: var(--muted); }
.stub .body { padding: .9rem 1rem .9rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; }
.stub .body h3 { margin: 0; font-size: 1.12rem; }
.stub .body .meta { color: var(--ink-2); font-size: .92rem; }
.stub .body .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-top: .5rem; }
.stub .price { font-weight: 700; }
.stub.soldout { opacity: .65; }
.stub.soldout .price { color: var(--bad); }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .7rem 1.15rem; border-radius: var(--r-sm); border: 2px solid var(--ink);
  background: var(--ink); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 44px; }
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn.primary { background: var(--red); border-color: var(--red); }
.btn.primary:hover { background: #B81E26; border-color: #B81E26; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: #fff; color: var(--ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.danger { background: #fff; color: var(--bad); border-color: #EBC4C6; }
.btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn.sm { padding: .4rem .7rem; min-height: 34px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--red); text-decoration: underline; cursor: pointer; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #D6CCDB; border-radius: var(--r-sm); padding: .65rem .75rem; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: 3px solid rgba(255,122,0,.35); outline-offset: 0; }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { font: inherit; font-size: .9rem; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--red); flex: none; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- Tarjetas y avisos ---------- */
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.25rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.flash { padding: .8rem 1rem; border-radius: var(--r-sm); margin: 1rem 0; border-left: 4px solid; background: #fff; }
.flash.ok { border-color: var(--ok); background: var(--ok-bg); }
.flash.error { border-color: var(--bad); background: var(--bad-bg); }
.flash.info { border-color: var(--orange); background: var(--gold-soft); }
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.ok { color: var(--ok); background: var(--ok-bg); }
.tag.wait { color: var(--wait); background: var(--wait-bg); }
.tag.bad { color: var(--bad); background: var(--bad-bg); }
.tag.muted { color: var(--muted); background: #EEE9F1; }

/* ---------- Compra: selector de entradas ---------- */
.perf-head { background: var(--ink); color: #fff; padding: 2rem 0 2.5rem; }
.perf-head .crumbs a { color: rgba(255,255,255,.7); text-decoration: none; font-size: .9rem; }
.perf-head h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); margin: .25rem 0 .4rem; }
.perf-head .facts { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; color: rgba(255,255,255,.9); }
.perf-head .facts b { color: var(--gold); font-weight: 700; }
.types { list-style: none; margin: 0; padding: 0; }
.types li { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.types li:last-child { border-bottom: 0; }
.types .name { font-weight: 700; }
.types .zone { color: var(--muted); font-size: .9rem; }
.types .price { font-weight: 700; font-size: 1.05rem; }
.types .left { font-size: .82rem; color: var(--wait); font-weight: 600; }
.types .out { color: var(--bad); font-weight: 700; font-size: .9rem; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid #D6CCDB; border-radius: var(--r-sm); background: #fff; }
.stepper button { width: 42px; height: 42px; border: 0; background: none; font-size: 1.35rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.stepper button:hover { background: var(--bg); }
.stepper button:disabled { color: #C9BFCE; cursor: default; background: none; }
.stepper input { width: 46px; min-height: 42px; border: 0; text-align: center; font-weight: 700; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.totalbar { position: sticky; bottom: 0; background: var(--paper); border-top: 4px solid; border-image: var(--ribbon) 1; padding: .9rem 0; margin-top: 1rem; z-index: 5; }
.coupon-box { border-top: 1px dashed var(--line); padding-top: 1rem; margin-top: .25rem; }
.coupon-box label { margin-bottom: .4rem; }
.coupon-box p { margin: .4rem 0 0; min-height: 1.2em; font-weight: 600; }
.discount-line { color: var(--ok); font-weight: 600; }
.summary tr.disc td { color: var(--ok); }
.totalbar .amount { font-size: 1.5rem; font-weight: 800; }

/* ---------- Pago ---------- */
.countdown { display: inline-flex; gap: .4rem; align-items: center; background: var(--gold-soft); color: var(--wait); font-weight: 700; padding: .35rem .7rem; border-radius: 999px; }
.countdown.late { background: var(--bad-bg); color: var(--bad); }
.bankbox dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; }
.bankbox dt { color: var(--muted); font-size: .9rem; }
.bankbox dd { margin: 0; font-weight: 700; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.copy { font: inherit; font-size: .78rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); }
.copy.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.summary { width: 100%; border-collapse: collapse; }
.summary td { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.summary td:last-child { text-align: right; white-space: nowrap; }
.summary tr.total td { border-bottom: 0; font-weight: 800; font-size: 1.15rem; padding-top: .75rem; }
.paytabs { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.paytabs label { margin: 0; border: 2px solid var(--line); border-radius: var(--r-sm); padding: .75rem; cursor: pointer; font-weight: 700; display: flex; gap: .5rem; align-items: center; background: #fff; }
.paytabs input { accent-color: var(--red); width: 18px; height: 18px; }
.paytabs label:has(input:checked) { border-color: var(--ink); background: var(--gold-soft); }

/* ---------- Mis entradas ---------- */
.ticket-card { display: grid; grid-template-columns: 1fr; background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
@media (min-width: 620px) { .ticket-card { grid-template-columns: 1fr 200px; } }
.ticket-card .info { padding: 1.1rem 1.25rem; border-top: 6px solid; border-image: var(--ribbon) 1; }
.ticket-card .qr { background: #fff; border-left: 2px dashed var(--line); display: grid; place-items: center; padding: 1rem; }
@media (max-width: 619px) { .ticket-card .qr { border-left: 0; border-top: 2px dashed var(--line); } }
.ticket-card .qr img { width: 170px; height: 170px; image-rendering: pixelated; }
.ticket-card .code { font-family: var(--mono); font-weight: 700; letter-spacing: .02em; }
.ticket-card.used .qr img, .ticket-card.void .qr img { opacity: .25; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0 0 .9rem 1rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.now::before { background: var(--orange); border-color: var(--orange); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* ---------- Resultado de escaneo (pantalla completa en celular) ---------- */
.scanres { min-height: 70vh; display: grid; place-content: center; text-align: center; padding: 2rem 1rem; border-radius: var(--r-lg); margin-top: 1rem; color: #fff; }
.scanres.ok { background: var(--ok); }
.scanres.used, .scanres.wrong_performance { background: #C26A00; }
.scanres.void, .scanres.not_found { background: var(--bad); }
.scanres .big { font-size: clamp(2.6rem, 12vw, 5rem); }
.scanres .detail { font-size: 1.15rem; max-width: 34ch; margin: .5rem auto 0; }

/* ==========================================================================
   Panel interno
   ========================================================================== */
.admin { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 980px) { .admin { grid-template-columns: 236px 1fr; background: linear-gradient(90deg, var(--ink) 236px, var(--bg) 236px); } }
.side { background: var(--ink); color: #fff; padding: 1rem .75rem; position: relative; }
@media (min-width: 980px) { .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
.side .brand { padding: .25rem .5rem 1rem; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 979px) {
  .side { padding: .5rem .75rem; display: flex; align-items: center; gap: .5rem; overflow-x: auto; }
  .side .brand { padding: 0; flex: none; } .side .brand div { display: none; }
  .side nav { flex-direction: row; }
  .side .who { display: flex; align-items: center; margin: 0 0 0 auto; padding: 0 0 0 .5rem; border: 0; flex: none; position: sticky; right: 0; background: var(--ink); box-shadow: -16px 0 12px -2px var(--ink); }

}
.side nav a { color: rgba(255,255,255,.82); text-decoration: none; padding: .55rem .7rem; border-radius: var(--r-sm); display: flex; justify-content: space-between; align-items: center; gap: .5rem; white-space: nowrap; font-size: .95rem; }
.side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side nav a.on { background: #fff; color: var(--ink); font-weight: 700; }
.side nav a .count { background: var(--gold); color: var(--ink); border-radius: 999px; font-size: .75rem; font-weight: 800; padding: 0 .45rem; }
.side .sep { height: 1px; background: rgba(255,255,255,.12); margin: .6rem .5rem; }
.side .who { margin-top: 1.5rem; padding: .75rem .7rem; font-size: .85rem; color: rgba(255,255,255,.7); border-top: 1px solid rgba(255,255,255,.12); }
.side .who b { color: #fff; display: block; }
.side .who .role { display: block; }
.side .who form { margin-top: .4rem; }
.side .who button { color: var(--gold); }
.content { padding: 1.25rem; min-width: 0; }
@media (min-width: 980px) { .content { padding: 1.75rem 2.25rem; } }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.8rem; font-variation-settings: "wdth" 75; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.toolbar .field { margin: 0; min-width: 150px; }
.toolbar .field.wide { flex: 1; min-width: 220px; }

.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th { text-align: left; font-weight: 700; color: var(--muted); font-size: .8rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: #FBFAFC; white-space: nowrap; }
table.data td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #FCFBFD; }
table.data .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data a.rowlink { color: var(--ink); font-weight: 700; text-decoration: none; }
table.data a.rowlink:hover { color: var(--red); }

.pager { display: flex; gap: .4rem; justify-content: flex-end; margin-top: 1rem; }

/* KPIs */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.kpi { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.kpi .label { color: var(--muted); font-size: .88rem; }
.kpi .value { font-size: 1.85rem; font-weight: 800; font-variation-settings: "wdth" 75; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .84rem; color: var(--ink-2); }
.kpi.alert { border-top: 4px solid var(--orange); }
.kpi a { color: inherit; }

.panels { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .panels { grid-template-columns: 1.6fr 1fr; } }
.panel { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; min-width: 0; }
.panel h2 { font-size: 1.05rem; margin-bottom: .2rem; }
.panel .note { color: var(--muted); font-size: .85rem; margin-bottom: .75rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }

/* Gráficos (SVG generado en dashboard.js) */
.chart { width: 100%; height: 240px; display: block; }
.chart .grid line { stroke: #EEE8F1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--red); }
.chart .bar:hover, .chart .bar.hl { fill: #9E1A21; }
.chart .hit { fill: transparent; cursor: crosshair; }
.hbars { display: grid; gap: .55rem; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.hbar .track { height: 12px; background: #F1ECF3; border-radius: 0 4px 4px 0; }
.hbar .fill { height: 100%; background: var(--red); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.meter { height: 10px; background: #F1ECF3; border-radius: 0 4px 4px 0; position: relative; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); border-radius: 0 4px 4px 0; }
.meter i.adm { background: var(--orange); }
.tooltip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; padding: .45rem .6rem; border-radius: var(--r-sm); font-size: .82rem; z-index: 50; box-shadow: var(--shadow); white-space: nowrap; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.split div { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .6rem .75rem; }
.split b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* Validación de pagos */
.review { display: grid; gap: 1rem; grid-template-columns: 1fr; background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; }
@media (min-width: 900px) { .review { grid-template-columns: 1.2fr 1fr auto; align-items: start; } }
.review .who b { font-size: 1.05rem; }
.review dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; margin: 0; font-size: .92rem; }
.review dt { color: var(--muted); }
.review dd { margin: 0; font-weight: 600; }
.review .match { font-weight: 700; }
.review .match.no { color: var(--bad); }
.review .match.yes { color: var(--ok); }
.review .actions { display: flex; flex-direction: column; gap: .5rem; min-width: 200px; }
.review details summary { cursor: pointer; color: var(--bad); font-weight: 700; list-style: none; }
.review details[open] summary { margin-bottom: .5rem; }
.warnline { background: var(--bad-bg); color: var(--bad); border-radius: var(--r-sm); padding: .35rem .6rem; font-size: .85rem; font-weight: 600; }

/* Boletería */
.pos { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .pos { grid-template-columns: 1.5fr 1fr; } }
.pos-types { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pos-type { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: .4rem; border: 2px solid transparent; }
.pos-type.picked { border-color: var(--ink); background: var(--gold-soft); }
.pos-type .name { font-weight: 800; font-size: 1.05rem; }
.pos-type .price { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pos-type .stepper { align-self: flex-start; margin-top: .25rem; }
.pos-type .stepper button { width: 52px; height: 52px; font-size: 1.6rem; }
.pos-type .stepper input { width: 56px; min-height: 52px; font-size: 1.2rem; }
.pos-cart { position: sticky; top: 1rem; }
.pos-quick { background: var(--gold-soft); border: 2px solid transparent; border-radius: var(--r-sm); padding: .7rem .8rem; margin: 0 0 1rem; cursor: pointer; }
.pos-quick:has(input:checked) { border-color: var(--ink); }
.pos-quick input { width: 22px; height: 22px; }
#pos-last { margin: 0 0 1rem; }
.pos-cart .total { font-size: 2.4rem; font-weight: 900; font-variation-settings: "wdth" 75; font-variant-numeric: tabular-nums; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.methods label { margin: 0; border: 2px solid var(--line); border-radius: var(--r-sm); padding: .8rem .5rem; text-align: center; cursor: pointer; font-weight: 700; background: #fff; }
.methods input { position: absolute; opacity: 0; }
.methods label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.methods label:has(input:focus-visible) { outline: 3px solid var(--orange); }
.change { font-size: 1.1rem; font-weight: 700; }
.done-sale { text-align: center; }
.done-sale .code { font-family: var(--mono); font-size: 1.4rem; font-weight: 800; }

/* Escáner */
.scanner { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 980px) { .scanner { grid-template-columns: 1fr 1fr; } }
.cam { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 1; max-height: 70vh; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.cam .off { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #fff; padding: 1rem; gap: .75rem; }
.verdict { border-radius: var(--r); padding: 1.4rem; color: #fff; background: #4A3552; min-height: 180px; display: flex; flex-direction: column; justify-content: center; }
.verdict .t { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 900; font-variation-settings: "wdth" 62; text-transform: uppercase; line-height: 1; }
.verdict .d { font-size: 1.1rem; margin-top: .35rem; }
.verdict .m { font-size: .9rem; opacity: .85; margin-top: .5rem; }
.verdict.ok { background: var(--ok); }
.verdict.used, .verdict.wrong_performance { background: #C26A00; }
.verdict.void, .verdict.not_found { background: var(--bad); }
.verdict.idle { background: var(--ink-2); }
.scanlog { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.scanlog li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.scanlog li span:first-child { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Catálogo / roles */
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; }
.perm-matrix .grp td { background: #FBFAFC; font-weight: 700; color: var(--muted); font-size: .8rem; }
.perm-matrix input { width: 20px; height: 20px; accent-color: var(--red); }
details.editor { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: .75rem; }
details.editor > summary { padding: .9rem 1.1rem; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; align-items: center; list-style: none; }
details.editor > summary::-webkit-details-marker { display: none; }
details.editor > summary h3 { margin: 0; }
details.editor > .inner { padding: 0 1.1rem 1.1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

dialog { border: 0; border-radius: var(--r); padding: 1.25rem; max-width: 460px; width: calc(100% - 2rem); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(42,22,48,.55); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  .side, .site-head, .site-foot, .toolbar, .btn, form { display: none !important; }
  body { background: #fff; } .content { padding: 0; } .card, .panel, .table-wrap { box-shadow: none; }
}
.cam:has(.off:not([hidden])) .frame { display: none; }

/* Avisos de pagos por revisar */
.alerts-ctl { margin: 1rem .5rem 0; padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; font-size: .85rem; }
.alerts-ctl span { color: rgba(255,255,255,.6); font-size: .78rem; }
.alerts-ctl .linkbtn { color: rgba(255,255,255,.85); font-size: .85rem; }
.alerts-ctl [aria-pressed="false"] { color: rgba(255,255,255,.5); }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; display: flex; flex-direction: column; gap: .5rem; width: min(360px, calc(100vw - 2rem)); }
.toast { background: var(--paper); color: var(--ink); border-left: 4px solid var(--gold); border-radius: var(--r-sm); box-shadow: 0 18px 40px -12px rgba(42,22,48,.45); padding: .8rem .95rem; display: flex; flex-direction: column; gap: .15rem; font-size: .9rem; animation: toast-in .25s ease-out; }
.toast b { font-size: .95rem; }
.toast span { color: var(--muted); }
.toast-actions { display: flex; gap: .75rem; align-items: center; margin-top: .45rem; }
.toast-actions .btn { padding: .35rem .8rem; font-size: .85rem; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
p.hint { font-size: .82rem; color: var(--muted); margin: .25rem 0 .75rem; }
.card h3 { margin: 1.25rem 0 .5rem; }
@media (max-width: 979px) { .alerts-ctl { display: none !important; } }

/* Cerrar sesión visible en celular (va al final para ganar a las reglas base) */
@media (max-width: 979px) {
  .side .who b, .side .who .role { display: none; }
  .side .who form { margin: 0; }
  .side .who button { color: var(--ink); background: var(--gold); text-decoration: none; font-weight: 700; padding: .45rem .8rem; border-radius: var(--r-sm); }
}
@media (max-width: 440px) { .site-head .brand div { display: none; } }
