/* Gestión Juguerías - estilos de la app. Diseño MOBILE-FIRST (base 360px). Ver CLAUDE.md §35.1 */

:root {
  --mj-primary: #1f7a4d;
  --mj-primary-dark: #17623d;
  --mj-primary-soft: #e3f2ea;
  --mj-accent: #f57c00;
  --mj-bg: #f4f7f3;
  --mj-surface: #ffffff;
  --mj-text: #1c2b24;
  --mj-muted: #5d6f66;
  --mj-border: #dbe4de;
  --mj-danger: #b3261e;
  --mj-nav-h: 64px;
  --mj-topbar-h: 56px;
  --mj-radius: 16px;

  --bs-body-bg: var(--mj-bg);
  --bs-body-color: var(--mj-text);
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-primary: var(--mj-primary);
  --bs-primary-rgb: 31, 122, 77;
  --bs-link-color: var(--mj-primary);
  --bs-link-hover-color: var(--mj-primary-dark);
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--mj-bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, a, input { touch-action: manipulation; }

.btn-primary {
  --bs-btn-bg: var(--mj-primary);
  --bs-btn-border-color: var(--mj-primary);
  --bs-btn-hover-bg: var(--mj-primary-dark);
  --bs-btn-hover-border-color: var(--mj-primary-dark);
  --bs-btn-active-bg: var(--mj-primary-dark);
  --bs-btn-active-border-color: var(--mj-primary-dark);
  --bs-btn-disabled-bg: var(--mj-primary);
  --bs-btn-disabled-border-color: var(--mj-primary);
}
.btn { min-height: 48px; border-radius: 12px; font-weight: 600; }
.form-control { min-height: 48px; font-size: 1rem; /* 16px: evita el zoom automático en iOS */ border-radius: 12px; }
.form-control:focus { border-color: var(--mj-primary); box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .22); }
:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb), .5); outline-offset: 2px; }

/* ---------- Carga inicial ---------- */
.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; color: var(--mj-muted); }
.boot img { border-radius: 18px; }

/* ---------- Pantallas de acceso ---------- */
.auth-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--mj-primary) 0, var(--mj-primary) 34%, var(--mj-bg) 34%);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--mj-surface);
  border-radius: 24px;
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: 0 10px 30px rgba(20, 60, 40, .18);
}
.auth-brand { text-align: center; margin: -3.4rem 0 1rem; }
.auth-brand img { width: 84px; height: 84px; border-radius: 22px; border: 4px solid var(--mj-surface); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.auth-title { font-size: 1.35rem; font-weight: 700; text-align: center; margin: 0 0 .25rem; }
.auth-sub { text-align: center; color: var(--mj-muted); margin: 0 0 1.25rem; font-size: .95rem; }
.input-group-toggle { position: relative; }
.input-group-toggle .form-control { padding-right: 3.25rem; }
.toggle-eye {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 48px; height: 44px; border: 0; background: transparent; color: var(--mj-muted); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.rule-list { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .85rem; color: var(--mj-muted); }
.rule-list li { display: flex; align-items: center; gap: .4rem; }
.rule-list li::before { content: "○"; }
.rule-list li.ok { color: var(--mj-primary); font-weight: 600; }
.rule-list li.ok::before { content: "✓"; }

/* ---------- Estructura de la app ---------- */
.app-shell { min-height: 100dvh; display: flex; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  min-height: calc(var(--mj-topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 1rem 0;
  display: flex; align-items: center; gap: .75rem;
  background: var(--mj-primary); color: #fff;
}
.topbar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; line-height: 1.2; }
.topbar .sub { font-size: .78rem; opacity: .85; line-height: 1.1; }
.topbar img { width: 32px; height: 32px; border-radius: 9px; }

.app-content {
  flex: 1;
  padding: 1rem 1rem calc(var(--mj-nav-h) + env(safe-area-inset-bottom) + 1.25rem);
  max-width: 880px; width: 100%; margin: 0 auto;
}

/* Barra de navegación inferior (móvil) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--mj-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--mj-surface);
  border-top: 1px solid var(--mj-border);
  box-shadow: 0 -4px 16px rgba(20, 60, 40, .08);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; border: 0; background: transparent; color: var(--mj-muted);
  font-size: .72rem; font-weight: 600; text-decoration: none; position: relative;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--mj-primary); }
.nav-item.active::before {
  content: ""; position: absolute; top: 6px; width: 52px; height: 30px; border-radius: 15px;
  background: var(--mj-primary-soft); z-index: -1;
}
.nav-item:active { background: var(--mj-primary-soft); }

/* Barra lateral (solo escritorio) */
.sidebar { display: none; }

/* Tarjetas */
.card-mj {
  background: var(--mj-surface); border: 1px solid var(--mj-border); border-radius: var(--mj-radius);
  padding: 1rem; margin-bottom: .85rem;
}
.card-mj h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-muted); margin: 0 0 .5rem; font-weight: 700; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--mj-border); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--mj-muted); }
.kv span:last-child { font-weight: 600; text-align: right; }

.badge-mj { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge-ok { background: var(--mj-primary-soft); color: var(--mj-primary-dark); }
.badge-warn { background: #fff1d6; color: #8a5200; }
.badge-bad { background: #fde7e5; color: var(--mj-danger); }

.banner { border-radius: 12px; padding: .75rem 1rem; margin-bottom: .85rem; font-size: .92rem; display: flex; gap: .6rem; align-items: flex-start; }
.banner-warn { background: #fff1d6; color: #6b4200; }
.banner-bad { background: #fde7e5; color: #7d1b15; }
.banner-info { background: var(--mj-primary-soft); color: var(--mj-primary-dark); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--mj-muted); }
.empty svg { width: 56px; height: 56px; color: var(--mj-primary); opacity: .75; margin-bottom: .75rem; }
.empty h2 { font-size: 1.1rem; color: var(--mj-text); text-transform: none; letter-spacing: 0; }

.offline-bar {
  position: sticky; top: 0; z-index: 40; background: #3a3a3a; color: #fff; text-align: center;
  font-size: .85rem; padding: calc(.35rem + env(safe-area-inset-top)) .5rem .35rem;
}

/* Hoja inferior "Más" */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 1040; background: rgba(0, 0, 0, .45);
  opacity: 0; transition: opacity .2s ease;
}
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
  max-height: 85dvh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom);
  background: var(--mj-surface); border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .2);
  transform: translateY(100%); transition: transform .22s ease;
}
.sheet.show { transform: none; }
.sheet[hidden], .sheet-backdrop[hidden] { display: none !important; }
@media (min-width: 768px) { .sheet { max-width: 480px; left: 50%; right: auto; width: 100%; margin-left: -240px; } }
.sheet .grab { width: 44px; height: 5px; background: var(--mj-border); border-radius: 3px; margin: 8px auto 0; }
.sheet-user { padding: .75rem 1rem .5rem; }
.sheet-user strong { display: block; }
.sheet-user small { color: var(--mj-muted); }
.sheet-item {
  display: flex; align-items: center; gap: .9rem; width: 100%; min-height: 54px; padding: .5rem 1rem;
  border: 0; background: transparent; text-align: left; font-size: 1rem; color: var(--mj-text);
}
.sheet-item svg { width: 22px; height: 22px; color: var(--mj-primary); }
.sheet-item:active { background: var(--mj-primary-soft); }
.sheet-item.danger, .sheet-item.danger svg { color: var(--mj-danger); }

/* Avisos emergentes */
.toast-stack {
  position: fixed; left: 0; right: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: .5rem;
  top: calc(var(--mj-topbar-h) + env(safe-area-inset-top) + .6rem); padding: 0 1rem; pointer-events: none;
}
.toast-mj {
  pointer-events: none; max-width: 440px; width: 100%; padding: .75rem 1rem; border-radius: 12px;
  background: #24332b; color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); font-size: .95rem;
  animation: toast-in .18s ease-out;
}
.toast-mj.error { background: var(--mj-danger); }
.toast-mj.success { background: var(--mj-primary-dark); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

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

/* ---------- Tablet ---------- */
@media (min-width: 768px) {
  .app-content { padding-left: 1.5rem; padding-right: 1.5rem; }
  .auth-card { padding: 2rem 1.75rem 1.75rem; }
}

/* ---------- Escritorio: barra lateral, sin barra inferior ---------- */
@media (min-width: 992px) {
  .bottom-nav { display: none; }
  .app-content { padding-bottom: 2rem; }
  .toast-stack { top: 4.2rem; }
  .sidebar {
    display: flex; flex-direction: column; width: 250px; flex: none;
    position: sticky; top: 0; height: 100dvh;
    background: var(--mj-surface); border-right: 1px solid var(--mj-border); padding: 1rem .75rem;
  }
  .sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1rem; font-weight: 700; }
  .sidebar .brand img { width: 36px; height: 36px; border-radius: 10px; }
  .sidebar .nav-item {
    flex-direction: row; justify-content: flex-start; gap: .75rem; width: 100%;
    min-height: 48px; padding: 0 .75rem; border-radius: 12px; font-size: .95rem; margin-bottom: 2px;
  }
  .sidebar .nav-item.active { background: var(--mj-primary-soft); }
  .sidebar .nav-item.active::before { display: none; }
  .sidebar .nav-item:hover { background: var(--mj-primary-soft); }
  .sidebar .spacer { flex: 1; }
  .topbar { background: var(--mj-surface); color: var(--mj-text); border-bottom: 1px solid var(--mj-border); }
  .topbar img { display: none; }
}

/* ======================= Catálogo (productos, categorías, extras) ======================= */
body.sheet-open { overflow: hidden; }

/* Pestañas / selector segmentado */
.seg { display: flex; background: #e6ece8; border-radius: 14px; padding: 4px; gap: 4px; }
.seg-btn {
  flex: 1; min-height: 44px; border: 0; border-radius: 11px; background: transparent;
  font-weight: 600; font-size: .92rem; color: var(--mj-muted);
}
.seg-btn.active { background: var(--mj-surface); color: var(--mj-primary-dark); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

/* Búsqueda y chips de categoría */
.toolbar { margin-bottom: .75rem; }
.search-box { position: relative; margin-bottom: .6rem; }
.search-box > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--mj-muted); pointer-events: none; }
.search-box .form-control { padding-left: 2.6rem; }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 1rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
  border: 1px solid var(--mj-border); background: var(--mj-surface); color: var(--mj-text); white-space: nowrap;
}
.chip.active { background: var(--mj-primary); border-color: var(--mj-primary); color: #fff; }

/* Lista de tarjetas */
.item-list { display: flex; flex-direction: column; gap: .6rem; }
.item-card {
  display: flex; align-items: center; gap: .5rem; background: var(--mj-surface);
  border: 1px solid var(--mj-border); border-radius: var(--mj-radius); padding: .25rem .5rem .25rem .25rem;
}
.item-card.dim .item-main { opacity: .55; }
.item-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left;
  border: 0; background: transparent; padding: .65rem .75rem; min-height: 56px; border-radius: 12px; color: inherit;
}
button.item-main:active { background: var(--mj-primary-soft); }
.item-title { font-size: 1rem; overflow-wrap: anywhere; }
.item-meta { font-size: .8rem; color: var(--mj-muted); }
.item-price { font-size: .88rem; color: var(--mj-primary-dark); font-weight: 600; overflow-wrap: anywhere; }
.item-switch { margin: 0; padding: 0 .5rem 0 0; min-height: 48px; display: flex; align-items: center; }
.item-switch .form-check-input, .switch-row .form-check-input { float: none; margin: 0; width: 3em; height: 1.6em; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--mj-primary); border-color: var(--mj-primary); }
.switch-row { display: flex; align-items: center; gap: .75rem; padding-left: 0; min-height: 48px; }

/* Botón flotante (acción principal) */
.fab {
  position: fixed; right: 16px; z-index: 25; width: 58px; height: 58px; border-radius: 50%; border: 0;
  bottom: calc(var(--mj-nav-h) + env(safe-area-inset-bottom) + 16px);
  background: var(--mj-primary); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(20, 60, 40, .35);
}
.fab:active { background: var(--mj-primary-dark); transform: scale(.96); }

/* Hoja de formulario */
.sheet.sheet-form {
  display: flex; flex-direction: column; max-height: 92dvh; overflow: hidden; padding-bottom: 0;
}
.sheet-form .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: .25rem .5rem .25rem 1.1rem; }
.sheet-form .sheet-head h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.sheet-close { width: 48px; height: 48px; border: 0; background: transparent; color: var(--mj-muted); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.sheet-body { flex: 1; overflow-y: auto; padding: .5rem 1.1rem 1rem; overscroll-behavior: contain; }
.sheet-footer {
  display: flex; gap: .6rem; padding: .75rem 1.1rem calc(.75rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--mj-border); background: var(--mj-surface);
}
.sheet-small .sheet-body { padding-bottom: 1.25rem; }
@media (min-width: 768px) { .sheet.sheet-form { max-width: 560px; margin-left: -280px; } }

/* Filas de tamaños */
.variant-row { display: flex; gap: .5rem; align-items: flex-start; }
.variant-row .vr-name { flex: 1 1 52%; min-width: 0; }
.variant-row .vr-price { flex: 1 1 34%; min-width: 0; }
.variant-row .mb-3 { margin-bottom: .6rem !important; }
.row-del { flex: none; width: 48px; padding: 0; display: flex; align-items: center; justify-content: center; }

.is-invalid + .invalid-feedback, .invalid-feedback { font-size: .82rem; }
.form-select { min-height: 48px; font-size: 1rem; border-radius: 12px; }

@media (min-width: 992px) {
  .fab { bottom: 24px; right: 28px; }
}

/* ======================= Venta (POS), pedidos y caja ======================= */
.badge-info { background: #e0eefc; color: #0d4a85; }
.badge-muted { background: #e9ecea; color: #4a5750; }

.pos-root { padding-bottom: calc(var(--mj-nav-h) * 0 + 4.5rem); }
.pos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.pos-grid .empty { grid-column: 1 / -1; }
.pos-tile {
  text-align: left; min-height: 96px; padding: .75rem .8rem; color: inherit;
  display: flex; flex-direction: column; justify-content: space-between; gap: .4rem;
  border: 1px solid var(--mj-border); border-radius: var(--mj-radius); background: var(--mj-surface);
}
.pos-tile:active:not([disabled]) { background: var(--mj-primary-soft); transform: scale(.98); }
.pos-tile[disabled] { opacity: .5; }
.pos-tile .t-name { font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.pos-tile .t-price { color: var(--mj-primary-dark); font-weight: 700; font-size: .9rem; }

.cart-bar {
  position: fixed; left: 12px; right: 12px; z-index: 26; width: calc(100% - 24px); min-height: 58px;
  bottom: calc(var(--mj-nav-h) + env(safe-area-inset-bottom) + 10px);
  display: flex; align-items: center; gap: .7rem; padding: .6rem 1rem;
  background: var(--mj-primary); color: #fff; border: 0; border-radius: 16px; text-align: left; font-weight: 600;
  box-shadow: 0 8px 22px rgba(20, 60, 40, .38);
}
.cart-bar:active { background: var(--mj-primary-dark); }
.cart-bar .count { background: rgba(255, 255, 255, .22); border-radius: 999px; padding: .1rem .65rem; font-weight: 700; }
.cart-bar .total { margin-left: auto; font-weight: 800; font-size: 1.15rem; }

/* Hojas de pedido y cobro */
.sheet-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-muted); font-weight: 700; margin: .25rem 0 .5rem; }
.opt-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.opt-btn {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: 52px; padding: .5rem .9rem;
  border: 2px solid var(--mj-border); border-radius: 12px; background: #fff; text-align: left; font-weight: 600; color: var(--mj-text);
}
.opt-btn.selected { border-color: var(--mj-primary); background: var(--mj-primary-soft); }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.method-grid .opt-btn { justify-content: center; }
.stepper { display: inline-flex; align-items: center; gap: .35rem; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--mj-border); background: #fff; color: var(--mj-text); display: flex; align-items: center; justify-content: center; }
.stepper button:active { background: var(--mj-primary-soft); }
.stepper .qty { min-width: 2rem; text-align: center; font-weight: 700; font-size: 1.05rem; }
.stepper-sm button { width: 38px; height: 38px; }
.line-row { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem 0; border-bottom: 1px dashed var(--mj-border); }
.line-row:last-child { border-bottom: 0; }
.min-w-0 { min-width: 0; overflow-wrap: anywhere; }
.big-line { font-size: 1.2rem; }
.big-total { font-size: 2.1rem; font-weight: 800; text-align: center; margin: .25rem 0 1rem; color: var(--mj-primary-dark); }
.change-box { text-align: center; font-size: 1.1rem; min-height: 1.6rem; margin-bottom: .75rem; }
.done-box { text-align: center; padding: .5rem 0; }
.done-icon { width: 72px; height: 72px; margin: 0 auto .5rem; border-radius: 50%; background: var(--mj-primary-soft); color: var(--mj-primary); display: flex; align-items: center; justify-content: center; }
.done-number { font-weight: 700; color: var(--mj-muted); }
.detail-number { font-weight: 800; font-size: 1.15rem; }
.refresh-btn { min-height: 44px; width: 48px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* Caja */
.kpi { text-align: center; padding: 1.1rem 1rem; background: var(--mj-primary-soft); border-radius: var(--mj-radius); margin-bottom: .85rem; }
.kpi .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-primary-dark); font-weight: 700; }
.kpi .value { font-size: 2.2rem; font-weight: 800; color: var(--mj-primary-dark); line-height: 1.15; }
.diff-ok { color: var(--mj-primary-dark); }
.diff-bad { color: var(--mj-danger); }
.close-result { font-size: 1.3rem; font-weight: 800; margin-bottom: .5rem; }

@media (min-width: 576px) { .pos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) {
  .pos-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cart-bar { left: 274px; right: 24px; width: auto; bottom: 20px; max-width: 880px; margin: 0 auto; }
}

/* ======================= Ticket (impresión térmica) ======================= */
#print-root { display: none; }
@media print {
  @page { margin: 0; }
  html, body { background: #fff !important; height: auto; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .ticket { margin: 0; padding: 3mm; color: #000; background: #fff; font: 12px/1.35 "Courier New", ui-monospace, monospace; }
  .ticket.t58 { width: 58mm; }
  .ticket.t80 { width: 80mm; font-size: 13px; }
  .ticket .t-center { text-align: center; }
  .ticket .t-bold { font-weight: 700; }
  .ticket .t-title { font-size: 1.25em; font-weight: 800; text-transform: uppercase; margin-bottom: 2px; }
  .ticket .t-big { font-size: 1.2em; }
  .ticket .t-sub { padding-left: 4mm; font-size: .92em; }
  .ticket .t-copy { margin: 2px 0; letter-spacing: .08em; }
  .ticket .t-row { display: flex; justify-content: space-between; gap: 6px; }
  .ticket .t-row span:first-child { overflow-wrap: anywhere; }
  .ticket .t-line { border-top: 1px dashed #000; margin: 4px 0; }
}

/* ======================= Reporte diario ======================= */
.day-btn { width: 48px; padding: 0; flex: none; font-size: 1.4rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.method-row { padding: .5rem 0; }
.method-row + .method-row { border-top: 1px dashed var(--mj-border); }
.bar { height: 8px; border-radius: 4px; background: var(--mj-primary-soft); margin-top: .4rem; overflow: hidden; }
.bar-fill { height: 100%; background: var(--mj-primary); border-radius: 4px; }
.rank-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--mj-border); }
.rank-row:last-child { border-bottom: 0; }
.rank { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--mj-primary-soft); color: var(--mj-primary-dark); font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center; }
.cash-block { padding-top: .75rem; margin-top: .5rem; border-top: 1px solid var(--mj-border); }

/* ======================= Panel de la plataforma ======================= */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.stat { background: var(--mj-surface); border: 1px solid var(--mj-border); border-radius: var(--mj-radius); padding: .8rem 1rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--mj-muted); font-weight: 600; }
.stat-ok .stat-value { color: var(--mj-primary-dark); }
.stat-bad .stat-value { color: var(--mj-danger); }
.cred-box { background: var(--mj-primary-soft); border-radius: var(--mj-radius); padding: 1rem; }
.cred-value { font-weight: 700; overflow-wrap: anywhere; }
.cred-pass { font-family: "Courier New", ui-monospace, monospace; font-size: 1.5rem; letter-spacing: .06em; user-select: all; }
.btn-sm-tap { width: 44px; height: 44px; padding: 0; flex: none; display: inline-flex; align-items: center; justify-content: center; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ======================= Menú digital (pantalla del dueño) ======================= */
.chips-wrap { flex-wrap: wrap; overflow-x: visible; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-muted); font-weight: 700; margin: 1.25rem 0 .5rem; }
.qr-box { width: 220px; max-width: 100%; margin: 0 auto; border: 1px solid var(--mj-border); border-radius: 12px; overflow: hidden; background: #fff; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.qr-box svg { display: block; width: 100%; height: auto; }
.poster { display: none; }
@media print {
  .poster { display: block; text-align: center; color: #000; background: #fff; padding: 18mm 14mm; font-family: system-ui, "Segoe UI", Arial, sans-serif; }
  .poster h1 { font-size: 34pt; font-weight: 800; margin: 0 0 6mm; }
  .poster-lead { font-size: 22pt; margin: 0 0 8mm; }
  .poster-qr { width: 120mm; margin: 0 auto 8mm; }
  .poster-qr svg { display: block; width: 100%; height: auto; }
  .poster-info { font-size: 14pt; margin: 0 0 4mm; }
  .poster-link { font-size: 12pt; word-break: break-all; margin: 0; }
}

/* ======================= Cocina / despacho ======================= */
.k-board { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.k-board .empty { grid-column: 1 / -1; }
.k-card {
  background: var(--mj-surface); border: 1px solid var(--mj-border); border-left-width: 8px; border-radius: var(--mj-radius);
  padding: .85rem .9rem; display: flex; flex-direction: column; gap: .6rem;
}
.k-pending { border-left-color: #e0a100; }
.k-preparing { border-left-color: #1f6fd1; }
.k-ready { border-left-color: var(--mj-primary); }
.k-card.k-late { background: #fff8e6; }
.k-card.k-very-late { background: #fdeceb; border-color: #e8b4b0; }
.k-card.is-new { box-shadow: 0 0 0 3px rgba(179, 38, 30, .35); animation: k-pulse 1.2s ease-in-out 4; }
@keyframes k-pulse { 50% { box-shadow: 0 0 0 7px rgba(179, 38, 30, .15); } }
.k-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.k-num { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.k-cust { font-weight: 600; color: var(--mj-muted); overflow-wrap: anywhere; }
.k-time { margin-left: auto; font-weight: 700; color: var(--mj-muted); }
.k-late .k-time { color: #8a5200; }
.k-very-late .k-time { color: var(--mj-danger); }
.k-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: 1.1rem; }
.k-items li { display: flex; gap: .6rem; align-items: flex-start; }
.k-qty { font-weight: 800; min-width: 2.4rem; font-size: 1.25rem; }
.k-sub { font-size: .95rem; color: var(--mj-muted); }
.k-note { background: #fff1d6; border-radius: 10px; padding: .5rem .7rem; font-size: .95rem; }
.k-btn { min-height: 56px; font-size: 1.1rem; width: 100%; }
@media (min-width: 768px) { .k-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .k-board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ======================= Fotos de productos ======================= */
.thumb {
  position: relative; width: 56px; height: 56px; flex: none; border-radius: 12px; overflow: hidden;
  margin-left: .35rem; background: var(--mj-primary-soft);
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
.thumb img.loaded { opacity: 1; }
.thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--mj-muted); opacity: .7; }
.thumb-lg { width: 96px; height: 96px; margin-left: 0; }
.thumb-tile { width: 100%; height: auto; aspect-ratio: 4 / 3; margin-left: 0; border-radius: 10px; }
.pos-tile.has-img { justify-content: flex-start; padding: .45rem .45rem .7rem; }
.photo-row { display: flex; align-items: center; gap: .9rem; }
.photo-preview { width: 96px; height: 96px; flex: none; border-radius: 12px; overflow: hidden; background: var(--mj-primary-soft); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-actions { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; flex: 1; }
@media (prefers-reduced-motion: reduce) { .thumb img { transition: none; } }

/* ======================= Lector de códigos de barras y presentaciones ======================= */
.scan-btn { width: 48px; padding: 0; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.scan-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 46vh; background: #000; border-radius: 14px; overflow: hidden; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: rgba(255, 60, 60, .85); box-shadow: 0 0 8px rgba(255, 60, 60, .8); animation: scan-sweep 1.8s ease-in-out infinite alternate; }
@keyframes scan-sweep { from { top: 28%; } to { top: 72%; } }
.scan-torch { position: absolute; right: .5rem; top: .5rem; background: rgba(255, 255, 255, .85); }
.scan-status { margin-top: .6rem; padding: .55rem .8rem; border-radius: 10px; background: #eef2ef; font-weight: 600; text-align: center; min-height: 2.6rem; }
.scan-status.good { background: var(--mj-primary-soft); color: var(--mj-primary-dark); }
.scan-status.bad { background: #fde7e5; color: #7d1b15; }
@media (prefers-reduced-motion: reduce) { .scan-line { animation: none; } }
.variant-box { padding: .5rem 0 .25rem; border-bottom: 1px dashed var(--mj-border); margin-bottom: .5rem; }
.variant-box .variant-row { align-items: flex-start; }
.variant-row .vr-units { flex: 0 0 24%; min-width: 0; }
.variant-row .vr-code { flex: 1 1 auto; min-width: 0; }

/* ======================= Inventario ======================= */
.stock-box { text-align: center; padding: 0 .6rem; flex: none; min-width: 64px; }
.stock-num { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stock-num.low, .stock-big.low { color: var(--mj-danger); }
.stock-lbl { font-size: .72rem; color: var(--mj-muted); font-weight: 600; }
.item-card.low-card { border-color: #e8b4b0; background: #fff8f7; }
.stock-head { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .25rem 0 .75rem; }
.stock-big { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.stock-big small { font-size: 1rem; font-weight: 600; color: var(--mj-muted); }
.stock-actions { display: grid; grid-template-columns: 1fr; gap: .5rem; }
@media (min-width: 576px) { .stock-actions { grid-template-columns: repeat(3, 1fr); } }
.mv-row { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px dashed var(--mj-border); }
.mv-row:last-child { border-bottom: 0; }
.mv-qty { text-align: right; flex: none; }
.pos-tile .t-low { font-size: .75rem; font-weight: 700; color: var(--mj-danger); }

/* ======================= Modal de confirmación reutilizable (modal.js) ======================= */
.mj-modal-backdrop {
  position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .18s ease;
}
.mj-modal-backdrop.show { opacity: 1; }
.mj-modal {
  width: 100%; max-width: 380px; background: var(--mj-surface); border-radius: 20px; padding: 1.5rem 1.25rem 1.1rem;
  text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); transform: translateY(12px) scale(.97); transition: transform .18s ease;
}
.mj-modal-backdrop.show .mj-modal { transform: none; }
.mj-modal-icon { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto .8rem; display: flex; align-items: center; justify-content: center; }
.tone-primary .mj-modal-icon { background: var(--mj-primary-soft); color: var(--mj-primary-dark); }
.tone-danger .mj-modal-icon { background: #fde7e5; color: var(--mj-danger); }
.tone-warning .mj-modal-icon { background: #fff1d6; color: #8a5200; }
.mj-modal h2 { font-size: 1.2rem; font-weight: 800; margin: 0 0 .4rem; }
.mj-modal p { color: var(--mj-muted); margin: 0 0 1.1rem; overflow-wrap: anywhere; }
.mj-modal-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.mj-modal-actions .btn { flex: 1; }
body.modal-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .mj-modal-backdrop, .mj-modal { transition: none; } }
