/* Tonos = significado, como en tones.js del kit de comercio del fork:
   neutral (slate) · positive (teal) · warning (amber) · danger (ruby) · info (blue) · accent (marca). */
:root {
  --slate-1: #fcfcfd; --slate-2: #f6f7f9; --slate-3: #eceef2; --slate-6: #d3d7de; --slate-9: #8b93a1; --slate-10: #6b7280; --slate-11: #4b5563; --slate-12: #1f2430;
  --teal-3: #e0f5f1; --teal-9: #12a594; --teal-11: #0b7a6e;
  --amber-3: #fff1d6; --amber-9: #f5a623; --amber-11: #9a5b00;
  --ruby-3: #ffe5ea; --ruby-9: #e5484d; --ruby-11: #b3172c;
  --blue-3: #e4effc; --blue-9: #3b82f6; --blue-11: #1d4ed8;
  --brand: #4f46e5; --brand-soft: rgba(79, 70, 229, .12); --brand-text: #3730a3;
  --radius: 8px; --sombra: 0 1px 2px rgba(31, 36, 48, .06), 0 4px 16px rgba(31, 36, 48, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--slate-12);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--slate-2); line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.cabecera { background: #fff; border-bottom: 1px solid var(--slate-3); position: sticky; top: 0; z-index: 5; }
.cabecera-int { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.marca { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.marca small { color: var(--slate-10); font-weight: 500; }
.pestanas { display: flex; gap: 4px; }
.pestanas a { text-decoration: none; color: var(--slate-11); padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.pestanas a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }
.aviso-global { margin-left: auto; font-size: 12px; color: var(--slate-10); }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.subtitulo { color: var(--slate-10); margin: 0 0 16px; }
.tarjeta { background: #fff; border: 1px solid var(--slate-3); border-radius: var(--radius); box-shadow: var(--sombra); padding: 16px; margin-bottom: 16px; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fila > .crece { flex: 1 1 240px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

input[type="text"], input[type="search"], input[type="number"], select, textarea {
  border: 1px solid var(--slate-6); border-radius: var(--radius); padding: 8px 10px; background: #fff; width: 100%;
}
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input[type="number"] { width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
label.campo { display: grid; gap: 4px; font-size: 12px; color: var(--slate-11); font-weight: 500; }

.btn { border: 1px solid var(--slate-6); background: #fff; border-radius: var(--radius); padding: 7px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--slate-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primario:hover { background: #4338ca; }
.btn-peligro { color: var(--ruby-11); }
.btn-peligro:hover { background: var(--ruby-3); }
.btn-chico { padding: 3px 8px; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--slate-6); border-radius: var(--radius); overflow: hidden; }
.stepper button { border: 0; background: #fff; width: 28px; height: 28px; cursor: pointer; }
.stepper button:hover { background: var(--slate-2); }
.stepper span { min-width: 2.2rem; text-align: center; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--slate-6); border-radius: 999px; padding: 4px 10px; background: #fff; cursor: pointer; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
.chip:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }

.pill { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; background: var(--slate-3); color: var(--slate-11); white-space: nowrap; }
.pill.ok, .pill.positive { background: var(--teal-3); color: var(--teal-11); }
.pill.degradado, .pill.warning { background: var(--amber-3); color: var(--amber-11); }
.pill.no_disponible, .pill.danger { background: var(--ruby-3); color: var(--ruby-11); }
.pill.info { background: var(--blue-3); color: var(--blue-11); }
.pill.accent { background: var(--brand-soft); color: var(--brand-text); }

.badge-comercio { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.badge-comercio::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--slate-9)); }
[data-comercio="tottus"] { --c: #12a594; }
[data-comercio="metro"] { --c: #f5a623; }
[data-comercio="wong"] { --c: #e5484d; }
[data-comercio="plazavea"] { --c: #3b82f6; }

.tabla-envoltura { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--slate-3); vertical-align: top; }
th { position: sticky; top: 0; background: var(--slate-1); color: var(--slate-10); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: var(--slate-1); }
td.mejor { background: var(--teal-3); color: var(--teal-11); font-weight: 700; }
tr.total td { font-weight: 700; border-top: 2px solid var(--slate-6); }
.nombre-producto { font-weight: 500; }
.detalle-producto { color: var(--slate-10); font-size: 12px; }
.precio-sec { color: var(--slate-10); font-size: 12px; }

.avisos { display: grid; gap: 6px; margin: 8px 0; }
.aviso { border-left: 3px solid var(--amber-9); background: var(--amber-3); color: var(--amber-11); padding: 6px 10px; border-radius: 4px; font-size: 13px; }
.aviso.danger { border-color: var(--ruby-9); background: var(--ruby-3); color: var(--ruby-11); }
.aviso.info { border-color: var(--blue-9); background: var(--blue-3); color: var(--blue-11); }
.aviso.positive { border-color: var(--teal-9); background: var(--teal-3); color: var(--teal-11); }
.vacio { color: var(--slate-10); text-align: center; padding: 32px 12px; }
.cargando { color: var(--slate-10); padding: 12px 0; }

.stat { display: grid; gap: 2px; }
.stat .etiqueta { font-size: 12px; color: var(--slate-10); font-weight: 500; }
.stat .valor { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .nota { font-size: 12px; color: var(--slate-11); }

.lista-carritos { display: grid; gap: 8px; }
.item-carrito { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--slate-3); border-radius: var(--radius); background: #fff; cursor: pointer; text-align: left; width: 100%; }
.item-carrito:hover { border-color: var(--brand); }
.grupo-comercio { margin-bottom: 14px; }
.grupo-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0 4px; }
.tarjeta-comercio { border: 1px solid var(--slate-3); border-radius: var(--radius); padding: 14px; background: #fff; display: grid; gap: 8px; }
.tarjeta-comercio dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.tarjeta-comercio dt { color: var(--slate-10); }
.tarjeta-comercio dd { margin: 0; }

dialog { border: 0; border-radius: 12px; padding: 0; max-width: 560px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(31, 36, 48, .25); }
dialog::backdrop { background: rgba(31, 36, 48, .45); }
.dialogo-cuerpo { padding: 20px; display: grid; gap: 12px; }
.dialogo-pie { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--slate-3); background: var(--slate-1); }
.bloqueo { border: 2px solid var(--amber-9); background: var(--amber-3); color: var(--amber-11); padding: 12px; border-radius: var(--radius); font-weight: 600; }
.pasos { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
.lista-handoff { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.lista-handoff li { display: flex; justify-content: space-between; gap: 8px; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--slate-12); color: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--sombra); max-width: 360px; font-size: 13px; }
.toast.danger { background: var(--ruby-11); }
.toast.positive { background: var(--teal-11); }

@media (max-width: 720px) {
  .cabecera-int { gap: 10px; }
  .aviso-global { display: none; }
  main { padding: 12px; }
  th, td { padding: 6px 8px; }
}

/* Market conserva tonos semánticos y controles del kit de comercio. */
.cabecera-int, main { max-width: none; width: 100%; padding-left: clamp(16px, 3vw, 76px); padding-right: clamp(16px, 3vw, 76px); }
.cabecera-int { min-height: 76px; }
main { padding-top: 30px; padding-bottom: 48px; }
.marca { text-decoration: none; color: var(--slate-12); font-size: 22px; }
.marca-icono { display: grid; place-items: center; height: 34px; width: 34px; border-radius: 9px; background: var(--brand); color: white; font-size: 20px; }
.pestanas { flex-wrap: wrap; }
.acceso-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 7vw, 150px); align-items: start; padding-top: clamp(20px, 6vh, 80px); }
.bienvenida { padding-top: 16px; }
.bienvenida h1 { font-size: clamp(32px, 3.5vw, 64px); line-height: 1.08; letter-spacing: -.045em; margin: 20px 0; max-width: 16ch; }
.presentacion { font-size: clamp(16px, 1.25vw, 21px); line-height: 1.6; color: var(--slate-11); max-width: 58ch; }
.recorrido { padding: 0; margin: 36px 0 0; list-style: none; counter-reset: paso; display: grid; gap: 24px; }
.recorrido li { counter-increment: paso; display: grid; grid-template-columns: 30px 1fr; column-gap: 14px; color: var(--slate-11); }
.recorrido li::before { content: counter(paso); grid-row: span 2; background: var(--slate-3); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; font-weight: 600; color: var(--slate-12); }
.recorrido strong { display: block; color: var(--slate-12); }
.acceso-panel { padding: clamp(24px, 2.5vw, 52px); margin: 0; border-top: 3px solid var(--brand); }
.acceso-panel h2 { font-size: 24px; margin-top: 0; }
.acceso-form, .form-pedido { display: grid; gap: 16px; }
.acceso-form { margin: 28px 0 18px; }
input[type="password"] { border: 1px solid var(--slate-6); border-radius: var(--radius); padding: 12px; width: 100%; background: white; }
.acceso-form .btn { min-height: 46px; }
.nota-piloto { border-top: 1px solid var(--slate-3); padding-top: 18px; margin-top: 24px; color: var(--slate-11); font-size: 13px; }
h2 { font-size: 18px; letter-spacing: -.02em; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.enlace-producto { background: none; border: none; text-align: left; padding: 0; color: var(--brand-text); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.codigo { padding: 12px; border-radius: var(--radius); background: var(--slate-2); font-size: 13px; overflow-wrap: anywhere; }
.fotos-producto { display: flex; gap: 10px; overflow-x: auto; }
.fotos-producto img { width: 190px; height: 190px; object-fit: contain; border: 1px solid var(--slate-3); border-radius: var(--radius); }
.consentimiento { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.consentimiento input { margin-top: 4px; flex: 0 0 auto; }
.form-pedido textarea { min-height: 72px; font-family: inherit; }
.tarjeta-comercio p { margin: 0; overflow-wrap: anywhere; }
.btn { min-height: 34px; }
@media (min-width: 1900px) { .tarjeta { padding: 24px; } .acceso-panel { padding: 52px; } }
@media (max-width: 900px) {
 .acceso-grid { grid-template-columns: 1fr; padding-top: 0; gap: 24px; }
 .bienvenida h1 { max-width: 22ch; }
 .recorrido { margin-top: 24px; gap: 16px; }
 .pestanas { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
 .pestanas a { padding: 7px 10px; white-space: nowrap; }
 .cabecera-int { gap: 12px; }
 #cerrar-sesion { margin-left: auto; }
}
@media (max-width: 450px) {
 .cabecera-int, main { padding-left: 16px; padding-right: 16px; }
 main { padding-top: 20px; }
 .acceso-panel { padding: 22px; }
 .bienvenida h1 { font-size: 36px; }
 .marca small { display: none; }
 .fila > .crece { flex-basis: 100%; }
 .tarjeta { padding: 14px; }
 .acceso-panel.tarjeta { padding: 22px; }
}
