:root{
  --brand:#2B60E7;
  --brand-600:#1f4ccc;
  --neutral:#E6E6E6;
  --neutral-200:#F5F7FA;
  --text:#111827;
  --muted:#6B7280;
  --radius:12px;
  --danger-bg: #FEE2E2;
  --danger-press: #FECACA;
  --danger-text: #B91C1C;
  --danger-border: #FCA5A5;
}

/* Reset y base */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color:var(--text);
  background:#fff;
}
h1,h2,h3,p{margin:0}
button{font:inherit}

/* contenedor */
.shell{
  display:flex;
  min-height:100dvh;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.card{
  width:100%;
  max-width:440px;
  padding:24px;
  border:1px solid var(--neutral);
  border-radius:var(--radius);
  background:#fff;
  box-shadow:0 8px 24px rgba(17,24,39,0.06);
}
.title{
  font-size:22px;
  line-height:1.2;
  text-align:center;
  margin-bottom:16px;
}

/* Inputs */
.input{
  width:100%;
  padding:12px 14px;
  margin:8px 0;
  border:1px solid var(--neutral);
  border-radius:10px;
  font-size:16px;
  background:#fff;
}
.error{color:#d00;margin-top:8px;text-align:center}

/* Segmentado */
.segmented{
  display:flex;
  gap:8px;
  background:var(--neutral-200);
  padding:6px;
  border-radius:999px;
  justify-content:center;
  margin:8px 0 12px;
}
.segmented__btn{
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
  border:none;
  background:transparent;
  color:#111;
  padding:10px 16px;
  font-weight:600;
  font-size:15px;
  border-radius:999px;
  cursor:pointer;
}
.segmented__btn.is-active{
  background:var(--brand);
  color:#fff;
  box-shadow:0 6px 14px rgba(43,96,231,0.25);
}
.segmented__btn:disabled{opacity:.6;cursor:not-allowed}

/* Stack / acciones */
.stack{display:flex;flex-direction:column;gap:12px;margin:14px 0 4px}

/* Botones */
.btn{
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:12px 16px;
  border-radius:10px;
  border:1px solid transparent;
  font-weight:600;
  font-size:16px;
  cursor:pointer;
  transition:transform .02s ease, box-shadow .2s ease, background .2s ease;
}
.btn--block{width:100%}
.btn--lg{padding:14px 18px;font-size:17px}
.btn:active{transform:scale(0.99)}
.btn--primary{
  background:var(--brand); color:#fff;
  box-shadow:0 8px 18px rgba(43,96,231,0.22);
}
.btn--primary:active{background:var(--brand-600)}
.btn--outline{background:#fff;color:#111;border-color:var(--neutral)}
.btn--ghost{background:transparent;color:#111;border-color:transparent}
.btn--danger{
  background: var(--danger-bg); color: var(--danger-text);
  border-color: var(--danger-border); box-shadow: none;
}
.btn--danger:active{background: var(--danger-press)}

/* Mensajes */
.message{text-align:center;margin:12px 0 8px;font-weight:600}
.muted{color:var(--muted);font-size:14px}

/* Lector */
.reader{
  width:100%; max-width:420px; margin:12px auto 0;
  border:1px dashed var(--neutral); border-radius:12px; overflow:hidden;
}

/* Modal base */
.modal.hidden{display:none}
.modal{position:fixed; inset:0; z-index:9999}
.modal-backdrop{position:absolute; inset:0; background:rgba(0,0,0,.45)}
.modal-card{
  position:relative; max-width:380px; width:92%;
  margin:12vh auto 0; background:#fff; border-radius:14px;
  padding:18px; box-shadow:0 12px 34px rgba(0,0,0,.2);
}
.modal-card h3{margin:0 0 6px}

/* Modal cantidad */
.qty-row{
  display:flex; align-items:center; justify-content:center; gap:12px;
  margin:10px 0 16px;
}
.circle-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:48px; height:48px; border-radius:50%;
  border:none; background:var(--neutral-200);
  font-size:22px; font-weight:700; line-height:1;
  cursor:pointer; user-select:none; -webkit-user-select:none;
  touch-action:manipulation;
}
#qtyInput{
  width:96px; text-align:center; padding:10px;
  font-size:18px; border:1px solid var(--neutral); border-radius:8px;
}
.modal-actions{display:flex; justify-content:flex-end; gap:10px}

/* === Action group ======================= */
.actions{display:flex;flex-direction:column;gap:10px;margin:14px 0 4px}
.action-btn{
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; padding: 14px 16px; border-radius: 12px;
  background: #fff; border: 1px solid var(--neutral); color: #111;
  font-weight: 600; font-size: 16px;
  cursor: pointer;
  transition: background .15s ease, box-shadow .2s ease, transform .02s ease, border-color .15s ease, color .15s ease;
  box-shadow: 0 2px 8px rgba(17,24,39,0.04);
}
.action-btn:hover { background: var(--neutral-200); }
.action-btn:active { transform: scale(.99); }
.action-btn:focus-visible { outline: 3px solid rgba(43,96,231,.35); outline-offset: 2px; }
.action-btn.is-selected{background: var(--brand); color: #fff; border-color: transparent; box-shadow: 0 10px 20px rgba(43,96,231,.25)}
.action-btn--danger{background:#fff;color:#111;border-color:var(--neutral)}
.action-btn--danger.is-selected{background:var(--brand);color:#fff;border-color:transparent}
@media (hover:hover){.action-btn:not(.is-selected):hover{border-color:#dcdcdc}}

/* Dropdown sucursales */
#sucursalRow { margin: 12px 0; }
#sucursalSelect {
  width: 100%; padding: 12px 14px; border: 1px solid var(--neutral);
  border-radius: 10px; font-size: 16px; background: #fff; font-weight: 500; color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%236B7280' height='20' viewBox='0 0 24 24' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
  cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
#sucursalSelect:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,96,231,.25) }
#sucursalSelect.error { border-color: var(--danger-text); box-shadow: 0 0 0 3px rgba(185,28,28,0.15) }

/* ===== Modal de confirmación: diseño VERTICAL mobile-first ===== */

/* La tarjeta ocupa buen ancho en teléfono/tablet y permite scroll interno si el contenido crece */
.confirm-card{
  width: 96%;
  max-width: 540px;
  max-height: 86vh;
  margin: 7vh auto 0;
  display: flex;
  flex-direction: column;
}

/* Contenedor ahora es columna: imagen arriba, info abajo */
.confirm-grid{
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 10px 0 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

/* Imagen del pase ocupa todo el ancho y mantiene proporciones */
.pass-preview{
  order: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}
.pass-preview .muted{ font-size: 13px; }
.pass-preview img{
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--neutral);
  box-shadow: 0 6px 18px rgba(17,24,39,0.10);
}

/* Info debajo de la imagen, con jerarquía clara */
.confirm-info{
  order: 1;
  font-size: 15px;
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 6px;
}
.confirm-info .muted{
  color: var(--muted);
  margin-top: 10px;
}

/* Acciones pegadas al fondo y con padding para toque cómodo */
.modal-actions{
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-top: 8px;
  background:
    linear-gradient(to top, rgba(255,255,255,1) 70%, rgba(255,255,255,0));
}

/* Botones a ancho completo en móviles (mejor accesibilidad) */
@media (max-width: 480px){
  .modal-actions .btn{
    width: 100%;
  }
}

/* En pantallas anchas (laptop/desktop), puedes volver a 2 columnas si quieres */
@media (min-width: 900px){
  .confirm-card{ max-width: 860px; }
  .confirm-grid{
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 18px;
  }
  .pass-preview{ order: 0; align-items: flex-start; text-align: left; }
  .modal-actions{ position: none; background: none; }
}

/* Accesibilidad / bloqueo scroll cuando modal abierto */
body.modal-open { overflow: hidden; }
.confirm-card:focus { outline: 3px solid rgba(43,96,231,.35); outline-offset: 2px; }

/* Placeholder del input de monto */
#amountInput::placeholder { color: var(--muted); }
