:root {
  --ivory: #f7f2e9;
  --paper: #fffdf8;
  --olive: #596043;
  --olive-dark: #343a28;
  --wine: #712f3b;
  --gold: #b38a4d;
  --ink: #25251f;
  --muted: #756f64;
  --line: rgba(89, 96, 67, .2);
  --green: #26734d;
  --red: #a43636;
  --amber: #956321;
  --shadow: 0 20px 55px rgba(52, 58, 40, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(179, 138, 77, .12), transparent 27rem),
    radial-gradient(circle at 100% 80%, rgba(113, 47, 59, .08), transparent 30rem),
    var(--ivory);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 52px);
  color: #fff;
  background: rgba(52, 58, 40, .96);
  border-bottom: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
}

.brand__seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 50%;
  color: #f3d9a9;
  font-family: Georgia, serif;
  font-size: 16px;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.65);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.topbar__actions { display: flex; gap: 8px; }

.page {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 55px;
}

.page--narrow { width: min(720px, calc(100% - 28px)); }

.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(35px, 7vw, 78px);
}

.hero__aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 5vw, 55px);
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255,255,255,.06), transparent 60%),
    var(--olive-dark);
}

.eyebrow {
  display: block;
  margin-bottom: 14px;
  color: var(--wine);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.hero__aside .eyebrow { color: #f1d6a5; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.05;
}
h1 { margin-bottom: 18px; font-size: clamp(39px, 6vw, 66px); letter-spacing: -.035em; }
h2 { margin-bottom: 11px; font-size: clamp(30px, 4vw, 43px); letter-spacing: -.025em; }
h3 { margin-bottom: 9px; }

.lead {
  max-width: 650px;
  margin-bottom: 25px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.55;
}

.flow {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.flow__item {
  display: grid;
  grid-template-columns: 35px 1fr;
  gap: 13px;
  padding: 16px 0;
  border-top: 1px solid rgba(255,255,255,.12);
}

.flow__item:first-child { border-top: 0; }
.flow__number {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid rgba(243,217,169,.42);
  border-radius: 50%;
  color: #f3d9a9;
  font-family: Georgia, serif;
}
.flow__item strong { display: block; margin: 2px 0 4px; }
.flow__item span span { color: rgba(255,255,255,.64); font-size: 13px; line-height: 1.45; }

.card {
  padding: clamp(22px, 4.5vw, 43px);
  border: 1px solid var(--line);
  border-radius: 25px;
  background: rgba(255,253,248,.96);
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 20px; }
.card--center { text-align: center; }
.card--compact { padding: 23px; box-shadow: 0 12px 34px rgba(52,58,40,.08); }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.section-heading p { max-width: 680px; margin-bottom: 0; color: var(--muted); line-height: 1.5; }

.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button--primary { color: #fff; background: var(--olive); }
.button--primary:hover { background: var(--olive-dark); }
.button--outline { color: var(--olive-dark); background: transparent; border-color: var(--line); }
.button--soft { color: var(--wine); background: rgba(113,47,59,.08); }
.button--danger { color: #fff; background: var(--red); }
.button--small { min-height: 39px; padding: 0 13px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; }
.field--full { grid-column: 1 / -1; }
label { color: var(--olive-dark); font-size: 12px; font-weight: 850; }
input, select {
  width: 100%;
  min-height: 49px;
  padding: 0 13px;
  border: 1px solid rgba(89,96,67,.25);
  border-radius: 11px;
  outline: 0;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(89,96,67,.1);
}
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 19px; }

.message {
  display: none;
  padding: 11px 13px;
  margin: 12px 0 0;
  border: 1px solid #edc2c2;
  border-radius: 10px;
  color: #812b2b;
  background: #fff0f0;
  font-size: 13px;
  line-height: 1.4;
}
.message.is-visible { display: block; }
.message--success { color: #1f6642; border-color: #bbdec9; background: #effaf3; }
.note {
  padding: 12px 14px;
  border: 1px solid #ead39e;
  border-radius: 11px;
  color: #684819;
  background: #fff6df;
  font-size: 12px;
  line-height: 1.5;
}
.hidden { display: none !important; }

.login {
  max-width: 470px;
  margin: 8vh auto 0;
}
.login__mark {
  display: grid;
  place-items: center;
  width: 67px;
  height: 67px;
  margin: 0 auto 17px;
  border-radius: 50%;
  color: #f1d5a3;
  background: var(--olive-dark);
  font-family: Georgia, serif;
  font-size: 25px;
}
.login h1 { font-size: 39px; text-align: center; }
.login .lead { font-size: 15px; text-align: center; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 21px;
}
.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.stat span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.stat strong { display: block; margin-top: 7px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }

.event-list { display: grid; gap: 13px; }
.event {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}
.event h3 { margin-bottom: 5px; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.event__meta { color: var(--muted); font-size: 12px; line-height: 1.45; }
.event__numbers { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.mini-stat { padding: 6px 9px; border-radius: 999px; color: var(--olive-dark); background: rgba(89,96,67,.08); font-size: 11px; font-weight: 800; }
.event__actions { display: flex; flex-direction: column; justify-content: center; gap: 7px; }

.integration {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f7f2;
}
.integration code {
  display: block;
  max-height: 145px;
  padding: 12px;
  overflow: auto;
  border-radius: 9px;
  color: #f8f5ed;
  background: #292d22;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; white-space: nowrap; }
th { color: var(--olive-dark); background: #f5f4ed; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.status--valid { color: #1f6642; background: #e8f6ee; }
.status--used { color: #842d2d; background: #fbeaea; }

.control-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 20px; align-items: start; }
.scanner {
  min-height: 280px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px dashed rgba(89,96,67,.32);
  border-radius: 16px;
  background: #f6f6f1;
}
.scanner:empty::before {
  content: "La cámara aparecerá aquí";
  display: grid;
  place-items: center;
  min-height: 280px;
  color: var(--muted);
  font-size: 12px;
}
.manual-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }

.check-result {
  display: grid;
  align-content: center;
  min-height: 470px;
  padding: clamp(24px, 5vw, 50px);
  border: 1px solid var(--line);
  border-radius: 23px;
  text-align: center;
  background: #fff;
  box-shadow: var(--shadow);
}
.result-mark {
  display: grid;
  place-items: center;
  width: 75px;
  height: 75px;
  margin: 0 auto 17px;
  border-radius: 50%;
  color: #fff;
  font-size: 36px;
  font-weight: 800;
}
.result-mark--waiting { background: var(--amber); }
.result-mark--valid { background: var(--green); }
.result-mark--used, .result-mark--cancelled { background: var(--red); }
.result-label { margin-bottom: 8px; font-size: 10px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.check-result h2 { margin-bottom: 7px; font-size: 37px; overflow-wrap: anywhere; }
.check-result .names { margin-bottom: 18px; color: var(--wine); font-weight: 800; }
.check-result .detail { margin-bottom: 21px; color: var(--muted); line-height: 1.55; }

.pass {
  position: relative;
  max-width: 600px;
  margin: 4vh auto 0;
  overflow: hidden;
  padding: clamp(25px, 6vw, 48px);
  border: 1px solid var(--line);
  border-radius: 29px;
  text-align: center;
  background:
    radial-gradient(circle at 100% 0%, rgba(179,138,77,.16), transparent 20rem),
    var(--paper);
  box-shadow: var(--shadow);
}
.pass__brand { margin-bottom: 27px; color: var(--olive-dark); font-family: Georgia, serif; font-size: 20px; }
.pass h1 { margin-bottom: 8px; font-size: clamp(35px, 7vw, 53px); overflow-wrap: anywhere; }
.pass__event { margin-bottom: 20px; color: var(--wine); font-weight: 850; }
.pass__qr {
  width: min(300px, 85%);
  margin: 22px auto;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.pass__qr canvas { display: block; width: 100% !important; height: auto !important; }
.pass__count { font-family: Georgia, serif; font-size: 25px; }
.pass__state { margin-top: 18px; padding: 12px; border-radius: 11px; font-size: 12px; font-weight: 850; }
.pass__state--valid { color: #1f6642; background: #eaf7ef; }
.pass__state--used { color: #842d2d; background: #fbeaea; }

.loading { color: var(--muted); text-align: center; }
.empty {
  padding: 35px 20px;
  border: 1px dashed rgba(89,96,67,.3);
  border-radius: 15px;
  color: var(--muted);
  text-align: center;
  background: rgba(89,96,67,.025);
}
.footer-note { max-width: 760px; margin: 20px auto 0; color: var(--muted); font-size: 11px; line-height: 1.55; text-align: center; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(370px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 11px;
  color: #fff;
  background: var(--olive-dark);
  box-shadow: 0 15px 35px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .hero, .control-grid { grid-template-columns: 1fr; }
  .hero { min-height: 0; }
  .hero__copy, .hero__aside { padding: 35px 27px; }
  .stats { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .topbar { min-height: 62px; padding: 10px 14px; }
  .brand small { display: none; }
  .page { width: min(100% - 20px, 1120px); padding-top: 18px; }
  .card { padding: 22px 16px; border-radius: 20px; }
  h1 { font-size: 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: auto; }
  .section-heading { display: block; }
  .section-heading .button-row { margin-top: 13px; }
  .event { grid-template-columns: 1fr; }
  .event__actions { flex-direction: row; justify-content: flex-start; flex-wrap: wrap; }
  .manual-form { grid-template-columns: 1fr; }
  .check-result { min-height: 360px; }
  .topbar__actions .button--outline { display: none; }
}


/* Control premium: evento en curso + estados de escaneo */
.event-live-banner { display:flex; align-items:center; gap:9px; margin:-2px 0 16px; padding:11px 13px; border-radius:12px; color:#244b35; background:#edf7f0; font-size:12px; }
.event-live-banner strong { font-size:12px; }
.event-live-banner span:last-child { color:#587060; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.event-live-dot { width:9px; height:9px; flex:0 0 9px; border-radius:50%; background:var(--green); box-shadow:0 0 0 4px rgba(38,115,77,.12); }
.stats--live { margin-bottom:0; }
.scan-state--valid, .scan-state--partial, .scan-state--used { margin:-18px; padding:28px 18px; border-radius:20px; }
.scan-state--valid { background:#edf8f1; box-shadow:inset 0 0 0 2px rgba(38,115,77,.18); }
.scan-state--partial { background:#fff6df; box-shadow:inset 0 0 0 2px rgba(149,99,33,.20); }
.scan-state--used { background:#fff0f0; box-shadow:inset 0 0 0 2px rgba(164,54,54,.18); }
.result-mark--partial { background:var(--amber); }
@media (max-width:580px) { .event-live-banner { align-items:flex-start; flex-wrap:wrap; } .scan-state--valid, .scan-state--partial, .scan-state--used { margin:-10px; padding:24px 14px; } }
