:root {
  --bg: #ead8a8;
  --card: #ffffff;
  --text: #181818;
  --muted: #6d6a64;
  --border: #dedbd4;
  --accent: #685729;
  --selected: #202020;
  --occupied: #cac7c0;
  --success-bg: #eaf7ee;
  --success-text: #165c2f;
  --error-bg: #fff0f0;
  --error-text: #8e2424;
  --radius: 20px;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.checkout-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.checkout-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.secure-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.event-card,
.card,
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.event-card {
  padding: 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.event-card h1,
.card h2,
.summary-card h2 {
  margin: 0;
}

.event-card h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
}

.event-prices {
  display: grid;
  gap: 6px;
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
}

.event-prices strong {
  color: var(--text);
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.checkout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 22px;
}

.card,
.summary-card {
  min-width: 0;
  max-width: 100%;
  padding: 26px;
}

.summary-card {
  position: sticky;
  top: 18px;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.section-heading > div {
  flex: 1 1 240px;
  min-width: 0;
}

.counter {
  color: var(--muted);
  font-size: 0.9rem;
}

.stage {
  width: min(520px, 90%);
  margin: 16px auto 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e4e1da;
  color: #6d6a64;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.seat-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #faf9f6;
  overflow: hidden;
}

.seat-scroll {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-x: scroll;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: auto;
}

.seat-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.seat-scroll::-webkit-scrollbar-track {
  background: #eeece6;
  border-radius: 999px;
}

.seat-scroll::-webkit-scrollbar-thumb {
  background: #aaa69e;
  border: 2px solid #eeece6;
  border-radius: 999px;
}

.seat-scroll:focus-visible {
  outline: 2px solid #996b22;
  outline-offset: -2px;
}

.seat-map {
  flex: none;
  width: max-content;
  min-width: 100%;
  padding: 8px 4px 18px;
}

.seat-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: max-content;
  margin-bottom: 8px;
}

.seat-row-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #faf9f6;
  box-shadow: 6px 0 8px #faf9f6;
  width: 26px;
  flex: 0 0 26px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.seat-row-sectors {
  display: flex;
  align-items: center;
  gap: 18px;
}

.seat-sector {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.seat-box {
  width: 25px;
  height: 25px;
  border: 1px solid #aaa69e;
  border-radius: 7px 7px 5px 5px;
  background: #fff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.seat-box:hover:not(.occupied) {
  transform: translateY(-2px);
  border-color: #2c2c2c;
}

.seat-box.selected {
  background: var(--selected);
  border-color: var(--selected);
}

.seat-box.occupied {
  background: var(--occupied);
  border-color: var(--occupied);
  cursor: not-allowed;
  opacity: 0.75;
}

.section-labels {
  margin-bottom: 14px;
}

.seat-sector-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.seat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.seat-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sector-reference {
  min-width: 0;
  margin: 26px 0 0;
}

.sector-reference figcaption {
  margin-bottom: 12px;
  font-weight: 650;
}

.sector-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 20px;
  border: 1px dashed #bdb8ad;
  border-radius: 14px;
  background: #f5f3ee;
  color: var(--muted);
  text-align: center;
}

.sector-image-placeholder p {
  margin: 0;
  font-size: 0.85rem;
}

.sector-reference img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.legend-box {
  width: 16px;
  height: 16px;
  display: inline-block;
  border: 1px solid #aaa69e;
  border-radius: 5px;
  background: white;
}

.legend-box.selected {
  background: var(--selected);
  border-color: var(--selected);
}

.legend-box.occupied {
  background: var(--occupied);
  border-color: var(--occupied);
}

.buyer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  width: 100%;
  gap: 18px;
}

.form-grid {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.buyer-form label {
  display: grid;
  min-width: 0;
  overflow-wrap: anywhere;
  gap: 7px;
  color: #3f3d39;
  font-size: 0.9rem;
  font-weight: 650;
}

.buyer-form input[type="text"],
.buyer-form input[type="email"],
.buyer-form input[type="tel"] {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: #fff;
}

.buyer-form input:focus {
  border-color: #77726b;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.terms {
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: start;
  font-weight: 400 !important;
  line-height: 1.45;
}

.terms input {
  margin-top: 3px;
}

.summary-event {
  margin: 18px 0 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.5;
}

.summary-row,
.summary-total {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.summary-row {
  margin: 14px 0;
  color: var(--muted);
}

.summary-row strong {
  max-width: 190px;
  color: var(--text);
  text-align: right;
}

.summary-total {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  align-items: baseline;
}

.summary-total strong {
  font-size: 1.7rem;
}

.reserve-button {
  width: 100%;
  min-height: 52px;
  margin-top: 22px;
  border: 0;
  border-radius: 13px;
  background: #171717;
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.reserve-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.summary-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.payment-status {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.92rem;
}

.payment-status.success {
  display: block;
  background: var(--success-bg);
  color: var(--success-text);
}

.payment-status.error {
  display: block;
  background: var(--error-bg);
  color: var(--error-text);
}

@media (max-width: 900px) {
  .checkout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-card {
    position: static;
  }
}

@media (max-width: 620px) {
  .checkout-page {
    width: min(100% - 20px, 1180px);
  }

  .event-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-prices {
    text-align: left;
  }

  .form-grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  .card,
  .summary-card,
  .event-card {
    padding: 20px;
    border-radius: 16px;
  }

  .seat-row-sectors {
    gap: 12px;
  }

  .seat-box {
    width: 23px;
    height: 23px;
  }

  .seat-picker {
    padding: 10px;
  }
}

[hidden] { display: none !important; }
.seat-box { flex-shrink: 0; padding: 0; font-size: 9px; color: var(--text); }
.seat-box.selected { color: white; }
.seat-box.unavailable, .legend-box.unavailable {
  background: repeating-linear-gradient(45deg, #fff, #fff 3px, #e4e1da 3px, #e4e1da 6px);
  cursor: not-allowed;
}
.seat-box:focus-visible, .reserve-button:focus-visible, a:focus-visible {
  outline: 3px solid #996b22;
  outline-offset: 3px;
}
.reservation-receipt { margin-top: 22px; line-height: 1.6; overflow-wrap: anywhere; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.primary-link { background: var(--accent); color: white; padding: 12px 18px; border-radius: 10px; text-decoration: none; }

[data-category="1"] { --category-color: #80561c; --category-bg: #fff1cd; }
[data-category="2"] { --category-color: #325b8c; --category-bg: #e5efff; }
[data-category="3"] { --category-color: #417452; --category-bg: #e5f3e8; }
[data-category="4"] { --category-color: #79508e; --category-bg: #f3eafa; }
.event-prices { white-space: normal; text-align: left; min-width: min(320px, 100%); }
.price-category { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.price-category > strong { margin-left: auto; white-space: nowrap; }
.price-category small { display: block; margin-top: 3px; font-size: 0.8rem; }
.category-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; background: var(--category-color); }
.seat-row-label { width: 72px; flex-basis: 72px; color: var(--text); }
.seat-row-label small { display: block; margin-top: 3px; color: var(--category-color, var(--muted)); font-size: 0.65rem; }
.seat-row .seat-box:not(.selected):not(.occupied):not(.unavailable) {
  background: var(--category-bg, white); border-color: var(--category-color, #aaa69e);
}
.seat-box.selected { box-shadow: inset 0 0 0 2px white; }
.category-subtotal { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 0.8rem; }
.category-subtotal span { border-left: 3px solid var(--category-color); padding-left: 7px; }
@media (max-width: 620px) { .event-prices { width: 100%; } }

.payway-checkout { margin-top: 1.5rem; }
.payway-checkout h3 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.payway-form { display: grid; gap: 14px; max-width: 560px; }
.payway-form label { display: grid; gap: 6px; color: var(--text); font-size: 0.9rem; }
.payway-form input, .payway-form select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font: inherit; }
.payway-form input:focus, .payway-form select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.payway-expiry { margin: 0; }

/* Checkout: contacto, facturación y pago comparten jerarquía y estados. */
.checkout-progress { display:flex; gap:24px; list-style:none; padding:0; margin:0 0 26px; color:var(--muted); font-size:.88rem; }
.checkout-progress li { display:flex; align-items:center; gap:9px; }
.checkout-progress li span { display:grid; place-items:center; width:27px; height:27px; border:1px solid var(--border); border-radius:50%; background:#fff; font-size:.8rem; }
.checkout-progress [aria-current="step"] { color:var(--text); font-weight:700; }
.checkout-progress [aria-current="step"] span { background:#26231d; border-color:#26231d; color:white; }
.form-intro { font-weight:400; color:var(--muted); font-size:.88rem; line-height:1.6; margin:0; }
.form-section { border:0; padding:0; margin:0; min-width:0; display:grid; gap:18px; }
.form-section legend { font-size:1rem; font-weight:750; padding:0 0 16px; }
.billing-section { border-top:1px solid var(--border); padding-top:24px; margin-top:8px; }
.billing-section legend { float:left; width:100%; padding:0; }
.buyer-form { gap:24px; }
.buyer-form small,.payway-form small { font-weight:400; font-size:.78rem; line-height:1.45; color:var(--muted); }
.optional { font-size:.72rem; font-weight:400; color:var(--muted); }
.buyer-form select,.payway-form select { font:inherit; width:100%; min-width:0; min-height:48px; border:1px solid var(--border); border-radius:10px; padding:10px 12px; background:#fff; color:var(--text); }
.buyer-form input,.payway-form input { font-size:16px; }
.buyer-form input:focus-visible,.buyer-form select:focus-visible,.payway-form input:focus-visible,.payway-form select:focus-visible { outline:2px solid #8d6f38; outline-offset:2px; border-color:#8d6f38; }
.buyer-form [aria-invalid="true"],.payway-form [aria-invalid="true"] { border-color:#ad3939; background:#fffafa; }
.field-error { font-size:.78rem; font-weight:500; color:#9a2424; line-height:1.45; }
.field-error[hidden],[hidden] { display:none !important; }
.phone-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(80px,.6fr) minmax(0,1fr); align-items:start; gap:12px; }
.phone-grid:has(#phoneAreaField[hidden]) { grid-template-columns:repeat(2,minmax(0,1fr)); }
.phone-preview { color:#3e614b; font-size:.82rem; margin:0; font-variant-numeric:tabular-nums; }
.phone-preview:empty { display:none; }
.address-street-grid { grid-template-columns:minmax(0,3fr) minmax(90px,1fr); }
.postal-field { max-width:260px; }
.checkout-trust { border-top:1px solid var(--border); padding-top:18px; font-size:.8rem; color:var(--muted); line-height:1.5; }
.reservation-receipt { width:100%; max-width:none; margin:24px 0; }
.payway-checkout { padding-top:24px; border-top:1px solid var(--border); }
.payway-checkout h3 { font-size:1.4rem; letter-spacing:-.03em; }
.payway-form { max-width:none; gap:20px; }
.payway-form input,.payway-form select { min-height:48px; border-radius:10px; }
.payment-brands { display:flex; flex-wrap:wrap; gap:8px; margin:16px 0; }
.payment-brands span { border:1px solid var(--border); background:#faf9f6; border-radius:6px; padding:5px 10px; font-size:.75rem; font-weight:700; }
.payment-amount { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:18px; margin:20px 0 24px; background:#f6f4ef; border:1px solid var(--border); border-radius:12px; }
.payment-amount span { color:var(--muted); font-size:.9rem; }
.payment-amount strong { font-size:1.5rem; font-variant-numeric:tabular-nums; }
.payway-checkout .reserve-button { margin-top:8px; min-height:50px; }
.receipt-actions { padding-top:22px; margin-top:24px; border-top:1px solid var(--border); font-size:.85rem; }
@media(max-width:600px) {
 .checkout-progress { gap:12px; justify-content:space-between; font-size:.72rem; }
 .checkout-progress li { flex-direction:column; text-align:center; gap:6px; flex:1; }
 .phone-grid { grid-template-columns:minmax(80px,.65fr) minmax(0,1.35fr); }
 .phone-grid>label:first-child { grid-column:1/-1; }
 .phone-grid:has(#phoneAreaField[hidden]) { grid-template-columns:minmax(0,1fr); }
 .card,.summary-card { padding:20px; }
 .payment-amount strong { font-size:1.25rem; }
}

.payment-timer {position:sticky;top:12px;z-index:5;margin:0 auto 24px;padding:16px 24px;background:#fff4db;border:1px solid #c3984a;border-radius:12px;color:#583a08;font-size:1.2rem;font-weight:700;font-variant-numeric:tabular-nums;text-align:center;}
.payment-choices {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:100%;margin:24px 0;}
.payment-choices button {padding:20px 14px;border:1px solid #bba274;border-radius:12px;background:white;color:#29231a;font:inherit;font-weight:600;cursor:pointer;}
.payment-choices button:disabled {opacity:.55;cursor:not-allowed;}
.payment-choices button[aria-expanded="true"] {background:#fff4db;border:2px solid #96712c;}
.payment-dialog {width:min(460px,calc(100vw - 48px));box-sizing:border-box;border:0;border-radius:18px;padding:32px;box-shadow:0 20px 80px #0004;}
.payment-dialog::backdrop {background:#0009;backdrop-filter:blur(3px);}
.payment-dialog h2 {margin-top:0;}.payment-dialog p {line-height:1.6;}
.dialog-actions {display:flex;flex-direction:column;gap:18px;margin-top:24px;}
@media(max-width:520px){.payment-choices{grid-template-columns:1fr;}.payment-timer{font-size:1rem;}}

/* Cabecera del checkout y precios junto al plano. */
.checkout-header { gap: 20px; margin-bottom: 20px; }
.checkout-header .checkout-progress { margin: 0; justify-content: center; }
.checkout-header .secure-label { text-align: right; }
.card > .event-prices {
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 8px 24px;
  margin-bottom: 20px;
}
@media (max-width: 620px) {
  .checkout-header { gap: 8px; }
  .checkout-header .site-logo { width: 90px; height: 42px; }
  .checkout-header .checkout-progress { flex: 1; gap: 8px; min-width: 0; }
  .checkout-header .secure-label { max-width: 64px; font-size: .72rem; }
}

/* En PC el plano ocupa todo el ancho; datos y resumen quedan debajo. */
@media (min-width: 901px) {
  .checkout-page { width: calc(100% - 48px); }
  .checkout-main { display: contents; }
  .seat-selection-card { grid-column: 1 / -1; }
}

.general-admission { max-width: 32rem; padding: 1rem; white-space: normal; }
.general-admission label { display: block; font-weight: 600; margin: 1rem 0 .5rem; }
.general-admission input { width: 7rem; padding: .75rem; font: inherit; border: 1px solid #b7a992; border-radius: .5rem; }
.general-admission p { margin: .75rem 0; }
.seat-map:has(.general-admission) { width: 100%; }
