/* Estilos compartidos por la tienda y el panel. Móvil primero. */
:root {
  --bg: #0b0e13;
  --card: #141922;
  --campo: #1b2230;
  --borde: #262f3f;
  --texto: #e8edf5;
  --muted: #8b97aa;
  --acento: #3b82f6;          /* lo sobrescribe el color elegido en el panel */
  --ok: #22c55e;
  --aviso: #f59e0b;
  --error: #ef4444;
  --r: 16px;
  --r-s: 12px;
  --sombra: 0 6px 24px rgba(0, 0, 0, .35);
  --nav-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--acento); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 14px; }
.muted { color: var(--muted); }
.peq { font-size: 13px; }

/* Tarjetas */
.card {
  background: var(--card);
  border: 1px solid var(--borde);
  border-radius: var(--r);
  padding: 16px;
}
.card h2, .card h3 { margin: 0 0 10px; font-size: 17px; }
.card + .card { margin-top: 12px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: var(--r-s); border: 1px solid var(--borde);
  background: var(--campo); color: var(--texto);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: #3a4558; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-acento { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-acento:hover { filter: brightness(1.08); border-color: var(--acento); }
.btn-ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-peligro { color: #fca5a5; border-color: #5b2a2a; background: #2a1517; }
.btn-fantasma { background: transparent; }
.btn-bloque { width: 100%; }
.btn-chico { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* Campos */
label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input, input.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--campo); border: 1px solid var(--borde); border-radius: var(--r-s);
  outline: none;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--acento); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acento) 25%, transparent); }
.input.invalido { border-color: var(--error); }
.error-txt { color: #fca5a5; font-size: 13px; margin: 6px 0 0; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--borde); background: var(--card);
  color: var(--texto); cursor: pointer; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"], .chip.activo { background: var(--acento); border-color: var(--acento); color: #fff; }
.chip .n { opacity: .7; font-weight: 500; font-size: 12px; }

/* Etiquetas */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--campo); border: 1px solid var(--borde);
}
.tag-agotado { background: #3a1518; border-color: #6b2228; color: #fecaca; }
.tag-nuevo { background: #10264a; border-color: #1e4f99; color: #bfdbfe; }
.tag-confirmado { background: #3a2a0c; border-color: #7a5512; color: #fde68a; }
.tag-entregado { background: #0f2e1c; border-color: #1c6b3c; color: #bbf7d0; }
.tag-cancelado { background: #2a1517; border-color: #5b2a2a; color: #fca5a5; }

/* Control − cantidad + */
.stepper {
  display: inline-grid; grid-template-columns: 40px minmax(34px, auto) 40px; align-items: center;
  background: var(--campo); border: 1px solid var(--borde); border-radius: 999px; overflow: hidden;
}
.stepper button {
  height: 38px; border: 0; background: transparent; cursor: pointer;
  font-size: 20px; font-weight: 700; color: var(--texto);
}
.stepper button:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper .cant { text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 34px; }
.stepper.activo { border-color: var(--acento); }
.stepper.activo .cant { color: var(--acento); }

/* Avisos flotantes */
.toast-zona {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom)); z-index: 90;
  display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none;
}
.toast {
  background: #1f2737; border: 1px solid var(--borde); border-radius: var(--r-s);
  padding: 12px 14px; box-shadow: var(--sombra); font-weight: 600;
  animation: entra .2s ease-out;
}
.toast.error { border-color: #6b2228; background: #2a1517; }
.toast.ok { border-color: #1c6b3c; background: #0f2e1c; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

/* Barra inferior (móvil) */
.nav-inf {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(14, 18, 25, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--borde);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.nav-inf button, .nav-inf a {
  position: relative; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.nav-inf .ico { font-size: 21px; line-height: 1; }
.nav-inf [aria-current="page"], .nav-inf .activo { color: var(--acento); }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--error); color: #fff; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Panel lateral / hoja inferior */
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 60; animation: aparece .2s; }
@keyframes aparece { from { opacity: 0; } }
.cajon {
  position: fixed; z-index: 61; background: var(--bg); border: 1px solid var(--borde);
  display: flex; flex-direction: column;
  left: 0; right: 0; bottom: 0; max-height: 92vh; border-radius: 20px 20px 0 0;
  animation: sube .22s ease-out;
}
@keyframes sube { from { transform: translateY(30px); opacity: 0; } }
.cajon-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--borde); }
.cajon-cab h2 { margin: 0; font-size: 18px; }
.cajon-cuerpo { overflow-y: auto; padding: 14px 16px; flex: 1; }
.cajon-pie { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); background: var(--card); }
.cerrar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--borde); background: var(--campo); cursor: pointer; font-size: 18px; }

@media (min-width: 760px) {
  .cajon { left: auto; top: 0; right: 0; bottom: 0; width: 440px; max-height: none; border-radius: 0; animation: lado .22s ease-out; }
  @keyframes lado { from { transform: translateX(30px); opacity: 0; } }
}

/* Diálogos */
dialog.modal {
  width: min(94vw, 560px); max-height: 92vh; padding: 0;
  background: var(--card); color: var(--texto); border: 1px solid var(--borde); border-radius: var(--r);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .6); }
dialog.modal form { padding: 16px; }
.modal-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-cab h2 { margin: 0; font-size: 18px; }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fila > .crece { flex: 1; min-width: 0; }
.grid2 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.vacio { text-align: center; padding: 36px 16px; color: var(--muted); }
.vacio .grande { font-size: 44px; margin-bottom: 6px; }
