/* =====================================================================
   POS Venezuela — estilos compartidos (tienda, POS, admin)
   ===================================================================== */
:root {
  /* Paleta "Caribe": azul intenso + amarillo sol + naranja */
  --bg: #f3f7ff;
  --panel: #ffffff;
  --ink: #0f1b3d;
  --muted: #5d6b8a;
  --line: #dfe7f7;
  --brand: #1d4ed8;        /* azul intenso */
  --brand-2: #f97316;      /* naranja */
  --brand-ink: #ffffff;
  --grad: linear-gradient(120deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
  --accent: #facc15;       /* amarillo */
  --accent-2: #f97316;
  --grad-accent: linear-gradient(120deg, #facc15 0%, #fb923c 60%, #f97316 100%);
  --usd: #1d4ed8;          /* azul: dólares */
  --bs: #ea580c;           /* naranja: bolívares */
  --ok: #059669;
  --warn: #d97706;
  --bad: #e11d48;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(30 58 138 / .06), 0 8px 24px rgb(30 58 138 / .08);
  --glow: 0 6px 20px rgb(37 99 235 / .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1024; --panel: #121a36; --ink: #eef3ff; --muted: #9aa8c9; --line: #24315a;
    --brand: #60a5fa; --brand-ink: #ffffff; --usd: #93c5fd; --bs: #fb923c;
    --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 8px 24px rgb(0 0 0 / .3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.num, .usd, .bs, td.n { font-variant-numeric: tabular-nums; }
.usd { color: var(--usd); font-weight: 600; }
.bs { color: var(--bs); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: .75rem; }
.grid { display: grid; gap: 1rem; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1rem; background: var(--brand); color: var(--brand-ink);
}
.topbar .marca { font-weight: 800; letter-spacing: -.01em; font-size: 1.05rem; color: inherit; text-decoration: none; }
.topbar .tasa { margin-left: auto; font-size: .85rem; background: rgb(255 255 255 / .14); padding: .3rem .6rem; border-radius: 999px; white-space: nowrap; }
.topbar a, .topbar button.link { color: inherit; }
.topbar nav { display: flex; gap: .75rem; align-items: center; }

main { max-width: 1240px; margin: 0 auto; padding: 1rem; }

/* ---------- componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: .55rem .9rem; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .06s ease, background .15s ease; min-height: 40px;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.accent { background: var(--accent); color: #2a1d00; border-color: transparent; }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
.btn.block { width: 100%; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .2rem; font-weight: 600; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; min-height: 40px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.campo { margin-bottom: .7rem; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--line); }
.badge.PENDIENTE { background: #fff1cc; color: #7a5200; }
.badge.PAGADO { background: #d8f3e2; color: #155c2c; }
.badge.EN_DESPACHO { background: #dbe9ff; color: #1b3f8a; }
.badge.ENTREGADO { background: #e6e1d5; color: #3b382f; }
.badge.ANULADO, .badge.FALTANTE, .badge.MOROSO, .badge.EXCEDIDO, .badge.BAJO { background: #fbdcd9; color: #8c1d16; }
.badge.SOBRANTE, .badge.EXCEDERIA { background: #ffe9c7; color: #7a4600; }
.badge.CUADRA, .badge.OK { background: #d8f3e2; color: #155c2c; }

.alerta { border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; font-size: .9rem; }
.alerta.warn { background: #fff4d6; color: #6b4600; border: 1px solid #f1d38a; }
.alerta.bad { background: #fde3e0; color: #7c1a14; border: 1px solid #f2b1aa; }
.alerta.ok { background: #e1f5e8; color: #155c2c; border: 1px solid #a7dcb8; }

/* ---------- tablas ---------- */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .5rem .65rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; }
tbody tr:hover { background: rgb(0 0 0 / .02); }

/* ---------- tienda ---------- */
.catalogo { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.producto { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.producto img, .producto .sin-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--line); display: grid; place-items: center; font-size: 2.2rem; }
.producto .info { padding: .7rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.producto .nombre { font-weight: 600; font-size: .92rem; }
.producto .precios { margin-top: auto; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: .35rem .8rem; cursor: pointer; white-space: nowrap; font: inherit; font-size: .85rem; color: var(--ink); }
.chip.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }

/* carrito lateral */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); background: var(--panel); z-index: 40; box-shadow: -8px 0 30px rgb(0 0 0 / .15);
  transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header, .drawer footer { padding: 1rem; border-bottom: 1px solid var(--line); }
.drawer footer { border-top: 1px solid var(--line); border-bottom: 0; }
.drawer .cuerpo { flex: 1; overflow: auto; padding: 1rem; }
.velo { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 30; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { border: 0; background: transparent; width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.qty input { width: 52px; border: 0; text-align: center; min-height: 32px; padding: 0; background: transparent; }
.fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 25; box-shadow: 0 6px 20px rgb(0 0 0 / .2); }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 1rem; align-items: start; }
.pos .ticket { position: sticky; top: 70px; }
.pos .lista-prod { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.pos .tile { text-align: left; padding: .6rem; cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; font: inherit; color: var(--ink); }
.pos .tile:hover { border-color: var(--brand); }
.pos .tile .sku { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.total-grande { font-size: 1.8rem; font-weight: 800; }
.linea-pago { display: grid; grid-template-columns: 1.3fr .7fr 1fr auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.linea-pago .extra { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.resumen-pago { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; font-size: .95rem; }
.resumen-pago .fuerte { font-weight: 800; font-size: 1.05rem; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { border: 0; background: none; padding: .7rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
.kpi { font-size: 1.5rem; font-weight: 800; }
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; align-items: end; margin-bottom: 1rem; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--line); vertical-align: middle; }

/* ---------- diálogo y toast ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100% - 2rem)); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog .dlg-head { padding: 1rem 1rem .5rem; display: flex; justify-content: space-between; align-items: center; }
dialog .dlg-body { padding: 0 1rem 1rem; max-height: 75vh; overflow: auto; }
dialog .dlg-foot { padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }
#toasts { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem; width: min(480px, calc(100% - 2rem)); }
.toast { padding: .7rem 1rem; border-radius: 10px; background: var(--ink); color: var(--panel); box-shadow: var(--shadow); animation: entra .2s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- responsivo ---------- */
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos .ticket { position: static; }
}
@media (max-width: 560px) {
  main { padding: .7rem; }
  .topbar { gap: .5rem; padding: .6rem .7rem; }
  .topbar nav .txt { display: none; }
  .linea-pago { grid-template-columns: 1fr 1fr; }
  .catalogo { grid-template-columns: repeat(2, 1fr); }
  .topbar nav { font-size: .85rem; gap: .5rem; }
  .topbar .marca { font-size: .95rem; }
  #toasts { bottom: 4.5rem; }
}
@media print {
  .topbar, .tabs, .filtros, .btn, #toasts { display: none !important; }
  body { background: #fff; }
}

/* =====================================================================
   Tema vibrante: degradados, brillo y detalles de color
   ===================================================================== */
.topbar { background: var(--grad); box-shadow: 0 4px 20px rgb(29 78 216 / .3); border-bottom: 4px solid; border-image: var(--grad-accent) 1; }
.topbar .tasa { background: rgb(255 255 255 / .2); border: 1px solid rgb(255 255 255 / .3); backdrop-filter: blur(6px); font-weight: 600; }
.btn { border-radius: 12px; }
.btn.primary { background: var(--grad); box-shadow: var(--glow); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 26px rgb(37 99 235 / .45); }
.btn.accent { background: var(--grad-accent); color: #3b1d00; box-shadow: 0 6px 20px rgb(249 115 22 / .4); }
.btn.danger { background: linear-gradient(120deg, #e11d48, #f43f5e); }
.card { border-color: var(--line); }
.producto { transition: transform .15s ease, box-shadow .15s ease; }
.producto:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgb(29 78 216 / .16); }
.producto .sin-img { background: linear-gradient(135deg, #dbeafe 0%, #fef9c3 55%, #ffedd5 100%); }
.producto .muted.small { color: var(--brand-2); font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; }
.producto .usd { font-size: 1.15rem; font-weight: 800; }
.chip { border-color: var(--line); font-weight: 600; }
.chip.on { background: var(--grad-accent); color: #3b1d00; border-color: transparent; box-shadow: var(--glow); }
.fab { border-radius: 999px; padding: .7rem 1.1rem; font-size: 1rem; }
.tabs button.on { color: var(--brand); border-image: var(--grad-accent) 1; }
.pos .tile { border-radius: 14px; transition: transform .1s ease, border-color .1s ease, box-shadow .1s ease; }
.pos .tile:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgb(29 78 216 / .15); transform: translateY(-2px); }
.pos .tile .sku { color: var(--brand-2); font-weight: 700; }
.total-grande { color: var(--brand); }
.kpi { letter-spacing: -.02em; }
th { color: var(--brand); }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.badge.PENDIENTE { background: #fef3c7; color: #92400e; }
.badge.PAGADO, .badge.CUADRA, .badge.OK { background: #d1fae5; color: #065f46; }
.badge.EN_DESPACHO { background: #dbeafe; color: #1e40af; }
.badge.ENTREGADO { background: #e0f2fe; color: #075985; }
.toast { background: #0f1b3d; border-radius: 12px; }
.toast.ok { background: linear-gradient(120deg, #059669, #10b981); }
.toast.bad { background: linear-gradient(120deg, #e11d48, #f43f5e); }
dialog { border-radius: 20px; }
@media (prefers-color-scheme: dark) {
  .producto .sin-img { background: linear-gradient(135deg, #172554, #422006 60%, #431407); }
  .tabs button.on, th { color: #93c5fd; }
}

/* ---------- Más protagonismo al amarillo y naranja ---------- */
.topbar { border-bottom-width: 6px; }
.topbar .tasa { background: var(--accent); color: #3b1d00; border-color: transparent; }
.btn.primary { background: var(--grad-accent); color: #3b1d00; box-shadow: 0 6px 20px rgb(249 115 22 / .4); font-weight: 800; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 26px rgb(249 115 22 / .55); }
.fab { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgb(29 78 216 / .45); border: 3px solid var(--accent); }
.producto { border-top: 4px solid var(--brand-2); }
.producto .sin-img { background: linear-gradient(135deg, #fef08a 0%, #fde047 45%, #fdba74 100%); }
.producto .bs, .pos .tile .bs { font-weight: 700; }
.chip:not(.on):hover { border-color: var(--brand-2); color: var(--brand-2); }
.pos .tile { border-left: 4px solid var(--accent); }
.pos .tile:hover { border-color: var(--brand-2); }
.card .kpi.usd { color: var(--brand); }
th { color: var(--brand-2); }
.tabs button.on { color: var(--brand-2); }
.badge { background: #fef3c7; }
@media (prefers-color-scheme: dark) {
  .producto .sin-img { background: linear-gradient(135deg, #713f12, #9a3412); }
  th, .tabs button.on { color: #fdba74; }
}

/* =====================================================================
   Modo demo
   ===================================================================== */
.demo-banner { display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: center; align-items: center;
  padding: .45rem 1rem; background: #0f1b3d; color: #fef3c7; font-size: .85rem; position: relative; z-index: 21; }
.demo-banner b { color: var(--accent); }
.demo-banner .demo-acciones { display: flex; gap: 1rem; }
.demo-banner a, .demo-banner .link { color: #fff; font-weight: 600; }
.demo-roles { display: grid; gap: .6rem; }
.demo-rol { display: flex; gap: .8rem; align-items: center; text-align: left; width: 100%; padding: .8rem 1rem; cursor: pointer;
  border: 2px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); font: inherit;
  transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease; }
.demo-rol:hover { border-color: var(--brand-2); box-shadow: 0 6px 18px rgb(249 115 22 / .2); transform: translateY(-1px); }
.demo-rol small { display: block; color: var(--muted); font-size: .82rem; }
.demo-ico { font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--grad-accent); flex: none; }

/* Simulador de WhatsApp */
.wa-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(300px, 420px); gap: 1.5rem; justify-content: center; align-items: start; }
.wa-telefono { border-radius: 28px; overflow: hidden; border: 8px solid #0f1b3d; background: #efeae2; box-shadow: 0 20px 50px rgb(15 27 61 / .3);
  display: flex; flex-direction: column; height: min(680px, calc(100vh - 140px)); min-height: 460px; }
.wa-cab { display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; background: #075e54; color: #fff; }
.wa-cab small { display: block; opacity: .8; font-size: .75rem; }
.wa-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--grad-accent); display: grid; place-items: center; font-size: 1.2rem; }
.wa-chat { flex: 1; overflow-y: auto; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .4rem;
  background-image: radial-gradient(rgb(0 0 0 / .04) 1px, transparent 1px); background-size: 16px 16px; }
.wa-msg { max-width: 85%; min-width: 4.5rem; padding: .45rem .6rem .3rem; border-radius: 10px; font-size: .9rem; line-height: 1.35; position: relative;
  box-shadow: 0 1px 1px rgb(0 0 0 / .1); color: #111b21; word-wrap: break-word; }
.wa-msg.in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.wa-msg.out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 2px; }
.wa-msg a { color: #027eb5; }
.wa-hora { display: block; text-align: right; margin-top: .15rem; font-size: .68rem; color: #667781; white-space: nowrap; }
.wa-vacio { margin: auto; background: #fff8c5; color: #54656f; padding: .5rem .8rem; border-radius: 8px; font-size: .85rem; }
.wa-input { display: flex; gap: .5rem; padding: .6rem; background: #f0f2f5; }
.wa-input input { background: #fff; border: 0; border-radius: 999px; }
.wa-enviar { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #00a884; color: #fff; font-size: 1.1rem; cursor: pointer; }
@media (max-width: 760px) { .wa-layout { grid-template-columns: 1fr; } .wa-telefono { height: 70vh; } }
@media print { .demo-banner { display: none !important; } }
.wa-info .chips { flex-wrap: wrap; overflow: visible; }
