/* =====================================================================
   IROFX · estilos base
   ===================================================================== */
:root {
  --bg: #0a0c12;
  --bg-soft: #0f121b;
  --surface: #141826;
  --surface-2: #1b2031;
  --border: #262d42;
  --border-strong: #343c57;
  --text: #e9ecf5;
  --muted: #8d95ab;
  --primary: #7c5cff;
  --primary-hover: #8f74ff;
  --accent: #22d3ee;
  --success: #22c55e;
  --warning: #f5a524;
  --danger: #f2555a;
  --info: #3b9eff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --gradient: linear-gradient(135deg, var(--primary), var(--accent));
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1000px 500px at 85% -10%, rgba(124, 92, 255, 0.12), transparent 60%),
    radial-gradient(800px 400px at -10% 10%, rgba(34, 211, 238, 0.07), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 28px 0 56px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.mt-sm { margin-top: 6px; }
.mt { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.big-amount { font-size: 1.6rem; font-weight: 800; }
.w-auto { width: auto; }
/* Nota: la CSP bloquea atributos style="" en línea. Usar siempre clases. */
.stack > * + * { margin-top: 16px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- Header */
.announcement { background: var(--gradient); color: #0a0c12; font-weight: 600; text-align: center; padding: 8px 16px; font-size: 0.9rem; }
.announcement.warning { background: var(--warning); }
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(10, 12, 18, 0.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; letter-spacing: 0.04em; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--gradient); display: grid; place-items: center; color: #0a0c12; font-weight: 900; font-size: 0.95rem; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.balance-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 0.9rem; }
.balance-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.menu-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; }

@media (max-width: 820px) {
  .menu-toggle { display: inline-grid; place-items: center; margin-left: auto; }
  .nav, .header-actions { display: none; }
  .site-header.open .container { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; }
  .site-header.open .nav { display: flex; flex-direction: column; width: 100%; order: 3; }
  .site-header.open .header-actions { display: flex; width: 100%; order: 4; flex-wrap: wrap; }
  /* Menú cerrado: el saldo sigue visible junto al botón de menú */
  .site-header:not(.open) .header-actions:has(.balance-chip) { display: flex; order: 2; margin-left: auto; }
  .site-header:not(.open) .header-actions > *:not(.balance-chip) { display: none; }
  .site-header:not(.open) .menu-toggle { order: 3; }
  .site-header:not(.open) .header-actions:has(.balance-chip) ~ .menu-toggle { margin-left: 8px; }
}

/* ---------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 0.85rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: underline; }

/* Páginas informativas (privacidad) */
.legal { max-width: 760px; margin: 12px auto 24px; line-height: 1.65; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li { margin-bottom: 6px; }
.legal a { text-decoration: underline; }

/* ---------------------------------------------------------------- Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface); border-color: transparent; }
.btn-danger { background: transparent; border-color: rgba(242, 85, 90, 0.5); color: var(--danger); }
.btn-danger:hover { background: rgba(242, 85, 90, 0.1); border-color: var(--danger); }
.btn-success { background: transparent; border-color: rgba(34, 197, 94, 0.5); color: var(--success); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .help { color: var(--muted); font-size: 0.82rem; }
.field .error-text { color: var(--danger); font-size: 0.82rem; }
.input, select.input, textarea.input { width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text); font: inherit; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2); }
.input.invalid { border-color: var(--danger); }
textarea.input { min-height: 110px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--primary); }
.google-btn { background: #fff; color: #1f1f1f; border-color: #dadce0; margin-bottom: 4px; }
.google-btn:hover { background: #f2f2f2; border-color: #c6c6c6; }
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.check-result:empty { display: none; }
.check-result { margin-top: 6px; padding: 8px 12px; border-radius: var(--radius-sm); }
.check-ok { background: rgba(34, 197, 94, 0.1); color: #9ff0bd; border: 1px solid rgba(34, 197, 94, 0.35); }
.check-bad { background: rgba(242, 85, 90, 0.1); color: #ffb3b5; border: 1px solid rgba(242, 85, 90, 0.35); }
.check-warn { background: rgba(245, 165, 36, 0.08); color: #ffd590; border: 1px solid rgba(245, 165, 36, 0.35); }
.check-none { display: none; }
.saved-ids { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.saved-ids .chip { padding: 5px 11px; font-size: 0.84rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forgot-link { display: inline-block; margin-top: 6px; text-decoration: underline; }
.spam-tip { margin: 16px 0; line-height: 1.5; }
.spam-tip ol { margin: 6px 0 0; padding-left: 20px; }
.spam-tip li { margin-bottom: 4px; }
.form-error { background: rgba(242, 85, 90, 0.1); border: 1px solid rgba(242, 85, 90, 0.4); color: #ffb3b5; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }

/* ---------------------------------------------------------------- Tarjetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card-tight { padding: 16px; }
.card h2, .card h3 { margin-bottom: 12px; }
.auth-card { max-width: 420px; margin: 24px auto; }
.grid { display: grid; gap: 18px; }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }

.hero { padding: 26px 0 30px; }
.hero p { color: var(--muted); font-size: 1.08rem; max-width: 560px; }
.hero .trust-badge { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; padding: 6px 14px; border-radius: 999px; font-size: 0.92rem; color: #9ff0bd; background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.35); }
.hero .trust-badge.hidden { display: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 500; cursor: pointer; font: inherit; font-size: 0.9rem; }
.chip.active, .chip:hover { color: var(--text); border-color: var(--primary); }

.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.product-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.product-media { aspect-ratio: 16 / 10; background: var(--gradient); display: grid; place-items: center; font-size: 2.4rem; font-weight: 900; color: rgba(10, 12, 18, 0.75); }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-body .category { color: var(--accent); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.product-body .price { margin-top: auto; padding-top: 8px; font-weight: 700; }

.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.variant { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; background: var(--bg-soft); transition: border-color 0.15s, background 0.15s; }
.variant input { position: absolute; opacity: 0; pointer-events: none; }
.variant .name { font-weight: 600; }
.variant .price { color: var(--muted); font-size: 0.9rem; }
.variant:has(input:checked) { border-color: var(--primary); background: rgba(124, 92, 255, 0.1); }
.variant:has(input:checked) .price { color: var(--text); }
.variant:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.3); }

.pay-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; font-size: 1.15rem; font-weight: 700; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat .label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.stat .value { font-size: 1.55rem; font-weight: 750; margin-top: 4px; }
.stat.alert .value { color: var(--warning); }

.balance-hero { background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(34, 211, 238, 0.12)); border: 1px solid var(--border-strong); }
.balance-hero .amount { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.02em; }

/* ---------------------------------------------------------------- Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); background: rgba(34, 197, 94, 0.12); }
.badge-warning { color: var(--warning); background: rgba(245, 165, 36, 0.12); }
.badge-danger { color: var(--danger); background: rgba(242, 85, 90, 0.12); }
.badge-info { color: var(--info); background: rgba(59, 158, 255, 0.12); }
.badge-muted { color: var(--muted); background: rgba(141, 149, 171, 0.12); }

/* ---------------------------------------------------------------- Tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.amount-pos { color: var(--success); font-weight: 600; }
.amount-neg { color: var(--danger); font-weight: 600; }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ''; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); min-height: 220px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- Modal y toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 5, 9, 0.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade 0.15s ease; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow); }
.modal.wide { max-width: 860px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-header h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.5rem; cursor: pointer; line-height: 1; }
@keyframes fade { from { opacity: 0; } }

.qr-box { background: #fff; border-radius: 14px; padding: 14px; width: 260px; max-width: 100%; margin: 0 auto 16px; }
.qr-box img { width: 100%; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }

/* Plan de entregas (ej. likes por N días) en el detalle del pedido */
.plan-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.plan-progress { max-width: none; margin: 10px 0 8px; }
.plan-progress span { background: var(--success); transform: scaleX(0); }

/* Pago QR: generando */
.qr-loading-text { font-weight: 700; font-size: 1.1rem; margin: 28px 0 4px; }

/* Pago QR: pendiente */
.pay-amount { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.pay-deadline { display: flex; justify-content: center; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pay-deadline .countdown { font-size: 1.15rem; color: var(--warning); }
.pay-deadline .countdown.urgent { color: var(--danger); }
.pay-progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 10px auto 16px; max-width: 260px; }
.pay-progress span { display: block; height: 100%; background: var(--warning); transform-origin: left; transition: transform 1s linear; }
.pay-progress span.urgent { background: var(--danger); }
.qr-reveal { animation: qr-reveal 0.35s ease; }
@keyframes qr-reveal { from { opacity: 0; transform: scale(0.94); } }
.pay-steps { text-align: left; color: var(--muted); font-size: 0.88rem; padding-left: 20px; margin: 16px auto 12px; max-width: 320px; }
.pay-steps li { margin-bottom: 4px; }
.pay-steps strong { color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  .qr-reveal { animation: none; }
}
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--warning); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: rgba(34, 197, 94, 0.15); color: var(--success); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 12px; }

.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: calc(100vw - 40px); }
.toast { background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 4px solid var(--info); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: fade 0.2s ease; max-width: 380px; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.dev-note { border: 1px dashed var(--warning); color: var(--warning); border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; margin-top: 14px; }
.notice { background: rgba(245, 165, 36, 0.08); border: 1px solid rgba(245, 165, 36, 0.35); color: #ffd590; border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; margin-top: 14px; }

/* ---------------------------------------------------------------- Panel admin */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--bg-soft); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar .brand { padding: 0 8px 20px; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.admin-sidebar nav a { padding: 10px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.admin-sidebar nav a:hover { background: var(--surface); color: var(--text); }
.admin-sidebar nav a.active { background: var(--surface-2); color: var(--text); }
.admin-sidebar .count { background: var(--warning); color: #0a0c12; border-radius: 999px; font-size: 0.72rem; font-weight: 800; padding: 1px 8px; }
.admin-main { padding: 28px; min-width: 0; }
.admin-main .page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-main .page-head h1 { font-size: 1.6rem; margin: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 200px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 12px; }
.variant-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
pre.json { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 0.8rem; margin: 0; }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .admin-main { padding: 20px 16px; }
  .kv { grid-template-columns: 1fr; }
}

/* =====================================================================
   Celulares
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; }
img, svg { max-width: 100%; }
.btn, .chip, .variant, .menu-toggle { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  main { padding: 18px 0 40px; }
  .container { padding: 0 14px; }
  h1 { font-size: 1.55rem; }
  .hero { padding: 8px 0 18px; }
  .hero p { font-size: 1rem; }

  /* iPhone hace zoom al enfocar campos con letra < 16px */
  .input, select.input, textarea.input { font-size: 16px; padding: 12px 14px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }

  .card { padding: 16px; border-radius: 12px; }
  .grid { gap: 12px; }

  /* Catálogo: 2 productos por fila */
  .grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-media { font-size: 1.8rem; }
  .product-body { padding: 12px; }
  .product-body h3 { font-size: 0.95rem; }
  .product-body .price { font-size: 0.9rem; }

  .variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .variant { padding: 12px; }
  .pay-options { grid-template-columns: 1fr; }
  .input-row { flex-wrap: wrap; }
  .input-row .btn { flex: 1 0 100%; }
  .balance-hero .amount { font-size: 2rem; }

  /* Tablas como tarjetas (cada celda muestra su título con data-label) */
  .table-wrap.cards { border: none; background: transparent; overflow: visible; }
  .table-wrap.cards table, .table-wrap.cards tbody, .table-wrap.cards tr, .table-wrap.cards td { display: block; width: 100%; }
  .table-wrap.cards thead { display: none; }
  .table-wrap.cards tr { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
  .table-wrap.cards td { border: none; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-wrap.cards td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; font-weight: 600; text-align: left; flex-shrink: 0; }
  .table-wrap.cards td.empty { display: block; text-align: center; }
  .table-wrap.cards td.empty::before { content: none; }

  /* Ventanas emergentes como hoja inferior */
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal, .modal.wide { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom); }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .qr-box { width: 230px; }

  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .list-item { flex-wrap: wrap; }

  .site-footer .container { flex-direction: column; gap: 4px; }

  /* Panel admin en celular */
  .admin-sidebar { padding: 12px; }
  .admin-sidebar nav { flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .admin-sidebar nav a { white-space: nowrap; padding: 8px 12px; }
  .admin-main { padding: 16px 12px; }
  .admin-main .page-head h1 { font-size: 1.3rem; }
  .toolbar .input { min-width: 0; width: 100%; }
  .toolbar .btn { width: 100%; }
  th, td { padding: 10px 10px; }
}

@media (max-width: 360px) {
  .grid-products { grid-template-columns: 1fr; }
  .variant-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- Packs con pestañas */
.step { display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.95rem; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--warning); color: #0a0c12; display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; flex-shrink: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 5px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border-strong); margin-bottom: 14px; }
.seg-btn { border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 11px 10px; border-radius: 999px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg-btn.active { background: var(--warning); color: #0a0c12; box-shadow: 0 4px 14px rgba(245, 165, 36, 0.3); }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 10px; }
.pack-list { display: grid; gap: 10px; }
.pack { position: relative; cursor: pointer; border: 1px solid var(--border-strong); border-radius: 14px; background: linear-gradient(160deg, #18213a, #10162a); transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s; }
.pack input { position: absolute; opacity: 0; pointer-events: none; }
.pack:active { transform: scale(0.98); }
.pack:has(input:checked) { border-color: var(--warning); box-shadow: 0 0 0 2px rgba(245, 165, 36, 0.35); }
.pack:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.4); }
.pack-diamond { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 10px; }
.pack-qty { font-size: 1.35rem; font-weight: 800; }
.pack-diamond .pack-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.pack-diamond .pack-price { margin-top: 6px; font-weight: 700; color: var(--warning); }
.pack-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 16px; }
.pack-icon { font-size: 1.6rem; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(245, 165, 36, 0.12); }
.pack-row .pack-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.92rem; }
.pack-row .pack-price { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.buy-bar { display: none; }
@media (max-width: 640px) {
  .has-buy-bar main { padding-bottom: 96px; }
  .buy-inline { display: none; }
  .buy-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(20, 24, 38, 0.97); backdrop-filter: blur(10px); border-top: 1px solid var(--border-strong); }
  .buy-bar-info { display: flex; flex-direction: column; min-width: 0; }
  .buy-bar-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .buy-bar .btn { flex-shrink: 0; min-width: 130px; }
  .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
