:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #1c2333;
  --muted: #6b7489;
  --border: #e2e6ee;
  --primary: #2f6fed;
  --primary-dark: #1f56c4;
  --primary-soft: #e8f0fe;
  --success: #12a150;
  --success-soft: #e3f6ea;
  --warning: #c27c00;
  --warning-soft: #fff4dc;
  --danger: #d93a3a;
  --danger-soft: #fdeaea;
  --side: #161c2d;
  --side-text: #aab3c7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 4px 14px rgba(20, 30, 60, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.hidden { display: none !important; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--side); color: var(--side-text); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 15px; line-height: 1.25; border-bottom: 1px solid #262e45; }
.brand small { display: block; font-weight: 400; color: var(--side-text); font-size: 12px; margin-top: 2px; }
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--side-text); font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: #222a40; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .ico { width: 20px; text-align: center; }
.nav .sep { height: 1px; background: #262e45; margin: 8px 6px; }
.side-foot { padding: 12px 16px; border-top: 1px solid #262e45; font-size: 12px; }
.side-foot b { color: #fff; }
.side-foot button { margin-top: 8px; width: 100%; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
/* Buscador general (barra de arriba) */
.gbusca { position: relative; flex: 1; max-width: 520px; }
.gbusca input { width: 100%; padding: 8px 64px 8px 34px; border-radius: 10px; background: var(--bg); }
.gbusca input:focus { background: var(--panel); }
.gb-lupa { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }
.gb-tecla { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--panel); pointer-events: none; }
.gbusca input:focus ~ .gb-tecla { display: none; }
.gb-drop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(20,30,60,.16); z-index: 60; max-height: 72vh; overflow: auto; width: max(100%, 640px); }
.gb-g { padding: 6px 0 4px; border-bottom: 1px solid var(--border); }
.gb-gt { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 4px 14px; }
.gb-it { display: flex; align-items: center; gap: 10px; padding: 7px 14px; cursor: pointer; }
.gb-it.sel, .gb-it:hover { background: var(--primary-soft, #eef3fe); }
.gb-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; flex-shrink: 0; }
.gb-tx { flex: 1; min-width: 0; }
.gb-tx > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-it mark { background: #fff1a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.gb-vacio { padding: 16px 14px; color: var(--muted); }
.gb-pie { display: flex; gap: 14px; padding: 8px 14px; font-size: 11.5px; color: var(--muted); background: var(--bg); }
.gb-pie b { border: 1px solid var(--border); background: var(--panel); border-radius: 4px; padding: 0 5px; margin-right: 2px; color: var(--text); }
.dolar {
  display: flex; align-items: center; gap: 8px; background: var(--success-soft); color: #0b6b35;
  padding: 6px 12px; border-radius: 20px; font-weight: 600; cursor: pointer; border: 0; font-size: 13px;
}
.dolar:hover { filter: brightness(.97); }
.content { padding: 22px 24px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .btn:hover { background: #f0f2f7; }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #0e8a44; }
.btn-danger { color: var(--danger); border-color: #f2c4c4; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 12px 20px; font-size: 16px; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 2px 4px; }
.btn-link:hover { background: none; text-decoration: underline; }
.sidebar button { background: #222a40; color: var(--side-text); border-color: #2c3550; }
.sidebar button:hover { color: #fff; }

/* Forms */
label { display: block; font-size: 12.5px; font-weight: 600; color: #3a4357; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #cfd5e1; border-radius: 7px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { resize: vertical; min-height: 60px; }
input[type=checkbox], input[type=radio] { width: auto; flex-shrink: 0; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.form-grid > div { grid-column: span 6; }
.form-grid .c3 { grid-column: span 3; } .form-grid .c4 { grid-column: span 4; }
.form-grid .c8 { grid-column: span 8; } .form-grid .c12 { grid-column: span 12; }
.form-grid .c2 { grid-column: span 2; } .form-grid .c1 { grid-column: span 1; }
.form-section { grid-column: span 12 !important; font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-top: 6px; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline > input { flex: 1; }
.inline > select { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.filters > * { width: auto; }
.filters input[type=search], .filters .grow { min-width: 260px; flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--border); background: #fafbfd; }
td { padding: 9px 10px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f6f8fc; }
tr.anulada td { color: #9aa2b3; text-decoration: line-through; }
td.actions { white-space: nowrap; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 28px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: #eef1f6; color: #4a5368; }
.b-green { background: var(--success-soft); color: #0b6b35; }
.b-blue { background: var(--primary-soft); color: var(--primary-dark); }
.b-orange { background: var(--warning-soft); color: var(--warning); }
.b-red { background: var(--danger-soft); color: var(--danger); }
.b-purple { background: #f1e8fd; color: #6b35c4; }
.b-gray { background: #eef1f6; color: #4a5368; }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.pos-search { position: relative; }
.pos-search input { font-size: 16px; padding: 12px 14px; }
.results { margin-top: 10px; max-height: 420px; overflow-y: auto; }
.result { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.result:hover { border-color: var(--primary); background: var(--primary-soft); }
.result .t { font-weight: 600; }
.cart-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.cart-item .row1 { display: flex; justify-content: space-between; gap: 8px; }
.cart-item .row2 { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.cart-item .row2 input { width: 110px; }
.cart-item .row2 input.qty { width: 64px; }
.cart-item .row2 select { width: 80px; }
.totals { border-top: 2px solid var(--border); margin-top: 10px; padding-top: 10px; }
.totals .line { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .big { font-size: 20px; font-weight: 800; }
.pay-row { display: grid; grid-template-columns: 1.3fr .8fr 1fr .7fr .7fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.saldo { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-weight: 700; display: flex; justify-content: space-between; }
.saldo.falta { background: var(--danger-soft); color: var(--danger); }
.saldo.ok { background: var(--success-soft); color: #0b6b35; }
.saldo.vuelto { background: var(--warning-soft); color: var(--warning); }
.caja-dolar { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.caja-dolar select { width: 100%; }
.caja-dolar input[name=cotizacion] { max-width: 140px; }
.saldo .muted { font-weight: 400; }
.picker { position: relative; }
.picker .drop { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 20; max-height: 260px; overflow-y: auto; }
.picker .drop div { padding: 8px 10px; cursor: pointer; }
.picker .drop div:hover { background: var(--primary-soft); }
.chosen { display: flex; justify-content: space-between; align-items: center; background: var(--primary-soft); padding: 8px 12px; border-radius: 8px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 14px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Detail lists */
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-weight: 600; }
dl.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); position: absolute; left: -5px; top: 13px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfd; border-radius: 0 0 12px 12px; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; padding: 2px 8px; color: var(--muted); }

/* Toasts */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1c2333; color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; animation: in .2s ease; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--success); }
@keyframes in { from { transform: translateY(10px); opacity: 0; } }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, #161c2d, #2f4a8a); }
.login { background: #fff; padding: 28px; border-radius: 14px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login h1 { margin-bottom: 4px; }
.login form > div { margin-top: 14px; }
.login button { width: 100%; justify-content: center; margin-top: 18px; }

/* Ticket */
.ticket { background: #fff; max-width: 720px; margin: 0 auto; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); }
.ticket-head { display: flex; justify-content: space-between; border-bottom: 2px solid #222; padding-bottom: 12px; margin-bottom: 16px; }
.ticket-head h1 { font-size: 20px; }
.ticket table th { background: none; color: #222; border-bottom: 1px solid #222; }
.ticket .firma { margin-top: 60px; display: flex; justify-content: space-around; }
.ticket .firma div { border-top: 1px solid #222; padding-top: 4px; width: 200px; text-align: center; font-size: 12px; }
.ticket .legal { font-size: 11.5px; color: #444; margin-top: 18px; border-top: 1px dashed #999; padding-top: 10px; white-space: pre-wrap; }
.ticket-actions { max-width: 720px; margin: 0 auto 14px; display: flex; gap: 8px; }

/* Bar chart */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar:hover { background: var(--primary-dark); }
.bars-labels { display: flex; gap: 3px; font-size: 10px; color: var(--muted); }
.bars-labels span { flex: 1; text-align: center; overflow: hidden; }

@media (max-width: 1100px) {
  .pos { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav .sep { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid > div, .form-grid .c3, .form-grid .c4, .form-grid .c8, .form-grid .c2, .form-grid .c1 { grid-column: span 12; }
  .content { padding: 16px; }
  .pay-row { grid-template-columns: 1fr 1fr; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, #toasts, .page-head, .tabs, #aviso-dolar { display: none !important; }
  .content { padding: 0; }
  .ticket { border: 0; padding: 0; max-width: none; }
}

/* Selector de moneda */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 6px 12px; font-size: 12.5px; background: #fff; color: var(--muted); }
.seg button.active { background: var(--primary); color: #fff; }
.saldo-debe { color: var(--danger); font-weight: 700; }
.saldo-favor { color: var(--success); font-weight: 700; }
.drop-zone { border: 2px dashed #c4cde0; border-radius: 12px; padding: 32px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfd; }
.drop-zone:hover, .drop-zone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; }
.map-grid .ok select { border-color: var(--success); }
.err-row td { background: var(--danger-soft); }

/* Checklist de usados */
.chk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin-top: 6px; }
.chk-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.chk-opts { display: inline-flex; gap: 4px; flex-shrink: 0; }
.chk-opts label { margin: 0; cursor: pointer; }
.chk-opts input { display: none; }
.chk-opts span { display: inline-block; min-width: 34px; text-align: center; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--muted); background: #fff; }
.chk-opts .chk-ok input:checked + span { background: var(--success); border-color: var(--success); color: #fff; }
.chk-opts .chk-falla input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.chk-opts .chk-na input:checked + span { background: #6b7489; border-color: #6b7489; color: #fff; }
.chk-resumen { display: flex; flex-wrap: wrap; gap: 4px; }
.chk-tag { font-size: 11.5px; padding: 2px 7px; border-radius: 10px; background: #eef1f6; }
.chk-tag.chk-ok { background: var(--success-soft); color: #0b6b35; }
.chk-tag.chk-falla { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.fotos { display: flex; flex-wrap: wrap; gap: 8px; }
.foto { position: relative; }
.foto img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.foto button { position: absolute; top: 4px; right: 4px; padding: 1px 6px; }
@media (max-width: 760px) { .chk-grid { grid-template-columns: 1fr; } }

/* Cierre de caja: conteo de billetes */
.billetes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-top: 8px; background: #fafbfd; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.billete { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.billete span { min-width: 70px; font-size: 12.5px; }
.billete input { padding: 4px 6px; }

/* Antigüedad del stock */
.tramo { display: grid; grid-template-columns: 130px 1fr 220px; align-items: center; gap: 10px; padding: 5px 0; }
.tramo-barra { height: 14px; background: #eef1f6; border-radius: 7px; overflow: hidden; }
.tramo-barra span { display: block; height: 100%; border-radius: 7px; min-width: 2px; }
.tramo-dato { text-align: right; font-size: 13px; }
@media (max-width: 760px) { .tramo { grid-template-columns: 1fr; } .tramo-dato { text-align: left; } }

/* Comparativas y gráficos */
.grafico-box { width: 100%; overflow: hidden; }
.grafico { width: 100%; height: auto; display: block; }
.grafico .g-grid { stroke: var(--border); stroke-width: 1; }
.grafico .g-cero { stroke: #c5ccd8; }
.grafico .g-eje { fill: var(--muted); font-size: 11px; }
.grafico .g-hover { fill: transparent; }
.grafico .g-hover:hover { fill: rgba(47, 111, 237, .07); }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
.leyenda i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.leyenda i.linea { height: 3px; width: 16px; border-radius: 2px; vertical-align: 3px; }
.var { font-size: 12px; font-weight: 600; white-space: nowrap; }
.var.sube { color: var(--success); }
.var.baja { color: var(--danger); }
table.comp tr.sub td { font-size: 12.5px; color: var(--muted); padding-top: 3px; padding-bottom: 3px; }
table.comp tr.sub td:first-child { padding-left: 20px; }
.grid > .card + .card { margin-top: 0; }
.tramo.compacto { grid-template-columns: 110px minmax(40px, 1fr) auto; }
.tramo.compacto .tramo-dato { white-space: nowrap; }
.precio-ars { font-size: 12.5px; color: var(--primary-dark); font-weight: 600; }

/* Listado de equipos tipo planilla: selección, orden, letra compacta, edición en celda */
.eq-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tabla-eq th.ordenable { cursor: pointer; user-select: none; white-space: nowrap; }
.tabla-eq th.ordenable:hover { color: var(--primary); }
.tabla-eq .chk-col { width: 34px; text-align: center; padding-left: 6px; padding-right: 4px; }
.tabla-eq .chk-col input { width: 16px; height: 16px; cursor: pointer; }
.tabla-eq tr.marcada td { background: var(--primary-soft); }
.tabla-eq tr.marcada:hover td { background: #dce7fd; }
.tabla-eq.compacta { font-size: 12.5px; }
.tabla-eq.compacta td { padding: 4px 8px; }
.tabla-eq.compacta th { padding: 6px 8px; font-size: 10.5px; }
.tabla-eq.compacta .small, .tabla-eq.compacta .precio-ars { font-size: 11px; }
.tabla-eq.compacta .badge { font-size: 10.5px; padding: 1px 7px; }
.tabla-eq.compacta .mono { font-size: 11.5px; }
.tabla-eq.compacta .btn-sm { padding: 2px 7px; }
.tabla-eq td.celda-precio { cursor: cell; }
.tabla-eq td.celda-precio:hover { outline: 1px dashed #b9c6e4; outline-offset: -3px; }
.inline-edit { width: 100px; padding: 3px 6px; text-align: right; border: 2px solid var(--primary); border-radius: 4px; font-weight: 700; }
.sel-bar { position: sticky; bottom: 10px; z-index: 20; margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 2px solid var(--primary); border-radius: 10px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(20, 30, 60, .18); }
.tabla-eq .chk-col { user-select: none; cursor: pointer; }

/* Estado de cuenta por período */
.tabla-cc tr.fila-saldo td { background: #f3f6fb; border-top: 1px solid var(--border); }
@media print {
  .tabla-cc { font-size: 11px; }
  .tabla-cc td, .tabla-cc th { padding: 3px 6px; }
  .tabla-cc tr.fila-saldo td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.aviso-busqueda { margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--primary-soft); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
mark { background: #ffe58a; padding: 0 1px; border-radius: 2px; }
@media print { .aviso-busqueda button { display: none; } }
/* Orden por columna en las tablas */
th.th-orden { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-orden:hover { color: var(--primary); }
th .ind-orden { color: var(--primary); }
.tabla-resultado td { padding: 6px 8px; }
.tabla-resultado tr.res-total td { border-top: 2px solid var(--border); background: #fafbfd; font-size: 15px; }

/* Ocultar montos (modo privacidad) */
.stat .label { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.btn-visibilidad { border: 0; background: none; padding: 2px; margin: -2px -2px -2px 0; color: var(--muted); cursor: pointer; line-height: 0; border-radius: 6px; }
.btn-visibilidad:hover { color: var(--primary); background: var(--primary-soft); }
.btn-privacidad { border: 1px solid var(--border); background: #fff; border-radius: 20px; padding: 6px 9px; line-height: 0; color: var(--muted); cursor: pointer; }
.btn-privacidad:hover, .btn-privacidad.active { color: var(--primary); border-color: var(--primary); }
.btn-privacidad.active { background: var(--primary-soft); }
/* Lo oculto se reemplaza por asteriscos */
.stat.oculto .value, .stat.oculto .sub,
body.privado:not([data-ruta="vender"]) #view :is(td.right, .totals .line > :last-child, dl.kv dd, .precio-ars, .tramo-dato, .saldo .v, .result b, .sel-bar .small, .res-total td.right) {
  position: relative; color: transparent !important; user-select: none;
}
:is(.stat.oculto .value, .stat.oculto .sub) *,
body.privado:not([data-ruta="vender"]) #view :is(td.right, .totals .line > :last-child, dl.kv dd, .precio-ars, .tramo-dato, .saldo .v, .result b, .sel-bar .small) * {
  color: transparent !important; background: transparent !important; border-color: transparent !important; box-shadow: none !important;
}
.stat.oculto .value::after { content: '******'; position: absolute; left: 0; top: 0; color: var(--text); letter-spacing: 2px; }
.stat.oculto .sub::after { content: '****'; position: absolute; left: 0; top: 0; color: var(--muted); }
body.privado:not([data-ruta="vender"]) #view :is(td.right, .totals .line > :last-child, .tramo-dato, .result b, .precio-ars)::after {
  content: '****'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); letter-spacing: 1px;
}
body.privado:not([data-ruta="vender"]) #view :is(dl.kv dd, .saldo .v, .sel-bar .small)::after { content: '****'; position: absolute; left: 0; top: 0; color: var(--muted); letter-spacing: 1px; }
body.privado:not([data-ruta="vender"]) #view .grafico .g-eje { fill: transparent; }
body.privado:not([data-ruta="vender"]) #view .grafico rect.g-hover title { display: none; }
@media print { .btn-visibilidad, .btn-privacidad { display: none; } }
/* Menú en celular: colapsado detrás del botón ☰ */
.btn-menu { display: none; }
@media (max-width: 760px) {
  .sidebar { position: sticky; top: 0; z-index: 40; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .btn-menu { display: inline-block; float: right; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 20px; line-height: 1; padding: 6px 10px; border-radius: 8px; }
  .sidebar .brand { margin: 0; padding: 4px 0; }
  .sidebar .brand small { display: none; }
  .sidebar .nav, .sidebar .side-foot { display: none; }
  .sidebar.abierta .nav { display: flex; flex-direction: column; margin-top: 10px; max-height: 70vh; overflow-y: auto; }
  .sidebar.abierta .side-foot { display: block; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
}
@media (max-width: 760px) {
  .sidebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .sidebar .brand { order: 1; flex: 1; min-width: 0; font-size: 15px; }
  .sidebar .btn-menu { order: 2; float: none; width: auto; flex: 0 0 auto; margin: 0; }
  .sidebar .nav { order: 3; flex-basis: 100%; }
  .sidebar .side-foot { order: 4; flex-basis: 100%; }
  .topbar > div:first-child { flex-basis: 100%; font-size: 12.5px; }
  .gbusca { flex-basis: 100%; max-width: none; order: 1; }
  .gb-tecla, .gb-pie { display: none; }
  .gb-drop { width: 100%; }
  .topbar .inline { flex-wrap: wrap; gap: 6px; }
  .topbar .inline > .small { display: none; }
}

/* Escáner de códigos con la cámara */
.con-escaner { display: flex; align-items: stretch; gap: 4px; min-width: 0; }
.con-escaner.grow { flex: 1; }
.con-escaner > input { flex: 1; min-width: 0; }
.btn-escaner { flex: 0 0 auto; padding: 0 10px; font-size: 16px; line-height: 1; }
.escaner { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 60vh; }
.escaner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.escaner-marco { position: absolute; inset: 36% 7%; border: 2px solid rgba(255,255,255,.85); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.escaner-marco span { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff3b3b; box-shadow: 0 0 8px #ff3b3b; animation: barrido 1.6s ease-in-out infinite alternate; }
@keyframes barrido { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
@media print { .btn-escaner { display: none; } }

/* ===== Por mayor: planillas de ingreso por lote y venta mayorista (estilo Excel) ===== */
.hoja-cab { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px 10px 0 0; border-bottom: 0; }
.hoja-cab > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hoja-cab label { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.hoja-cab input, .hoja-cab select { height: 32px; padding: 4px 8px; }
.hoja-barra { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 10px; background: #f3f5f9; border: 1px solid #dfe3eb; border-bottom: 0; font-size: 12.5px; }
.hoja-barra .sep { width: 1px; height: 20px; background: #d5dae4; margin: 0 4px; }
.hoja-barra .ayuda { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.hoja-barra button { padding: 3px 9px; font-size: 12.5px; border-radius: 4px; background: #fff; }
.hoja-barra input, .hoja-barra select { height: 26px; padding: 2px 6px; font-size: 12.5px; border-radius: 4px; }
.hoja-wrap { overflow: auto; max-height: 64vh; border: 1px solid #dfe3eb; background: #fff; }
.hoja-wrap.redondo { border-radius: 0 0 10px 10px; }
table.hoja { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; background: #fff; }
table.hoja th { position: sticky; top: 0; z-index: 2; background: #eef1f6; color: #4a5368; font-weight: 700; font-size: 11px; text-transform: none; letter-spacing: 0;
  padding: 5px 7px; border-right: 1px solid #dfe3eb; border-bottom: 1px solid #cfd5e0; white-space: nowrap; text-align: left; }
table.hoja th.right, table.hoja td.right { text-align: right; }
table.hoja th.ordenable { cursor: pointer; user-select: none; }
table.hoja th.ordenable:hover { background: #e3e8f1; }
table.hoja td { border-right: 1px solid #e6e9f0; border-bottom: 1px solid #e6e9f0; padding: 0; height: 27px; vertical-align: middle; white-space: nowrap; }
table.hoja td.txt { padding: 0 7px; }
table.hoja td.fila-n, table.hoja th.fila-n { width: 38px; min-width: 38px; text-align: center; background: #f3f5f9; color: #8a93a6; font-size: 11px; padding: 0 4px; border-right: 1px solid #cfd5e0; }
table.hoja td.fila-n input[type=checkbox] { width: 14px; height: 14px; vertical-align: middle; cursor: pointer; }
table.hoja tr:hover td:not(.fila-n) { background: #fafbfe; }
table.hoja tr.marcada td:not(.fila-n), table.hoja tr.pedido td:not(.fila-n) { background: #eef4ff; }
table.hoja tr.pedido td.cant input { font-weight: 800; color: var(--primary-dark); }
table.hoja input, table.hoja select { display: block; width: 100%; height: 27px; border: 0; border-radius: 0; padding: 0 7px; margin: 0; background: transparent; font-size: 12.5px; box-shadow: none; color: var(--text); }
table.hoja select { padding-right: 2px; cursor: pointer; }
table.hoja input:focus, table.hoja select:focus { outline: 2px solid #1f7a45; outline-offset: -2px; background: #fff; box-shadow: none; position: relative; z-index: 1; }
table.hoja input.num { text-align: right; font-variant-numeric: tabular-nums; }
table.hoja input.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
table.hoja input::placeholder { color: #c0c6d2; }
table.hoja td.auto input { color: #6b7489; font-style: italic; }
table.hoja td.mal { background: #fde8e8 !important; box-shadow: inset 0 0 0 1px #f0a5a5; }
table.hoja td.mal input { color: var(--danger); }
table.hoja td.aviso { background: #fff6e0 !important; }
table.hoja tr.vacia td:not(.fila-n) input::placeholder { color: #d5dae3; }
table.hoja td.estado { width: 26px; min-width: 26px; text-align: center; font-size: 13px; }
table.hoja tfoot td { position: sticky; bottom: 0; background: #eef1f6; font-weight: 700; padding: 0 7px; border-top: 1px solid #cfd5e0; z-index: 1; }
table.hoja td .sub { color: var(--muted); font-size: 11px; margin-left: 4px; }
table.hoja tr.unidad td { background: #fbfcfe; font-size: 12px; }
table.hoja tr.unidad td.txt:first-of-type { padding-left: 22px; }
table.hoja .exp { cursor: pointer; color: #8a93a6; width: 100%; height: 27px; border: 0; background: transparent; padding: 0; font-size: 11px; }
table.hoja .exp:hover { color: var(--primary); }
table.hoja .mini { color: var(--muted); font-size: 11px; }

.hoja-pestanas { display: flex; gap: 0; align-items: stretch; background: #e9ecf2; border: 1px solid #dfe3eb; border-top: 0; padding: 0 8px; border-radius: 0 0 10px 10px; }
.hoja-pestanas button { border: 0; border-radius: 0 0 6px 6px; background: transparent; padding: 6px 16px; font-size: 12.5px; color: #4a5368; margin-top: -1px; }
.hoja-pestanas button.activa { background: #fff; color: #1f7a45; font-weight: 700; box-shadow: 0 1px 0 #fff inset, 0 2px 0 #1f7a45 inset; border-left: 1px solid #dfe3eb; border-right: 1px solid #dfe3eb; }
.hoja-pestanas .tot { margin-left: auto; align-self: center; font-size: 12px; color: #4a5368; padding: 4px 6px; }

.hoja-pie { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; margin-top: 16px; align-items: start; }
.resumen-hoja { width: 100%; }
.total-hoja { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-top: 2px solid var(--text); margin-top: 6px; }
.total-hoja b { font-size: 22px; }
.pagos-hoja td { padding: 2px 3px !important; }
.pagos-hoja select, .pagos-hoja input { height: 30px; padding: 2px 6px; }
.rapidos { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.rapidos button { padding: 3px 9px; font-size: 12px; }
.exito-lote { text-align: center; padding: 36px 20px; }
.exito-lote .ico { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; font-size: 36px; background: var(--success-soft); color: var(--success); }
.exito-lote .acciones { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.escaneando { animation: parpadeo-ok .5s; }
@keyframes parpadeo-ok { from { background: #d5f5e1; } to { background: transparent; } }
@media (max-width: 900px) { .hoja-pie { grid-template-columns: 1fr; } .hoja-barra .ayuda { display: none; } .hoja-wrap { max-height: none; } }
.pagos-hoja td:first-child select { min-width: 150px; }
.pagos-hoja td:nth-child(2) select { min-width: 64px; }
table.hoja input[type=checkbox] { display: inline-block; width: 14px; height: 14px; padding: 0; margin: 0; vertical-align: middle; cursor: pointer; }
table.hoja td.fila-n label { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-size: 11px; color: #8a93a6; font-weight: 400; cursor: pointer; }
table.hoja th.fila-n, table.hoja td.fila-n { width: 52px; min-width: 52px; }
@media (max-width: 900px) { table.hoja th.col-cant, table.hoja td.cant { position: sticky; right: 0; z-index: 2; background: #fff; box-shadow: -3px 0 6px rgba(20,30,60,.08); min-width: 74px; } table.hoja th.col-cant { z-index: 3; background: #eef1f6; } table.hoja tr.pedido td.cant { background: #eef4ff; } }
.progreso { height: 8px; border-radius: 6px; background: #eef1f6; overflow: hidden; margin: 8px 0 6px; }
.progreso > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #4c86ff); border-radius: 6px; transition: width .25s; }
.progreso.lleno > span { background: linear-gradient(90deg, var(--success), #2fc06c); }
/* Opciones elegibles como tarjetas (forma de pago de la compra) */
.op-pagos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.op-pago { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 400; margin: 0; background: #fff; transition: border-color .15s, background .15s; }
.op-pago:hover { border-color: #c9d3e6; }
.op-pago input { position: absolute; opacity: 0; pointer-events: none; }
.op-pago .ico { font-size: 20px; margin-bottom: 2px; }
.op-pago b { font-size: 13.5px; }
.op-pago small { color: var(--muted); font-size: 12px; }
.op-pago:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.op-pago:has(input:checked) b { color: var(--primary-dark); }
.op-pago:has(input:focus-visible) { outline: 2px solid var(--primary); }
