/* ============================================================
   Multinegocios NJJ — estilos base (v2, look moderno)
   ============================================================ */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f2f3f9;
  --surface-3: #eaecf6;
  --border: #e6e8f2;
  --border-strong: #d8dbe8;
  --text: #14162b;
  --text-muted: #6b7085;
  --text-faint: #9698ab;

  --accent: #6d5bf6;
  --accent-2: #8b6bfb;
  --accent-soft: #f0edfe;
  --accent-contrast: #ffffff;
  --accent-gradient: linear-gradient(135deg, #6d5bf6 0%, #9a5bf6 100%);

  --success: #17a673;
  --success-soft: #e8f9f2;
  --danger: #e6415f;
  --danger-soft: #fdecef;
  --warning: #e08a1f;
  --warning-soft: #fdf3e4;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow-xs: 0 1px 2px rgba(20, 20, 55, 0.04);
  --shadow-sm: 0 2px 8px rgba(20, 20, 55, 0.05), 0 1px 2px rgba(20, 20, 55, 0.04);
  --shadow: 0 8px 24px -6px rgba(30, 24, 90, 0.10), 0 2px 6px rgba(30, 24, 90, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(30, 24, 90, 0.20);

  --sidebar-w: 252px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Temas por categoría — se pueden editar desde Ajustes,
     estas son solo los valores por defecto. */
  --cat-ropa_bebe-color: #ec4899;
  --cat-ropa_bebe-bg: #fdf1f8;
  --cat-hidraulico-color: #2f6fed;
  --cat-hidraulico-bg: #eef4ff;
  --cat-otros-color: #6b7085;
  --cat-otros-bg: #f1f2f7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; letter-spacing: -0.006em; }

a { color: inherit; }

h1, h2, h3 { letter-spacing: -0.02em; }

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

::selection { background: var(--accent-soft); color: var(--accent); }

/* thin, unobtrusive scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 18px;
}

.sidebar-brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 14px -4px rgba(109, 91, 246, 0.55);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand .logo img,
.pub-logo img {
  display: block;
}

.sidebar-brand .brand-text {
  line-height: 1.25;
  min-width: 0;
}

.sidebar-brand .brand-text strong {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand .brand-text span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 6px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-icon svg { width: 100%; height: 100%; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.data-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  width: 100%;
}

.data-mode-pill.demo { color: var(--warning); }
.data-mode-pill.live { color: var(--success); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
  flex-shrink: 0;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: none;
  padding: 8px;
  border-radius: var(--radius-xs);
  width: 34px;
  height: 34px;
}

.menu-toggle svg { width: 18px; height: 18px; }

.menu-toggle:hover { background: var(--surface-3); }

.topbar h1 {
  font-size: 18.5px;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.topbar .topbar-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.content {
  padding: 26px 28px 70px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; animation: fadein 0.2s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Reusable pieces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card + .card { margin-top: 18px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-header h2 { font-size: 16px; margin: 0; font-weight: 700; }
.card-header h3 { font-size: 14px; margin: 0; font-weight: 700; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-tile .stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-tile .stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-tile .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-icon svg { width: 17px; height: 17px; }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease, box-shadow 0.12s ease;
}

.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 6px 16px -6px rgba(109, 91, 246, 0.6);
}

.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 20px -6px rgba(109, 91, 246, 0.7); }

.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); border-color: #f8ccd4; }

.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: var(--radius-xs); }

.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field textarea { resize: vertical; min-height: 60px; }

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 9px 13px;
  flex: 1;
  min-width: 180px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.search-box svg { width: 16px; height: 16px; color: var(--text-faint); flex-shrink: 0; }

.search-box input {
  border: none;
  outline: none;
  flex: 1;
  background: transparent;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }

tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--surface-2); }

.empty-state {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 26px;
  margin-bottom: 10px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 45, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 100;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.16s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 { margin: 0; font-size: 16.5px; font-weight: 700; }

.modal-close {
  background: var(--surface-2);
  border: none;
  font-size: 15px;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--surface-3); color: var(--text); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: var(--text);
  color: white;
  padding: 11px 18px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: fadein 0.15s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Categoría — tinte por sección */
[data-cat="ropa_bebe"] { --cat-color: var(--cat-ropa_bebe-color); --cat-bg: var(--cat-ropa_bebe-bg); }
[data-cat="hidraulico"] { --cat-color: var(--cat-hidraulico-color); --cat-bg: var(--cat-hidraulico-bg); }
[data-cat="otros"] { --cat-color: var(--cat-otros-color); --cat-bg: var(--cat-otros-bg); }

.cat-badge {
  background: var(--cat-bg);
  color: var(--cat-color);
}

.cat-tab {
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.cat-tab.active {
  background: var(--cat-bg);
  color: var(--cat-color);
  border-color: var(--cat-color);
}

.product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.product-card .product-img {
  aspect-ratio: 4 / 3;
  background: linear-gradient(155deg, var(--cat-bg, var(--surface-2)) 0%, var(--surface) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  overflow: hidden;
}

.product-card .product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .product-body { padding: 13px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.product-card .product-name { font-weight: 600; font-size: 13px; }
.product-card .product-price { font-size: 15.5px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.product-card .product-stock { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* Sidebar mobile */
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 13, 35, 0.35);
    backdrop-filter: blur(1px);
    z-index: 30;
  }
  .sidebar-scrim.open { display: block; }
}

.helper-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Flipbook ---------- */

#flipbookStage {
  perspective: 1600px;
  display: flex;
  justify-content: center;
}

.flip-anim {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  animation: flipIn 0.35s ease;
  transform-origin: left center;
}

@keyframes flipIn {
  from { transform: rotateY(-10deg); opacity: 0.3; }
  to { transform: rotateY(0deg); opacity: 1; }
}

/* ---------- Vista de "doble página" (libro abierto) ----------
   El "escenario" siempre respeta la misma relación de aspecto tipo
   revista (3:2 abierto / 3:4 por página), como una revista física:
   así la portada sola y el libro abierto se ven proporcionados y
   del mismo tamaño entre sí, sin importar cuánto contenido tenga
   cada página. ------------------------------------------------- */

.flipbook-spread {
  display: flex;
  align-items: stretch;
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}

.flipbook-spread--single {
  width: 50%;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
}

.flipbook-spread:not(.flipbook-spread--single)::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  width: 20px;
  margin-left: -10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.14), rgba(0,0,0,0) 35%, rgba(0,0,0,0) 65%, rgba(0,0,0,0.14));
  z-index: 2;
  pointer-events: none;
}

.flip-page-slot {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.flipbook-spread:not(.flipbook-spread--single) .flip-page-slot:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.flipbook-spread:not(.flipbook-spread--single) .flip-page-slot:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.flipbook-spread--single .flip-page-slot { border-radius: var(--radius); }

.flip-page-slot .flip-page,
.flip-page-slot .flip-page--photo,
.flip-page-slot .flip-page--center {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow-y: auto;
}

.flip-page-slot .flip-page::before { display: none; }

@media (max-width: 720px) {
  .flip-anim { max-width: 420px; }
  .flipbook-spread:not(.flipbook-spread--single) {
    flex-direction: column;
    aspect-ratio: auto;
  }
  .flipbook-spread:not(.flipbook-spread--single) .flip-page-slot {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 3 / 4;
    height: auto;
  }
  .flipbook-spread:not(.flipbook-spread--single) .flip-page-slot:first-child { border-radius: var(--radius) var(--radius) 0 0; }
  .flipbook-spread:not(.flipbook-spread--single) .flip-page-slot:last-child { border-radius: 0 0 var(--radius) var(--radius); }
  .flipbook-spread:not(.flipbook-spread--single)::before { display: none; }
  .flipbook-spread--single { width: 100%; }
}

/* ---------- Paginador inferior del flipbook ---------- */

.flipbook-pager-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.flipbook-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.flipbook-pager-nums {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px;
}

.flipbook-pager-num {
  min-width: 34px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.flipbook-pager-num:hover { border-color: var(--border-strong); }

.flipbook-pager-num.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.flip-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 30px;
  min-height: 360px;
  position: relative;
  box-sizing: border-box;
}

.flip-page::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(115deg, rgba(255,255,255,0.5), transparent 30%);
  pointer-events: none;
}

.flip-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 360px;
  background: var(--accent-gradient);
  color: white;
}

.flip-cover h2, .flip-cover h3 { color: white; }
.flip-cover p { color: rgba(255,255,255,0.85); }

.flip-page--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 380px;
  padding: 36px 30px;
  box-sizing: border-box;
}

.flip-page--photo {
  padding: 0;
  overflow: hidden;
  min-height: 420px;
  position: relative;
  display: flex;
  box-sizing: border-box;
}

.flip-page--photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.flip-page-photo-placeholder {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-faint);
  font-size: 28px;
  text-align: center;
}

/* Dentro del "escenario" de doble página, la altura la da el aspect-ratio
   del spread, no estos mínimos (pensados solo como resguardo si el bloque
   se usa suelto). */
.flip-page-slot .flip-page--center,
.flip-page-slot .flip-page--photo,
.flip-page-slot .flip-page-photo-placeholder {
  min-height: 0;
}

.flip-page-photo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 24px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  font-size: 17px;
  font-weight: 700;
}

.product-card--lg .product-img { aspect-ratio: 16 / 11; font-size: 56px; }
.product-card--lg .product-name { font-size: 16px; }
.product-card--lg .product-price { font-size: 20px; }

/* ---------- Editor de páginas del flipbook ---------- */

.flip-page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.flip-page-row:hover { border-color: var(--border-strong); }
.flip-page-row.active { border-color: var(--accent); background: var(--accent-soft); }

.flip-page-row-label {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flip-page-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.flip-page-row-actions .btn { padding: 4px 8px; }

/* ---------- Pantalla completa ---------- */

.flipbook-stage-outer { position: relative; }

.flipbook-stage-outer:fullscreen,
.flipbook-stage-outer.pseudo-fullscreen {
  background: #0d0d16;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 500;
}

.flipbook-stage-outer:fullscreen #flipbookStage,
.flipbook-stage-outer.pseudo-fullscreen #flipbookStage {
  width: 100%;
}

.flipbook-stage-outer:fullscreen .flip-anim,
.pseudo-fullscreen .flip-anim {
  width: min(92vw, calc(78vh * 1.5), 1400px);
  max-width: none;
}

.flip-fullscreen-exit {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255,255,255,0.14);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12.5px;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.flip-fullscreen-exit:hover { background: rgba(255,255,255,0.24); }

.flipbook-stage-outer:fullscreen #flipbookPagerBar,
.flipbook-stage-outer:fullscreen #pubPagerBar,
.pseudo-fullscreen #flipbookPagerBar,
.pseudo-fullscreen #pubPagerBar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  width: auto;
  max-width: calc(100% - 40px);
  background: rgba(15,15,25,0.55);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 8px 16px;
  z-index: 6;
}

.flipbook-stage-outer:fullscreen #flipbookPagerBar .flipbook-pager,
.flipbook-stage-outer:fullscreen #pubPagerBar .flipbook-pager,
.pseudo-fullscreen #flipbookPagerBar .flipbook-pager,
.pseudo-fullscreen #pubPagerBar .flipbook-pager {
  width: auto;
}

.flipbook-stage-outer:fullscreen #flipbookPagerBar .btn,
.flipbook-stage-outer:fullscreen #pubPagerBar .btn,
.pseudo-fullscreen #flipbookPagerBar .btn,
.pseudo-fullscreen #pubPagerBar .btn {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: none;
}

.flipbook-stage-outer:fullscreen #flipbookPagerBar .flipbook-pager-num,
.flipbook-stage-outer:fullscreen #pubPagerBar .flipbook-pager-num,
.pseudo-fullscreen #flipbookPagerBar .flipbook-pager-num,
.pseudo-fullscreen #pubPagerBar .flipbook-pager-num {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.85);
}

.flipbook-stage-outer:fullscreen #flipbookPagerBar .flipbook-pager-num.active,
.flipbook-stage-outer:fullscreen #pubPagerBar .flipbook-pager-num.active,
.pseudo-fullscreen #flipbookPagerBar .flipbook-pager-num.active,
.pseudo-fullscreen #pubPagerBar .flipbook-pager-num.active {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.section-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-tab-btn {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.12s ease;
}

.section-tab-btn.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

/* ============================================================
   Punto de venta (Registrar venta) — buscador retraíble a la
   izquierda + carrito a la derecha, con el logo del negocio activo
   como marca de agua de fondo.
   ============================================================ */

.pos-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
}

.pos-watermark img {
  width: 320px;
  height: 320px;
  object-fit: contain;
  filter: grayscale(0.35);
}

.pos-watermark-icon {
  font-size: 220px;
  line-height: 1;
  opacity: 0.6;
}

.pos-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
  transition: grid-template-columns 0.22s ease;
}

.pos-layout.pos-collapsed {
  grid-template-columns: 0px 1fr;
}

.pos-layout.pos-collapsed .pos-search-panel {
  opacity: 0;
  pointer-events: none;
  padding: 0;
  border-width: 0;
  overflow: hidden;
}

.pos-search-panel {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: var(--surface);
  transition: opacity 0.15s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pos-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
}

.pos-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.pos-result-item:hover { border-color: var(--accent); background: var(--accent-soft); }

.pos-result-name {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-result-add {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}

.pos-result-add:hover { background: var(--accent-2); }

.pos-cart-panel {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 14px;
  background: var(--surface);
  min-width: 0;
}

.pos-cart-panel > *:not(.pos-watermark) {
  position: relative;
  z-index: 1;
}

.pos-cart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.pos-cart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
}

.pos-cart-item-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-cart-item-qty {
  width: 54px;
  padding: 5px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  text-align: center;
  flex-shrink: 0;
}

.pos-cart-item-price {
  font-size: 12px;
  color: var(--text-muted);
  width: 68px;
  text-align: right;
  flex-shrink: 0;
}

.pos-cart-item-sub {
  font-size: 12.5px;
  font-weight: 700;
  width: 76px;
  text-align: right;
  flex-shrink: 0;
}

.pos-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  font-size: 15px;
  font-weight: 700;
  border-top: 1.5px dashed var(--border);
  margin: 10px 0;
}

@media (max-width: 860px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-layout:not(.pos-collapsed) .pos-search-panel { margin-bottom: 4px; }
  .pos-layout.pos-collapsed .pos-search-panel { display: none; }
  .pos-results { max-height: 260px; }
}
