:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1a1d24;
  --ink-soft: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --didi: #ff6f1e;
  --uber: #06c167;
  --rappi: #ff441f;
  --accent: #4338ca;
  --ok: #059669;
  --err: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #eef0f4 0%, var(--bg) 320px);
  color: var(--ink);
  min-height: 100vh;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.top {
  text-align: center;
  margin-bottom: 32px;
}

.top .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.top h1 {
  font-size: 28px;
  margin: 6px 0 4px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.top p {
  color: var(--ink-soft);
  margin: 0;
  font-size: 15px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.provider-option { position: relative; }

.provider-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

.provider-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  transition: all 0.15s ease;
  background: var(--surface);
}

.provider-card .dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: block;
  object-fit: cover;
}

.provider-card .name {
  font-weight: 700;
  font-size: 14px;
}

.provider-card .tag {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}


.provider-option input:checked + .provider-card {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.provider-option input:focus-visible + .provider-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.provider-card.provider-disabled {
  opacity: 0.45;
  position: relative;
  cursor: not-allowed;
}

.provider-option:has(input:disabled) { cursor: not-allowed; }

.provider-unavailable {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input[type="text"],
input[type="tel"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfbfc;
  color: var(--ink);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.12);
}

.field { margin-bottom: 16px; }

textarea { resize: vertical; min-height: 60px; }

input[readonly] {
  background: var(--bg);
  color: var(--ink-soft);
  cursor: not-allowed;
}

input[readonly]:focus {
  box-shadow: none;
  border-color: var(--border);
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.items-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0 8px 8px;
}

.items-table td {
  padding: 4px 8px 4px 0;
  vertical-align: middle;
}

.items-table input { padding: 8px 10px; }

.item-row .qty { width: 70px; }
.item-row .price { width: 110px; }

.remove-item {
  background: none;
  border: none;
  color: var(--err);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.add-item {
  background: #fff;
  border: 1px dashed var(--border);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
}

.add-item:hover { border-color: var(--accent); background: #f5f4ff; }

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.3);
  transition: transform 0.1s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.danger {
  background: #fff;
  color: var(--err);
  border: 1px solid #fecaca;
  box-shadow: none;
}

.btn.danger:hover { background: #fef2f2; }

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.status-pill {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.status-pill.ok { background: #d1fae5; color: var(--ok); }
.status-pill.err { background: #fee2e2; color: var(--err); }

.result-meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 20px; }

pre {
  background: #0f1117;
  color: #d7dbe4;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
  max-height: 420px;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.split-2 h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #92400e;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 18px;
}

.footer-links { margin-top: 24px; text-align: center; }
.footer-links a { color: var(--ink-soft); font-size: 13px; text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface);
}

.step-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.step-dot.active { color: var(--accent); }
.step-dot.active .step-num { border-color: var(--accent); background: var(--accent); color: #fff; }
.step-dot.completed .step-num { border-color: var(--accent); color: var(--accent); }

.step-line {
  width: 48px;
  height: 2px;
  background: var(--border);
}

.wizard-step[hidden] { display: none; }

.actions-between { justify-content: space-between; }

/* Paso 2: menú + carrito */
.menu-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.menu-category { margin-bottom: 28px; }

.menu-category-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 12px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.menu-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.menu-item-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.menu-item-body { padding: 12px 14px 14px; }

.menu-item-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }

.menu-item-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  min-height: 32px;
}

.menu-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-item-price { font-weight: 800; font-size: 14px; }

.btn-add {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-add:hover { opacity: 0.92; }

.cart-panel { position: sticky; top: 20px; }

.cart-card { margin-bottom: 0; }

.cart-lines { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }

.cart-empty { color: var(--ink-soft); font-size: 13px; margin: 0; }

.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cart-line:last-child { border-bottom: none; padding-bottom: 0; }

.cart-line-name { font-weight: 700; font-size: 13px; }

.cart-line-mods { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.cart-line-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.cart-line-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.cart-line-price { font-weight: 700; font-size: 13px; }

.cart-line-remove {
  background: none;
  border: none;
  color: var(--err);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.cart-totals-row, .receipt-totals .row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
}

.cart-totals-total, .receipt-totals .row-grand {
  font-weight: 800;
  font-size: 15px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px;
}

/* Recibo (paso 3 y resultado) */
.receipt-lines { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.receipt-line:last-child { border-bottom: none; }

.receipt-line-name { font-weight: 700; }

.receipt-line-mods { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.receipt-line-price { font-weight: 700; white-space: nowrap; }

.receipt-totals { margin-top: 6px; }

/* Modal de personalización */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop[hidden] { display: none; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
}

.modal-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }

.modal-body { padding: 18px 20px 22px; }

.modal-body h3 { margin: 0 0 6px; font-size: 18px; }

.modal-desc { color: var(--ink-soft); font-size: 13px; margin: 0 0 16px; }

.modifier-group { margin-bottom: 16px; }

.modifier-group-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.req-badge, .opt-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
}

.req-badge { background: #fee2e2; color: var(--err); }
.opt-badge { background: #e0e7ff; color: var(--accent); }

.modifier-options { display: flex; flex-direction: column; gap: 6px; }

.modifier-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin: 0;
}

.modifier-option input { width: auto; margin: 0; }

.modal-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0;
}

.qty-stepper { display: flex; align-items: center; gap: 12px; }

.qty-stepper button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 16px;
  cursor: pointer;
}

.modal-add-btn {
  width: 100%;
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 13px 20px;
  border-radius: 10px;
  cursor: pointer;
}

.modal-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 640px) {
  .provider-grid, .grid-2, .split-2 { grid-template-columns: 1fr; }
  .menu-layout { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
}
