/* TIENDA BTC · panel. Phone first. The store's brand colour arrives from /api/config and only paints the
   primary button, the active section and the login; state colours (green, amber, red) never change. */
:root {
  --marca: #2B2B2B; --marca-tx: #fff; --marca-suave: #EEF0F2;
  --fondo: #F4F5F7; --tarjeta: #fff; --tinta: #1D2129; --tinta-2: #5B6472; --tinta-3: #8A93A1;
  --linea: #E1E5EA; --linea-2: #EDF0F3; --oscuro: #20242B;
  --ok: #1F6B43; --ok-bg: #E3F3EA; --aviso: #8A5A00; --aviso-bg: #FFF2CC; --error: #A3312A; --error-bg: #FBE7E5;
  --info: #1E4E8C; --info-bg: #E5EEFB;
  --radio: 12px; --sombra: 0 1px 2px rgba(20, 24, 31, .06), 0 6px 20px rgba(20, 24, 31, .06);
  --barra-abajo: 62px; --lado: 232px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; line-height: 1.25; }
small, .suave { color: var(--tinta-2); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--marca) 55%, #fff); outline-offset: 2px; }
.arranque { padding: 3rem 1rem; text-align: center; color: var(--tinta-2); }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--linea); background: var(--tarjeta); color: var(--tinta); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--tinta-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primario { background: var(--marca); border-color: var(--marca); color: var(--marca-tx); }
.btn.primario:hover { filter: brightness(1.08); }
.btn.peligro { color: var(--error); border-color: #E7C2BE; }
.btn.chico { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn.icono { width: 44px; padding: 0; }
.btn.plano { border-color: transparent; background: transparent; }
.btn.plano:hover { background: var(--linea-2); }
.btn.link { border: 0; background: none; padding: .3rem .1rem; min-height: 36px; text-decoration: underline; font-weight: 500; color: var(--tinta); }
.btn.ancho { width: 100%; }
.campo { display: grid; gap: .3rem; font-weight: 600; font-size: .93rem; }
.campo > small, .ayuda { font-weight: 400; font-size: .85rem; color: var(--tinta-2); }
.campo .opc { font-weight: 400; color: var(--tinta-3); }
input[type=text], input[type=search], input[type=password], input[type=tel], input[type=email], input[type=date], input:not([type]), input[inputmode], select, textarea {
  width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--linea); border-radius: 10px; background: var(--tarjeta); font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--marca); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--marca) 18%, transparent); }
.con-error input, .con-error select, .con-error textarea, .con-error .precio { border-color: var(--error); }
.error-campo { color: var(--error); font-weight: 500; font-size: .85rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: .05rem 0 0; accent-color: var(--marca); flex: none; }
.check small { display: block; font-weight: 400; }
.precio { display: flex; align-items: center; border: 1px solid var(--linea); border-radius: 10px; background: var(--tarjeta); }
.precio:focus-within { border-color: var(--marca); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marca) 18%, transparent); }
.precio > span { padding: 0 .1rem 0 .7rem; color: var(--tinta-2); font-weight: 500; }
.precio input { border: 0; box-shadow: none !important; min-width: 0; background: transparent; }
.precio em { padding: 0 .7rem 0 .2rem; font-style: normal; color: var(--tinta-2); white-space: nowrap; font-size: .9rem; }
.interruptor { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex: none; min-height: 44px; }
.interruptor input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.interruptor span { width: 46px; height: 28px; border-radius: 99px; background: #C6CCD4; position: relative; transition: background .15s; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.interruptor input:checked + span { background: var(--ok); }
.interruptor input:checked + span::after { transform: translateX(18px); }
.interruptor input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--marca) 55%, #fff); outline-offset: 2px; }
.interruptor input:disabled + span { opacity: .5; }
.dos { display: grid; gap: 1rem; }
@media (min-width: 560px) { .dos { grid-template-columns: 1fr 1fr; } }
.opciones { display: flex; gap: .5rem; flex-wrap: wrap; }
.opciones label { flex: 1; min-width: 120px; display: flex; gap: .5rem; align-items: center; justify-content: center; min-height: 44px; padding: 0 .6rem; border: 1px solid var(--linea); border-radius: 10px; cursor: pointer; font-weight: 600; background: var(--tarjeta); text-align: center; }
.opciones label:has(input:checked) { border-color: var(--marca); background: var(--marca-suave); }
.opciones input { accent-color: var(--marca); }
fieldset { border: 1px solid var(--linea); border-radius: var(--radio); padding: .9rem 1rem 1rem; margin: 0; display: grid; gap: .9rem; background: var(--tarjeta); min-width: 0; }
legend { font-weight: 700; padding: 0 .35rem; }
details > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }

/* ------------------------------------------------------------ frame */
.marco { min-height: 100vh; }
.arriba { position: sticky; top: 0; z-index: 30; background: var(--oscuro); color: #fff; }
.arriba-in { display: flex; align-items: center; gap: .6rem; padding: .5rem 14px; min-height: 54px; }
.arriba .logo { height: 30px; width: auto; max-width: 120px; object-fit: contain; }
.arriba .sigla { width: 34px; height: 34px; border-radius: 9px; background: var(--marca); color: var(--marca-tx); display: grid; place-items: center; font-weight: 800; flex: none; }
.arriba .titulo { font-weight: 700; line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arriba .titulo small { display: block; color: #AEB6C2; font-weight: 500; font-size: .76rem; }
.arriba .espacio { flex: 1; }
.arriba .btn { background: transparent; border-color: rgba(255, 255, 255, .3); color: #fff; min-height: 38px; padding: .3rem .75rem; font-size: .9rem; }
.pub { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; padding: .2rem .55rem; border-radius: 99px; background: rgba(255, 255, 255, .12); color: #D9F2E3; border: 0; cursor: default; min-height: 28px; }
.pub::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5DD39E; }
.pub.falta { background: var(--aviso-bg); color: var(--aviso); cursor: pointer; }
.pub.falta::before { background: #D99A00; }
.lado { display: none; }
.abajo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--tarjeta); border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); }
.abajo button { border: 0; background: none; min-height: var(--barra-abajo); padding: 6px 0 8px; font-size: .72rem; font-weight: 700; color: var(--tinta-2); display: grid; justify-items: center; align-content: center; gap: 2px; cursor: pointer; position: relative; }
.abajo button[aria-current=page] { color: var(--tinta); }
.abajo button[aria-current=page] svg { color: var(--marca); }
.abajo button[aria-current=page]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--marca); }
.num { display: inline-block; min-width: 1.5em; padding: 0 .4em; border-radius: 99px; background: var(--error); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.5; text-align: center; }
.abajo .num { position: absolute; top: 5px; left: calc(50% + 6px); }
main { max-width: 1120px; margin: 0 auto; padding: 16px 14px calc(var(--barra-abajo) + 96px + env(safe-area-inset-bottom)); }
.sin-barras .abajo { display: none; }
.cabeza { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 12px; }
.cabeza .acciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.volver { display: inline-flex; align-items: center; gap: .3rem; border: 0; background: none; padding: .4rem .2rem; min-height: 44px; font-weight: 600; color: var(--tinta-2); cursor: pointer; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
.bloque { padding: 1rem 1.05rem; display: grid; gap: .6rem; align-content: start; }
.vacio { padding: 2.2rem 1rem; text-align: center; color: var(--tinta-2); display: grid; gap: .8rem; justify-items: center; }
.caja { border-radius: 10px; padding: .7rem .85rem; font-size: .94rem; background: var(--info-bg); color: var(--info); }
.caja.aviso { background: var(--aviso-bg); color: var(--aviso); }
.caja.error { background: var(--error-bg); color: var(--error); }
.caja.ok { background: var(--ok-bg); color: var(--ok); }
.etq { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 700; padding: .08rem .5rem; border-radius: 99px; background: var(--linea-2); color: var(--tinta-2); white-space: nowrap; }
.etq.ok { background: var(--ok-bg); color: var(--ok); }
.etq.aviso { background: var(--aviso-bg); color: var(--aviso); }
.etq.error { background: var(--error-bg); color: var(--error); }
.etq.info { background: var(--info-bg); color: var(--info); }
.etq.marca { background: var(--marca-suave); color: var(--tinta); }
.esq { background: linear-gradient(90deg, var(--linea-2) 25%, #F7F8FA 37%, var(--linea-2) 63%); background-size: 400% 100%; animation: esq 1.3s ease infinite; border-radius: 8px; min-height: 18px; }
@keyframes esq { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (min-width: 900px) {
  .abajo { display: none; }
  .lado { display: flex; flex-direction: column; gap: 2px; position: fixed; top: 54px; left: 0; bottom: 0; width: var(--lado); padding: 14px 10px; background: var(--tarjeta); border-right: 1px solid var(--linea); overflow-y: auto; z-index: 20; }
  .lado button, .lado a { display: flex; align-items: center; gap: .65rem; border: 0; background: none; padding: .6rem .7rem; border-radius: 10px; min-height: 44px; font-weight: 600; color: var(--tinta-2); cursor: pointer; text-decoration: none; text-align: left; }
  .lado button:hover, .lado a:hover { background: var(--linea-2); }
  .lado button[aria-current=page] { background: var(--marca-suave); color: var(--tinta); }
  .lado button[aria-current=page] svg { color: var(--marca); }
  .lado .num { margin-left: auto; }
  .lado hr { border: 0; border-top: 1px solid var(--linea); margin: 8px 4px; }
  .lado .pie { margin-top: auto; font-size: .78rem; color: var(--tinta-3); padding: .6rem .7rem 0; }
  .con-lado main { margin-left: var(--lado); max-width: none; padding: 22px 28px 120px; }
  .con-lado main > * { max-width: 1120px; }
  h1 { font-size: 1.6rem; }
}

.pausa { margin: 12px 14px 0; border-radius: 10px; }
@media (min-width: 900px) { .con-lado .pausa { margin: 16px 28px 0 calc(var(--lado) + 28px); } }
.permisos { display: grid; gap: .55rem; padding: .7rem .8rem; border: 1px solid var(--linea); border-radius: 10px; background: #FAFBFC; }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(400px, 100%); padding: 1.6rem 1.4rem; display: grid; gap: 1rem; }
.login .logo { display: flex; justify-content: center; }
.login .logo img { max-width: 180px; max-height: 72px; }
.login .sigla { width: 64px; height: 64px; border-radius: 18px; background: var(--marca); color: var(--marca-tx); display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; margin: 0 auto; }
.login h1 { text-align: center; font-size: 1.2rem; }
.login .sub { text-align: center; color: var(--tinta-2); margin-top: -.6rem; }
.clave-campo { position: relative; }
.clave-campo input { padding-right: 86px; }
.clave-campo button { position: absolute; right: 4px; top: 4px; bottom: 4px; border: 0; background: none; padding: 0 .6rem; font-weight: 600; font-size: .85rem; color: var(--tinta-2); cursor: pointer; border-radius: 8px; }

/* ------------------------------------------------------------ home */
.datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (min-width: 820px) { .datos { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.dato { display: grid; gap: .1rem; align-content: start; padding: .85rem .95rem; text-align: left; color: var(--tinta); font: inherit; min-width: 0; }
button.dato { cursor: pointer; }
button.dato:hover { border-color: var(--tinta-3); }
.dato b { font-size: 1.5rem; line-height: 1.15; overflow-wrap: anywhere; letter-spacing: -.01em; }
.dato span { font-weight: 600; color: var(--tinta-2); font-size: .9rem; }
.dato small { font-size: .8rem; }
.dato.atencion { border-color: #E6C766; background: #FFFBEC; }
.salud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.salud button { display: grid; gap: 0; padding: .6rem .7rem; text-align: left; border: 1px solid var(--linea); border-radius: 10px; background: var(--tarjeta); cursor: pointer; min-height: 60px; min-width: 0; }
.salud button:hover { border-color: var(--tinta-3); }
.salud b { font-size: 1.15rem; }
.salud span { font-size: .8rem; color: var(--tinta-2); font-weight: 600; overflow-wrap: anywhere; }
.salud .cero { opacity: .55; }
.dos-col { display: grid; gap: 12px; }
@media (min-width: 820px) { .dos-col { grid-template-columns: 1fr 1fr; } }
.top { margin: 0; padding-left: 1.3rem; display: grid; gap: .45rem; }
.top li span { font-weight: 600; margin-right: .4rem; }
.renglones { list-style: none; margin: 0; padding: 0; }
.renglones li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .7rem; padding: .5rem 0; border-top: 1px solid var(--linea-2); }
.renglones li:first-child { border-top: 0; }
.renglones .crece { flex: 1; min-width: 150px; }
.barra-plan { height: 8px; background: var(--linea-2); border-radius: 99px; overflow: hidden; }
.barra-plan i { display: block; height: 100%; background: var(--marca); border-radius: 99px; }

/* ------------------------------------------------------------ product list */
.busca { position: relative; }
.busca input { padding-left: 2.5rem; padding-right: 2.6rem; }
.busca > svg { position: absolute; left: .7rem; top: 11px; color: var(--tinta-3); }
.busca .borra { position: absolute; right: 2px; top: 2px; width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--tinta-2); font-size: 1.1rem; }
.herramientas { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; margin-bottom: 10px; }
.herramientas .btn { padding: .5rem .75rem; }
@media (max-width: 559px) { .solo-ancho { display: none; } .herramientas .btn { min-width: 46px; padding: .5rem .6rem; } }
.herramientas .btn .cuenta { background: var(--marca); color: var(--marca-tx); border-radius: 99px; font-size: .72rem; padding: 0 .4rem; }
.pildoras { display: flex; gap: .4rem; overflow-x: auto; padding: 2px 14px 8px; margin: 0 -14px; scrollbar-width: none; }
.pildoras::-webkit-scrollbar { display: none; }
.pildoras button { border: 1px solid var(--linea); background: var(--tarjeta); border-radius: 99px; padding: .3rem .75rem; min-height: 38px; font-weight: 600; font-size: .88rem; color: var(--tinta-2); cursor: pointer; white-space: nowrap; flex: none; }
.pildoras button[aria-pressed=true] { background: var(--oscuro); border-color: var(--oscuro); color: #fff; }
.pildoras button small { color: inherit; opacity: .75; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 8px; }
.chips button { border: 0; background: var(--marca-suave); border-radius: 99px; padding: .25rem .4rem .25rem .7rem; min-height: 32px; font-size: .84rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.chips button::after { content: "✕"; font-size: .7rem; opacity: .6; }
.resumen { margin: 4px 2px 8px; font-size: .88rem; color: var(--tinta-2); display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; justify-content: space-between; }
.lista { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.fila { display: grid; grid-template-columns: auto 56px minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .6rem .8rem; border-top: 1px solid var(--linea-2); cursor: pointer; background: var(--tarjeta); min-height: 76px; }
.fila:first-child { border-top: 0; }
.fila:hover { background: #FAFBFC; }
.fila.elegida { background: var(--marca-suave); }
.fila .sel { width: 24px; height: 24px; accent-color: var(--marca); margin: 0; cursor: pointer; }
.lista:not(.eligiendo) .fila { grid-template-columns: 56px minmax(0, 1fr) auto; }
.lista:not(.eligiendo) .fila .sel { display: none; }
.mini { width: 56px; height: 56px; border-radius: 10px; background: var(--linea-2); overflow: hidden; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; position: relative; }
.mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini.sin { color: var(--tinta-3); background: var(--linea-2); border: 1px dashed var(--tinta-3); }
.fila.oculta .mini img { opacity: .45; }
.info { min-width: 0; display: grid; gap: .1rem; }
.info b { overflow-wrap: anywhere; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.info .meta { font-size: .82rem; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info .plata { font-weight: 700; font-size: .95rem; }
.info .plata { display: flex; flex-wrap: wrap; gap: 0 .45rem; align-items: baseline; }
.info .plata s { font-weight: 400; color: var(--tinta-3); font-size: .85rem; white-space: nowrap; }
.etqs { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; }
.fila .der { display: flex; align-items: center; gap: .3rem; }
mark { background: #FFE99A; color: inherit; border-radius: 3px; padding: 0 1px; }
.mas { display: grid; justify-items: center; gap: .4rem; padding: 14px 0; }
.lote { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--oscuro); color: #fff; padding: .55rem 12px calc(.55rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(0, 0, 0, .2); }
.lote-in { max-width: 1120px; margin: 0 auto; display: grid; gap: .45rem; }
.lote .arr { display: flex; align-items: center; gap: .5rem; }
.lote .arr b { flex: 1; min-width: 0; }
.lote .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff; min-height: 40px; padding: .3rem .7rem; font-size: .9rem; }
.lote .btn.primario { background: #fff; color: var(--oscuro); border-color: #fff; }
.lote .acc { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.lote .acc::-webkit-scrollbar { display: none; }
.lote .acc .btn { flex: none; }
.lote .todo { background: none; border: 0; color: #B9D6FF; text-decoration: underline; cursor: pointer; padding: .2rem 0; font-size: .88rem; text-align: left; min-height: 32px; }
@media (min-width: 900px) { .con-lado .lote { left: var(--lado); } }
.fijo-abajo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--tarjeta); border-top: 1px solid var(--linea); box-shadow: 0 -6px 20px rgba(20, 24, 31, .1); padding: .6rem 14px calc(.6rem + env(safe-area-inset-bottom)); }
.fijo-abajo-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.fijo-abajo-in b, .fijo-abajo-in span.crece { flex: 1; min-width: 120px; }
@media (min-width: 900px) { .con-lado .fijo-abajo { left: var(--lado); } }
@media (max-width: 559px) { .fijo-abajo-in .suave { display: none; } .fijo-abajo-in .btn { flex: 1; } }
@media (min-width: 900px) {
  /* Every column has a width of its own: each row is its own grid, so an "auto" column (the switch in a row,
     nothing in the titles) made the rows and the titles disagree */
  .fila, .lista:not(.eligiendo) .fila { grid-template-columns: 24px 48px minmax(0, 2.2fr) minmax(0, 1.2fr) 150px 140px 64px; min-height: 64px; }
  .lista.precios .fila { grid-template-columns: 24px 48px minmax(0, 2.2fr) minmax(0, 1.2fr) 150px 140px 160px; }
  .fila .der { justify-content: flex-end; }
  .lista:not(.eligiendo) .fila .sel { display: block; }
  .mini { width: 48px; height: 48px; }
  .fila .solo-movil { display: none; }
  .fila.cab { cursor: default; min-height: 40px; font-size: .78rem; font-weight: 700; color: var(--tinta-2); background: #FAFBFC; text-transform: uppercase; letter-spacing: .04em; }
  .fila.cab button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: .3rem 0; text-align: left; text-transform: inherit; letter-spacing: inherit; }
  .fila.cab button[aria-sort]::after { content: " ↓"; }
  .fila.cab button[aria-sort=ascending]::after { content: " ↑"; }
}
@media (max-width: 899px) { .fila .solo-pc, .fila.cab { display: none; } }

/* ------------------------------------------------------------ sheets and dialogs */
dialog { padding: 0; border: 0; color: var(--tinta); background: var(--tarjeta); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); max-width: 100%; }
dialog::backdrop { background: rgba(20, 24, 31, .55); }
dialog.hoja { width: min(560px, 100%); max-height: min(92vh, 100%); border-radius: 16px; }
dialog.hoja.ancha { width: min(760px, 100%); }
@media (max-width: 640px) {
  dialog.hoja { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92vh; }
  dialog.hoja.llena { height: 100%; max-height: 100%; border-radius: 0; }
}
.dlg { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.dlg-cab { display: flex; align-items: center; gap: .5rem; padding: .7rem .6rem .7rem 1.1rem; border-bottom: 1px solid var(--linea-2); }
.dlg-cab h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dlg-cuerpo { padding: 1rem 1.1rem; overflow-y: auto; display: grid; gap: 1rem; align-content: start; }
.dlg-pie { display: flex; gap: .5rem; flex-wrap: wrap; padding: .7rem 1.1rem calc(.7rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--linea-2); background: #FAFBFC; }
.dlg-pie .espacio { flex: 1; }
.menu { display: grid; }
.menu button, .menu a { display: flex; align-items: center; gap: .75rem; border: 0; background: none; padding: .7rem .4rem; min-height: 52px; font-weight: 600; cursor: pointer; text-align: left; border-top: 1px solid var(--linea-2); text-decoration: none; color: var(--tinta); }
.menu button:first-child, .menu a:first-child { border-top: 0; }
.menu button:hover, .menu a:hover { background: var(--linea-2); }
.menu .peligro { color: var(--error); }
.menu small { display: block; font-weight: 400; }
.menu [aria-checked=true]::after { content: "✓"; margin-left: auto; font-weight: 800; color: var(--marca); }
.vista-previa { border: 1px solid var(--linea); border-radius: 10px; overflow: hidden; }
.vista-previa div { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem .7rem; border-top: 1px solid var(--linea-2); font-size: .9rem; }
.vista-previa div:first-child { border-top: 0; }
.vista-previa span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vista-previa b { white-space: nowrap; }

/* ------------------------------------------------------------ product form and photos */
.ficha { display: grid; gap: 14px; }
@media (min-width: 980px) { .ficha { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; } .ficha .col { display: grid; gap: 14px; } }
.ficha .col { display: grid; gap: 14px; min-width: 0; }
.fotos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .fotos { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.foto { position: relative; border: 1px solid var(--linea); border-radius: 12px; overflow: hidden; background: var(--linea-2); aspect-ratio: 1 / 1; display: grid; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; grid-area: 1 / 1; }
.foto .principal { position: absolute; top: 6px; left: 6px; background: var(--oscuro); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 6px; padding: 1px 6px; z-index: 2; }
.foto .toca { position: absolute; inset: 0; border: 0; background: none; cursor: pointer; z-index: 3; }
.foto .estado { grid-area: 1 / 1; align-self: end; z-index: 2; background: rgba(20, 24, 31, .78); color: #fff; font-size: .74rem; font-weight: 700; padding: .3rem .45rem; display: grid; gap: .25rem; }
.foto .estado.ok { background: rgba(31, 107, 67, .92); }
.foto .estado.mal { background: rgba(163, 49, 42, .95); }
.foto .progreso { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.foto .progreso i { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .15s; }
.foto.subiendo img { opacity: .55; }
.giro { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; display: inline-block; animation: giro .8s linear infinite; vertical-align: -2px; margin-right: .3rem; }
.giro.oscuro { border-color: var(--linea); border-top-color: var(--tinta-2); }
@keyframes giro { to { transform: rotate(360deg); } }
.agregar-foto { border: 2px dashed #C3CAD3; border-radius: 12px; background: var(--tarjeta); aspect-ratio: 1 / 1; display: grid; place-items: center; align-content: center; gap: .2rem; cursor: pointer; color: var(--tinta-2); font-weight: 700; font-size: .85rem; text-align: center; padding: .4rem; }
.agregar-foto:hover, .agregar-foto.sobre { border-color: var(--marca); background: var(--marca-suave); }
.fotos-pie { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; font-size: .85rem; color: var(--tinta-2); }
.cant-fila { display: grid; grid-template-columns: 104px 1fr auto; gap: .5rem; align-items: center; }
.historial { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.historial li { padding: .45rem 0; border-top: 1px solid var(--linea-2); display: grid; gap: .05rem; }
.historial li:first-child { border-top: 0; }
.historial small { font-size: .78rem; }

/* ------------------------------------------------------------ orders, categories, users */
.pedido { padding: .9rem 1rem; display: grid; gap: .5rem; border-top: 1px solid var(--linea-2); }
.pedido:first-child { border-top: 0; }
.pedido.nuevo { border-left: 4px solid #D99A00; }
.pedido-cab { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.pedido-cab select { width: auto; min-width: 150px; }
.pedido ul { margin: 0; padding-left: 1.1rem; }
.pedido .total { font-weight: 700; display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; }
.arbol { display: grid; }
.nodo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; padding: .55rem .8rem; border-top: 1px solid var(--linea-2); min-height: 56px; }
.arbol > .nodo:first-child { border-top: 0; }
.nodo .nombre { display: flex; align-items: center; gap: .5rem; min-width: 0; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.nodo .nombre:disabled { cursor: default; }
.nodo .nombre b { overflow-wrap: anywhere; }
.nodo .txt, .prod .txt { display: grid; min-width: 0; }
.nodo .txt small, .prod .txt small { color: var(--tinta-2); }
.nodo .flecha { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--tinta-2); }
.nodo .flecha .i { width: 18px; height: 18px; transition: transform .15s; }
.nodo.abierta .flecha .i { transform: rotate(90deg); }
.nodo.abierta { background: #FAFBFC; }
/* A product inside an open category: one step further in than the category that holds it */
.prod { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: .6rem; align-items: center; width: 100%; min-height: 48px; padding: .35rem .8rem; border: 0; border-top: 1px solid var(--linea-2); background: var(--tarjeta); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.prod:hover { background: var(--marca-suave); }
.prod .mini { width: 36px; height: 36px; border-radius: 8px; }
.prod .mini .i { width: 16px; height: 16px; }
.prod .txt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod.oculto .txt b { color: var(--tinta-3); }
.prod.p1 { padding-left: 2.55rem; }
.prod.p2 { padding-left: 3.75rem; }
.prod.p3 { padding-left: 5.15rem; }
.prod.mas { display: block; min-height: 40px; color: var(--marca); font-weight: 600; font-size: .9rem; }
@media (prefers-reduced-motion: reduce) { .nodo .flecha .i { transition: none; } }
.nodo .acc .solo-chico { display: none; }
@media (max-width: 559px) {
  .nodo .acc .btn:not(.solo-chico) { display: none; }
  .nodo .acc .solo-chico { display: inline-flex; }
  .nodo.n2 { padding-left: 1.5rem; }
  .nodo.n3 { padding-left: 2.2rem; }
  .prod.p1 { padding-left: 2.2rem; }
  .prod.p2 { padding-left: 2.9rem; }
  .prod.p3 { padding-left: 3.6rem; }
}
.nodo .punto { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.nodo.n2 { padding-left: 2rem; }
.nodo.n3 { padding-left: 3.4rem; }
.nodo.apagada b { color: var(--tinta-3); }
.nodo .acc { display: flex; gap: .25rem; }
.persona { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--linea-2); }
.persona:first-child { border-top: 0; }
.persona.apagada b { color: var(--tinta-3); }
.clave-nueva { font: 700 1.5rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; text-align: center; padding: .8rem; background: var(--linea-2); border-radius: 10px; user-select: all; overflow-wrap: anywhere; }
.ajustes { display: grid; gap: 14px; max-width: 760px; }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--barra-abajo) + 14px + env(safe-area-inset-bottom)); z-index: 100; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .8rem; max-width: 520px; padding: .7rem 1rem; border-radius: 12px; background: var(--oscuro); color: #fff; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); animation: sube .2s ease; }
.toast.error { background: var(--error); }
.toast button { border: 0; background: none; color: #B9D6FF; font-weight: 700; text-decoration: underline; cursor: pointer; padding: .3rem 0; min-height: 32px; white-space: nowrap; }
@keyframes sube { from { opacity: 0; transform: translateY(12px); } }
.con-pie .toasts { bottom: calc(150px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } .con-pie .toasts { bottom: 110px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
