:root {
  --bg: #fdfaf6;
  --surface: #ffffff;
  --surface-alt: #f5efe6;
  --ink: #1e1b18;
  --muted: #665e54;
  --line: #e6dec8;
  --brand: #c85a17;
  --brand-dark: #9e430c;
  --brand-light: #fff1e6;
  --wa: #1da851;
  --wa-dark: #15853f;
  --blue: #084cd7;
  --radius: 20px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: 96px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.sr-only {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  top: 12px;
}

.store-wrap {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}

/* Barra superior de demo AllinWeb */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #101923;
  color: #f5f7fa;
  border-bottom: 1px solid #263547;
  font-size: 0.85rem;
}
.demo-banner-inner {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
  padding: 10px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.demo-banner p {
  margin: 0;
  flex: 1 1 280px;
  color: #d0dce9;
}
.demo-banner strong {
  color: #fff;
}
.demo-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #084cd7;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.demo-banner-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #4d8bff;
  background: #162844;
  color: #fff;
  font: 600 0.8rem Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}
.demo-admin-btn:hover {
  background: #084cd7;
}
.demo-back-link {
  color: #9fc0ff;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.demo-back-link:hover {
  text-decoration: underline;
}

/* Cabecera del emprendimiento */
.store-header {
  padding: 28px 0 22px;
  background: linear-gradient(180deg, #fff6ec 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.store-brand {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.store-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffecd6, #f7c597);
  border: 2px solid #fff;
  box-shadow: 0 10px 24px -10px rgba(158, 67, 12, 0.35);
  font-size: 2.2rem;
}
.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.badge-open, .badge-zone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.badge-open {
  background: #e6f6ec;
  color: #156832;
}
.badge-open .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1da851;
}
.badge-zone {
  background: var(--surface-alt);
  color: var(--muted);
}
.store-info h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.store-desc {
  margin: 8px 0 0;
  max-width: 65ch;
  color: var(--muted);
  font-size: 0.96rem;
}

.store-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.highlight-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.84rem;
}
.highlight-card strong {
  color: var(--ink);
  font-size: 0.88rem;
}
.highlight-card span {
  color: var(--muted);
}

/* Controles de filtro y búsqueda */
.store-main {
  padding-top: 24px;
}
.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-tabs [role="tab"] {
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.86rem Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.category-tabs [role="tab"][aria-selected="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.category-tabs [role="tab"]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.search-box {
  flex: 1 1 220px;
  max-width: 300px;
}
.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.search-box input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* Grilla de productos */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.product-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -18px rgba(30, 27, 24, 0.22);
}
.product-card.is-agotado {
  opacity: 0.72;
}
.product-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  font-size: 4rem;
  background: var(--bg-tone, #fdf2e6);
}
.product-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.product-status {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.status-disponible {
  background: #e6f6ec;
  color: #156832;
}
.status-encargo {
  background: #fff4d6;
  color: #8a5300;
}
.status-agotado {
  background: #fde8e8;
  color: #9b1c1c;
}

.product-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 18px;
}
.product-body h3 {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}
.product-body p {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
  flex: 1;
}
.product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.product-price {
  display: flex;
  flex-direction: column;
}
.product-price strong {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.product-price small {
  color: var(--muted);
  font-size: 0.74rem;
}

.btn-add {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
  font: 600 0.86rem Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.btn-add:hover:not(:disabled) {
  background: var(--brand);
  color: #fff;
}
.btn-add:disabled {
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--muted);
  cursor: not-allowed;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 999px;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.qty-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.qty-val {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

/* Sección explicativa para emprendedores */
.how-it-works {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}
.how-it-works h2 {
  margin: 0 0 20px;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: -0.03em;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.step-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.step-card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}
.step-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.cta-banner {
  margin-top: 24px;
  padding: 26px 28px;
  border-radius: 24px;
  background: linear-gradient(135deg, #0e1b33, #123a7a);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.cta-banner h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}
.cta-banner p {
  margin: 0;
  max-width: 58ch;
  color: #c9d6ee;
  font-size: 0.92rem;
}
.cta-banner code {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 6px;
  color: #fff;
}
.cta-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  font: 600 0.9rem Inter, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  border: 0;
}
.btn-primary {
  background: #fff;
  color: #101923;
}
.btn-primary:hover {
  background: #e7f0ff;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.24);
}

.store-footer {
  margin-top: 44px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}
.footer-inner p {
  margin: 4px 0;
}
.footer-inner a {
  color: var(--blue);
  font-weight: 600;
}

/* Barra inferior flotante */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(30, 27, 24, 0.12);
}
.bottom-bar[hidden] {
  display: none;
}
.bottom-bar-inner {
  width: min(1080px, 100%);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.bottom-bar-summary {
  display: flex;
  flex-direction: column;
}
.bottom-count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.bottom-total {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.btn-order {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 0;
  background: var(--wa);
  color: #fff;
  font: 700 0.95rem Inter, system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(29, 168, 81, 0.55);
}
.btn-order:hover {
  background: var(--wa-dark);
}

/* Modal de pedido y panel del dueño (reglas de contención de scroll para dialog:modal) */
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(16, 25, 35, 0.55);
  backdrop-filter: blur(3px);
}

.order-dialog, .owner-dialog {
  width: min(620px, calc(100% - 24px));
  max-height: min(880px, calc(100dvh - 24px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 70px -20px rgba(16, 25, 35, 0.45);
}
.order-dialog[open], .owner-dialog[open] {
  display: flex;
  flex-direction: column;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.dialog-header h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}
.dialog-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dialog-body {
  padding: 18px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.order-items {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
.order-item-info strong {
  display: block;
}
.order-item-info small {
  color: var(--muted);
}

.form-group {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}
.form-group legend {
  font-weight: 700;
  font-size: 0.94rem;
  margin-bottom: 10px;
}
.delivery-options, .payment-options {
  display: grid;
  gap: 8px;
}
.delivery-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.radio-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radio-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-light);
}
.radio-card:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.radio-title {
  font-weight: 700;
  font-size: 0.88rem;
}
.radio-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.form-row[hidden] {
  display: none;
}
.form-row label {
  font-size: 0.84rem;
  font-weight: 600;
}
.form-row label small {
  color: var(--muted);
  font-weight: 400;
}
.req {
  color: #b42318;
}
.form-row input, .form-row select {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.form-row input[aria-invalid="true"] {
  border-color: #b42318;
}

.payment-box {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f4f7fb;
  border: 1px solid #d5e0f2;
}
.payment-box[hidden] {
  display: none;
}
.payment-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.payment-box-head strong {
  display: block;
  font-size: 0.9rem;
}
.payment-box-head span {
  font-size: 0.78rem;
  color: var(--muted);
}
.bank-details {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #dce4f2;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.btn-copy, .btn-pay-sim {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--blue);
  background: #fff;
  color: var(--blue);
  font: 600 0.82rem Inter, system-ui, sans-serif;
  cursor: pointer;
}
.btn-copy:hover, .btn-pay-sim:hover {
  background: var(--blue);
  color: #fff;
}
.copy-feedback {
  margin: 6px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #156832;
}
.copy-feedback:empty {
  display: none;
}
.link-explain {
  margin: 0 0 10px;
  font-size: 0.84rem;
  color: #3a4250;
}

.order-totals {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--muted);
  padding: 3px 0;
}
.total-row[hidden] {
  display: none;
}
.total-final {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
}

.whatsapp-preview-box {
  margin-bottom: 14px;
}
.preview-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.whatsapp-preview {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #e9fbe5;
  border: 1px solid #bfe8b7;
  color: #132a17;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.form-error {
  margin: 0 0 10px;
  color: #b42318;
  font-size: 0.85rem;
  font-weight: 600;
}
.form-error:empty {
  display: none;
}

.btn-whatsapp {
  width: 100%;
  min-height: 48px;
  border-radius: 999px;
  border: 0;
  background: var(--wa);
  color: #fff;
  font: 700 0.96rem Inter, system-ui, sans-serif;
  cursor: pointer;
}
.btn-whatsapp:hover {
  background: var(--wa-dark);
}

.order-success {
  margin-top: 16px;
  padding: 18px;
  border-radius: 18px;
  background: #eef8f0;
  border: 1px solid #b7e1c1;
  text-align: center;
}
.order-success[hidden] {
  display: none;
}
.success-icon {
  font-size: 2rem;
}
.order-success h3 {
  margin: 6px 0;
  font-size: 1.1rem;
}
.order-success p {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--muted);
}
.success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.success-actions .btn-primary {
  background: var(--blue);
  color: #fff;
}

/* Panel del emprendedor */
.owner-intro {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
}
.owner-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.owner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.owner-row strong {
  font-size: 0.9rem;
}
.owner-row input[type="number"] {
  width: 96px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
  font-size: 0.86rem;
}
.owner-row select {
  min-height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
}
.owner-footer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.owner-footer p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}
.owner-footer .btn-primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
}

@media (max-width: 760px) {
  .store-highlights, .steps-grid, .delivery-options, .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .owner-row {
    grid-template-columns: 1fr 1fr;
  }
  .owner-row strong {
    grid-column: 1 / -1;
  }
}
