/* =====================================================================
   StockFlow — sistema de diseño (claro / oscuro)
   Un solo archivo para todas las páginas. Los colores salen de variables;
   el tema se elige con <html data-tema="claro|oscuro">.
   ===================================================================== */

:root,
html[data-tema="claro"] {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel2: #f6f8fc;
  --hover: #eef3fb;
  --line: #e2e8f2;
  --txt: #172033;
  --muted: #667389;
  --acc: #2563eb;
  --acc-strong: #1d4ed8;
  --acc-soft: #e6eefe;
  --ok: #15803d;
  --ok-soft: #e3f6ea;
  --warn: #b45309;
  --warn-soft: #fdf1dc;
  --dan: #c2392b;
  --dan-soft: #fde9e6;
  --side: #ffffff;
  --side-txt: #3a4760;
  --sombra: 0 1px 2px rgba(16, 28, 56, .05), 0 4px 14px rgba(16, 28, 56, .05);
  --sombra-alta: 0 12px 40px rgba(16, 28, 56, .16);
  --radio: 12px;
  --radio-sm: 8px;
  --side-ancho: 264px;
  --side-mini: 78px;
  color-scheme: light;
}

html[data-tema="oscuro"] {
  --bg: #0d1322;
  --panel: #151d31;
  --panel2: #1a2439;
  --hover: #1d2942;
  --line: #26324b;
  --txt: #e8edf8;
  --muted: #94a2bd;
  --acc: #5b8def;
  --acc-strong: #7ba3f5;
  --acc-soft: #1b2c52;
  --ok: #4ade80;
  --ok-soft: #12301f;
  --warn: #fbbf24;
  --warn-soft: #33260c;
  --dan: #f87171;
  --dan-soft: #3a1a1a;
  --side: #111a2e;
  --side-txt: #b4c0d6;
  --sombra: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .25);
  --sombra-alta: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
strong { font-weight: 700; }
h1, h2, h3 { line-height: 1.25; }

.ico { flex: 0 0 auto; display: block; }

:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- Formularios ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.row label, .panel.row label { margin-top: 0; }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--txt);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radio-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input::placeholder { color: var(--muted); opacity: .75; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
input:focus, select:focus, textarea:focus { border-color: var(--acc); box-shadow: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input[type="file"] { padding: 7px 10px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  color: #fff; background: var(--acc);
  border: 1px solid transparent; border-radius: var(--radio-sm);
  padding: 9px 16px; min-height: 40px;
  transition: background-color .15s, transform .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--acc-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sec { background: var(--panel); color: var(--txt); border-color: var(--line); }
.btn.sec:hover { background: var(--hover); }
.btn.dan { background: var(--dan); color: #fff; }
.btn.dan:hover { filter: brightness(.92); }
.btn.sm { padding: 5px 11px; min-height: 32px; font-size: 13px; }
.btn-lleno { width: 100%; }
.btn-grande { min-height: 52px; font-size: 15px; letter-spacing: .04em; border-radius: 12px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: 0 0 40px;
  color: var(--txt); background: transparent;
  border: 1px solid transparent; border-radius: var(--radio-sm);
  cursor: pointer; transition: background-color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--hover); border-color: var(--line); }
.link { background: none; border: 0; color: var(--acc); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- Estructura general ---------- */
.layout { display: grid; grid-template-columns: var(--side-ancho) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .22s ease; }
html[data-lado="mini"] .layout { grid-template-columns: var(--side-mini) minmax(0, 1fr); }

.side {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px;
  background: var(--side); color: var(--side-txt);
  border-right: 1px solid var(--line);
  overflow: hidden auto;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 20px; color: var(--txt); }
.marca-logo { border-radius: 9px; flex: 0 0 auto; }
.marca-texto { white-space: nowrap; letter-spacing: -.01em; }
.marca-texto strong, .login-marca strong, .bv-marca strong { color: var(--acc); }

.negocio {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 9px 12px; border-radius: var(--radio-sm);
  background: var(--panel2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--txt);
}
.negocio-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: 0 0 8px; box-shadow: 0 0 0 3px var(--ok-soft); }
.negocio-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.nav-grupo { display: flex; flex-direction: column; gap: 3px; }
.nav-titulo { padding: 0 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 9px 12px; border-radius: var(--radio-sm);
  font-weight: 600; font-size: 14.5px; color: var(--side-txt);
  transition: background-color .15s, color .15s;
}
.nav-item:hover { background: var(--hover); color: var(--txt); }
.nav-item.on { background: var(--acc-soft); color: var(--acc); }
.nav-item.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--acc); }
.nav-texto { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-pie { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.usuario { display: flex; align-items: center; gap: 11px; padding: 4px; min-width: 0; }
.usuario-datos { min-width: 0; }
.usuario-nombre { font-weight: 700; font-size: 13.5px; color: var(--txt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-rol { font-size: 12px; color: var(--muted); }
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; overflow: hidden;
  border-radius: 50%; background: var(--acc-soft); color: var(--acc); font-weight: 700; font-size: 13.5px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.btn-salir {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--dan);
  background: transparent; border: 0; border-radius: var(--radio-sm); cursor: pointer;
}
.btn-salir:hover { background: var(--dan-soft); }

/* Menú contraído (escritorio) */
html[data-lado="mini"] .side { padding-left: 12px; padding-right: 12px; }
html[data-lado="mini"] .marca-texto,
html[data-lado="mini"] .nav-texto,
html[data-lado="mini"] .negocio-nombre,
html[data-lado="mini"] .usuario-datos,
html[data-lado="mini"] .nav-titulo { display: none; }
html[data-lado="mini"] .side-head { flex-direction: column; gap: 10px; }
html[data-lado="mini"] .nav-item, html[data-lado="mini"] .btn-salir, html[data-lado="mini"] .negocio { justify-content: center; padding-left: 0; padding-right: 0; }
html[data-lado="mini"] .nav-item.on::before { left: -12px; }
html[data-lado="mini"] .usuario { justify-content: center; }
html[data-lado="mini"] .btn-lado .ico { transform: rotate(180deg); }

.principal { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-titulo { font-size: 20px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.top-acciones { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.sel-idioma { width: auto; padding: 7px 8px; font-size: 13px; font-weight: 600; }

.buscador {
  display: flex; align-items: center; gap: 8px; flex: 0 1 380px; margin-left: 18px;
  padding: 0 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.buscador:focus-within { border-color: var(--acc); }
.buscador input { border: 0; background: transparent; box-shadow: none; padding: 9px 0; border-radius: 0; }

.contenido { flex: 1; padding: 26px 28px 8px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pie { padding: 18px 28px 26px; font-size: 12px; color: var(--muted); text-align: center; }

.solo-movil, .cubre { display: none; }

/* Notificaciones */
.notif { position: relative; }
.badge {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--dan); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(380px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radio);
  box-shadow: var(--sombra-alta); overflow: hidden; z-index: 50;
}
.notif-cab { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif-lista { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 12px 16px; background: transparent; border: 0; border-bottom: 1px solid var(--line); font: inherit; color: var(--txt); cursor: pointer; }
.notif-item:hover { background: var(--hover); }
.notif-item.nueva { background: var(--acc-soft); }
.notif-item .punto { width: 8px; height: 8px; margin-top: 6px; flex: 0 0 8px; border-radius: 50%; background: var(--acc); }
.notif-item.leida .punto { background: transparent; }
.notif-item small { display: block; color: var(--muted); font-size: 12px; }
.notif-vacia { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- Componentes ---------- */
.panel {
  min-width: 0; overflow-x: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radio);
  padding: 20px; box-shadow: var(--sombra);
}
.panel h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.row > div { flex: 1 1 180px; min-width: min(100%, 140px); }
.row > .fit { flex: 0 0 auto; min-width: 0; }
.right { margin-left: auto; text-align: right; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.card {
  padding: 18px 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radio); box-shadow: var(--sombra);
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); }
.card .k { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.card .v { margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.ok { color: var(--ok); }
.bad { color: var(--dan); }

table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
td .btn + .btn { margin-left: 4px; }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
}
td:last-child:has(.btn) { white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.low { background: var(--dan-soft); color: var(--dan); border-color: transparent; }
.rol { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--acc-soft); color: var(--acc); }
.rol-admin { background: #ede4fb; color: #6d3fc4; }
.rol-encargado { background: var(--acc-soft); color: var(--acc); }
.rol-vendedor { background: var(--ok-soft); color: var(--ok); }
.rol-repositor { background: var(--warn-soft); color: var(--warn); }
.rol-contador { background: #e1f4f7; color: #0e7490; }
.rol-cliente { background: var(--panel2); color: var(--muted); }
html[data-tema="oscuro"] .rol-admin { background: #2b2150; color: #c4a8ff; }
html[data-tema="oscuro"] .rol-contador { background: #0f2f36; color: #67d4e8; }

/* Modales */
.modal {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 14, 30, .55); backdrop-filter: blur(3px);
}
.modal.on { display: flex; animation: aparecer .15s ease; }
.modal .box {
  width: min(480px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto;
  padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sombra-alta);
  animation: subir .2s ease;
}
.modal .box h2 { margin-bottom: 4px; }
.confirm-texto { margin: 10px 0 20px; color: var(--muted); }

/* Avisos (toasts) */
.avisos { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.aviso {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: var(--radio);
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--acc);
  box-shadow: var(--sombra-alta); animation: subir .22s ease; font-weight: 500;
}
.aviso.ok { border-left-color: var(--ok); color: var(--txt); }
.aviso.error { border-left-color: var(--dan); color: var(--txt); }

/* Gráficos simples (SVG/CSS) */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 22px; }
.chart-bars .col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.chart-bars .col .val { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.chart-bars .col .fill { display: block; width: 100%; max-width: 46px; min-height: 3px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--acc), var(--acc-strong)); transition: filter .15s; }
.chart-bars .col:hover .fill { filter: brightness(1.12); }
.chart-labels { display: flex; gap: 8px; margin-top: 6px; }
.chart-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg { flex: 0 0 auto; }
.legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 9px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-item .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.legend-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-item .val { color: var(--muted); font-weight: 600; white-space: nowrap; }

/* Inventario */
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 9px; background: var(--panel2); display: block; border: 1px solid var(--line); }
.thumb.empty { display: grid; place-items: center; font-size: 9px; color: var(--muted); text-align: center; line-height: 1.1; }
.img-row { display: flex; align-items: center; gap: 12px; }
.img-prev { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* Portal */
.catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.prod-card { display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radio); transition: transform .18s, box-shadow .18s; }
.prod-card:hover { transform: translateY(-3px); box-shadow: var(--sombra-alta); }
.prod-img { aspect-ratio: 4 / 3; background: var(--panel2); display: grid; place-items: center; overflow: hidden; }
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
.prod-img .ph { color: var(--muted); font-size: 12px; }
.prod-info { display: flex; flex-direction: column; gap: 6px; padding: 14px; flex: 1; }
.prod-name { font-weight: 700; }
.prod-cat { font-size: 12.5px; color: var(--muted); }
.prod-price { font-size: 18px; font-weight: 800; color: var(--acc); }
.prod-buy { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.prod-buy input { width: 70px; }
.cart-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.cart-item { display: flex; align-items: center; gap: 10px; }
.cart-item span:first-child { flex: 1; min-width: 0; }
.cart-item input { width: 70px; }
.cart-total { display: flex; justify-content: space-between; font-size: 17px; padding-top: 12px; border-top: 1px solid var(--line); }

.simple { max-width: 420px; margin: 18vh auto; padding: 0 20px; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }

/* ---------- Login (centrado, fondo blanco, formas azules decorativas) ---------- */
.login-body { min-height: 100vh; background: #fff; color: #172033; color-scheme: light; }
.login {
  position: relative; min-height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px 64px;
  background: #fff;
}
.login::before, .login::after { content: ""; position: absolute; z-index: 0; pointer-events: none; }
.login::before {
  left: -110px; top: 21%; width: 300px; height: 300px; border-radius: 84px; transform: rotate(38deg);
  background: linear-gradient(135deg, #00c0f0, #1768e0);
}
.login::after {
  right: -130px; top: -90px; width: 300px; height: 300px; border-radius: 84px; transform: rotate(38deg);
  background: linear-gradient(135deg, #1f8ef1, #1458d6);
}
.login-box { position: relative; z-index: 1; width: 100%; max-width: 330px; }
.login-box h1 { text-align: center; font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.login-marca { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 28px; font-weight: 500; margin-bottom: 20px; letter-spacing: -.01em; }
.login-marca img { border-radius: 20px; }
.login-box label { color: #8a94a6; font-weight: 500; margin: 16px 0 6px; }
.login-box input { background: #fff; border-color: #d8dee9; color: #172033; }
.campo-clave { position: relative; }
.campo-clave input { padding-right: 42px; }
.ver-clave { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0; color: #5b6578; cursor: pointer; border-radius: 8px; }
.ver-clave:hover { color: #1768e0; }
.login-box .btn-lleno { width: auto; min-width: 118px; margin-top: 24px; border-radius: 999px; padding: 9px 30px; background: #0a6cf5; }
.login-box .btn-lleno:hover { background: #0856c7; }
.msg { min-height: 20px; margin-top: 14px; font-size: 13px; font-weight: 600; color: #c2392b; }
.login-pie { position: relative; z-index: 1; margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 12.5px; color: #6b7690; }
.login-pie select { width: auto; padding: 5px 8px; font-size: 13px; background: #fff; color: #172033; border-color: #d8dee9; }
.login-dev { position: absolute; z-index: 1; left: 0; right: 0; bottom: 18px; text-align: center; font-size: 12.5px; color: #6b7690; }
.login-dev strong { color: #1768e0; }

/* ---------- Pantalla de bienvenida ---------- */
.bienvenida-body {
  min-height: 100vh; display: grid;
  background:
    radial-gradient(900px 500px at 12% -10%, color-mix(in srgb, var(--acc) 22%, transparent), transparent 60%),
    radial-gradient(800px 480px at 100% 110%, color-mix(in srgb, var(--ok) 16%, transparent), transparent 60%),
    var(--bg);
}
.bv { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 28px 18px; }
.bv-marca { display: flex; align-items: center; gap: 10px; font-size: 22px; animation: aparecer .5s ease both; }
.bv-marca img { border-radius: 9px; }
.bv-tarjeta {
  width: min(460px, 100%); padding: 44px 36px 38px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--sombra-alta);
  animation: subir .55s cubic-bezier(.2, .8, .2, 1) both;
}
.bv-avatar {
  display: grid; place-items: center; width: 112px; height: 112px; margin-bottom: 8px; overflow: hidden;
  border-radius: 32px; color: #fff;
  background: linear-gradient(145deg, var(--acc), var(--acc-strong));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--acc) 38%, transparent);
  animation: emerger .7s .15s cubic-bezier(.2, .9, .3, 1.3) both;
}
.bv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bv-titulo { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.bv-nombre { font-size: 22px; font-weight: 700; color: var(--acc); overflow-wrap: anywhere; }
.bv-desc { max-width: 330px; margin: 10px 0 18px; color: var(--muted); }
.bv-tarjeta form { width: 100%; }
.bv-boton svg { transition: transform .2s; }
.bv-boton:hover svg { transform: translateX(5px); }
.bv-boton:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--acc) 40%, transparent); transform: translateY(-1px); }
.bv-pie { color: var(--muted); font-size: 13px; animation: aparecer .8s .3s ease both; }

/* ---------- Animaciones ---------- */
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes emerger { from { opacity: 0; transform: scale(.6) rotate(-8deg); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Adaptable ---------- */
@media (max-width: 1100px) {
  .grid3 { grid-template-columns: 1fr; }
  .buscador { flex-basis: 260px; }
}

@media (max-width: 860px) {
  .layout, html[data-lado="mini"] .layout { display: block; }
  .solo-desktop { display: none; }
  .solo-movil { display: inline-grid; }

  .side, html[data-lado="mini"] .side {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 310px); height: 100dvh; padding: 18px 14px;
    transform: translateX(-105%); transition: transform .24s ease; box-shadow: var(--sombra-alta);
  }
  html[data-lado="mini"] .marca-texto, html[data-lado="mini"] .nav-texto, html[data-lado="mini"] .negocio-nombre,
  html[data-lado="mini"] .usuario-datos, html[data-lado="mini"] .nav-titulo { display: revert; }
  html[data-lado="mini"] .side-head { flex-direction: row; }
  html[data-lado="mini"] .nav-item, html[data-lado="mini"] .btn-salir, html[data-lado="mini"] .negocio { justify-content: flex-start; padding-left: 12px; }
  .menu-open .side { transform: translateX(0); }
  .cubre { position: fixed; inset: 0; z-index: 25; background: rgba(8, 14, 30, .5); }
  .menu-open .cubre { display: block; }

  .top { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  .top-titulo { font-size: 18px; }
  .buscador { order: 5; flex: 1 1 100%; margin-left: 0; }
  .contenido { padding: 18px 14px 6px; }
  .pie { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .login::before { width: 220px; height: 220px; left: -120px; border-radius: 60px; }
  .login::after { width: 220px; height: 220px; right: -120px; top: -100px; border-radius: 60px; }
  input, select, textarea, .btn { min-height: 44px; font-size: 16px; }
  .btn.sm { min-height: 36px; font-size: 14px; }
  .modal { padding: 12px; }
  .modal .box { padding: 18px; }
}

@media (max-width: 480px) {
  .cards, .catalogo { grid-template-columns: 1fr; }
  .panel, .card { padding: 15px; }
  .bv-tarjeta { padding: 34px 22px 28px; }
  .bv-titulo { font-size: 26px; }
  .row > div { flex-basis: 100%; }
  .avisos { right: 12px; bottom: 12px; }
}

@media print {
  .side, .top, .cubre, .avisos, .pie, .btn, .icon-btn { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #000; }
  .panel, .card { box-shadow: none; border-color: #ccc; }
}

/* ======================= v3: módulos comerciales ======================= */
.muted { color: var(--muted); }
.chico { font-size: 12px; }
.chico-valor { font-size: 17px !important; }
.tabla-scroll { overflow-x: auto; }
.tabla-scroll table { min-width: 560px; }
td.acciones { white-space: normal !important; min-width: 190px; }
td.acciones .btn { margin: 2px 4px 2px 0; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.barra-acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.barra-acciones .muted { margin-left: auto; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.orden { color: inherit; text-decoration: none; }
.orden:hover { color: var(--acc); }
.paginacion { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.mas { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; }
.mas summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; margin-top: 10px; }
.modal .box { max-height: 92vh; overflow-y: auto; }

/* Punto de venta */
.pos { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.pos-estado { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pos-buscar { display: flex; gap: 10px; }
.pos-buscar input { font-size: 16px; min-height: 46px; flex: 1; }
.pos-video { margin-top: 10px; border-radius: 12px; overflow: hidden; background: #000; max-height: 260px; }
.pos-video video { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.pos-resultados { display: grid; gap: 4px; margin: 8px 0; }
.pos-res { display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--txt); cursor: pointer; font: inherit; }
.pos-res:hover, .pos-res:focus-visible { background: var(--hover); border-color: var(--acc); outline: none; }
.pos-tabla { min-width: 0; margin-top: 10px; }
.pos-n { width: 74px; padding: 6px 8px; min-height: 34px; }
.pos-totales { display: grid; gap: 6px; margin: 14px 0; padding: 12px 14px; background: var(--panel2); border-radius: 12px; }
.pos-totales > div { display: flex; justify-content: space-between; }
.pos-totales .grande { font-size: 22px; font-weight: 800; }
.pos-pagos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--acc-soft); color: var(--acc); font-weight: 600; font-size: 13px; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.pos-cola { margin-top: 16px; padding: 12px; border: 1px dashed var(--warn); border-radius: 12px; background: var(--warn-soft); }
.cola-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0; }
@media (max-width: 960px) { .pos { grid-template-columns: 1fr; } }

/* Impresión: ticket, lista de precios, etiquetas */
body.imprimir { background: #fff; color: #111; }
.barra-imprimir { display: flex; gap: 10px; padding: 14px; justify-content: center; background: var(--panel2); border-bottom: 1px solid var(--line); }
.ticket { width: 300px; margin: 18px auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #111; }
.ticket table { min-width: 0; }
.ticket td { padding: 2px 0; border: 0; }
.ticket hr { border: 0; border-top: 1px dashed #666; margin: 8px 0; }
.t-centro { text-align: center; } .t-der { text-align: right; white-space: nowrap; } .t-total td { font-weight: 800; font-size: 15px; }
.hoja { max-width: 820px; margin: 20px auto; padding: 0 20px; }
.hoja h1 { font-size: 22px; margin-bottom: 4px; }
.hoja table { margin-top: 16px; font-size: 13px; }
.hoja th { color: #333; }
.etiquetas { display: grid; grid-template-columns: repeat(auto-fill, 215px); gap: 8px; padding: 18px; justify-content: center; }
.etiqueta { width: 215px; border: 1px dashed #999; padding: 8px 10px; text-align: center; color: #111; break-inside: avoid; }
.etiqueta .barras { width: 100%; height: 44px; display: block; margin: 4px 0 2px; }
.e-nombre { font-size: 12px; font-weight: 700; line-height: 1.2; min-height: 29px; overflow: hidden; }
.e-codigo { font-size: 11px; letter-spacing: .08em; }
.e-precio { font-size: 20px; font-weight: 800; }
@media print {
  .no-imprimir { display: none !important; }
  body.imprimir { padding: 0; }
  .ticket { margin: 0; width: 100%; }
}
.celda-prod { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.celda-prod .thumb { flex: 0 0 40px; width: 40px; height: 40px; }

/* Dashboard v3 */
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
a.card.kpi { color: inherit; text-decoration: none; display: block; }
.card .sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.chart-svg { position: relative; }
.grafico-linea { display: block; overflow: visible; }
.eje-linea { stroke: var(--line); stroke-width: 1; }
.eje-txt { fill: var(--muted); font-size: 11px; }
.grafico-linea .linea { stroke: var(--acc); stroke-width: 2.4; stroke-linejoin: round; }
.grafico-linea .area { fill: var(--acc); opacity: .12; }
.grafico-linea .punto { fill: var(--panel); stroke: var(--acc); stroke-width: 2.4; }
.grafico-linea .punto-chico { fill: var(--acc); }
.tooltip-g { position: absolute; background: var(--txt); color: var(--panel); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; pointer-events: none; white-space: nowrap; }
.chart-top { display: grid; gap: 12px; }
.barra-h { display: grid; grid-template-columns: minmax(70px, 1.1fr) 2fr auto; gap: 10px; align-items: center; font-size: 13px; }
.barra-h-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-h-pista { background: var(--panel2); border-radius: 999px; height: 10px; overflow: hidden; }
.barra-h-fill { display: block; height: 100%; background: var(--acc); border-radius: 999px; }
.barra-h-v { color: var(--muted); font-size: 12px; }
table.compacta { min-width: 0; }
table.compacta td { padding: 8px 10px; }
@media (max-width: 860px) { .grid3 { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; } }
.fila-barras{display:flex;gap:6px}.fila-barras input{flex:1;min-width:0}#posNoEnc{padding:6px 2px}
