/* =====================================================================
   Terraza del Recuerdo · Cuentas por cobrar
   ===================================================================== */
:root {
  --verde-900: #0d2e23;
  --verde-800: #123d2f;
  --verde-700: #1b5642;
  --verde-600: #24705a;
  --verde-100: #e5f2ec;
  --oro: #f2b33d;
  --morado: #8a2be2;
  --rojo: #e0294a;
  --fondo: #f3f5f4;
  --borde: #e3e8e6;
  --bs-body-font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-bg: var(--fondo);
  --bs-body-color: #1d2a25;
}

body { background: var(--fondo); padding-bottom: env(safe-area-inset-bottom); }

/* ---------- Botones ---------- */
.btn-terraza {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--verde-700);
  --bs-btn-border-color: var(--verde-700);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--verde-800);
  --bs-btn-hover-border-color: var(--verde-800);
  --bs-btn-active-bg: var(--verde-900);
  --bs-btn-active-border-color: var(--verde-900);
}
.btn-outline-terraza {
  --bs-btn-color: var(--verde-700);
  --bs-btn-border-color: var(--verde-700);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--verde-700);
  --bs-btn-hover-border-color: var(--verde-700);
  --bs-btn-active-bg: var(--verde-800);
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(242,179,61,.25), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(138,43,226,.22), transparent 60%),
    linear-gradient(160deg, var(--verde-900), var(--verde-700));
}
.login-card { background: #fff; border-radius: 20px; padding: 32px 28px; width: 100%; max-width: 380px; }
.logo-circulo {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  font-size: 2.2rem; color: var(--oro);
  background: radial-gradient(circle at 30% 30%, #2a6e57, var(--verde-900));
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(242,179,61,.6), 0 10px 25px rgba(0,0,0,.25);
}

/* ---------- Barra superior ---------- */
.barra-top {
  background: linear-gradient(90deg, var(--verde-900), var(--verde-700));
  box-shadow: 0 4px 18px rgba(13,46,35,.25);
}
.logo-mini {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: var(--oro); background: rgba(255,255,255,.08); border: 2px solid rgba(242,179,61,.7);
}
.navbar-brand small { font-size: .72rem; }

/* ---------- Tarjetas y KPIs ---------- */
.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }

.kpi {
  position: relative; background: #fff; border: 1px solid var(--borde); border-radius: 16px;
  padding: 16px 18px; height: 100%; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.kpi-icono {
  position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.15rem; color: var(--c); background: var(--c-suave);
}
.kpi-titulo { font-size: .78rem; color: #6b7a74; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.kpi-valor  { font-size: 1.55rem; font-weight: 700; margin-top: 6px; color: #13211c; }
.kpi-sub    { font-size: .8rem; color: #6b7a74; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-rojo   { --c: var(--rojo);    --c-suave: #fde8ec; }
.kpi-morado { --c: var(--morado);  --c-suave: #f2e6fd; }
.kpi-verde  { --c: #16a34a;        --c-suave: #e3f6ea; }
.kpi-ambar  { --c: #d48806;        --c-suave: #fdf2dc; }

/* ---------- Pestañas ---------- */
.pestanas .nav-link { color: #4b5a54; border-radius: 999px; font-weight: 500; padding: .45rem 1rem; }
.pestanas .nav-link.active { background: var(--verde-700); color: #fff; }

/* ---------- Tabla de clientes ---------- */
.tabla-clientes thead th {
  background: var(--verde-800); color: #fff; font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .03em; border: 0; padding: 14px 16px;
}
.tabla-clientes td { padding: 12px 16px; border-color: #eef2f0; }
.tabla-clientes tbody tr { cursor: pointer; }
.nombre-cliente { color: var(--morado); font-weight: 600; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 36px;
  font-weight: 600; font-size: .85rem; color: #fff; background: var(--av, var(--verde-600));
}
.saldo      { font-weight: 700; color: var(--rojo); }
.saldo.cero { color: #16a34a; }
.saldo.favor{ color: #0d6efd; }

.chip-dias { font-weight: 600; font-size: .78rem; border-radius: 999px; padding: .3rem .65rem; display: inline-block; min-width: 64px; text-align: center; }
.dias-ok    { background: #e3f6ea; color: #15803d; }
.dias-medio { background: #fff4d6; color: #a16207; }
.dias-alto  { background: #ffe4e6; color: #be123c; }
.dias-cero  { background: #eef2f0; color: #6b7a74; }

/* ---------- Tarjetas de cliente (celular) ---------- */
.cliente-card { display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; }
.cliente-card:active { background: #f7faf8; }

/* ---------- Movimientos ---------- */
.mov-icono {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 38px; font-size: 1.05rem;
}
.mov-consumo .mov-icono { background: #fde8ec; color: var(--rojo); }
.mov-abono   .mov-icono { background: #e3f6ea; color: #16a34a; }
.mov-valor   { font-weight: 700; white-space: nowrap; }
.mov-consumo .mov-valor { color: var(--rojo); }
.mov-abono   .mov-valor { color: #16a34a; }
.list-group-item { padding: 12px 16px; border-color: #eef2f0; }
.mov-acciones .btn { --bs-btn-padding-y: .15rem; --bs-btn-padding-x: .4rem; }

/* ---------- Panel de detalle ---------- */
.detalle { --bs-offcanvas-width: 460px; }
.detalle-header { background: linear-gradient(120deg, var(--verde-900), var(--verde-700)); color: #fff; }
.detalle-saldo { padding: 20px 16px; background: linear-gradient(#f7faf8, #fff); border-bottom: 1px solid var(--borde); }
.timeline .list-group-item { padding-left: 16px; }

/* ---------- Formularios ---------- */
.form-control:focus, .form-select:focus { border-color: var(--verde-600); box-shadow: 0 0 0 .2rem rgba(36,112,90,.18); }
.chip-rapido, .chip-metodo {
  border: 1px solid var(--borde); background: #fff; border-radius: 999px; font-size: .8rem; padding: .25rem .7rem;
}
.chip-rapido:hover { border-color: var(--verde-600); color: var(--verde-700); }
.chip-metodo.activo { background: var(--verde-700); border-color: var(--verde-700); color: #fff; }
.modal-content { border: 0; border-radius: 18px; }

/* ---------- Botones flotantes ---------- */
.fab-grupo { position: fixed; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; z-index: 1030; }
.fab {
  width: 58px; height: 58px; border-radius: 50%; border: 0; font-size: 1.5rem; color: #fff;
  background: var(--verde-700); box-shadow: 0 8px 20px rgba(13,46,35,.35);
}
.fab-abono { width: 48px; height: 48px; font-size: 1.2rem; background: #16a34a; align-self: center; }

/* ---------- Avisos ---------- */
#aviso { background: var(--verde-800); color: #fff; }
#aviso.error { background: var(--rojo); }

@media (max-width: 767.98px) {
  main { padding-bottom: 190px !important; }
  .kpi-valor { font-size: 1.2rem; }
  .kpi-icono { width: 32px; height: 32px; font-size: 1rem; }
}

.min-w-0 { min-width: 0; }
.barra-top .container-xl { flex-wrap: nowrap; }
.kpi-titulo { padding-right: 44px; }
@media (max-width: 767.98px) {
  .barra-top .navbar-brand { font-size: 1rem; min-width: 0; }
  .barra-top .navbar-brand .d-block { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi { padding: 14px; }
  .kpi-titulo { font-size: .68rem; padding-right: 34px; }
  .kpi-icono { right: 10px; top: 10px; }
}

/* Deudas pendientes y estado de cada deuda */
.chip-deudas { font-weight: 700; color: #6b21a8; background: #f3e8ff; border-radius: 999px; padding: .3rem .65rem; font-size: .85rem; display: inline-block; min-width: 64px; text-align: center; }
.chip-deudas small { font-weight: 500; color: #7e6a93; }
.chip-deudas.sin { background: #eef2f0; color: #6b7a74; }
.badge-pagado { display: inline-block; margin-top: 4px; font-size: .72rem; font-weight: 600; color: #15803d; background: #e3f6ea; border-radius: 999px; padding: .15rem .55rem; }
.chip-dias, .chip-deudas, .tabla-clientes th { white-space: nowrap; }

/* Comprobantes */
.zona-comprobante {
  border: 2px dashed #cfd8d4; border-radius: 14px; padding: 18px; text-align: center; color: var(--verde-700);
  background: #f8fbf9; transition: .15s;
}
.zona-comprobante:hover, .zona-comprobante.arrastrando { border-color: var(--verde-600); background: var(--verde-100); }
.previa-comprobante { position: relative; border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; background: #f8fbf9; }
.previa-comprobante img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #eef2f0; }
.previa-pdf { display: flex; align-items: center; gap: 10px; padding: 18px; font-weight: 500; }
.previa-pdf i { font-size: 2rem; color: #dc2626; }
.previa-acciones { display: flex; gap: 6px; justify-content: flex-end; padding: 8px; border-top: 1px solid var(--borde); background: #fff; }
.btn-comprobante { --bs-btn-padding-y: .1rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem; border-radius: 999px; }
.visor-comprobante { background: #f3f5f4; min-height: 200px; }
.visor-comprobante img { max-height: 70vh; }
.visor-comprobante iframe { width: 100%; height: 70vh; border: 0; border-radius: 8px; background: #fff; }

/* ---------- Logo ---------- */
.logo-login { width: 128px; height: 128px; filter: drop-shadow(0 0 18px rgba(236,72,153,.55)); }
img.logo-mini { width: 42px; height: 42px; border: 0; background: none; filter: drop-shadow(0 0 6px rgba(236,72,153,.6)); }

/* ---------- Selector de productos ---------- */
.selector-productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.prod-tile {
  position: relative; border: 1px solid var(--borde); border-radius: 12px; padding: 10px 8px; text-align: center;
  background: #fff; user-select: none; transition: .12s;
}
.prod-tile:hover { border-color: var(--verde-600); }
.prod-tile:active { transform: scale(.97); }
.prod-tile.activo { border-color: var(--verde-700); background: var(--verde-100); box-shadow: 0 0 0 1px var(--verde-700) inset; }
.prod-nombre { font-weight: 600; font-size: .85rem; line-height: 1.15; }
.prod-precio { font-size: .75rem; color: #6b7a74; }
.prod-cant {
  position: absolute; top: -8px; right: -6px; min-width: 24px; height: 24px; border-radius: 999px; padding: 0 6px;
  background: var(--verde-700); color: #fff; font-weight: 700; font-size: .8rem; display: grid; place-items: center;
}
.prod-menos {
  position: absolute; top: -8px; left: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: var(--rojo); color: #fff; font-weight: 700; line-height: 1; padding: 0;
}

/* ---------- Productos ---------- */
.producto-card { display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; }
.producto-card:hover { border-color: var(--verde-600); }
.producto-card.inactivo { opacity: .55; }
.producto-icono { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 40px; background: #fff4d6; color: #b45309; font-size: 1.1rem; }

/* ---------- Recordatorios ---------- */
.rec-enviado { background: #f3fbf6; }
.rec-enviado .nombre-cliente { color: #15803d; }

/* ---------- Reporte ---------- */
.reporte-cabecera { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.reporte-cabecera img { filter: drop-shadow(0 0 6px rgba(236,72,153,.45)); }
.tabla-reporte thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7a74; font-weight: 600; background: #f7faf8; }
.tabla-reporte td, .tabla-reporte th { padding: 10px 16px; border-color: #eef2f0; }
.tabla-reporte .fila-total td { font-weight: 700; background: #f7faf8; }

@media print {
  body.imprimiendo-reporte * { visibility: hidden !important; }
  body.imprimiendo-reporte #reporte, body.imprimiendo-reporte #reporte * { visibility: visible !important; }
  body.imprimiendo-reporte #reporte { position: absolute; left: 0; top: 0; width: 100%; }
  body.imprimiendo-reporte .barra-top, body.imprimiendo-reporte .fab-grupo { display: none !important; }
  .kpi, .tarjeta { break-inside: avoid; box-shadow: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Copia de seguridad */
.copia-bloque { border: 1px solid var(--borde); border-radius: 14px; padding: 16px; background: #fff; }
.copia-icono { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 40px; font-size: 1.1rem; }
.bg-verde { background: #e3f6ea; color: #15803d; }
.bg-ambar { background: #fff4d6; color: #b45309; }
.punto-aviso { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--oro); box-shadow: 0 0 0 2px var(--verde-800); }

/* ---------- Ahorros (colchón) ---------- */
.colchon {
  border-radius: 20px; padding: 22px; color: #fff;
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(242,179,61,.28), transparent 60%),
    linear-gradient(135deg, var(--verde-900), var(--verde-600));
  box-shadow: 0 10px 30px rgba(13,46,35,.25);
}
.colchon-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
.colchon-saldo { font-size: 2.6rem; font-weight: 700; line-height: 1.1; margin: 4px 0; }
.colchon-sub { font-size: .85rem; opacity: .9; }
.colchon-mini { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 10px 12px; height: 100%; }
.colchon-mini div { font-size: .72rem; opacity: .8; line-height: 1.2; }
.colchon-mini b { font-size: 1.05rem; }
.colchon .btn-light { background: #fff; }
.colchon .btn-light:disabled { opacity: .55; }
.ah-badge { font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .25rem .6rem; white-space: nowrap; }
.ah-dep .ah-badge { background: #e3f6ea; color: #15803d; }  .ah-dep .ah-valor { color: #15803d; }
.ah-ret .ah-badge { background: #fde8ec; color: #be123c; }  .ah-ret .ah-valor { color: #be123c; }
.ah-dev .ah-badge { background: #e0edff; color: #1d4ed8; }  .ah-dev .ah-valor { color: #1d4ed8; }
.ah-devs { font-size: .78rem; color: #4b5a54; border-top: 1px dashed var(--borde); padding-top: 6px; }
.ah-disponible { background: #f3f7f5; border-radius: 10px; padding: 10px 12px; }
.ah-resultado { min-height: 1.5em; }
@media (max-width: 767.98px) {
  .colchon-saldo { font-size: 2rem; }
  .colchon .btn { font-size: .85rem; padding-left: .25rem; padding-right: .25rem; }
}
.fab-grupo.oculto { display: none !important; }

/* =====================================================================
   INVENTARIO
   ===================================================================== */
/* Pestañas: en celular se deslizan de lado en vez de partirse en 3 filas */
@media (max-width: 767.98px) {
  .pestanas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .pestanas::-webkit-scrollbar { display: none; }
  .pestanas .nav-link { white-space: nowrap; }
}

/* Botones de acción grandes */
.inv-acciones { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.inv-accion {
  border: 0; border-radius: 16px; padding: 14px 10px; color: #fff; text-align: left; display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12); transition: transform .12s, box-shadow .12s; position: relative; overflow: hidden;
}
.inv-accion:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.inv-accion:active { transform: scale(.98); }
.inv-accion i { font-size: 1.6rem; line-height: 1; margin-bottom: 4px; }
.inv-accion span { font-weight: 700; font-size: 1rem; }
.inv-accion small { opacity: .85; font-size: .74rem; }
.inv-accion::after { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.12); }
.acc-compra { background: linear-gradient(135deg, #15803d, #22c55e); }
.acc-surtir { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.acc-cierre { background: linear-gradient(135deg, #b45309, #f59e0b); }
.acc-lista  { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.acc-merma  { background: linear-gradient(135deg, #be123c, #f43f5e); }
@media (max-width: 991.98px) { .inv-acciones { grid-template-columns: repeat(3, 1fr); } .acc-cierre { grid-column: span 3; order: -1; flex-direction: row; align-items: center; gap: 12px; } }
@media (max-width: 575.98px) {
  .inv-acciones { grid-template-columns: repeat(2, 1fr); }
  .acc-cierre { grid-column: span 2; }
  .inv-accion { padding: 12px; }
  .inv-accion i { font-size: 1.35rem; }
}
.kpi-clic { cursor: pointer; }
.kpi-clic:hover { border-color: var(--rojo); }

/* Tarjetas de ubicación */
.ubic-card {
  background: #fff; border: 1px solid var(--borde); border-radius: 16px; padding: 14px; height: 100%; cursor: pointer; transition: .12s;
  display: block; text-align: left;
}
.ubic-card:hover { border-color: var(--verde-600); }
.ubic-card.activa { border-color: var(--verde-700); box-shadow: 0 0 0 2px var(--verde-700) inset; background: var(--verde-100); }
.ubic-icono { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: #e0f2fe; color: #0369a1; }
.ubic-bodega .ubic-icono { background: #fef3c7; color: #b45309; }
.ubic-editar { color: #9aa8a2; }
.ubic-nombre { font-weight: 600; margin-top: 8px; }
.ubic-und { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.ubic-und small { font-size: .75rem; font-weight: 500; color: #6b7a74; }
.ubic-sub { font-size: .78rem; color: #6b7a74; }
.ubic-nueva { border-style: dashed; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--verde-700); gap: 4px; min-height: 120px; }
.ubic-nueva i { font-size: 1.5rem; }

/* Sub-pestañas */
.inv-subtabs .nav-link { color: #4b5a54; font-weight: 500; }
.inv-subtabs .nav-link.active { color: var(--verde-700); font-weight: 700; }

/* Fotos de producto */
.inv-foto { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: 0 0 44px; background: #fff; border: 1px solid var(--borde); }
.inv-foto-sm { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex: 0 0 32px; background: #fff; border: 1px solid var(--borde); }
.foto-vacia { display: inline-grid; place-items: center; color: #fff; border: 0 !important; }
.foto-nac  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.foto-prem { background: linear-gradient(135deg, #b91c1c, #7f1d1d); }
.foto-imp  { background: linear-gradient(135deg, #2563eb, #1e3a8a); }
.inv-foto.foto-vacia { font-size: 1.15rem; }
.inv-foto-sm.foto-vacia { font-size: .9rem; }

/* Tabla de stock */
.tabla-inv thead th { background: var(--verde-800); color: #fff; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; border: 0; padding: 12px; white-space: nowrap; }
.tabla-inv thead th.col-activa { background: var(--verde-600); }
.tabla-inv td { padding: 10px 12px; border-color: #eef2f0; white-space: nowrap; }
.tabla-inv td.col-activa { background: #f0faf5; }
.tabla-inv tbody tr { cursor: pointer; }
.tabla-inv tbody tr:hover td { background: #f7faf8; }
.tabla-inv tfoot td { font-weight: 700; background: #f7faf8; font-size: .85rem; }
.est { font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .25rem .6rem; white-space: nowrap; display: inline-block; }
.est-ok { background: #e3f6ea; color: #15803d; }
.est-bajo { background: #fff4d6; color: #a16207; }
.est-agotado { background: #ffe4e6; color: #be123c; }
.inv-card { padding: 12px; cursor: pointer; }
.inv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.inv-chips:empty { display: none; }
.inv-chip { font-size: .74rem; background: #f3f7f5; border-radius: 999px; padding: .2rem .55rem; color: #3f4d47; }

/* Cierres */
.cierre-dato { background: #f7faf8; border-radius: 12px; padding: 8px 12px; height: 100%; }
.cierre-dato span { display: block; font-size: .72rem; color: #6b7a74; text-transform: uppercase; letter-spacing: .03em; }
.cierre-dato b { font-size: 1.05rem; }
.cierre-card summary { cursor: pointer; }

/* Historial */
.mv-compra .mov-icono   { background: #e3f6ea; color: #15803d; }
.mv-traslado .mov-icono { background: #e0edff; color: #1d4ed8; }
.mv-venta .mov-icono    { background: #fff4d6; color: #b45309; }
.mv-merma .mov-icono    { background: #ffe4e6; color: #be123c; }
.mv-ajuste .mov-icono   { background: #eef2f0; color: #4b5a54; }

/* Ventana de compra / surtir / merma */
.inv-modal-header { color: #fff; }
.inv-modal-header .modal-title { color: #fff; }
.hdr-compra { background: linear-gradient(135deg, #15803d, #22c55e); }
.hdr-surtir { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.hdr-merma  { background: linear-gradient(135deg, #be123c, #f43f5e); }
.hdr-cierre { background: linear-gradient(135deg, #b45309, #f59e0b); }
.inv-catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 58vh; overflow-y: auto; padding: 2px; }
.cat-tile { position: relative; background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 8px; text-align: center; cursor: pointer; transition: .12s; user-select: none; }
.cat-tile:hover { border-color: var(--verde-600); }
.cat-tile:active { transform: scale(.97); }
.cat-tile.activo { border-color: var(--verde-700); box-shadow: 0 0 0 2px var(--verde-700) inset; background: var(--verde-100); }
.cat-tile.vacio { opacity: .5; }
.cat-foto { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #fff; display: grid; place-items: center; font-size: 2rem; }
.cat-nombre { font-weight: 600; font-size: .8rem; line-height: 1.15; margin-top: 4px; }
.cat-sub { font-size: .7rem; color: #6b7a74; }
.cat-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--verde-700); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.inv-carrito { background: #f7faf8; border: 1px solid var(--borde); border-radius: 16px; padding: 12px; position: sticky; top: 0; }
.linea { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.linea.excede { border-color: #f43f5e; }
.linea-ctrl { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.linea-ctrl > div { flex: 1; min-width: 96px; }
.linea-lbl { display: block; font-size: .7rem; color: #6b7a74; margin-bottom: 2px; }
.linea-pie { display: flex; justify-content: space-between; font-size: .85rem; margin-top: 6px; }
.inv-total { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed #cfd8d4; padding-top: 10px; margin-top: 4px; }
.inv-total:empty { display: none; }
.paso { display: flex; align-items: stretch; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; background: #fff; }
.paso button { border: 0; background: #f3f7f5; width: 32px; font-size: 1.1rem; font-weight: 700; color: var(--verde-700); }
.paso button:active { background: var(--verde-100); }
.paso input { border: 0; width: 100%; min-width: 34px; text-align: center; font-weight: 700; outline: none; }

/* Cierre / conteo */
.cie-ubic .nav-link { border: 1px solid var(--borde); margin-right: 6px; margin-bottom: 6px; color: #3f4d47; background: #fff; }
.cie-ubic .nav-link.active { background: #b45309; border-color: #b45309; color: #fff; }
.cie-ubic .nav-link.active .badge.text-bg-light { background: rgba(255,255,255,.25) !important; color: #fff !important; }
.cie-ayuda { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; font-size: .88rem; }
.cie-fila { display: grid; grid-template-columns: 44px 1fr 200px 130px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef2f0; }
.cie-inputs { display: flex; gap: 6px; }
.cie-inputs label { flex: 1; font-size: .7rem; color: #6b7a74; }
.cie-inputs input { text-align: center; font-weight: 700; font-size: 1.05rem; padding: .35rem; }
.cie-dif { font-size: .82rem; text-align: right; line-height: 1.2; }
.dif-ok { color: #15803d; font-weight: 600; }
.dif-mas { color: #1d4ed8; font-weight: 600; }
.dif-falta { color: #be123c; font-weight: 600; }
.dif-venta { color: #b45309; font-weight: 700; }
.cie-pie { flex-wrap: wrap; }
.cie-resumen { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; }
@media (max-width: 767.98px) {
  .cie-fila { grid-template-columns: 44px 1fr; }
  .cie-inputs { grid-column: 1 / -1; }
  .cie-dif { grid-column: 1 / -1; text-align: left; }
  .cie-pie .cie-resumen { width: 100%; margin-bottom: 6px; }
}

/* Lista de compras */
.lista-fila { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 10px; }
.lista-fila .paso { width: 120px; }
.lista-total { display: flex; justify-content: space-between; margin-top: 12px; padding: 12px; background: #f3f0ff; border-radius: 12px; }

/* Productos */
.prod-card { overflow: hidden; cursor: pointer; transition: .12s; height: 100%; }
.prod-card:hover { border-color: var(--verde-600); transform: translateY(-2px); }
.prod-card.inactivo { opacity: .55; }
.prod-card-foto { position: relative; background: #fff; border-bottom: 1px solid var(--borde); }
.prod-card-img { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; font-size: 2.6rem; }
.prod-codigo { position: absolute; left: 8px; top: 8px; font-size: .68rem; font-weight: 700; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 1px 6px; }
.prod-oculto { position: absolute; right: 8px; top: 8px; font-size: .68rem; font-weight: 700; background: #6b7a74; color: #fff; border-radius: 6px; padding: 1px 6px; }
.margen { font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .15rem .5rem; }
.m-alto { background: #e3f6ea; color: #15803d; }
.m-medio { background: #fff4d6; color: #a16207; }
.m-bajo { background: #ffe4e6; color: #be123c; }
.prod-foto { border: 2px dashed #cfd8d4; border-radius: 16px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; background: #f8fbf9; color: var(--verde-700); cursor: pointer; }
.prod-foto:hover { border-color: var(--verde-600); }
.prod-foto img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.prod-seccion { background: #f7faf8; border: 1px solid var(--borde); border-radius: 14px; padding: 12px; }
.prod-seccion-titulo { font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
.prod-margen { height: 38px; display: flex; align-items: center; }
.prod-tile-foto { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; display: inline-grid; place-items: center; margin-bottom: 2px; font-size: 1rem; }

/* Fotos vacías grandes (tarjetas de producto y catálogo de compra): fondo suave + icono de color */
.prod-card-img.foto-vacia, .cat-foto.foto-vacia { font-size: 2.4rem; }
.prod-card-img.foto-vacia.foto-nac,  .cat-foto.foto-vacia.foto-nac  { background: #fff7e6; color: #d97706; }
.prod-card-img.foto-vacia.foto-prem, .cat-foto.foto-vacia.foto-prem { background: #fdecec; color: #b91c1c; }
.prod-card-img.foto-vacia.foto-imp,  .cat-foto.foto-vacia.foto-imp  { background: #eaf1ff; color: #1d4ed8; }
.prod-card-img.foto-vacia { aspect-ratio: 16 / 9; }
.cat-foto.foto-vacia { aspect-ratio: auto; height: 64px; }

/* Ajustar stock */
.aj-ayuda { background: #eef6ff; border: 1px solid #cfe2ff; border-radius: 12px; padding: 10px 12px; font-size: .88rem; }
.aj-fila { display: grid; grid-template-columns: 1fr 78px 78px 90px; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid #eef2f0; }
.aj-fila label { font-size: .7rem; color: #6b7a74; }
.aj-fila input { text-align: center; font-weight: 700; font-size: 1.05rem; padding: .35rem; }
.aj-dif { font-size: .82rem; text-align: right; padding-bottom: 8px; font-weight: 600; }
.aj-resumen { background: #f7faf8; border-radius: 12px; padding: 10px 12px; }
@media (max-width: 575.98px) {
  .aj-fila { grid-template-columns: 1fr 1fr; }
  .aj-lugar { grid-column: 1 / -1; }
  .aj-dif { grid-column: 1 / -1; text-align: left; padding-bottom: 0; }
}

/* =====================================================================
   VENTAS (gráficas)
   ===================================================================== */
.viz-root {
  --series-1: #2a78d6;          /* azul: validado contra el fondo blanco */
  --series-1-hover: #1c5cab;
  --grid: #e9eeeb;
  --eje: #6b7a74;
}
.ven-grafica { width: 100%; min-height: 280px; margin-top: 8px; }
.ven-grafica svg { display: block; overflow: visible; }
.ven-grid { stroke: var(--grid); stroke-width: 1; }
.ven-grid.base { stroke: #cfd8d4; }
.ven-eje { font-size: 11px; fill: var(--eje); font-family: var(--bs-body-font-family); }
.ven-barra { fill: var(--series-1); transition: fill .12s; }
.ven-barra.activa { fill: var(--series-1-hover); }
.ven-zona { fill: transparent; cursor: pointer; outline: none; }
.ven-prom { stroke: #8a958f; stroke-width: 1.5; stroke-dasharray: 4 4; }
.ven-prom-txt { font-size: 11px; fill: #4b5a54; font-weight: 600; font-family: var(--bs-body-font-family); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.ven-etq { font-size: 11px; fill: #1d2a25; font-weight: 700; font-family: var(--bs-body-font-family); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.ven-tooltip {
  position: fixed; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: #13211c; color: #fff; border-radius: 10px; padding: 8px 12px; font-size: .82rem; min-width: 170px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.ven-tooltip.visible { opacity: 1; }
.ven-top { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.ven-top-nombre { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; font-size: .9rem; }
.ven-top-barra { height: 14px; background: #f3f6f4; border-radius: 0 4px 4px 0; }
.ven-top-barra span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.ven-top-valor { text-align: right; line-height: 1.1; white-space: nowrap; }
.ven-top-valor b { display: block; font-size: .9rem; }
.ven-top-valor small { color: #6b7a74; font-size: .74rem; }
@media (max-width: 575.98px) {
  .ven-top { grid-template-columns: 1fr auto; }
  .ven-top-barra { grid-column: 1 / -1; grid-row: 2; }
}
.btn-outline-terraza { --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--verde-700); }
.btn-check:checked + .btn-outline-terraza { color: #fff; background: var(--verde-700); border-color: var(--verde-700); }
.ven-leyenda { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .8rem; color: #4b5a54; margin-top: 8px; }
.ven-ley-barra { width: 12px; height: 12px; border-radius: 3px; background: var(--series-1); display: inline-block; }
.ven-ley-prom { width: 20px; border-top: 2px dashed #8a958f; display: inline-block; margin-left: 10px; }

/* =====================================================================
   GASTOS
   ===================================================================== */
.gas-acciones { grid-template-columns: repeat(3, 1fr) !important; }
.gas-acciones .inv-accion { grid-column: auto !important; order: 0 !important; flex-direction: column !important; align-items: flex-start !important; gap: 2px !important; }
.acc-gasto { background: linear-gradient(135deg, #be123c, #f43f5e); }
.acc-pago  { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.acc-fijo  { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.hdr-gasto { background: linear-gradient(135deg, #be123c, #f43f5e); }
@media (max-width: 575.98px) {
  .gas-acciones { grid-template-columns: 1fr 1fr !important; }
  .gas-acciones .acc-gasto { grid-column: span 2 !important; }
}
.gas-cat-ico { width: 32px; height: 32px; border-radius: 10px; display: inline-grid; place-items: center; flex: 0 0 32px; background: #fde8ec; color: #be123c; font-size: .95rem; }
.gas-cat-ico.grande { width: 40px; height: 40px; flex-basis: 40px; font-size: 1.1rem; }
.gas-item { cursor: pointer; }
.gas-item:hover { background: #fafcfb; }
.gas-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.gas-chip { border: 1px solid var(--borde); background: #fff; border-radius: 999px; padding: .35rem .75rem; font-size: .85rem; }
.gas-chip:hover { border-color: #f43f5e; }
.gas-chip.activo { background: #be123c; border-color: #be123c; color: #fff; }
.gas-chip.nueva { border-style: dashed; color: #6b7a74; }
.trab-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--borde); border-radius: 12px; padding: 10px; }
.trab-card.inactivo { opacity: .55; }
.fijo-fila { display: flex; align-items: center; gap: 10px; border: 1px solid var(--borde); border-radius: 12px; padding: 10px; background: #fff; }
.fijo-fila.pagado { background: #f3fbf6; border-color: #bfe8cf; }
.fijo-fila.inactivo { opacity: .55; }
.fijo-ok { color: #15803d; font-size: .8rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 767.98px) {
  .inv-subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .inv-subtabs::-webkit-scrollbar { display: none; }
  .inv-subtabs .nav-link { white-space: nowrap; }
}
.ubic-cifras { display: flex; gap: 18px; align-items: flex-end; margin-top: 2px; }
.ubic-cifras > div { display: flex; flex-direction: column; line-height: 1.05; }
.ubic-cifras small { font-size: .72rem; color: #6b7a74; font-weight: 500; }
.ubic-cifras > div + div { padding-left: 18px; border-left: 1px solid var(--borde); }
