/* ============================================================
   Super POS — Sistema de diseño
   ============================================================ */
:root {
  --brand: #1d4ed8;
  --brand-600: #1e40af;
  --brand-700: #1e3a8a;
  --brand-soft: #e8efff;
  --navy: #0b2a6f;
  --navy-2: #143c9c;
  --ink: #0b2a6f;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0284c7;

  --bg: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f6f8fd;
  --border: #dfe4ef;
  --text: #14151f;
  --muted: #6b7080;
  --muted-2: #9aa0b0;

  --shadow-sm: 0 1px 2px rgba(20, 21, 31, .06), 0 1px 3px rgba(20, 21, 31, .04);
  --shadow: 0 4px 12px rgba(20, 21, 31, .08), 0 2px 4px rgba(20, 21, 31, .04);
  --shadow-lg: 0 18px 40px rgba(20, 21, 31, .16);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --sidebar-w: 256px;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  --brand: #5b8cff;
  --brand-600: #4a7bf0;
  --brand-soft: #1c2a4d;
  --navy: #0a1630;
  --navy-2: #12224a;
  --ink: #e8eeff;
  --ok-soft: #10321f;
  --warn-soft: #3a2c0c;
  --danger-soft: #3a1414;

  --bg: #0e0f17;
  --surface: #171826;
  --surface-2: #1d1f30;
  --border: #2a2c40;
  --text: #edeef5;
  --muted: #9a9fb5;
  --muted-2: #6b7089;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 6px 18px rgba(0,0,0,.45);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::selection { background: var(--brand); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ============================================================
   Pantalla de bloqueo / activación (licencia)
   ============================================================ */
.license-lock {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #0b2a6f, #1d4ed8 60%, #06b6d4);
}
.lic-card {
  width: min(420px, 100%); background: #fff; border-radius: 20px;
  padding: 32px 28px; text-align: center; box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.lic-logo { font-size: 54px; }
.lic-card h1 { font-size: 24px; margin: 6px 0 4px; color: #14151f; }
.lic-sub { color: #6b7080; font-size: 14px; margin-bottom: 18px; }
.lic-id {
  display: flex; flex-direction: column; gap: 2px; padding: 12px; margin-bottom: 16px;
  background: #f4f5fb; border: 1px dashed #c7c9e0; border-radius: 12px;
}
.lic-id span { font-size: 12px; color: #6b7080; }
.lic-id strong { font-size: 20px; letter-spacing: 2px; color: #1d4ed8; font-family: Consolas, monospace; }
.lic-card .input {
  text-align: center; font-size: 20px; letter-spacing: 3px; font-family: Consolas, monospace;
  padding: 14px; margin-bottom: 8px; color: #14151f; background: #fafafe; border: 1px solid #e6e7ef; border-radius: 12px; width: 100%;
}
.lic-card .input:focus { outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,.18); }
.lic-err { color: #dc2626; font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.lic-wa {
  display: inline-block; margin-top: 14px; color: #25d366; font-weight: 700; text-decoration: none; font-size: 14px;
}
.lic-wa:hover { text-decoration: underline; }
.lic-foot { margin-top: 18px; font-size: 11px; color: #9aa0b0; }

/* ============================================================
   Splash
   ============================================================ */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: linear-gradient(160deg, #0b2a6f, #1d4ed8 60%, #06b6d4);
  color: #fff;
}
.splash-logo { font-size: 68px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.3)); animation: pop .6s ease; }
.splash-name { font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.splash-bar { width: 190px; height: 5px; background: rgba(255,255,255,.25); border-radius: 20px; overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 40%; background: #fff; border-radius: 20px; animation: load 1s ease-in-out infinite; }
@keyframes load { 0%{margin-left:-40%} 100%{margin-left:100%} }
@keyframes pop { from{transform:scale(.6);opacity:0} to{transform:scale(1);opacity:1} }

/* ============================================================
   Layout
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; transition: grid-template-columns .22s ease; }

/* Barra lateral escondida (colapsada) — solo aplica en escritorio */
@media (min-width: 861px) {
  .app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .app.sidebar-collapsed > .sidebar {
    padding-left: 0; padding-right: 0; border-right-color: transparent;
    opacity: 0; pointer-events: none;
  }
}

/* Modo inventario del contador: pantalla completa, sin el menú del negocio */
.app.modo-inventario { grid-template-columns: minmax(0, 1fr); }
.app.modo-inventario > .sidebar { display: none; }
.app.modo-inventario #btn-menu { display: none; }
.app.modo-inventario .caja-status { display: none; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  gap: 8px;
  min-width: 0; overflow: hidden;
  transition: opacity .18s ease, padding .22s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 14px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(140deg, var(--brand), #06b6d4);
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  border: none; background: transparent; text-align: left; width: 100%;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.sidebar-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.btn-theme { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.btn-theme:hover { background: var(--surface-2); color: var(--text); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, #f59e0b, #ef4444);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 12px; }

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar-title h1 { font-size: 19px; font-weight: 800; }
.topbar-title p { color: var(--muted); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.caja-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 20px; font-weight: 600; font-size: 13px;
  background: var(--danger-soft); color: var(--danger);
}
.caja-status.open { background: var(--ok-soft); color: var(--ok); }
.caja-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: 15px; }

.view { flex: 1; overflow-y: auto; padding: 24px; }

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
  transition: filter .15s, transform .05s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn-lg { padding: 14px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: var(--danger); }
.btn-ok { background: var(--ok); }
.btn-ghost { background: transparent; border: none; color: var(--muted); font-weight: 600; }
.btn-ghost:hover { color: var(--text); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }

/* Botón de esconder / mostrar el menú (más pequeño y con diseño propio) */
#btn-menu {
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--brand); background: var(--brand-soft); color: var(--brand);
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
#btn-menu:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
#btn-menu:active { transform: scale(.92); }
#btn-menu .ico { width: 17px; height: 17px; }
.app.sidebar-collapsed #btn-menu { background: var(--brand); color: #fff; border-color: var(--brand); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ============================================================
   Tarjetas
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; font-weight: 800; }
.card-head .card-actions { margin-left: auto; display: flex; gap: 8px; }

.grid { display: grid; gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .stat-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  margin-bottom: 14px; color: #fff;
}
.stat .stat-ico.violet { background: linear-gradient(140deg, #6366f1, #8b5cf6); }
.stat .stat-ico.green { background: linear-gradient(140deg, #10b981, #059669); }
.stat .stat-ico.amber { background: linear-gradient(140deg, #f59e0b, #f97316); }
.stat .stat-ico.blue { background: linear-gradient(140deg, #0ea5e9, #2563eb); }
.stat .stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .stat-value { font-size: 26px; font-weight: 800; margin-top: 2px; letter-spacing: -.5px; }
.stat .stat-sub { font-size: 12px; margin-top: 6px; color: var(--muted); }
.stat .stat-sub .up { color: var(--ok); font-weight: 700; }
.stat .stat-sub .down { color: var(--danger); font-weight: 700; }

/* ============================================================
   Formularios
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; color: var(--text); }
.field .hint { color: var(--muted); font-size: 12px; }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
  background: var(--surface);
}
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.input-group .input { padding-left: 48px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.search {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.search input { border: none; background: transparent; color: var(--text); width: 100%; min-width: 0; outline: none; }
.search .ico { color: var(--muted); width: 18px; height: 18px; flex: none; }

/* ============================================================
   Tablas
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 16px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .right { text-align: right; }
.cell-main { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .emoji { font-size: 40px; margin-bottom: 10px; }
.empty h4 { font-size: 16px; color: var(--text); margin-bottom: 4px; }

/* ============================================================
   Punto de venta
   ============================================================ */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 18px; height: 100%; }
.pos-left { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }
.pos-tools { display: flex; gap: 12px; align-items: center; min-width: 0; }
.pos-tools .search { flex: 1; min-width: 0; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cat-pill {
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap;
}
.cat-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.products-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; overflow-y: auto; padding: 2px; align-content: start; flex: 1;
}
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .15s, border-color .15s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.product-card:active { transform: translateY(0); }
.product-emoji {
  width: 100%; aspect-ratio: 1.5; border-radius: 10px; display: grid; place-items: center; font-size: 46px;
  line-height: 1; background: var(--surface-2);
}
.product-card .p-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; color: var(--text); }
.product-card .p-meta { display: flex; align-items: center; justify-content: space-between; }
.product-card .p-price { font-weight: 800; font-size: 16px; color: var(--brand); }
.product-card .p-stock { font-size: 12px; color: var(--muted); font-weight: 600; }
.product-card.out { opacity: .55; }
.product-card .p-stock.low { color: var(--warn); font-weight: 700; }
/* Favorito (estrella) en la tarjeta del POS */
.product-emoji { position: relative; }
.product-card .p-fav {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 19px; line-height: 1; color: #b8b8c4;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: transform .1s, color .15s;
}
.product-card .p-fav:hover { transform: scale(1.12); color: #f59e0b; }
.product-card .p-fav.on { color: #f59e0b; border-color: #fcd34d; background: #fffbeb; }
.product-card.fav { border-color: #fcd34d; }
.product-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); transform: translateY(-2px); }
.p-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 6px; align-self: flex-start; }
.p-tag.brand { background: var(--brand-soft); color: var(--brand); }
.p-tag.warn { background: var(--warn-soft); color: var(--warn); }
.qty .qty-edit { width: auto; min-width: 60px; padding: 0 8px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.qty .qty-edit:hover { border-color: var(--brand); color: var(--brand); }
.pres-opt.key-sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.suggest-box { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; display: none; }
.suggest-box.show { display: block; }
.suggest-item { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.suggest-item:hover, .suggest-item.active { background: var(--brand-soft); color: var(--brand); }
.suggest-item .s-sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.it-existing:not(:empty) { margin-bottom: 8px; }

/* Ticket / carrito */
.cart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm); }
.cart-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.cart-head h3 { font-size: 15px; font-weight: 800; }
.cart-head .count { margin-left: auto; }
.cart-customer { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 10px; min-height: 120px; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px; border-radius: 10px; }
.cart-item:hover { background: var(--surface-2); }
.cart-item .ci-name { font-weight: 700; font-size: 13px; }
.cart-item .ci-price { color: var(--muted); font-size: 12px; }
.cart-item .ci-total { font-weight: 800; text-align: right; }
.qty { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.qty button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 800; display: grid; place-items: center; }
.qty button:hover { background: var(--brand-soft); color: var(--brand); }
.qty span { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.qty .rm { margin-left: 4px; border-color: transparent; color: var(--muted); }
.qty .rm:hover { color: var(--danger); background: var(--danger-soft); }

.cart-empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.cart-empty .emoji { font-size: 42px; margin-bottom: 8px; opacity: .8; }

.cart-summary { border-top: 1px solid var(--border); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.sum-row.total { font-size: 22px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 4px; }
.sum-row .discount-link { color: var(--brand); font-weight: 700; background: none; border: none; }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px 16px; }

/* ============================================================
   Modales
   ============================================================ */
.modal-root { position: fixed; inset: 0; z-index: 60; display: none; }
.modal-root.show { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 11, 20, .5); backdrop-filter: blur(2px); animation: fade .15s ease; }
.modal {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: rise .18s ease;
}
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.modal.slim { width: min(420px, calc(100vw - 32px)); }
.modal.xl { width: min(1100px, calc(100vw - 32px)); }
/* Vista previa de Subir Excel (Productos) */
.imp-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.imp-stats .stat { padding: 12px 14px; }
.imp-stats .stat-label { font-size: 12px; }
.imp-stats .stat-value { font-size: 22px; }
.imp-table .table th, .imp-table .table td { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
.imp-table .table td.cell-main { white-space: normal; min-width: 180px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fade { from{opacity:0} to{opacity:1} }
@keyframes rise { from{opacity:0; transform:translate(-50%,-46%)} to{opacity:1; transform:translate(-50%,-50%)} }

/* Teclado de pago */
.pay-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.pay-method {
  padding: 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; color: var(--muted);
}
.pay-method .ico { width: 24px; height: 24px; }
.pay-method.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pay-total { text-align: center; padding: 16px; background: var(--brand); color: #fff; border-radius: 14px; margin-bottom: 16px; }
.pay-total .lbl { font-size: 13px; opacity: .85; font-weight: 600; }
.pay-total .amt { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { padding: 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 18px; font-weight: 700; color: var(--text); }
.keypad button:hover { background: var(--brand-soft); color: var(--brand); }
.quick-cash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.quick-cash button { padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; color: var(--text); }
.quick-cash button:hover { border-color: var(--brand); color: var(--brand); }
.change-box { text-align: center; padding: 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); margin-top: 14px; }
.change-box .amt { font-size: 26px; font-weight: 800; }
.change-box.neg { background: var(--danger-soft); color: var(--danger); }

/* ============================================================
   Recibo / factura imprimible
   ============================================================ */
.receipt { font-family: "Consolas", "Courier New", monospace; color: #111; background: #fff; padding: 18px; width: 300px; margin: 0 auto; font-size: 12.5px; }
.receipt .r-center { text-align: center; }
.receipt h2 { font-size: 16px; }
.receipt .r-line { border-top: 1px dashed #999; margin: 8px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt table td { padding: 2px 0; vertical-align: top; }
.receipt .r-tot td { font-weight: 800; }
.receipt .r-small { font-size: 11px; color: #444; }
.receipt .r-sub td { font-weight: 900; }  /* producto subrayado: negrita con ► (delivery) */
.receipt .r-revisar { font-weight: 900; font-size: 13.5px; }
.receipt .r-revisar > div:not(.r-center) { padding: 1px 0; }

/* ============================================================
   Toasts
   ============================================================ */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-width: 260px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 12px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .t-ico { font-size: 20px; }
.toast .t-body { flex: 1; }
.toast .t-title { font-weight: 700; font-size: 14px; }
.toast .t-msg { color: var(--muted); font-size: 13px; }
@keyframes toastIn { from{opacity:0; transform:translateX(30px)} to{opacity:1; transform:translateX(0)} }

/* ============================================================
   Iconos SVG
   ============================================================ */
.ico { display: inline-block; width: 20px; height: 20px; vertical-align: middle; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   Utilidades
   ============================================================ */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-right { text-align: right; }
.big-num { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.page-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.page-actions .search { flex: 1; min-width: 200px; }
.section-title { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; display: none; }
.scrim.show { display: block; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); }
  .two-col, .three-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .only-mobile { display: grid; }
  .pos { grid-template-columns: 1fr; height: auto; }
  .cart { position: sticky; bottom: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pay-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .view { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .stats { grid-template-columns: 1fr; }
}

/* ============================================================
   Impresión
   ============================================================ */
@media print {
  @page { margin: 0; }
  html, body { background: #fff !important; height: auto !important; overflow: visible !important; }
  /* Ocultar TODA la app; solo se imprime el recibo (evita hojas en blanco de más) */
  body > * { display: none !important; }
  #modal-root { display: block !important; position: static !important; }
  #modal-root .modal-inst, #modal-root .modal, #modal-root .modal-body {
    display: block !important; position: static !important; overflow: visible !important;
    max-height: none !important; height: auto !important; width: auto !important;
    inset: auto !important; transform: none !important; margin: 0 !important;
    box-shadow: none !important; border: none !important; background: #fff !important; animation: none !important;
  }
  #modal-root .modal-backdrop, #modal-root .modal-head, #modal-root .modal-foot { display: none !important; }
  /* Al imprimir, dentro del modal solo sale el área de impresión (oculta la parte interactiva) */
  #modal-root .modal-body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; position: static !important; width: 100%; margin: 0; padding: 2mm 3mm; }
  #print-area * { color: #000 !important; }
  .receipt { width: 100%; }
}

/* ===== Entrada rápida de inventario (rapido.js) ===== */
.rp-grid { display: grid; grid-template-columns: 140px 1fr 1.4fr; gap: 12px; }
.rp-grid.mt { margin-top: 4px; }
.rp-grid + .rp-grid { grid-template-columns: repeat(4, 1fr); }
.rp-grid .field { margin-bottom: 0; }
.rp-grid .input[readonly] { background: var(--surface-2); color: var(--muted); }
.rp-actions { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.rp-ref { flex: 1 1 260px; min-width: 240px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; font-size: 12px; }
.rp-ref:empty { display: none; }
.rp-ref-title { font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 4px; }
.rp-ref-line { margin: 2px 0; }
.rp-ref-tbl { width: 100%; border-collapse: collapse; margin-top: 4px; }
.rp-ref-tbl th, .rp-ref-tbl td { padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--border); font-size: 11px; }
.rp-ref-tbl .num { text-align: right; }
.rp-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; border-top: 2px solid var(--border); font-size: 15px; }
.rp-foot strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.rp-table th.ctr { text-align: center; }
.rp-row-sel { background: color-mix(in srgb, var(--brand) 16%, transparent) !important; }
@media (max-width: 860px) {
  .rp-grid, .rp-grid + .rp-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== POS: barra de opciones arriba (Precio 1/2 o presentación) ===== */
.pos-optbar {
  background: var(--brand-soft); border: 1.5px solid var(--brand);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px;
}
.pos-optbar .ob-head { font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--text); }
.pos-optbar .ob-hint { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 6px; }
.pos-optbar .ob-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-optbar .ob-opt {
  flex: 1 1 160px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer;
  transition: border-color .12s, background .12s, transform .05s;
}
.pos-optbar .ob-opt:hover { border-color: var(--brand); }
.pos-optbar .ob-opt.sel { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 35%, transparent); }
.pos-optbar .ob-opt.sel .ob-pr, .pos-optbar .ob-opt.sel em { color: #fff; }
.pos-optbar .ob-lb em { color: var(--muted); font-style: normal; font-weight: 600; font-size: 11px; text-transform: uppercase; margin-left: 4px; }
.pos-optbar .ob-pr { font-variant-numeric: tabular-nums; }

/* Precio editable en la línea del carrito */
.ci-price-edit {
  background: transparent; border: 1px dashed transparent; border-radius: 6px;
  padding: 1px 5px; margin: -1px -5px; color: var(--muted); font: inherit; cursor: pointer; text-align: left;
}
.ci-price-edit:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ===== POS: cobro F9 (cliente, deuda, teclas de método) ===== */
.pay-cust-info { margin: 8px 0 4px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.pay-cust-info .pci-name { font-weight: 800; }
.pay-cust-info .pci-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pay-cust-info .pci-sub b { color: var(--text); }
/* Programa de puntos: línea de puntos del cliente en la pantalla de cobro */
.pay-cust-info .pci-pts { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pay-cust-info .pci-pts b { color: var(--brand); font-weight: 800; }
.pm-key { font-style: normal; font-size: 10px; font-weight: 800; opacity: .7; margin-left: 6px; border: 1px solid currentColor; border-radius: 5px; padding: 0 4px; }
.pay-method.active .pm-key { opacity: 1; }
.deuda-box { padding: 12px 16px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); text-align: center; border: 1px solid var(--danger); }
.deuda-box .lbl { font-size: 12px; font-weight: 700; opacity: .85; }
.deuda-box .amt { font-size: 28px; font-weight: 900; color: #dc2626; }
.deuda-box .dbz { font-size: 12px; margin-top: 4px; font-weight: 600; }
.deuda-box.bad { background: var(--danger-soft); color: var(--danger); }
/* la lista de clientes en el modal de cobro flota bajo el buscador */
#pay-cust-list.suggest-box { top: 100%; left: 0; right: 44px; }

/* ===== Botón de notificaciones (transferencias) + panel ===== */
.notif-btn {
  position: relative; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: grid; place-items: center; font-size: 16px; line-height: 1;
  transition: background .15s, border-color .15s, color .15s;
}
.notif-btn:hover { background: var(--surface-2); color: var(--text); }
.notif-btn.has { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.notif-btn .notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 20px; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.tr-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--surface-2);
}
.tr-item .tr-top { font-size: 15px; }
.tr-item .tr-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tr-item .tr-btns { display: flex; gap: 8px; }
.tr-item .tr-btns .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Monto de apertura de caja (se veía apretado con el prefijo RD$) */
.input-group.caja-amt .input { padding-left: 52px; font-size: 22px; font-weight: 700; text-align: right; }
.input-group.caja-amt .prefix { font-size: 15px; font-weight: 800; }
/* Foco visible en los botones de un diálogo de confirmación (navegación con flechas) */
.modal-foot .btn:focus-visible, .modal-foot .btn.kbd-focus { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }

/* Reporte: ventas por cliente (gráfica de barras) */
.cli-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cli-row:last-child { border-bottom: 0; }
.cli-medal { width: 34px; text-align: center; font-size: 22px; flex-shrink: 0; }
.cli-medal .cli-rank { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 800; }
.cli-bar-wrap { flex: 1; min-width: 0; }
.cli-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cli-track { height: 12px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.cli-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, #1d4ed8, #06b6d4); }
.cli-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Ciclo de inventario */
.btn.btn-sm { padding: 6px 10px; font-size: 13px; }
.txt-pos, span.pos, td.pos { color: #059669; }
.txt-neg, .neg { color: #dc2626; }
.chip-warn { display: inline-block; font-size: 11px; font-weight: 700; color: #b45309; background: #fef3c7; border-radius: 20px; padding: 1px 8px; margin-left: 6px; }
.cyc-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; }
.cyc-banner.open { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.cyc-banner-l { display: flex; align-items: center; gap: 12px; }
.cyc-banner-emoji { font-size: 26px; }
.cyc-head { margin-bottom: 12px; }
.cyc-n { font-size: 20px; font-weight: 800; }
.cyc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cyc-stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.cyc-stat.g { background: color-mix(in srgb, #10b981 12%, var(--surface-2)); }
.cyc-stat.r { background: color-mix(in srgb, #ef4444 12%, var(--surface-2)); }
.cyc-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.cyc-val { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cyc-sub { margin-top: 8px; font-size: 12px; }
.cal-list { display: flex; flex-direction: column; gap: 8px; }
.cal-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-name { min-width: 140px; font-weight: 700; }
.cal-stars { display: flex; gap: 2px; }
.cal-star { background: none; border: none; cursor: pointer; font-size: 24px; line-height: 1; color: var(--border); padding: 0 2px; }
.cal-star.on { color: #f59e0b; }
.cal-note { flex: 1; min-width: 160px; }

/* Indicador de margen en Compras (debajo del costo) */
.cmp-hint { font-size: 12.5px; margin-top: 8px; min-height: 18px; line-height: 1.5; }
.cmp-hint .btn-sm { padding: 3px 9px; font-size: 12px; margin-left: 4px; }

/* Pago mixto (reparto por método) */
#pay-mixto .mx-row { display: grid; grid-template-columns: 1fr 130px; align-items: center; gap: 10px; margin-bottom: 8px; }
#pay-mixto .mx-row label { font-weight: 700; font-size: 14px; }
#pay-mixto .mx { text-align: right; font-weight: 700; }
#pay-mixto .mx-sum { text-align: right; font-size: 13px; color: var(--muted); margin-top: 4px; }
#pay-mixto .mx-sum b { color: var(--text); font-size: 15px; }

/* ===== Cobro compacto: que TODO quepa sin salirse del cuadro ===== */
.pay-grid { gap: 16px; }
.pay-grid .pay-total { padding: 12px; margin-bottom: 12px; }
.pay-grid .pay-total .amt { font-size: 26px; }
.pay-grid .pay-total .lbl { font-size: 12px; }
.pay-grid .field { margin-bottom: 8px; }
.pay-grid .pay-cust-info { margin: 6px 0; padding: 6px 10px; }
/* métodos en una sola fila de 4, compactos */
.pay-grid .pay-methods { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.pay-grid .pay-method { padding: 8px 3px; gap: 2px; }
.pay-grid .pay-method .ico { width: 18px; height: 18px; }
.pay-grid .pay-method span { font-size: 10.5px; line-height: 1.05; text-align: center; }
.pay-grid .pay-method .pm-key { margin-left: 0; font-size: 9px; padding: 0 3px; }
/* monto y cajas de resultado más compactos */
.pay-grid #pay-amount { font-size: 24px; padding: 10px; }
.pay-grid .quick-cash { gap: 6px; margin-top: 6px; }
.pay-grid .quick-cash button { padding: 9px; font-size: 13px; }
.pay-grid .change-box, .pay-grid .deuda-box { padding: 10px; margin-top: 10px; }
.pay-grid .change-box .amt, .pay-grid .deuda-box .amt { font-size: 22px; }
.pay-grid #pay-mixto .mx-row { margin-bottom: 6px; }

/* Accesos rápidos a Servicios en el encabezado del Punto de Venta */
.topbar-services { display: flex; gap: 8px; margin-left: 20px; }
.tbs-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13px;
  transition: border-color .15s, background .15s, color .15s; }
.tbs-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.tbs-btn span { font-size: 15px; }
@media (max-width: 900px) { .topbar-services { display: none; } }

/* Registro de compra — cuadrículas de la entrada por teclado */
.cmp-grid2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.cmp-grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cmp-grid5 .input { text-align: right; }
@media (max-width: 900px) { .cmp-grid2 { grid-template-columns: 1fr; } .cmp-grid5 { grid-template-columns: 1fr 1fr; } }

/* Fondo disponible de servicios (recargas) */
.srv-fund { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.srv-fund .srv-fund-amt { font-size: 22px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ===== Login por usuario (PIN) ===== */
.login-lock { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #0b2a6f, #1d4ed8 60%, #06b6d4); }
.login-box { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 30px 26px; text-align: center; box-shadow: 0 30px 70px rgba(0,0,0,.4); color: #14151f; }
.login-logo { font-size: 48px; }
.login-box h2 { font-size: 22px; margin: 6px 0 2px; }
.login-box p { color: #6b7080; font-size: 14px; margin-bottom: 16px; }
.login-users { display: flex; flex-direction: column; gap: 10px; }
.login-user { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid #e6e7ef; border-radius: 14px; background: #fafafe; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.login-user:hover { border-color: #1d4ed8; background: #e8efff; }
.login-user .lu-av { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(140deg, #1d4ed8, #06b6d4); flex: none; }
.login-user .lu-t { display: flex; flex-direction: column; line-height: 1.2; }
.login-user .lu-t small { color: #6b7080; font-size: 12px; }
.login-box #login-pin { width: 100%; padding: 14px; border-radius: 13px; border: 2px solid #e6e7ef; background: #fafafe; color: #14151f; font-size: 24px; text-align: center; letter-spacing: 8px; outline: none; margin-bottom: 12px; }
.login-box #login-pin:focus { border-color: #1d4ed8; }
.login-err { color: #dc2626; font-size: 13px; min-height: 18px; font-weight: 700; margin-bottom: 4px; }


/* ============================================================
   REDISEÑO 2026-09 — look colorido/vivo (diseño de Oscar)
   ============================================================ */
/* Barra superior azul oscuro con botones de colores */
.topbar {
  background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff;
  border-bottom: none; padding: 10px 18px; gap: 12px; min-height: 66px;
  box-shadow: 0 4px 14px rgba(11, 42, 111, .25);
}
.topbar-title h1 { color: #fff; font-size: 20px; }
.topbar-title p { color: rgba(255,255,255,.72); }
#btn-menu { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; }
#btn-menu:hover, .app.sidebar-collapsed #btn-menu { background: #fff; color: #0b2a6f; border-color: #fff; }
.clock { color: #fff; font-size: 16px; line-height: 1.15; text-align: right; }
.clock small { display: block; font-size: 12px; font-weight: 600; color: rgba(255,255,255,.75); }
.caja-status { padding: 8px 14px; font-size: 14px; font-weight: 700; background: #dc2626; color: #fff; }
.caja-status.open { background: #16a34a; color: #fff; }
.notif-btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.notif-btn.has { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.topbar-services { margin-left: 8px; gap: 10px; flex-wrap: nowrap; overflow-x: auto; }
.tbs-btn {
  padding: 9px 16px; border-radius: 12px; border: none; color: #fff; font-size: 14px; font-weight: 800;
  box-shadow: 0 3px 8px rgba(0,0,0,.18); white-space: nowrap; transition: transform .08s, filter .15s;
}
.tbs-btn:hover { filter: brightness(1.08); color: #fff; transform: translateY(-1px); }
.tbs-btn:active { transform: translateY(0); }
.tbs-btn span { font-size: 16px; }
.tbs-btn.c-ventas { background: #2563eb; }
.tbs-btn.c-cobro { background: #f59e0b; }
.tbs-btn.c-gastos { background: #dc2626; }
.tbs-btn.c-compras { background: #16a34a; }
.tbs-btn.c-devol { background: #0ea5e9; }
.tbs-btn.c-recargas { background: #7c3aed; }
.tbs-btn.c-facturas { background: #0d9488; }
.tbs-btn.c-seguros { background: #db2777; }

/* Menú lateral */
.nav-item { font-size: 14.5px; padding: 11px 12px; border-radius: 12px; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(29,78,216,.28); }
.nav-item.active .badge { background: #fff; color: var(--danger); }

/* Buscador y herramientas del POS */
.pos { gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); }
.pos-tools .search { padding: 12px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); border-color: var(--border); }
.pos-tools .search input { font-size: 15px; }
.pos-tools .search .ico { width: 22px; height: 22px; color: var(--ink); }
.pos-tools .btn-secondary { padding: 12px 16px; border-radius: 14px; font-size: 14.5px; box-shadow: var(--shadow-sm); }
.pos-tools .btn-secondary .ico { color: var(--ink); }
/* Pantallas medianas: los botones del POS (Escanear / Cobro / Reimprimir) quedan solo con icono para que el buscador no se achique */
@media (max-width: 1750px) {
  /* Solo se esconde el TEXTO, nunca el icono (el icono también es un span: .ico) */
  .app:not(.sidebar-collapsed) .pos-tools .btn-secondary span:not(.ico) { display: none; }
  .app:not(.sidebar-collapsed) .pos-tools .btn-secondary { padding: 12px 13px; }
}
@media (max-width: 1500px) {
  .pos-tools .btn-secondary span:not(.ico) { display: none; }
  .pos-tools .btn-secondary { padding: 12px 13px; }
}
.cats { gap: 10px; padding-bottom: 6px; }
.cat-pill { padding: 10px 18px; font-size: 14px; border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; gap: 8px; }
.cat-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 12px rgba(29,78,216,.32); }
.cat-pill.fav-pill.active { background: #f59e0b; border-color: #f59e0b; box-shadow: 0 4px 12px rgba(245,158,11,.35); }

/* Tarjeta de producto */
.products-grid { grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px; }
.product-card { border-radius: 16px; padding: 12px 12px 10px; gap: 4px; border-color: var(--border); box-shadow: 0 2px 6px rgba(11,42,111,.06); position: relative; }
.product-card:hover { border-color: var(--brand); box-shadow: 0 8px 20px rgba(29,78,216,.16); }
.product-emoji { background: transparent; aspect-ratio: 1.25; font-size: 58px; margin-bottom: 4px; }
.product-emoji img { width: 100%; height: 100%; object-fit: contain; }
.product-card .p-stockbadge {
  position: absolute; top: 10px; right: 10px; min-width: 34px; height: 26px; padding: 0 9px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: #16a34a;
  box-shadow: 0 2px 6px rgba(0,0,0,.18); font-variant-numeric: tabular-nums;
}
.product-card .p-stockbadge.low { background: #f59e0b; }
.product-card .p-stockbadge.out { background: #dc2626; }
.product-card .p-stockbadge.inf { background: #64748b; }
.product-card .p-name { font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--text); min-height: 2.5em; }
.product-card .p-meta { display: grid; grid-template-columns: 1fr auto; align-items: end; margin-top: 2px; }
.product-card .p-price { font-size: 19px; font-weight: 800; color: var(--brand); letter-spacing: -.3px; line-height: 1.1; }
.product-card .p-unit { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.product-card .p-fav { position: static; width: 30px; height: 30px; border: none; background: transparent; font-size: 22px; color: #c7ccd8; box-shadow: none; }
.product-card .p-fav.on { color: #f59e0b; background: transparent; }
.product-card.fav { border-color: var(--border); }
.product-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.28); }

/* Ticket de venta */
.cart { border-radius: 18px; box-shadow: 0 4px 14px rgba(11,42,111,.08); }
.cart-head { padding: 16px 20px; }
.cart-head h3 { font-size: 20px; font-weight: 800; color: var(--ink); }
.cart-head > .ico { width: 26px; height: 26px; color: #16a34a; }
.cart-head .count { background: var(--brand-soft); color: var(--brand); font-size: 14px; padding: 5px 14px; border-radius: 20px; }
.cart-customer { padding: 12px 20px 14px; }
.cart-customer .select { padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; background: var(--surface-2); }
.cart-items { padding: 6px 12px; }
.cart-item { grid-template-columns: 44px minmax(0, 1fr) auto auto auto; align-items: center; gap: 4px 10px; padding: 10px 8px; border-bottom: 1px solid var(--border); border-radius: 0; }
.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: transparent; }
.cart-item .ci-thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 24px; overflow: hidden; }
.cart-item .ci-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cart-item .ci-name { font-size: 14px; font-weight: 700; line-height: 1.2; }
.cart-item .ci-price { margin-top: 2px; }
.cart-item .ci-price .ci-price-edit { color: var(--brand); font-weight: 800; font-size: 14px; }
.cart-item .qty { margin-top: 0; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.cart-item .qty button { width: 32px; height: 34px; border: none; border-radius: 0; font-size: 17px; background: var(--surface-2); }
.cart-item .qty button:hover { background: var(--brand-soft); color: var(--brand); }
.cart-item .qty span, .cart-item .qty .qty-edit { min-width: 36px; height: 34px; display: grid; place-items: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; font-size: 15px; }
.cart-item .ci-total { font-size: 15px; font-weight: 800; white-space: nowrap; min-width: 84px; text-align: right; }
.cart-item .ci-rm { width: 34px; height: 34px; border: none; background: transparent; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.cart-item .ci-rm:hover { color: var(--danger); background: var(--danger-soft); }
.cart-item .ci-rm .ico { width: 19px; height: 19px; }
.cart-summary { padding: 12px 20px 10px; gap: 8px; }
.sum-row { font-size: 15px; }
.sum-row.total { border: none; margin-top: 6px; padding: 12px 16px; border-radius: 14px; background: var(--brand-soft); color: var(--ink); font-size: 22px; align-items: center; }
.sum-row.total span:last-child { color: var(--brand); font-size: 30px; letter-spacing: -.5px; }
.cart-actions { padding: 4px 20px 18px; gap: 12px; }
.cart-actions .btn { padding: 16px; font-size: 17px; border-radius: 14px; }
.cart-actions .btn-secondary { font-weight: 800; }
.cart-actions .btn-ok { background: #16a34a; box-shadow: 0 6px 16px rgba(22,163,74,.35); }
.cart-actions .btn .ico { width: 22px; height: 22px; }
.cart-actions .pm-key { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.22); border: none; opacity: 1; }
/* Tarjetas de resumen (Inicio, Productos…) */
.stat .stat-ico.violet { background: linear-gradient(140deg, #2563eb, #7c3aed); }
.btn-ok { background: #16a34a; }
@media (max-width: 1100px) { .topbar-services .tbs-btn { padding: 8px 11px; font-size: 13px; } }

/* Ajustes de encaje (barra superior y línea del ticket) */
.topbar { min-height: 64px; padding: 8px 16px; }
.topbar-title { flex: none; }
.topbar-title h1 { font-size: 18px; white-space: nowrap; }
.topbar-title p { display: none; }
.topbar-services { flex: 1; min-width: 0; margin-left: 4px; scrollbar-width: none; }
.topbar-services::-webkit-scrollbar { display: none; }
.topbar-actions { flex: none; gap: 10px; }
.caja-status { white-space: nowrap; padding: 7px 12px; font-size: 13px; }
.clock { white-space: nowrap; font-size: 15px; }
.clock small { font-size: 11px; }
.tbs-btn { padding: 8px 13px; font-size: 13.5px; gap: 5px; }
.tbs-btn span { font-size: 15px; }
.cart-item { grid-template-columns: 40px minmax(0, 1fr) auto auto auto; gap: 4px 6px; padding: 9px 4px; }
.cart-item .ci-thumb { width: 40px; height: 40px; font-size: 22px; }
.cart-item .ci-price .ci-price-edit { font-size: 13px; white-space: nowrap; }
.cart-item .qty button { width: 28px; height: 32px; font-size: 16px; }
.cart-item .qty span, .cart-item .qty .qty-edit { min-width: 30px; height: 32px; font-size: 14px; padding: 0 4px; }
.cart-item .ci-total { min-width: 0; font-size: 14px; }
.cart-item .ci-rm { width: 28px; height: 32px; }
.cart-item .ci-rm .ico { width: 17px; height: 17px; }
/* Pantallas medianas con el menú abierto: botones más compactos (sin emoji) para que quepan todos */
@media (max-width: 1650px) {
  .app:not(.sidebar-collapsed) .tbs-btn { padding: 7px 10px; font-size: 13px; }
  .app:not(.sidebar-collapsed) .tbs-btn span { display: none; }
}
@media (max-width: 1400px) {
  .tbs-btn { padding: 7px 10px; font-size: 12.5px; }
  .tbs-btn span { display: none; }
  .topbar-title h1 { font-size: 16px; }
}
@media (max-width: 1400px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar-services { gap: 7px; }
  .tbs-btn { padding: 7px 9px; }
  .topbar-actions { gap: 8px; }
  .clock { font-size: 14px; }
}

/* Aviso de vencimiento de licencia (arriba del contenido) */
.lic-aviso { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 18px 0; padding: 12px 16px; border-radius: 14px; background: #fffbeb; border: 1px solid #fcd34d; color: #78350f; }
.lic-aviso.urgente { background: #fef2f2; border-color: #fca5a5; color: #7f1d1d; }
.lic-aviso .la-txt { display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 240px; flex: 1; }
.lic-aviso .la-txt strong { font-size: 13px; letter-spacing: .2px; }
.lic-aviso .la-pago { font-size: 12.5px; opacity: .9; margin-top: 2px; }
.lic-aviso .la-acts { display: flex; align-items: center; gap: 8px; }
.lic-aviso .btn { padding: 9px 14px; font-size: 13.5px; }
[data-theme="dark"] .lic-aviso { background: #3b2f0b; border-color: #a16207; color: #fde68a; }
[data-theme="dark"] .lic-aviso.urgente { background: #3f1212; border-color: #b91c1c; color: #fecaca; }

/* ============================================================
   INVENTARIO DEL CONTADOR — conteo físico
   Resumen en una línea + barra de captura (escanear → cantidad → costo → precio → vence)
   ============================================================ */
.inv-resumen {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 12px;
}
.inv-resumen .ir-item { font-size: 13px; color: var(--muted); white-space: nowrap; }
.inv-resumen .ir-item b { color: var(--text); font-size: 15px; font-weight: 800; }
.inv-resumen .ir-item.warn b { color: var(--warn); }
.inv-resumen .ir-item.danger b { color: var(--danger); }
.inv-resumen .ir-item.ok b { color: var(--ok); }
.inv-resumen .ir-acts { margin-left: auto; display: flex; gap: 8px; }
.inv-resumen .ir-acts .btn { padding: 8px 14px; font-size: 13.5px; }

.inv-captura { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.inv-fila { display: grid; grid-template-columns: minmax(200px, 1.8fr) 95px 105px 105px 135px 105px 130px; gap: 9px; align-items: end; }
.inv-campo { min-width: 0; position: relative; }
.inv-campo > label { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.inv-campo .input, .inv-campo .search { width: 100%; }
.inv-campo .btn-block { width: 100%; }
.inv-campo.grow { min-width: 220px; }

/* Producto elegido: se ve claro qué se está contando */
.inv-elegido { display: none; }
.inv-elegido.on {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding: 8px 12px; border-radius: 10px;
  background: var(--brand-soft, var(--surface-2)); border: 1px solid var(--border);
}
.inv-elegido .ie-emoji { font-size: 20px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.inv-elegido .ie-emoji img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; }
.inv-elegido .ie-nombre { font-weight: 800; }
.inv-elegido .ie-dato { color: var(--muted); font-size: 13px; }
.inv-elegido .btn-ghost { margin-left: auto; font-size: 12.5px; }

/* Sugerencias del buscador (nombre o código) */
.inv-campo .suggest-box { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; display: none; }
.inv-campo .suggest-box.show { display: block; }
.inv-campo .suggest-box .sug-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.inv-campo .suggest-box .sug-item.on, .inv-campo .suggest-box .sug-item:hover { background: var(--surface-2); }
.inv-campo .suggest-box .si-emoji { font-size: 17px; width: 24px; text-align: center; }
.inv-campo .suggest-box .si-emoji img { width: 24px; height: 24px; object-fit: contain; border-radius: 4px; background: #fff; }
.inv-campo .suggest-box .si-nombre { font-weight: 700; font-size: 13.5px; }
.inv-campo .suggest-box .si-sub { margin-left: auto; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .inv-fila { grid-template-columns: 1fr 1fr 1fr; }
  .inv-campo.grow { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .inv-fila { grid-template-columns: 1fr 1fr; }
  .inv-resumen .ir-acts { margin-left: 0; width: 100%; }
}

/* Reporte de inventario (se imprime / se guarda como PDF) */
.rep-inv .ri-head { text-align: center; margin-bottom: 14px; }
.rep-inv .ri-head h2 { margin: 0; font-size: 20px; }
.rep-inv .ri-head h3 { margin: 10px 0 2px; font-size: 15px; font-weight: 700; }
.rep-inv .ri-fecha { color: var(--muted); font-size: 12.5px; }
.rep-inv .ri-tabla { font-size: 12.5px; }
.rep-inv .ri-tabla th, .rep-inv .ri-tabla td { padding: 6px 8px; }
.rep-inv .ri-tot td { font-weight: 800; border-top: 2px solid var(--border); background: var(--surface-2); }
.rep-inv .ri-gan { text-align: right; padding-top: 8px; }
@media print {
  .rep-inv .ri-tabla { font-size: 10.5px; }
  .rep-inv .ri-tabla th { background: #eee !important; }
}

/* Casilla de dañado en el conteo del contador */
.ct-dan { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-radius: 12px;
  background: var(--danger-soft, #fef2f2); border: 1px solid var(--danger); color: var(--danger);
  font-weight: 700; font-size: 13.5px; cursor: pointer; text-transform: none; letter-spacing: 0; margin: 0; }
.ct-dan input { width: 18px; height: 18px; accent-color: var(--danger); }

/* Peso en el ticket (productos por peso / etiqueta de balanza): que no se corte en dos líneas */
.cart-item .qty .qty-edit.dec { width: auto; min-width: 62px; white-space: nowrap; padding: 0 7px; font-size: 13.5px; color: var(--brand); }

/* marca CajaNova */
.brand-logo { background: #0e0f1a; }
