/* ==========================================================================
   Gestor de Negocio — estilos
   Mobile-first: barra inferior en celular, menú lateral en escritorio (≥ 900px).
   --p (color principal) se ajusta por negocio desde JS.
   ========================================================================== */

:root {
  --p: #2563eb;
  --p-oscuro: #1d4ed8;
  --p-suave: rgba(37, 99, 235, .10);
  --p-texto: #ffffff;
  --fondo: #f3f5f9;
  --tarjeta: #ffffff;
  --texto: #0f172a;
  --texto2: #64748b;
  --texto3: #94a3b8;
  --borde: #e2e8f0;
  --borde2: #cbd5e1;
  --verde: #16a34a;
  --verde-suave: #dcfce7;
  --rojo: #dc2626;
  --rojo-suave: #fee2e2;
  --ambar: #d97706;
  --ambar-suave: #fef3c7;
  --azul-suave: #dbeafe;
  --radio: 14px;
  --radio-chico: 9px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
  --sombra-modal: 0 20px 60px rgba(15, 23, 42, .25);
  --lateral: 250px;
  --inferior: 62px;
  --barra: 56px;
  --fuente: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 15px;
  line-height: 1.45;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: var(--p); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.ic.chico { width: 16px; height: 16px; }
svg.ic.grande { width: 26px; height: 26px; }
[hidden] { display: none !important; }
.oculto { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.verde { color: var(--verde); }
.rojo { color: var(--rojo); }
.ambar { color: var(--ambar); }
.gris { color: var(--texto2); }
.chico { font-size: .85rem; }
.mini { font-size: .78rem; }
.negrita { font-weight: 700; }
.centro { text-align: center; }
.derecha { text-align: right; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.mt-chico { margin-top: 8px; }
.sep { height: 1px; background: var(--borde); margin: 14px 0; }

/* -------------------------------------------------------------- carga */
.cargando-pantalla { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--borde); border-top-color: var(--p); border-radius: 50%; animation: girar .8s linear infinite; }
.cargando { display: flex; justify-content: center; padding: 60px 0; }
.cargando::after { content: ""; width: 30px; height: 30px; border: 3px solid var(--borde); border-top-color: var(--p); border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--p-suave), var(--fondo) 60%); }
.login-caja { width: 100%; max-width: 380px; background: var(--tarjeta); border-radius: 20px; padding: 32px 28px; box-shadow: var(--sombra-modal); }
.login-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--p); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; font-size: 1.6rem; font-weight: 800; }
.login-logo svg { width: 32px; height: 32px; }
.login h1 { text-align: center; font-size: 1.35rem; }
.login .sub { text-align: center; color: var(--texto2); margin-bottom: 22px; }

/* -------------------------------------------------------------- estructura */
#shell { min-height: 100vh; }
.barra {
  position: sticky; top: 0; z-index: 30; height: var(--barra);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--tarjeta); border-bottom: 1px solid var(--borde);
}
.barra-marca { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.barra-marca img, .marca-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: var(--p); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.barra-marca b { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-marca small { display: block; color: var(--texto2); font-size: .72rem; line-height: 1.1; }
.btn-icono { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--texto2); }
.btn-icono:hover { background: var(--fondo); color: var(--texto); }

main#contenido { padding: 16px 14px calc(var(--inferior) + 90px); max-width: 1120px; margin: 0 auto; }

.inferior {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--inferior) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--tarjeta); border-top: 1px solid var(--borde);
}
.inferior a, .inferior button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .68rem; color: var(--texto2); border: 0; background: none; padding: 6px 2px;
}
.inferior a.activo { color: var(--p); font-weight: 600; }
.inferior svg.ic { width: 22px; height: 22px; }

.lateral { display: none; }

@media (min-width: 900px) {
  .barra, .inferior { display: none; }
  .lateral {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: var(--lateral);
    background: var(--tarjeta); border-right: 1px solid var(--borde); padding: 18px 12px; overflow-y: auto;
  }
  .lateral-marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; border-bottom: 1px solid var(--borde); margin-bottom: 10px; }
  .lateral-marca img, .lateral-marca .marca-logo { width: 42px; height: 42px; border-radius: 12px; }
  .lateral-marca b { display: block; line-height: 1.15; }
  .lateral-marca small { color: var(--texto2); font-size: .74rem; }
  .lateral-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .lateral-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--texto2); font-weight: 500;
  }
  .lateral-nav a:hover { background: var(--fondo); color: var(--texto); }
  .lateral-nav a.activo { background: var(--p-suave); color: var(--p); font-weight: 600; }
  .lateral-nav .grupo { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texto3); padding: 14px 12px 4px; }
  .lateral-pie { border-top: 1px solid var(--borde); padding-top: 12px; margin-top: 10px; }
  .lateral-pie .usuario { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: var(--texto2); font-size: .85rem; }
  .lateral-pie .usuario b { color: var(--texto); display: block; }
  main#contenido { margin-left: var(--lateral); max-width: none; padding: 28px 32px 60px; }
  .contenido-int { max-width: 1120px; margin: 0 auto; }
}

/* -------------------------------------------------------------- cabecera de página */
.cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cab h1 { font-size: 1.4rem; }
.cab .sub { color: var(--texto2); font-size: .88rem; margin: 0; }
.cab-acciones { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------- botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--borde2); background: var(--tarjeta);
  font-weight: 600; font-size: .92rem; line-height: 1.2; color: var(--texto); white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--fondo); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-p { background: var(--p); border-color: var(--p); color: var(--p-texto); }
.btn-p:hover { background: var(--p-oscuro); }
.btn-verde { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn-verde:hover { background: #15803d; }
.btn-rojo { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn-rojo:hover { background: #b91c1c; }
.btn-suave { background: var(--p-suave); border-color: transparent; color: var(--p); }
.btn-suave:hover { background: var(--p-suave); filter: brightness(.96); }
.btn-fantasma { background: transparent; border-color: transparent; color: var(--texto2); }
.btn-fantasma:hover { background: var(--fondo); color: var(--texto); }
.btn-chico { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn-chico svg.ic { width: 15px; height: 15px; }
.btn-bloque { width: 100%; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1fb457; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--inferior) + 18px + env(safe-area-inset-bottom)); z-index: 25;
  width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--p); color: var(--p-texto);
  display: grid; place-items: center; box-shadow: 0 10px 24px rgba(15, 23, 42, .25);
}
.fab svg.ic { width: 28px; height: 28px; stroke-width: 2.4; }
@media (min-width: 900px) { .fab { display: none; } }

/* -------------------------------------------------------------- tarjetas */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); }
.tarjeta + .tarjeta { margin-top: 14px; }
.tarjeta-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tarjeta-cab h2, .tarjeta-cab h3 { font-size: 1rem; }
.tarjeta.sin-pad { padding: 0; overflow: hidden; }
.tarjeta.sin-pad .tarjeta-cab { padding: 14px 16px 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 899px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid-2.uno-movil { grid-template-columns: 1fr; } }
.grid-principal { display: grid; gap: 14px; }
.grid > *, .grid-principal > * { min-width: 0; }
@media (min-width: 900px) { .grid-principal { grid-template-columns: 1.6fr 1fr; align-items: start; } }

.kpi { padding: 14px 16px; }
.kpi .kpi-t { font-size: .78rem; color: var(--texto2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.kpi .kpi-v { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .kpi-s { font-size: .8rem; color: var(--texto2); margin-top: 2px; }
.kpi .kpi-s .delta { font-weight: 700; }
@media (max-width: 480px) { .kpi .kpi-v { font-size: 1.25rem; } }
.kpi.acento { border-left: 4px solid var(--p); }
.kpi.verde-borde { border-left: 4px solid var(--verde); }
.kpi.rojo-borde { border-left: 4px solid var(--rojo); }
.kpi.ambar-borde { border-left: 4px solid var(--ambar); }

/* -------------------------------------------------------------- listas */
.lista { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--borde);
  cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; color: inherit;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--fondo); }
.item.sin-click { cursor: default; }
.item.sin-click:hover { background: none; }
.item-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--p-suave); color: var(--p); font-weight: 700; }
.item-ico.verde { background: var(--verde-suave); color: var(--verde); }
.item-ico.rojo { background: var(--rojo-suave); color: var(--rojo); }
.item-ico.ambar { background: var(--ambar-suave); color: var(--ambar); }
.item-ico.gris { background: var(--fondo); color: var(--texto2); }
.item-txt { flex: 1; min-width: 0; }
.item-txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-txt small { display: block; color: var(--texto2); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-der { text-align: right; flex-shrink: 0; }
.item-der b { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-der small { display: block; color: var(--texto2); font-size: .76rem; }
.item.anulada .item-txt, .item.anulada .item-der { opacity: .5; text-decoration: line-through; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.badge-verde { background: var(--verde-suave); color: #15803d; }
.badge-rojo { background: var(--rojo-suave); color: #b91c1c; }
.badge-ambar { background: var(--ambar-suave); color: #b45309; }
.badge-azul { background: var(--azul-suave); color: #1d4ed8; }
.badge-gris { background: var(--fondo); color: var(--texto2); }
.badge-p { background: var(--p-suave); color: var(--p); }
.badge-punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.vacio { text-align: center; padding: 34px 16px; color: var(--texto2); }
.vacio .vacio-ico { width: 56px; height: 56px; border-radius: 18px; background: var(--fondo); display: grid; place-items: center; margin: 0 auto 12px; color: var(--texto3); }
.vacio b { display: block; color: var(--texto); margin-bottom: 4px; }

/* -------------------------------------------------------------- filtros / chips */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtros .buscar { flex: 1; min-width: 160px; }
.buscar { position: relative; }
.buscar input[type] { padding-left: 38px; }
.buscar svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--texto3); width: 18px; height: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--borde2); background: var(--tarjeta);
  font-size: .84rem; font-weight: 500; color: var(--texto2); white-space: nowrap;
}
.chip:hover { border-color: var(--p); color: var(--p); }
.chip.activo { background: var(--p); border-color: var(--p); color: var(--p-texto); font-weight: 600; }
.chip.chico { padding: 5px 10px; font-size: .78rem; }
.resumen-barra { display: flex; gap: 6px 18px; flex-wrap: wrap; padding: 10px 14px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio-chico); margin-bottom: 14px; font-size: .86rem; color: var(--texto2); }
.resumen-barra b { color: var(--texto); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- formularios */
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.campo > label, .etiqueta { font-size: .8rem; font-weight: 600; color: var(--texto2); }
.campo .ayuda { font-size: .76rem; color: var(--texto3); }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], input[type="email"], input[type="tel"], input[type="search"], input[type="color"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--borde2); border-radius: 10px; background: var(--tarjeta); outline: 0; min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-suave); }
input[type="color"] { padding: 4px; width: 60px; }
textarea { resize: vertical; min-height: 70px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.fila { display: flex; gap: 10px; align-items: flex-end; }
.fila > * { flex: 1; min-width: 0; }
.fila > .fijo { flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; padding: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--p); margin: 0; }
.interruptor { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.interruptor input { position: absolute; opacity: 0; width: 0; height: 0; }
.interruptor .pista { width: 42px; height: 24px; border-radius: 999px; background: var(--borde2); position: relative; transition: background .15s; flex-shrink: 0; }
.interruptor .pista::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.interruptor input:checked + .pista { background: var(--p); }
.interruptor input:checked + .pista::after { left: 21px; }
.dinero { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.dinero-grande { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.total-caja { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--p-suave); border-radius: 10px; margin: 6px 0 12px; }
.total-caja span { color: var(--texto2); font-weight: 600; }
.total-caja b { font-size: 1.4rem; color: var(--p); font-variant-numeric: tabular-nums; }
.error-form { background: var(--rojo-suave); color: #991b1b; padding: 10px 12px; border-radius: 8px; font-size: .86rem; margin-bottom: 12px; }
.pestanas { display: flex; gap: 4px; background: var(--fondo); border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.pestanas button { flex: 1; padding: 8px; border: 0; border-radius: 8px; background: none; font-weight: 600; color: var(--texto2); font-size: .88rem; }
.pestanas button.activo { background: var(--tarjeta); color: var(--texto); box-shadow: var(--sombra); }

/* selector de productos en nueva venta */
.prod-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 2px; }
.prod-btn { text-align: left; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--tarjeta); display: flex; flex-direction: column; gap: 2px; min-height: 58px; }
.prod-btn:hover { border-color: var(--p); background: var(--p-suave); }
.prod-btn b { font-size: .86rem; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-btn small { color: var(--texto2); font-size: .78rem; }
.prod-btn .cant { position: absolute; }
.prod-btn.en-carro { border-color: var(--p); background: var(--p-suave); }
.prod-btn { position: relative; }
.prod-btn .marca { position: absolute; top: 6px; right: 8px; background: var(--p); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; }
.linea { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.linea:last-child { border-bottom: 0; }
.linea .linea-nombre { flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linea .linea-nombre small { display: block; color: var(--texto2); font-weight: 400; font-size: .76rem; }
.linea input.cant { width: 52px; text-align: center; padding: 6px 4px; min-height: 36px; }
.linea input.precio { width: 92px; padding: 6px 8px; min-height: 36px; }
.linea .linea-total { width: 80px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--borde2); border-radius: 8px; overflow: hidden; }
.stepper button { width: 32px; height: 36px; border: 0; background: var(--fondo); font-size: 1.1rem; font-weight: 700; color: var(--texto2); }
.stepper button:hover { color: var(--p); }
.stepper input { width: 46px; border: 0; text-align: center; min-height: 36px; padding: 0; border-radius: 0; }

/* -------------------------------------------------------------- tablas */
.tabla-scroll { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th, .tabla td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texto2); font-weight: 700; }
.tabla td.num, .tabla th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tfoot td { font-weight: 700; background: var(--fondo); }
.tabla tbody tr:hover td { background: var(--fondo); }

/* -------------------------------------------------------------- modal */
.modal-fondo { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-end; justify-content: center; animation: aparecer .15s; }
.modal { background: var(--tarjeta); width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; box-shadow: var(--sombra-modal); animation: subir .2s; }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.modal-cab h2 { font-size: 1.1rem; }
.modal-cuerpo { padding: 4px 18px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-pie { display: flex; gap: 10px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); }
.modal-pie .btn { flex: 1; }
@media (min-width: 640px) {
  .modal-fondo { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; max-width: 520px; max-height: 90vh; }
  .modal.ancho { max-width: 760px; }
  .modal-pie .btn { flex: 0 0 auto; min-width: 120px; }
  .modal-pie { justify-content: flex-end; }
}
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(30px); opacity: 0; } }

/* -------------------------------------------------------------- toasts */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: .9rem; font-weight: 500; box-shadow: var(--sombra-modal); animation: subir .2s; display: flex; gap: 8px; align-items: center; }
.toast.ok { background: #14532d; }
.toast.error { background: #7f1d1d; }

/* -------------------------------------------------------------- gráficos */
.grafico { width: 100%; overflow: hidden; }
.grafico svg { width: 100%; height: auto; display: block; }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--texto2); margin-top: 8px; }
.leyenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--p)); margin-right: 6px; vertical-align: middle; }
.barra-prog { height: 8px; border-radius: 999px; background: var(--fondo); overflow: hidden; }
.barra-prog i { display: block; height: 100%; background: var(--c, var(--p)); border-radius: 999px; }
.dona-envoltura { display: flex; gap: 16px; align-items: center; }
.dona-envoltura svg { width: 130px; height: 130px; flex-shrink: 0; }
.dona-lista { flex: 1; min-width: 0; font-size: .84rem; }
.dona-lista div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.dona-lista div span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dona-lista b { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- órdenes */
.orden-tarjeta { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--borde); border-radius: 12px; background: var(--tarjeta); cursor: pointer; text-align: left; width: 100%; color: inherit; margin-bottom: 8px; }
.orden-tarjeta:hover { border-color: var(--p); }
.orden-num { font-family: var(--mono); font-size: .78rem; color: var(--texto2); }
.estado-pasos { display: flex; gap: 6px; flex-wrap: wrap; }

/* -------------------------------------------------------------- negocios (superadmin) */
.negocio-tarjeta { display: flex; align-items: center; gap: 14px; }
.negocio-tarjeta .ico { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; flex-shrink: 0; }
.plantilla-btn { text-align: left; padding: 12px; border: 2px solid var(--borde); border-radius: 12px; background: var(--tarjeta); display: flex; gap: 10px; align-items: flex-start; }
.plantilla-btn.activo { border-color: var(--p); background: var(--p-suave); }
.plantilla-btn .pi { font-size: 1.4rem; }
.plantilla-btn b { display: block; font-size: .9rem; }
.plantilla-btn small { color: var(--texto2); font-size: .76rem; line-height: 1.3; }

.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--ambar-suave); color: #78350f; font-size: .86rem; margin-bottom: 14px; }
.aviso.azul { background: var(--azul-suave); color: #1e3a8a; }
.aviso svg { flex-shrink: 0; margin-top: 1px; }

/* -------------------------------------------------------------- impresión */
@media print {
  .barra, .inferior, .lateral, .fab, .filtros, .cab-acciones, .modal-pie { display: none !important; }
  main#contenido { margin: 0; padding: 0; }
  .tarjeta { box-shadow: none; }
}
