/* =====================================================================
   POS Venezuela — sistema visual corporativo
   4 temas oscuros vía [data-theme] en <html>:
     titanium (por defecto) · navy · bronze · forest
   Componentes: paneles de vidrio, bordes 1px, etiquetas en versalitas,
   cifras tabulares. Las clases son las mismas que usa el JS.
   ===================================================================== */

/* ---------- 1. Tokens por tema ---------- */
:root,
[data-theme="titanium"] {
  --bg: #0b0d11;
  --bg-2: #12151c;
  --glass: rgba(20, 24, 33, .75);
  --glass-2: rgba(30, 36, 48, .6);          /* campos, filas resaltadas */
  --borde-acento: rgba(51, 65, 85, .4);      /* slate-700/40 */
  --brand: #38bdf8;                          /* acento principal */
  --brand-2: #94a3b8;                        /* acento secundario */
  --brand-ink: #06121b;                      /* texto sobre botón primario */
  --usd: #7dd3fc;
  --bs: #c4b5fd;
  --halo: rgba(56, 189, 248, .14);
}
[data-theme="navy"] {
  --bg: #080c14;
  --bg-2: #0f172a;
  --glass: rgba(15, 23, 42, .7);
  --glass-2: rgba(30, 41, 59, .55);
  --borde-acento: rgba(14, 165, 233, .2);    /* sky-500/20 */
  --brand: #2563eb;
  --brand-2: #f8fafc;
  --brand-ink: #ffffff;
  --usd: #93c5fd;
  --bs: #fcd34d;
  --halo: rgba(37, 99, 235, .18);
}
[data-theme="bronze"] {
  --bg: #111111;
  --bg-2: #18181b;
  --glass: rgba(28, 28, 30, .8);
  --glass-2: rgba(39, 39, 42, .6);
  --borde-acento: rgba(180, 83, 9, .3);      /* amber-700/30 */
  --brand: #d4af37;
  --brand-2: #ca8a04;
  --brand-ink: #1a1405;
  --usd: #e6c65c;
  --bs: #d6d3d1;
  --halo: rgba(212, 175, 55, .13);
}
[data-theme="forest"] {
  --bg: #080f0e;
  --bg-2: #0f1a18;
  --glass: rgba(13, 26, 23, .75);
  --glass-2: rgba(20, 40, 35, .55);
  --borde-acento: rgba(4, 120, 87, .25);     /* emerald-700/25 */
  --brand: #059669;
  --brand-2: #10b981;
  --brand-ink: #ffffff;
  --usd: #6ee7b7;
  --bs: #fde68a;
  --halo: rgba(16, 185, 129, .13);
}

/* Tokens comunes a los 4 temas */
:root {
  color-scheme: dark;
  --ink: #e5e7eb;
  --ink-2: #f8fafc;
  --muted: #94a3b8;                          /* slate-400 */
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --panel: var(--glass);                     /* alias usado por el JS antiguo */
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --ok-bg: rgba(52, 211, 153, .12);
  --warn-bg: rgba(251, 191, 36, .12);
  --bad-bg: rgba(248, 113, 113, .12);
  --info-bg: rgba(148, 163, 184, .12);
  --radius: 12px;                            /* rounded-xl */
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--halo), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, var(--halo), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 420px);
  background-color: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--ink-2); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.3rem; } h2 { font-size: 1.05rem; } h3 { font-size: .92rem; }
hr { border: 0; border-top: 1px dashed var(--line-2); margin: .6rem 0; }
.num, .usd, .bs, td.n, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.usd { color: var(--usd); font-weight: 600; }
.bs { color: var(--bs); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: .75rem; }
.grid { display: grid; gap: .75rem; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
::selection { background: var(--brand); color: var(--brand-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- 3. Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.2rem;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar .marca { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: .98rem; color: var(--ink-2); letter-spacing: -.01em; display: inline-flex; align-items: center; gap: .55rem; }
.topbar .marca::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--brand); box-shadow: 0 0 0 3px var(--halo); }
.topbar .tasa {
  margin-left: auto; white-space: nowrap;
  font: 500 .78rem/1 var(--mono); color: var(--ink);
  padding: .42rem .7rem; border-radius: 999px;
  border: 1px solid var(--borde-acento); background: var(--glass);
}
.topbar nav { display: flex; gap: 1rem; align-items: center; font-size: .85rem; }
.topbar a, .topbar button.link { color: var(--muted); text-decoration: none; }
.topbar a:hover, .topbar button.link:hover { color: var(--ink-2); }

main { max-width: 1320px; margin: 0 auto; padding: 1.2rem; }

/* ---------- 4. Paneles de vidrio ---------- */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.card .card { background: var(--glass-2); backdrop-filter: none; }

/* Fichas (bloques numerados del POS y formularios) */
.ficha { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.ficha + .ficha { margin-top: .9rem; }
.ficha-head { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.ficha-head h2 { margin: 0; font-size: .9rem; }
.ficha-head .sub { color: var(--muted); font-size: .76rem; }
.ficha-head .acciones { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.ficha-num {
  flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  font: 600 .74rem/1 var(--mono); color: var(--brand); border: 1px solid var(--borde-acento); background: var(--halo);
}
.ficha-body { padding: 1rem; }
.ficha-body.flush { padding: 0; }

/* Rejillas de campos 1 / 3 / 4 columnas con gap-3 */
.campos { display: grid; gap: .75rem; grid-template-columns: 1fr; }
.campos.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.campos.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.campos.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.campos .s2 { grid-column: span 2; }
.campos .s3 { grid-column: span 3; }
.campos .full { grid-column: 1 / -1; }
.dato { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--glass-2); min-height: 38px; display: flex; align-items: center; gap: .4rem; font-variant-numeric: tabular-nums; }
.dato.mono { font-family: var(--mono); font-size: .86rem; }

/* ---------- 5. Formularios ---------- */
label, .etq {
  display: block; margin-bottom: .3rem;
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
label.btn { display: inline-flex; margin: 0; text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 500; color: var(--ink); }
label.row, label.check { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 500; color: var(--ink); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink-2);
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .5rem .7rem; min-height: 38px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: #64748b; }
select { appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--bg-2); color: var(--ink); }
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--halo); }
input:disabled, select:disabled { opacity: .55; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; accent-color: var(--brand); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); }
.campo { margin-bottom: .75rem; }
.campos .campo { margin-bottom: 0; }
/* Campo obligatorio resaltado (referencia de Pago Móvil / Transferencia) */
.req input, input.req { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: var(--warn-bg); }
.req label::after { content: " *"; color: var(--warn); }
.req .ayuda { color: var(--warn); }
.invalido input, input.invalido, select.invalido { border-color: var(--bad) !important; box-shadow: 0 0 0 3px var(--bad-bg) !important; }
.ayuda { display: block; margin-top: .25rem; font-size: .72rem; color: var(--muted); }

/* ---------- 6. Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 36px; padding: .45rem .85rem;
  font: inherit; font-size: .85rem; font-weight: 500; color: var(--ink);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); color: var(--ink-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .tabs button:focus-visible, .tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 86%, #fff); border-color: transparent; color: var(--brand-ink); }
.btn.accent { background: transparent; border-color: var(--brand); color: var(--brand); font-weight: 600; }
.btn.accent:hover:not(:disabled) { background: var(--halo); color: var(--brand); }
.btn.danger { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 22%, transparent); color: #fecaca; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); border-color: transparent; color: var(--ink-2); }
.btn.sm { min-height: 30px; padding: .25rem .6rem; font-size: .78rem; }
.btn.lg { min-height: 46px; font-size: .95rem; }
.btn.block { width: 100%; }
.btn.ico { width: 30px; padding: 0; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--brand); }

/* ---------- 7. Badges, chips de estado, alertas ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px;
  font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  background: var(--info-bg); color: var(--ink); border: 1px solid var(--line);
}
.badge.PAGADO, .badge.CUADRA, .badge.OK, .badge.CUADRADO, .badge.ENTREGADO { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge.PENDIENTE, .badge.SOBRANTE, .badge.EXCEDERIA, .badge.EXCEDENTE, .badge.BAJO { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.ANULADO, .badge.FALTANTE, .badge.MOROSO, .badge.EXCEDIDO { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.badge.EN_DESPACHO { background: var(--halo); color: var(--brand); border-color: var(--borde-acento); }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.alerta { border-radius: var(--radius-sm); padding: .55rem .8rem; margin: .5rem 0; font-size: .84rem; border: 1px solid var(--line); background: var(--info-bg); }
.alerta.warn { background: var(--warn-bg); color: #fde68a; border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alerta.bad { background: var(--bad-bg); color: #fecaca; border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alerta.ok { background: var(--ok-bg); color: #a7f3d0; border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---------- 8. Tablas densas ---------- */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); }
.ficha-body.flush > .tabla-wrap, .ficha .tabla-wrap.plana { border: 0; border-radius: 0; background: transparent; }
table { border-collapse: collapse; width: 100%; font-size: .83rem; }
th, td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th {
  position: sticky; top: 0; z-index: 1;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); border-bottom: 0; background: rgba(255, 255, 255, .02); }
td .ref { font-family: var(--mono); font-size: .78rem; color: var(--ink-2); }
tr.editando { background: var(--halo) !important; box-shadow: inset 3px 0 0 var(--brand); }
table.densa th, table.densa td { padding: .38rem .6rem; }

/* ---------- 9. Tienda ---------- */
.catalogo { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.producto { display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: border-color .15s ease, transform .15s ease; }
.producto:hover { border-color: var(--borde-acento); transform: translateY(-2px); }
.producto img, .producto .sin-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: grid; place-items: center; font-size: 2rem;
  background: linear-gradient(135deg, var(--glass-2), rgba(0, 0, 0, .3)); border-bottom: 1px solid var(--line); }
.producto .sin-img { font: 700 2.4rem/1 var(--font); letter-spacing: -.02em; color: var(--muted); }
.producto .sin-img small { display: block; margin-top: .5rem; font-size: .66rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.producto .info { padding: .75rem; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.producto .nombre { font-weight: 500; font-size: .9rem; color: var(--ink-2); }
.producto .muted.small { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.producto .precios { margin-top: auto; padding-top: .3rem; }
.producto .usd { font-size: 1.08rem; font-weight: 700; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.chip { border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: .32rem .8rem; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: .8rem; color: var(--muted); transition: all .15s ease; }
.chip:hover { color: var(--ink-2); border-color: rgba(255, 255, 255, .25); }
.chip.on { background: var(--halo); color: var(--brand); border-color: var(--brand); }

/* Carrito lateral */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); z-index: 40;
  background: color-mix(in srgb, var(--bg-2) 94%, transparent); backdrop-filter: blur(20px); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .22s 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: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); z-index: 30; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; background: rgba(0, 0, 0, .2); }
.qty button { border: 0; background: transparent; width: 28px; height: 28px; font-size: 1rem; cursor: pointer; color: var(--muted); }
.qty button:hover { color: var(--ink-2); background: rgba(255, 255, 255, .06); }
.qty input { width: 50px; border: 0; text-align: center; min-height: 28px; padding: 0; background: transparent; box-shadow: none !important; }
.btn.fab { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 25; border-radius: 999px; padding: .7rem 1.1rem; min-height: 46px;
  background: var(--brand); color: var(--brand-ink); border-color: transparent; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.btn.fab:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 86%, #fff); color: var(--brand-ink); }

/* ---------- 10. POS en 3 fichas ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: .9rem; align-items: start; margin-top: .9rem; }
.pos .ticket, .pos .liquidacion { position: sticky; top: 64px; }
.pos .ficha + .ficha { margin-top: 0; }
.barra-acciones { display: flex; gap: .4rem; flex-wrap: wrap; }
.lista-prod { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.tile {
  text-align: left; padding: .55rem .65rem; cursor: pointer; font: inherit; color: var(--ink);
  border: 1px solid var(--line); background: rgba(255, 255, 255, .025); border-radius: var(--radius-sm);
  display: grid; gap: .1rem; transition: border-color .12s ease, background .12s ease;
}
.tile:hover:not(:disabled) { border-color: var(--borde-acento); background: var(--halo); }
.tile:disabled { opacity: .4; cursor: not-allowed; }
.tile .sku { font: 500 .66rem/1.2 var(--mono); color: var(--muted); letter-spacing: .03em; }
.tile .nom { font-size: .82rem; color: var(--ink-2); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .pie { display: flex; justify-content: space-between; align-items: baseline; margin-top: .15rem; font-size: .8rem; }
.tile .stk { font-size: .68rem; color: var(--muted); }
.items-vacio { padding: 1.6rem 1rem; text-align: center; color: var(--muted); font-size: .85rem; }
.items-vacio b { display: block; color: var(--ink); font-weight: 500; margin-bottom: .2rem; }

/* Totales de la liquidación */
.totales { display: grid; grid-template-columns: 1fr auto; gap: .35rem .8rem; font-size: .85rem; align-items: center; }
.totales .lbl { color: var(--muted); }
.totales .val { text-align: right; font-variant-numeric: tabular-nums; }
.total-box { border: 1px solid var(--borde-acento); background: var(--halo); border-radius: var(--radius); padding: .8rem 1rem; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.total-grande { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.total-box .bs { font-size: .95rem; font-variant-numeric: tabular-nums; }

/* Cliente seleccionado */
.cliente-sel { display: flex; gap: .7rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--borde-acento); border-radius: var(--radius-sm); background: var(--halo); }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 600; font-size: .8rem; color: var(--brand); border: 1px solid var(--borde-acento); background: rgba(0, 0, 0, .2); }
.resultados { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.resultados:empty { display: none; }
.resultados button { display: flex; width: 100%; gap: .5rem; align-items: center; justify-content: space-between; text-align: left; padding: .5rem .7rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: .83rem; cursor: pointer; }
.resultados button:hover { background: var(--halo); }
.resultados .vacio { padding: .5rem .7rem; color: var(--muted); font-size: .83rem; }
.rel { position: relative; }

/* ---------- 11. Gestor de pagos ---------- */
.gestor-pagos { display: grid; gap: .75rem; }
.borrador { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: .75rem; background: rgba(0, 0, 0, .15); }
.borrador.editando { border-style: solid; border-color: var(--brand); background: var(--halo); }
.borrador .titulo { display: flex; justify-content: space-between; align-items: center; margin-bottom: .55rem; }
.borrador .equiv { font-family: var(--mono); font-size: .82rem; }
.campos.pago { grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.3fr); }
.campos.pago [data-c="referencia"] { grid-column: span 2; }
.campos.pago [data-c="banco"].hidden + [data-c="referencia"] { grid-column: 1 / -1; }
.rapidos { display: flex; gap: .35rem; flex-wrap: wrap; }
.cola-pagos td .met { display: flex; flex-direction: column; line-height: 1.25; }
.cola-pagos td .met small { color: var(--muted); font-size: .72rem; }
.cola-pagos .vacio td { text-align: center; color: var(--muted); padding: .9rem; white-space: normal; }
.balance { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.balance > div { padding: .6rem .7rem; border-right: 1px solid var(--line); min-width: 0; }
.balance > div:last-child { border-right: 0; }
.balance .usd, .balance .bs { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance .usd { font-size: 1rem; }
.balance .bs { font-size: .76rem; }
.balance .estado-pago { background: rgba(255, 255, 255, .02); }
.estado-pago.pendiente { box-shadow: inset 0 2px 0 var(--warn); }
.estado-pago.cuadrado { box-shadow: inset 0 2px 0 var(--ok); }
.estado-pago.excedente { box-shadow: inset 0 2px 0 var(--brand); }
.estado-pago.pendiente .usd { color: var(--warn); }
.estado-pago.cuadrado .usd { color: var(--ok); }
.estado-pago.excedente .usd { color: var(--brand); }
.badge.EXCEDENTE { background: var(--halo); color: var(--brand); border-color: var(--borde-acento); }
/* Compatibilidad con el componente anterior */
.resumen-pago { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; font-size: .9rem; }
.resumen-pago .fuerte { font-weight: 700; }
.linea-pago { display: grid; grid-template-columns: 1.3fr .7fr 1fr auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }

/* ---------- 12. Admin ---------- */
.tabs { display: flex; gap: .2rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { border: 0; background: none; padding: .65rem .85rem; font: inherit; font-size: .85rem; font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s ease, border-color .15s ease; }
.tabs button:hover { color: var(--ink-2); }
.tabs button.on { color: var(--ink-2); border-color: var(--brand); }
.kpi { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kpi.usd { color: var(--usd); }
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; align-items: end; margin-bottom: 1rem;
  padding: .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); }
.thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--glass-2); vertical-align: middle; border: 1px solid var(--line); }

/* Conciliación */
.conc-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr)); }
.conc-bloque { border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass); overflow: hidden; }
.conc-bloque > header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .65rem .85rem; border-bottom: 1px solid var(--line); }
.conc-bloque > header h3 { margin: 0; font-size: .82rem; }
.conc-bloque .tot { text-align: right; line-height: 1.2; }
.conc-bloque .tot .bs, .conc-bloque .tot .usd { display: block; font-variant-numeric: tabular-nums; font-weight: 600; }
.conc-bloque table { font-size: .78rem; }
.conc-bloque .scroll { max-height: 230px; overflow: auto; }
.conc-bloque .vacio { padding: .8rem .85rem; color: var(--muted); font-size: .8rem; }
.conc-efectivo { display: grid; grid-template-columns: 1fr 1fr; }
.conc-efectivo > div { padding: .75rem .85rem; }
.conc-efectivo > div + div { border-left: 1px solid var(--line); }

/* ---------- 13. Diálogo, toast, menú de temas ---------- */
dialog { border: 1px solid var(--line-2); border-radius: 14px; padding: 0; width: min(680px, calc(100% - 2rem));
  background: color-mix(in srgb, var(--bg-2) 96%, transparent); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog.ancho { width: min(1000px, calc(100% - 2rem)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
dialog .dlg-head { padding: .9rem 1rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
dialog .dlg-head h2 { margin: 0; font-size: .98rem; }
dialog .dlg-body { padding: 1rem; max-height: 75vh; overflow: auto; }
dialog .dlg-foot { padding: .75rem 1rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }
#toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem; width: min(460px, calc(100% - 2rem)); }
.toast { padding: .65rem .9rem; border-radius: var(--radius-sm); font-size: .86rem; color: var(--ink-2);
  background: color-mix(in srgb, var(--bg-2) 95%, transparent); border: 1px solid var(--line-2); border-left: 3px solid var(--brand);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: entra .2s ease; }
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

.tema { position: relative; }
.tema-btn { display: inline-flex; align-items: center; gap: .45rem; background: transparent; border: 1px solid var(--line-2); color: var(--muted);
  border-radius: 999px; padding: .3rem .65rem; font: inherit; font-size: .78rem; cursor: pointer; }
.tema-btn:hover { color: var(--ink-2); border-color: rgba(255, 255, 255, .25); }
.tema-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.tema-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 230px; padding: .35rem;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0, 0, 0, .55); }
.tema-menu .etq { padding: .35rem .55rem .2rem; margin: 0; }
.tema-op { display: flex; width: 100%; gap: .65rem; align-items: center; padding: .5rem .55rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font: inherit; font-size: .84rem; cursor: pointer; text-align: left; }
.tema-op:hover { background: rgba(255, 255, 255, .06); }
.tema-op[aria-checked="true"] { background: rgba(255, 255, 255, .06); }
.tema-op[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--brand); }
.tema-op small { display: block; color: var(--muted); font-size: .72rem; }
.tema-sw { flex: none; width: 28px; height: 28px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .12); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 14. Responsivo ---------- */
@media (max-width: 1100px) {
  .pos { grid-template-columns: 1fr; }
  .pos .ticket, .pos .liquidacion { position: static; }
}
@media (max-width: 760px) {
  .campos.c3, .campos.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campos .s3 { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  main { padding: .75rem; }
  .topbar { gap: .5rem; padding: .55rem .75rem; }
  .topbar .tasa { font-size: .68rem; padding: .32rem .5rem; }
  .topbar .marca::before { display: none; }
  .topbar nav { gap: .6rem; font-size: .8rem; }
  .topbar nav .txt, .tema-btn .txt { display: none; }
  .campos.c2, .campos.c3, .campos.c4 { grid-template-columns: 1fr; }
  .campos .s2, .campos .s3 { grid-column: auto; }
  .linea-pago { grid-template-columns: 1fr 1fr; }
  .catalogo { grid-template-columns: repeat(2, 1fr); }
  .balance { grid-template-columns: 1fr; }
  .balance > div { border-right: 0; border-bottom: 1px solid var(--line); }
  #toasts { bottom: 4.6rem; }
}

/* =====================================================================
   Modo demo
   ===================================================================== */
.demo-banner { display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: center; align-items: center;
  padding: .4rem 1rem; background: var(--bg); color: var(--muted); font-size: .8rem; position: relative; z-index: 21; border-bottom: 1px solid var(--line); }
.demo-banner b { color: var(--brand); font-weight: 600; }
.demo-banner .demo-acciones { display: flex; gap: 1rem; }
.demo-banner a, .demo-banner .link { color: var(--ink-2); font-weight: 500; }
.demo-roles { display: grid; gap: .5rem; }
.demo-rol { display: flex; gap: .8rem; align-items: center; text-align: left; width: 100%; padding: .75rem .9rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .025); color: var(--ink); font: inherit;
  transition: border-color .15s ease, background .15s ease; }
.demo-rol:hover { border-color: var(--borde-acento); background: var(--halo); }
.demo-rol small { display: block; color: var(--muted); font-size: .8rem; }
.demo-ico { font-size: 1.3rem; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; flex: none;
  border: 1px solid var(--borde-acento); background: var(--halo); }

/* Simulador de WhatsApp (mantiene los colores de WhatsApp dentro del teléfono) */
.wa-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(300px, 440px); gap: 1.5rem; justify-content: center; align-items: start; }
.wa-telefono { border-radius: 28px; overflow: hidden; border: 8px solid #05070a; background: #0b141a; box-shadow: 0 30px 70px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-2);
  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: #202c33; color: #e9edef; }
.wa-cab small { display: block; opacity: .7; font-size: .74rem; }
.wa-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 1.1rem; }
.wa-chat { flex: 1; overflow-y: auto; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .4rem;
  background-color: #0b141a; background-image: radial-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px); background-size: 16px 16px; }
.wa-msg { max-width: 85%; min-width: 4.5rem; padding: .45rem .6rem .3rem; border-radius: 8px; font-size: .88rem; line-height: 1.35; position: relative;
  color: #e9edef; word-wrap: break-word; }
.wa-msg.in { background: #202c33; align-self: flex-start; border-top-left-radius: 2px; }
.wa-msg.out { background: #005c4b; align-self: flex-end; border-top-right-radius: 2px; }
.wa-msg a { color: #53bdeb; }
.wa-hora { display: block; text-align: right; margin-top: .15rem; font-size: .66rem; color: #8696a0; white-space: nowrap; }
.wa-vacio { margin: auto; background: #182229; color: #8696a0; padding: .5rem .8rem; border-radius: 8px; font-size: .84rem; }
.wa-input { display: flex; gap: .5rem; padding: .6rem; background: #202c33; }
.wa-input input { background: #2a3942; border: 0; border-radius: 999px; color: #e9edef; }
.wa-enviar { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: #00a884; color: #fff; font-size: 1.05rem; cursor: pointer; }
.wa-info .chips { flex-wrap: wrap; overflow: visible; }
@media (max-width: 760px) { .wa-layout { grid-template-columns: 1fr; } .wa-telefono { height: 70vh; } }

/* =====================================================================
   Impresión: A4 / PDF (fondo blanco, sin navegación)
   ===================================================================== */
@media print {
  :root { --ink: #111; --ink-2: #000; --muted: #555; --line: #ccc; --line-2: #999; --usd: #000; --bs: #333; --glass: #fff; --glass-2: #fff; }
  body { background: #fff !important; color: #000; font-size: 11px; }
  .topbar, .tabs, .filtros, .btn, #toasts, .demo-banner, .tema, .fab, .no-print, dialog .dlg-head button, dialog .dlg-foot { display: none !important; }
  .card, .ficha, .tabla-wrap, .conc-bloque, .filtros { background: #fff !important; border-color: #ccc !important; backdrop-filter: none !important; box-shadow: none !important; }
  th { background: #f2f2f2 !important; color: #333; position: static; }
  dialog { position: static; box-shadow: none; border: 0; width: 100%; max-width: none; background: #fff; color: #000; }
  dialog .dlg-body { max-height: none; overflow: visible; }
  .conc-bloque .scroll { max-height: none; overflow: visible; }
  main { max-width: none; padding: 0; }
  .badge { border: 1px solid #999 !important; background: #fff !important; color: #000 !important; }
  .badge::before { display: none; }
  tr, .conc-bloque { break-inside: avoid; }
}

/* ---------- Bandeja de pedidos web ---------- */
.bandeja { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr); }
.bandeja > section { min-width: 0; }
.badge { white-space: nowrap; }
.bandeja-tit { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.bandeja-tit h3 { margin: 0; }
.bandeja-vacio { padding: .9rem 1rem; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); font-size: .85rem; text-align: center; }
.pagos-rep { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.pago-rep { display: grid; gap: .55rem; padding: .8rem .9rem; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius); background: var(--warn-bg); }
.pr-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.pr-monto { display: flex; flex-direction: column; }
.pr-monto > span:first-child { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pr-ref { display: flex; flex-direction: column; gap: .15rem; padding: .45rem .6rem; border-radius: var(--radius-sm); background: rgba(0, 0, 0, .25); font-size: .85rem; }
.pr-acc { display: flex; justify-content: flex-end; gap: .4rem; }
.lista-ped { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--glass); }
.lp-fila { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .8fr) 150px; gap: .75rem; align-items: center; padding: .6rem .9rem; border-bottom: 1px solid var(--line); font-size: .85rem; }
.lp-fila:last-child { border-bottom: 0; }
.lp-fila:not(.lp-cab):hover { background: rgba(255, 255, 255, .025); }
.lp-fila > span { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.lp-fila > span.n { align-items: flex-end; text-align: right; }
.lp-fila small { font-size: .74rem; }
.lp-fila .badge { align-self: flex-start; }
.lp-cab { padding: .45rem .9rem; background: color-mix(in srgb, var(--bg-2) 92%, transparent); font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lp-acc { flex-direction: row !important; gap: .35rem !important; justify-content: flex-end; }
@media (max-width: 760px) {
  .lp-cab { display: none; }
  .lp-fila { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: .5rem; }
  .lp-acc { grid-column: 1 / -1; }
  .lp-fila > span.n:nth-child(5) { align-items: flex-start; text-align: left; }
  .bandeja-tit input[type=search] { max-width: none !important; margin-left: 0 !important; flex-basis: 100%; }
}
