/* =============================================
   VENDLY — Custom Styles
   ============================================= */

:root {
  --primary: #00BCD4;
  --secondary: #FF6B00;
  --sidebar-bg: #1a1f2e;
  --sidebar-width: 64px;
  --sidebar-collapsed: 64px;
  --sidebar-expanded: 220px;
  --text-primary: #111827;
  --surface-2: #fff;
  --border: #E5E7EB;
  --content-bg: #F5F7FA;
  --success: #28A745;
  --danger: #DC3545;
  --warning: #FFC107;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --transition: all 0.25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', sans-serif;
  background: var(--content-bg);
  color: #333;
  overflow-x: hidden;
}

/* ---- WRAPPER ---- */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  max-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #2e3f52 var(--sidebar-bg);
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
#sidebar::-webkit-scrollbar-thumb { background: #2e3f52; border-radius: 2px; }

#sidebar.collapsed { width: var(--sidebar-collapsed); }
#sidebar.collapsed .sidebar-logo-text,
#sidebar.collapsed .sidebar-user-info,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .submenu-arrow,
#sidebar.collapsed .sidebar-submenu { display: none !important; }

#sidebar.collapsed .sidebar-user { justify-content: center; }
#sidebar.collapsed .sidebar-user img { margin: 0; }
#sidebar.collapsed .nav-item-link { justify-content: center; padding: 12px; }
#sidebar.collapsed .nav-item-link .nav-icon { margin: 0; font-size: 1.3rem; }

/* Logo */
.sidebar-logo {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  min-height: 64px;
  flex-shrink: 0;
}

.sidebar-logo-icon {
  font-size: 1.6rem;
  color: var(--secondary);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
  white-space: nowrap;
}

/* User profile in sidebar */
.sidebar-user {
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-user img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--primary);
}

.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.72rem;
  color: #a0aec0;
  white-space: nowrap;
}
.sidebar-user-store {
  font-size: 0.72rem;
  color: #a0aec0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-user-store .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #28d68a;
  display: inline-block;
  flex-shrink: 0;
}

/* Nav */
.sidebar-nav {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.nav-item { position: relative; }

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: #c0cfe0;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item-link:hover {
  background: rgba(0,188,212,0.12);
  color: #fff;
  border-left-color: var(--primary);
}

.nav-item-link.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-left-color: var(--primary);
}

.nav-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.nav-label {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  flex: 1;
}

.submenu-arrow {
  font-size: 0.7rem;
  transition: transform 0.25s;
  flex-shrink: 0;
}

.nav-item-link[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}

/* Submenu — Bootstrap .collapse handles display */
.sidebar-submenu {
  list-style: none;
  background: rgba(0,0,0,0.15);
  padding: 4px 0;
}

.sidebar-submenu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 48px;
  color: #90a4b8;
  text-decoration: none;
  font-size: 0.79rem;
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar-submenu li a:hover { color: #fff; background: rgba(0,188,212,0.1); }
.sidebar-submenu li a.active { color: var(--primary); font-weight: 600; }
.sidebar-submenu li a::before {
  content: '•';
  color: var(--primary);
  font-size: 0.6rem;
  flex-shrink: 0;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
#main-content {
  margin-left: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

/* =============================================
   HEADER
   ============================================= */
.top-header {
  position: sticky;
  top: 0;
  z-index: 1040;
  background: #fff;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.btn-sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #555;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-sidebar-toggle:hover { background: var(--content-bg); color: var(--primary); }

.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1E2A38;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-icon-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #555;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 8px;
  transition: var(--transition);
  text-decoration: none;
  display: flex;
  align-items: center;
}

.header-icon-btn:hover { background: var(--content-bg); color: var(--primary); }

.header-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  border-radius: 8px;
  padding: 1px 4px;
  line-height: 1.2;
  min-width: 16px;
  text-align: center;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: #333;
}

.header-user:hover { background: var(--content-bg); }

.header-user img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.header-user-name { font-size: 0.82rem; font-weight: 600; }

/* =============================================
   PAGE CONTENT
   ============================================= */
.page-content {
  flex: 1;
  min-width: 0;
  padding: 24px 20px;
}

.page { display: none; }
.page.active { display: block; }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  display: none;
}

/* =============================================
   CARDS
   ============================================= */
.vcard {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 20px;
  transition: var(--transition);
}

.vcard:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }

.vcard-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1E2A38;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Stat mini cards */
.stat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  color: inherit;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  color: inherit;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}

.stat-icon.orange { background: var(--secondary); }
.stat-icon.green { background: var(--success); }
.stat-icon.purple { background: #7c3aed; }
.stat-icon.red { background: var(--danger); }

.stat-info { overflow: hidden; }

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1E2A38;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Notif cards */
.notif-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border-top: 3px solid var(--primary);
  text-decoration: none;
  color: inherit;
  display: block;
}

.notif-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); color: inherit; }

.notif-card .notif-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
}

.notif-card .notif-number.red { color: var(--danger); }

.notif-card .notif-icon {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 6px;
  display: block;
}

.notif-card .notif-label { font-size: 0.78rem; color: #6c757d; font-weight: 500; }

/* General count cards */
.count-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 20px 16px;
  text-align: center;
  transition: var(--transition);
}

.count-card:hover { transform: translateY(-2px); }

.count-number {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.count-label { font-size: 0.78rem; color: #6c757d; margin-top: 4px; font-weight: 500; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary-custom {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary-custom:hover { background: #0097a7; color: #fff; }

.btn-success-custom {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-success-custom:hover { background: #218838; color: #fff; }

.btn-secondary-custom {
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-secondary-custom:hover { background: #545b62; color: #fff; }

.btn-danger-custom {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-danger-custom:hover { background: #c82333; color: #fff; }

/* =============================================
   TABLES
   ============================================= */
.table-wrapper {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 20px;
}

.table-wrapper .tutorial-hint {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 14px;
}

.table-wrapper .tutorial-hint a { color: var(--primary); }

table.dataTable thead th {
  background: #f8f9fa;
  color: #1E2A38;
  font-size: 0.79rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid #dee2e6 !important;
  white-space: nowrap;
}

table.dataTable tbody tr:hover { background: rgba(0,188,212,0.04); }

table.dataTable tbody td { font-size: 0.83rem; vertical-align: middle; }

.badge-type {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-type.simple { background: #e3f8fb; color: #0097a7; }
.badge-type.compuesto { background: #fff3e0; color: #e65100; }
.badge-type.servicio { background: #e8f5e9; color: #2e7d32; }

.product-img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: #eee;
}

/* Action dropdown */
.action-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.action-btn:hover { background: #0097a7; }

/* =============================================
   FOOTER
   ============================================= */
.app-footer {
  background: #fff;
  border-top: 1px solid #e9ecef;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #6c757d;
}

.footer-plan {
  background: var(--primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* =============================================
   POS / CREATE SALE
   ============================================= */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  min-height: calc(100vh - 180px);
}

.pos-left { display: flex; flex-direction: column; gap: 14px; }
.pos-right { display: flex; flex-direction: column; gap: 14px; }

.pos-search-bar {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.pos-search-bar input {
  flex: 1;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.87rem;
  outline: none;
  transition: var(--transition);
}

.pos-search-bar input:focus { border-color: var(--primary); }

.pos-cart {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 16px;
  flex: 1;
}

.pos-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.pos-cart-item:last-child { border-bottom: none; }

.pos-total-card {
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  padding: 20px;
}

.pos-total-card .total-label { font-size: 0.82rem; opacity: 0.85; }
.pos-total-card .total-value { font-size: 2rem; font-weight: 800; }

/* =============================================
   FORMS
   ============================================= */
.form-label-custom {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1E2A38;
  margin-bottom: 5px;
}

.form-control-custom {
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  width: 100%;
  outline: none;
  transition: var(--transition);
  background: #fff;
}

.form-control-custom:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,188,212,0.15); }

/* =============================================
   CHARTS
   ============================================= */
.chart-container { position: relative; }

/* =============================================
   OVERLAY (mobile sidebar)
   ============================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1049;
}

.sidebar-overlay.show { display: block; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991px) {
  #main-content { margin-left: 0 !important; }
  .pos-layout { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
  .page-content { padding: 14px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header > div { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .page-header { margin-bottom: 12px; }

  /* Stat-cards compactas globalmente en mobile */
  .stat-card { padding: 10px 10px; gap: 8px; }
  .stat-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 8px; }
  .stat-value { font-size: 1rem; }
  .stat-label { font-size: 0.68rem; }

  /* Botones en page-header: fila con Crear flex-grow y Acciones compacto */
  .page-header > div { flex-wrap: nowrap; }
  .page-header .btn-success-custom { flex: 1; justify-content: center; width: auto; }
  .page-header .btn-primary-custom,
  .page-header .btn-danger-custom  { flex-shrink: 0; width: auto; }
  .page-header .dropdown { flex-shrink: 0; }

  /* Header */
  .header-user-name { display: none; }
  #countryBadge { display: none !important; }
  .header-actions { gap: 2px; }
  .header-icon-btn { padding: 5px 6px; font-size: 1.1rem; }
  .top-header { padding: 0 10px; gap: 6px; }
  .header-title { font-size: 0.95rem; }

  /* Cards y tablas */
  .vcard { padding: 14px 12px; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* DataTables: controles alineados y compactos en mobile */
  .dataTables_length { text-align: left !important; }
  .dataTables_filter { text-align: right !important; }
  .dataTables_filter input { width: 110px !important; }
  .dataTables_info, .dataTables_paginate { text-align: center !important; font-size: 0.78rem; }

  /* Balance sub-tabs compactos en mobile */
  #blSubTabs .bl-subtab { padding: 7px 10px; font-size: 0.78rem; }

  /* KPI stat-cards compactas en mobile */
  #blKpiRow .stat-card { padding: 10px 8px; gap: 7px; flex-direction: column; align-items: flex-start; border-radius: 10px; }
  #blKpiRow .stat-icon { width: 34px; height: 34px; font-size: 1rem; border-radius: 8px; }
  #blKpiRow .stat-value { font-size: 0.85rem; }
  #blKpiRow .stat-label { font-size: 0.62rem; white-space: normal; line-height: 1.2; }

  /* Balance: tabs de filtro scroll horizontal en mobile */
  .bl-sales-tabs-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .bl-sales-tabs-row::-webkit-scrollbar { display: none; }

}

/* =============================================
   UTILITIES
   ============================================= */
.gap-2 { gap: 8px; }
@media (min-width: 576px) {
  .w-sm-auto { width: auto !important; }
  .flex-sm-row { flex-direction: row !important; }
  .bl-sales-tabs-row { flex-wrap: wrap; }
}
@media (min-width: 992px) {
  .w-lg-auto { width: auto !important; }
  .d-lg-grid { display: grid !important; }
}
/* Balance: botones de acción — siempre flex row */
.bl-actions-grid { display: flex; flex-direction: row; gap: 8px; flex-wrap: wrap; }

/* Balance: tabs de filtro — estilos globales */
.bl-stab {
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: #e9ecef;
  color: #495057;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.bl-stab:hover { background: #dee2e6; }
.bl-stab.active { background: #00BCD4; color: #fff; }
.bl-sales-tabs-row { display: flex; gap: 6px; flex-wrap: wrap; }

.text-primary-custom { color: var(--primary); }
.text-secondary-custom { color: var(--secondary); }
.fw-800 { font-weight: 800; }
.rounded-custom { border-radius: 12px; }
.mb-section { margin-bottom: 24px; }
@media (max-width: 575px) { .mb-section { margin-bottom: 12px; } }

/* Loading shimmer */
@keyframes shimmer {
  0% { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

.shimmer {
  background: linear-gradient(to right, #f0f0f0 8%, #e0e0e0 18%, #f0f0f0 33%);
  background-size: 800px 104px;
  animation: shimmer 1.2s linear infinite;
  border-radius: 8px;
}

/* Select2 override */
.select2-container--default .select2-selection--single {
  border: 1.5px solid #dee2e6 !important;
  border-radius: 8px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: normal !important;
  padding: 0 14px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 38px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0,188,212,0.15) !important;
}

/* DataTables override */
div.dataTables_wrapper div.dataTables_length select {
  border: 1.5px solid #dee2e6;
  border-radius: 6px;
  padding: 4px 8px;
}

div.dataTables_wrapper div.dataTables_filter input {
  border: 1.5px solid #dee2e6;
  border-radius: 6px;
  padding: 5px 10px;
  outline: none;
}

div.dataTables_wrapper div.dataTables_filter input:focus {
  border-color: var(--primary);
}

.dataTables_paginate .paginate_button {
  border-radius: 6px !important;
  padding: 4px 10px !important;
}

.dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

/* Sidebar divider */
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 6px 14px;
}

/* Tooltip for collapsed sidebar */
#sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: #1E2A38;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* =============================================
   SIDEBAR NUEVO (v2)
   ============================================= */
#sidebar.sidebar-new {
  width: 64px; height: 100vh; position: sticky; top: 0; min-height: 100vh;
  background: #1a1f2e; display: flex; flex-direction: column;
  overflow: hidden; transition: width 0.25s ease; flex-shrink: 0; z-index: 100;
}
#sidebar.sidebar-new:hover { width: 220px; }
.sidebar-logo-wrap {
  display: flex; align-items: center; gap: 10px; padding: 16px 14px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08); flex-shrink: 0; min-height: 60px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px; border-radius: 9px; background: rgba(0,188,212,0.15);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo-text { color: #fff; font-size: 16px; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity 0.15s; }
#sidebar.sidebar-new:hover .sidebar-logo-text { opacity: 1; }
.sidebar-tenant {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08); flex-shrink: 0;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #00bcd4;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #1a1f2e; flex-shrink: 0; text-transform: uppercase;
}
.sidebar-tenant-info { display: flex; flex-direction: column; opacity: 0; transition: opacity 0.15s; white-space: nowrap; overflow: hidden; min-width: 0; }
#sidebar.sidebar-new:hover .sidebar-tenant-info { opacity: 1; }
.sidebar-tenant-name { font-size: 13px; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.sidebar-tenant-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.sidebar-items { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0; scrollbar-width: none; }
.sidebar-items::-webkit-scrollbar { display: none; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 6px 14px; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  color: rgba(255,255,255,0.5); text-decoration: none !important;
  font-size: 13px; cursor: pointer; white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.sidebar-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); text-decoration: none; }
.sidebar-item.active { background: rgba(0,188,212,0.12); color: #00bcd4; }
.sidebar-item i { font-size: 19px; flex-shrink: 0; width: 38px; text-align: center; }
.sidebar-item span { opacity: 0; transition: opacity 0.15s; overflow: hidden; flex: 1; }
#sidebar.sidebar-new:hover .sidebar-item span { opacity: 1; }
.sidebar-group-trigger {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  color: rgba(255,255,255,0.5); font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: background 0.12s, color 0.12s; user-select: none;
}
.sidebar-group-trigger:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.sidebar-group-trigger i:first-child { font-size: 19px; flex-shrink: 0; width: 38px; text-align: center; }
.sidebar-group-trigger span { opacity: 0; transition: opacity 0.15s; flex: 1; overflow: hidden; }
#sidebar.sidebar-new:hover .sidebar-group-trigger span { opacity: 1; }
.sidebar-chevron { font-size: 14px !important; width: auto !important; margin-left: auto; flex-shrink: 0; transition: transform 0.2s, opacity 0.15s; opacity: 0; }
#sidebar.sidebar-new:hover .sidebar-chevron { opacity: 1; }
.sidebar-group.open .sidebar-chevron { transform: rotate(90deg); }
.sidebar-submenu { display: none; overflow: hidden; }
.sidebar-group.open .sidebar-submenu { display: block; }
.sidebar-subitem {
  display: block; padding: 6px 14px 6px 46px; color: rgba(255,255,255,0.55);
  font-size: 12px; text-decoration: none !important; white-space: nowrap;
  transition: color 0.12s, background 0.12s;
  border-left: 2px solid transparent; margin-left: 18px;
}
.sidebar-subitem:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.05); border-left-color: rgba(0,188,212,0.4); text-decoration: none; }
.sidebar-subitem.active { color: #00bcd4; border-left-color: #00bcd4; }
.sidebar-badge { font-style: normal; font-size: 10px; padding: 2px 6px; border-radius: 999px; background: rgba(0,188,212,0.2); color: #00bcd4; margin-left: 4px; }
.sidebar-plan-badge { display: none; }
@media (max-width: 991px) {
  #sidebar.sidebar-new {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 1050;
    width: 220px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  #sidebar.sidebar-new.mobile-open {
    transform: translateX(0);
  }
  #sidebar.sidebar-new.mobile-open .sidebar-logo-text,
  #sidebar.sidebar-new.mobile-open .sidebar-tenant-info,
  #sidebar.sidebar-new.mobile-open .sidebar-item span,
  #sidebar.sidebar-new.mobile-open .sidebar-group-trigger span,
  #sidebar.sidebar-new.mobile-open .sidebar-chevron,
  #sidebar.sidebar-new.mobile-open .sidebar-plan-badge { opacity: 1; }
}

/* =============================================
   DASHBOARD NUEVO (v2)
   ============================================= */
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.dash-date { font-size: 12px; color: #9CA3AF; margin: 0 0 3px; text-transform: capitalize; }
.dash-title { font-size: 22px; font-weight: 600; color: var(--text-primary); margin: 0; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-btn-outline { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-primary); cursor: pointer; transition: background 0.15s; }
.dash-btn-outline:hover { background: #f3f4f6; }
.dash-btn-primary { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: none; background: #00bcd4; font-size: 13px; font-weight: 500; color: #1a1f2e; cursor: pointer; transition: opacity 0.15s; }
.dash-btn-primary:hover { opacity: 0.88; }
.dash-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .dash-kpis { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .dash-kpis { grid-template-columns: repeat(2,1fr); gap: 8px; margin-bottom: 12px; } }
.dash-kpi { background: var(--surface-2); border-radius: 14px; padding: 18px; border: 1px solid #F3F4F6; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.dash-kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.dash-kpi-val { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.dash-kpi-label { font-size: 12px; color: #9CA3AF; }
@media (max-width: 480px) {
  .dash-kpi { padding: 12px; border-radius: 10px; }
  .dash-kpi-icon { width: 30px; height: 30px; font-size: 14px; margin-bottom: 8px; }
  .dash-kpi-icon i { font-size: 15px !important; }
  .dash-kpi-val { font-size: 15px; }
  .dash-kpi-label { font-size: 11px; }
}
/* Stat-cards compactas en sección de ganancias */
@media (max-width: 575px) {
  .stat-card.dash-kpi-sm { padding: 8px 6px; gap: 6px; flex-direction: column; align-items: flex-start; }
  .dash-kpi-sm-val { font-size: 0.78rem !important; line-height: 1.2; }
  .stat-card.dash-kpi-sm .stat-label { font-size: 0.6rem; }
}
/* Weekly KPI grid: siempre 3 cols, texto reducido en mobile */
.weekly-kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 575px) {
  .weekly-kpi-grid { gap: 6px; }
  .weekly-kpi-grid .stat-card { padding: 8px; gap: 6px; flex-direction: column; align-items: flex-start; }
  .weekly-kpi-grid .stat-icon { width: 28px; height: 28px; font-size: 0.8rem; border-radius: 7px; margin-bottom: 2px; }
  .weekly-kpi-grid .stat-value { font-size: 0.72rem; line-height: 1.2; }
  .weekly-kpi-grid .stat-label { font-size: 0.58rem; }
}
/* Ganancia Real — KPIs 5 columnas desktop, 3 mobile, 2 xs */
.gr-kpis-5 { grid-template-columns: repeat(5,1fr) !important; }
@media (max-width: 900px) { .gr-kpis-5 { grid-template-columns: repeat(3,1fr) !important; } }
@media (max-width: 480px) { .gr-kpis-5 { grid-template-columns: repeat(2,1fr) !important; } }
/* Ganancia Real — grid inferior: lado a lado desktop, apilado mobile */
.gr-bottom-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
@media (max-width: 767px) { .gr-bottom-grid { grid-template-columns: 1fr; } }
/* Ganancia Real — header con selects: fila en desktop, columna en mobile */
@media (max-width: 575px) {
  #page-ganancia-real .dash-header { flex-direction: column; align-items: flex-start; }
  #page-ganancia-real .dash-actions { width: 100%; flex-wrap: wrap; }
  #page-ganancia-real .dash-actions .form-select { flex: 1 1 100px; }
  #page-ganancia-real .dash-actions .dash-btn-primary { flex: 1 1 100%; justify-content: center; }
}
/* Count-cards compactas en mobile (4 en fila, col-3) */
@media (max-width: 575px) {
  .count-card { padding: 10px 6px; border-radius: 8px; }
  .count-number { font-size: 1.4rem; }
  .count-label { font-size: 0.62rem; margin-top: 2px; }
}
/* Donut categorías: limitar tamaño en mobile */
@media (max-width: 767px) {
  #rankings-cat-chart { height: 190px !important; max-width: 190px; margin: 0 auto; }
}

.dash-grid { display: grid; grid-template-columns: 1fr 260px; gap: 14px; width: 100%; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; overflow: hidden; } }
.dash-card { background: var(--surface-2); border-radius: 14px; padding: 18px; border: 1px solid #F3F4F6; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.dash-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dash-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.dash-card-link { font-size: 12px; color: #00bcd4; cursor: pointer; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th { text-align: left; padding: 6px 10px; color: #9CA3AF; font-weight: 500; border-bottom: 1px solid #F3F4F6; }
.dash-table td { padding: 9px 10px; color: var(--text-primary); border-bottom: 1px solid #F9FAFB; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-loading { text-align: center; color: #9CA3AF; padding: 20px; }
.dash-pos-card { background: linear-gradient(135deg, #1a1f2e, #0d4f58); border-radius: 14px; padding: 18px; }

/* ── Balance — tabs principales (pill toggle) ── */
#blMainTabs {
  background: #f0f4f8;
  border-radius: 12px 12px 0 0;
  padding: 6px 6px 0;
  display: flex;
  gap: 4px;
  border-bottom: none;
}
#blMainTabs .nav-link {
  border: none !important;
  border-radius: 8px 8px 0 0;
  padding: 8px 18px;
  font-size: 0.87rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
#blMainTabs .nav-link.active {
  background: #fff;
  color: #1E2A38;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
#blMainTabs .nav-link:hover:not(.active) {
  background: rgba(255,255,255,0.55);
  color: #374151;
}

/* ── Balance — sub-tabs (underline style) ── */
#blSubTabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#blSubTabs::-webkit-scrollbar { display: none; }
#blSubTabs .bl-subtab {
  color: #9ca3af;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 9px 14px;
  font-size: 0.87rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}
#blSubTabs .bl-subtab.active {
  color: #1E2A38;
  border-bottom-color: #00BCD4;
  font-weight: 700;
}
#blSubTabs .bl-subtab:hover:not(.active) {
  color: #374151;
  border-bottom-color: #d1d5db;
}

/* ── Products page — chips, inline inputs, badges ── */
.prod-chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.5;
}
.prod-chip:hover { border-color: #00BCD4; color: #00BCD4; }
.prod-chip.active { background: #F5B800; border-color: #F5B800; color: #1E2A38; font-weight: 700; }

.prod-inline-input {
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 0.78rem;
  width: 90px;
  color: #1E2A38;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  font-weight: 500;
}
.prod-inline-input:focus { border-color: #00BCD4; box-shadow: 0 0 0 3px rgba(0,188,212,0.12); }
.prod-input-danger { border-color: #fca5a5 !important; color: #dc2626; }

.prod-low-badge  { background: #fee2e2; color: #dc2626; font-size: 0.65rem; border-radius: 4px; padding: 1px 6px; font-weight: 600; }
.prod-out-badge  { background: #f3f4f6; color: #6b7280; font-size: 0.65rem; border-radius: 4px; padding: 1px 6px; font-weight: 600; }

#prodTable tbody tr:hover { background: #fafbff; }
#prodTable tbody tr:last-child { border-bottom: none; }

#page-products.active { min-height: calc(100vh - 112px); display: flex; flex-direction: column; }
#page-products > .vcard.p-0 { flex: 1; min-height: 300px; }
#_prodMenuDlg::backdrop { background: transparent; }
.prod-menu-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 14px;
  cursor: pointer;
  color: #374151;
  font-size: 0.82rem;
  white-space: nowrap;
  border: none;
  background: none;
  width: 100%;
}
.prod-menu-item:hover { background: #f3f4f6; }
.prod-menu-item .bi { display: block; text-align: center; font-size: 14px; }
.prod-menu-item.text-danger { color: #ef4444; }

/* ── Toggle Web en tabla productos ── */
.prod-web-toggle { position:relative; display:inline-block; width:42px; height:24px; cursor:pointer; margin:0; }
.prod-web-toggle input { opacity:0; width:0; height:0; position:absolute; }
.prod-web-slider { position:absolute; inset:0; background:#d1d5db; border-radius:24px; transition:.25s; }
.prod-web-slider::before { content:''; position:absolute; width:18px; height:18px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:.25s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.prod-web-toggle input:checked + .prod-web-slider { background:#22c55e; }
.prod-web-toggle input:checked + .prod-web-slider::before { transform:translateX(18px); }

/* ── Nueva Venta Modal — métodos de pago ── */
.nv-metodo-btn { cursor: pointer; transition: all 0.15s; background: #fff; }
.nv-metodo-btn:hover { border-color: #00BCD4 !important; background: #f0fbfc; }
.nv-metodo-active { border-color: #00BCD4 !important; background: #e0f8fb !important; }
.nv-metodo-active i { color: #00BCD4 !important; }
.nv-metodo-active div { color: #007b8f; font-weight: 600; }
