<!DOCTYPE html>
<html lang="es">
<head>
  <script>/*pos_theme_early*/(function(){var t=localStorage.getItem("pos_theme")||"industrial";document.documentElement.setAttribute("data-theme",t);})()</script>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Nexus Autoparts — Dashboard</title>
  <link rel="stylesheet" href="/pos/static/css/chat.css" />
  <link rel="stylesheet" href="/pos/static/css/tokens.css" />
  <link rel="stylesheet" href="/pos/static/css/common.css" />
  <link rel="stylesheet" href="/pos/static/css/pos-ui.css?v=33" />
  <link rel="stylesheet" href="/pos/static/css/sidebar.css" />
  <link rel="stylesheet" href="/pos/static/css/pos-glass.css" />
  <link rel="manifest" href="/pos/static/pwa/manifest.json" />
  <meta name="theme-color" content="#F5A623" />
  <link rel="shortcut icon" type="image/png" href="/pos/static/pwa/icon-192.png" />

  <link rel="stylesheet" href="/pos/static/css/dashboard.css?v=33"></head>

<body>

  <!-- =========================================================================
       THEME SWITCHER BAR (fixed top, 36px)
       ========================================================================= -->

  <div class="theme-bar">
    <span class="theme-bar__brand">Nexus Autoparts</span>
    <div class="theme-bar__controls">
      <span class="theme-bar__label">Tema:</span>
      <div class="theme-switcher">
        <button class="theme-btn active" id="btn-industrial" onclick="setTheme('industrial')">Industrial</button>
        <button class="theme-btn" id="btn-modern" onclick="setTheme('modern')">Moderno</button>
      </div>
    </div>
  </div>

  <!-- Sidebar mobile overlay -->
  <div class="sidebar-overlay" id="sidebar-overlay" onclick="closeSidebar()"></div>

  <!-- =========================================================================
       APP SHELL
       ========================================================================= -->

  <div class="app-shell">

    <!-- ===================================================================
         SIDEBAR NAVIGATION
         =================================================================== -->

    <nav class="sidebar themed-scrollbar" id="sidebar">

      <div class="sidebar__logo">
        <div class="sidebar__logo-text">Nexus</div>
        <div class="sidebar__logo-sub">Autoparts POS</div>
      </div>

      <div class="sidebar__nav">

        <div class="sidebar__section-label">Principal</div>

        <a href="/pos/dashboard" class="nav-link active">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <rect x="1" y="1" width="6" height="6" rx="1" fill="currentColor" opacity="0.9"/>
              <rect x="9" y="1" width="6" height="6" rx="1" fill="currentColor" opacity="0.5"/>
              <rect x="1" y="9" width="6" height="6" rx="1" fill="currentColor" opacity="0.5"/>
              <rect x="9" y="9" width="6" height="6" rx="1" fill="currentColor" opacity="0.5"/>
            </svg>
          </span>
          Dashboard
        </a>

        <a href="/pos/sale" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <rect x="1" y="2" width="14" height="10" rx="1.5" stroke="currentColor" stroke-width="1.5"/>
              <path d="M5 15h6M8 12v3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
              <rect x="4" y="5" width="3" height="2" rx="0.5" fill="currentColor" opacity="0.6"/>
              <rect x="9" y="5" width="3" height="2" rx="0.5" fill="currentColor" opacity="0.6"/>
            </svg>
          </span>
          POS
        </a>

        <a href="/pos/catalog" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M3 2h7l3 3v9H3V2z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
              <path d="M10 2v3h3" stroke="currentColor" stroke-width="1.5"/>
              <path d="M5 7h6M5 9.5h4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
            </svg>
          </span>
          Catálogo
        </a>

        <a href="/pos/inventory" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <rect x="1" y="3" width="14" height="10" rx="1.5" stroke="currentColor" stroke-width="1.5"/>
              <path d="M1 6h14" stroke="currentColor" stroke-width="1.2"/>
              <path d="M4 9.5h3M10 9.5h2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
            </svg>
          </span>
          Inventario
        </a>

        <div class="sidebar__section-label">Ventas</div>

        <a href="/pos/customers" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <circle cx="7" cy="6" r="4" stroke="currentColor" stroke-width="1.5"/>
              <path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
            </svg>
          </span>
          Clientes
        </a>

        <a href="/pos/invoicing" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M3 2h10a1 1 0 011 1v10a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z" stroke="currentColor" stroke-width="1.5"/>
              <path d="M5 6h6M5 8.5h4M5 11h2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
            </svg>
          </span>
          Facturación
        </a>

        <a href="/pos/accounting" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M8 1v14M11 4H6.5a2.5 2.5 0 000 5H9.5a2.5 2.5 0 010 5H4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
            </svg>
          </span>
          Contabilidad
        </a>

        <div class="sidebar__section-label">Análisis</div>

        <a href="/pos/reports" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M2 13L5 9l3 2 3-5 3 3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
              <path d="M2 13h12" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
            </svg>
          </span>
          Reportes
        </a>

        <a href="/pos/historical-sales" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5">
              <rect x="2" y="3" width="12" height="11" rx="1"/>
              <path d="M2 6h12" stroke-width="1.2"/>
              <path d="M5 2v2M11 2v2"/>
            </svg>
          </span>
          Ventas Históricas
        </a>

        <div class="sidebar__section-label">Gestión</div>

        <a href="/pos/marketplace" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M1 3h14v2l-1.5 1.5V14H2.5V6.5L1 5V3z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/>
              <path d="M6 10h4v4H6z" fill="currentColor" opacity="0.4"/>
            </svg>
          </span>
          Marketplace B2B
        </a>

        <div class="sidebar__section-label">Sistema</div>

        <a href="/pos/config" class="nav-link">
          <span class="nav-link__icon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <circle cx="8" cy="8" r="2" stroke="currentColor" stroke-width="1.4"/>
              <path d="M8 1v2M8 13v2M1 8h2M13 8h2M2.93 2.93l1.41 1.41M11.66 11.66l1.41 1.41M2.93 13.07l1.41-1.41M11.66 4.34l1.41-1.41" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
            </svg>
          </span>
          Configuración
        </a>

      </div><!-- end sidebar__nav -->

      <div class="sidebar__footer">
        <div class="user-chip">
          <div class="user-chip__avatar">CA</div>
          <div class="user-chip__info">
            <div class="user-chip__name">Carlos Alvarado</div>
            <div class="user-chip__role">Propietario</div>
          </div>
          <svg width="14" height="14" viewBox="0 0 14 14" fill="none" style="color:var(--color-text-muted);flex-shrink:0">
            <path d="M2 5l5 5 5-5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
        </div>
      </div>

    </nav><!-- end sidebar -->

    <!-- ===================================================================
         MAIN AREA
         =================================================================== -->

    <div class="main">

      <!-- Header bar -->
      <header class="header">
        <div class="header__left">
          <button class="hamburger-btn" id="hamburger-btn" onclick="toggleSidebar()" aria-label="Menú">
            <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
              <path d="M2 4h14M2 9h14M2 14h14" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
            </svg>
          </button>
          <div class="header__greeting">
            <div class="header__title" id="header-greeting">Buenos días</div>
            <div class="header__subtitle" id="header-subtitle">Cargando...</div>
          </div>
        </div>
        <div class="header__right">
          <div class="header__store-badge">
            <svg width="12" height="12" viewBox="0 0 12 12" fill="none">
              <path d="M1 5.5L6 1l5 4.5V11H8V8H4v3H1V5.5z" fill="currentColor" opacity="0.7"/>
            </svg>
            Sucursal Centro
          </div>
          <button class="icon-btn" title="Notificaciones" onclick="window.location.href='/pos/inventory#alertas'">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M8 1a5 5 0 00-5 5v3l-1.5 2h13L13 9V6a5 5 0 00-5-5z" stroke="currentColor" stroke-width="1.4"/>
              <path d="M6.5 13a1.5 1.5 0 003 0" stroke="currentColor" stroke-width="1.4"/>
            </svg>
            <span class="notif-dot"></span>
          </button>
          <button class="icon-btn" title="Refrescar datos" onclick="Dashboard.init()">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M13.5 8a5.5 5.5 0 11-1.5-3.8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
              <path d="M14 2v4h-4" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
            </svg>
          </button>
        </div>
      </header>

      <!-- Dashboard scrollable content -->
      <div class="dashboard themed-scrollbar">

        <!-- =================================================================
             KPI CARDS (2x2 mobile, 4x1 desktop)
             ================================================================= -->

        <section>
          <div class="section-header">
            <span class="section-title">Resumen del día</span>
            <a href="/pos/reports" class="section-action" style="text-decoration:none;color:inherit;">Ver detalle &rarr;</a>
          </div>
          <div class="kpi-grid">

            <!-- Card 1: Ventas Hoy -->
            <div class="kpi-card" id="kpi-ventas-hoy">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Ventas Hoy
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <path d="M7 1v12M10 4H5.5a2.5 2.5 0 000 5H8.5a2.5 2.5 0 010 5H3" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-ventas-total"><div class="skeleton skeleton--text" style="width:60%;"></div></div>
              <div class="kpi-card__meta" id="kpi-ventas-meta">
                <div class="skeleton skeleton--text-sm" style="width:80%;"></div>
              </div>
            </div>

            <!-- Card 2: Tickets Hoy -->
            <div class="kpi-card" id="kpi-tickets">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Tickets Hoy
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <path d="M2 2h10a1 1 0 011 1v8a1 1 0 01-1 1H2a1 1 0 01-1-1V3a1 1 0 011-1z" stroke="currentColor" stroke-width="1.4"/>
                    <path d="M3.5 5.5h7M3.5 7.5h5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-tickets-count"><div class="skeleton skeleton--text" style="width:40%;"></div></div>
              <div class="kpi-card__meta" id="kpi-tickets-meta">
                <div class="skeleton skeleton--text-sm" style="width:70%;"></div>
              </div>
            </div>

            <!-- Card 3: Ticket Promedio -->
            <div class="kpi-card" id="kpi-promedio">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Ticket Promedio
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <rect x="1" y="2" width="12" height="11" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
                    <path d="M4 1v2M10 1v2M1 6h12" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-promedio-value"><div class="skeleton skeleton--text" style="width:60%;"></div></div>
              <div class="kpi-card__meta" id="kpi-promedio-meta">
                <div class="skeleton skeleton--text-sm" style="width:75%;"></div>
              </div>
            </div>

            <!-- Card 4: Cajas Activas -->
            <div class="kpi-card" id="kpi-cajas">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Cajas del Día
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <path d="M2 11L5 8l2.5 2L10 5l2.5 2.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-cajas-count"><div class="skeleton skeleton--text" style="width:30%;"></div></div>
              <div class="kpi-card__meta" id="kpi-cajas-meta">
                <div class="skeleton skeleton--text-sm" style="width:80%;"></div>
              </div>
            </div>

          </div><!-- end kpi-grid -->
        </section>

        <!-- =================================================================
             HISTÓRICO IMPORTADO
             ================================================================= -->
        <section>
          <div class="section-header">
            <span class="section-title">Histórico importado</span>
            <a href="/pos/reports" class="section-action" style="text-decoration:none;color:inherit;">Ver en reportes &rarr;</a>
          </div>
          <div class="kpi-grid">
            <div class="kpi-card" id="kpi-historico-total">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Total Histórico
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <rect x="1" y="2" width="12" height="11" rx="1" stroke="currentColor" stroke-width="1.4"/>
                    <path d="M4 1v2M10 1v2M1 6h12" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-historico-total-value"><div class="skeleton skeleton--text" style="width:60%;"></div></div>
              <div class="kpi-card__meta" id="kpi-historico-total-meta">
                <div class="skeleton skeleton--text-sm" style="width:80%;"></div>
              </div>
            </div>

            <div class="kpi-card" id="kpi-historico-mes">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Este Mes (Histórico)
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <path d="M2 3h10v9H2z" stroke="currentColor" stroke-width="1.4"/>
                    <path d="M2 6h10M5 1v2M9 1v2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-historico-mes-value"><div class="skeleton skeleton--text" style="width:60%;"></div></div>
              <div class="kpi-card__meta" id="kpi-historico-mes-meta">
                <div class="skeleton skeleton--text-sm" style="width:80%;"></div>
              </div>
            </div>

            <div class="kpi-card" id="kpi-historico-count">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Tickets Históricos
                <span class="kpi-card__icon">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                    <path d="M2 2h10a1 1 0 011 1v8a1 1 0 01-1 1H2a1 1 0 01-1-1V3a1 1 0 011-1z" stroke="currentColor" stroke-width="1.4"/>
                    <path d="M3.5 5.5h7M3.5 7.5h5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
                  </svg>
                </span>
              </div>
              <div class="kpi-card__value" id="kpi-historico-count-value"><div class="skeleton skeleton--text" style="width:40%;"></div></div>
              <div class="kpi-card__meta" id="kpi-historico-count-meta">
                <div class="skeleton skeleton--text-sm" style="width:70%;"></div>
              </div>
            </div>
          </div>
        </section>

        <!-- =================================================================
             SALES CHART (CSS-only bar chart)
             ================================================================= -->

        <section>
          <div class="chart-card">
            <div class="chart-header">
              <div>
                <div class="section-title">Ventas Semanales</div>
                <div style="font-size:var(--text-caption);color:var(--color-text-muted);margin-top:2px;" id="chart-week-total">
                  Total semana: <strong style="color:var(--color-primary);font-family:var(--font-mono);">--</strong>
                </div>
              </div>
              <div class="period-selector">
                <button class="period-btn" onclick="setPeriod(this)">Hoy</button>
                <button class="period-btn active" onclick="setPeriod(this)">Semana</button>
                <button class="period-btn" onclick="setPeriod(this)">Mes</button>
                <button class="period-btn" onclick="setPeriod(this)">Año</button>
              </div>
            </div>

            <!-- Bar chart: populated by JS -->
            <div class="bar-chart" id="bar-chart">
              <!-- Filled dynamically -->
            </div>

            <div class="chart-legend" id="chart-legend">
              <div class="legend-item">
                <div class="legend-dot"></div>
                Ventas brutas (7 días)
              </div>
            </div>

          </div><!-- end chart-card -->
        </section>

        <!-- =================================================================
             ESTADÍSTICAS EN TIEMPO REAL
             ================================================================= -->
        <section>
          <div class="section-header">
            <span class="section-title">Rendimiento Hoy</span>
          </div>
          <div class="two-col-grid">
            <div class="rank-card">
              <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--space-4);">
                <div style="font-family:var(--font-heading);font-weight:var(--heading-weight-secondary);font-size:var(--text-body-sm);letter-spacing:var(--tracking-wider);text-transform:uppercase;color:var(--color-text-secondary);">
                  Ventas por Hora
                </div>
              </div>
              <div class="chart-canvas-wrap"><canvas id="hourlySalesChart"></canvas></div>
            </div>
            <div class="rank-card">
              <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--space-4);">
                <div style="font-family:var(--font-heading);font-weight:var(--heading-weight-secondary);font-size:var(--text-body-sm);letter-spacing:var(--tracking-wider);text-transform:uppercase;color:var(--color-text-secondary);">
                  Top Productos (Hoy)
                </div>
              </div>
              <div class="chart-canvas-wrap"><canvas id="topProductsChart"></canvas></div>
            </div>
          </div>
        </section>

        <!-- =================================================================
             TOP PRODUCTOS / TOP CLIENTES
             ================================================================= -->

        <section>
          <div class="section-header">
            <span class="section-title">Rankings</span>
          </div>
          <div class="two-col-grid">

            <!-- Top Productos -->
            <div class="rank-card">
              <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--space-4);">
                <div style="font-family:var(--font-heading);font-weight:var(--heading-weight-secondary);font-size:var(--text-body-sm);letter-spacing:var(--tracking-wider);text-transform:uppercase;color:var(--color-text-secondary);">
                  Top Productos Hoy
                </div>
                <a href="/pos/inventory" style="font-size:var(--text-caption);color:var(--color-primary);font-weight:var(--font-weight-semibold);cursor:pointer;text-decoration:none;">Ver todos</a>
              </div>
              <div class="rank-list" id="top-products-list">
                <div class="rank-item"><div class="skeleton skeleton--text" style="width:90%;"></div></div>
                <div class="rank-item"><div class="skeleton skeleton--text" style="width:70%;"></div></div>
                <div class="rank-item"><div class="skeleton skeleton--text" style="width:80%;"></div></div>
              </div>
            </div><!-- end Top Productos -->

            <!-- Desglose por Caja -->
            <div class="rank-card">
              <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--space-4);">
                <div style="font-family:var(--font-heading);font-weight:var(--heading-weight-secondary);font-size:var(--text-body-sm);letter-spacing:var(--tracking-wider);text-transform:uppercase;color:var(--color-text-secondary);">
                  Cajas del Día
                </div>
                <a href="/pos/config" style="font-size:var(--text-caption);color:var(--color-primary);font-weight:var(--font-weight-semibold);cursor:pointer;text-decoration:none;">Gestionar</a>
              </div>
              <div class="rank-list" id="registers-list">
                <div class="rank-item"><div class="skeleton skeleton--text" style="width:85%;"></div></div>
                <div class="rank-item"><div class="skeleton skeleton--text" style="width:65%;"></div></div>
              </div>
            </div><!-- end Cajas del Día -->

          </div><!-- end two-col-grid -->
        </section>

        <!-- =================================================================
             ALERTS
             ================================================================= -->

        <section>
          <div class="section-header">
            <span class="section-title">Alertas &amp; Pendientes</span>
            <span class="section-action">Gestionar todo &rarr;</span>
          </div>
          <div class="alerts-grid" id="alerts-grid">
            <div class="alert-item" style="border-left:none;"><div class="skeleton skeleton--text" style="width:100%;"></div></div>
            <div class="alert-item" style="border-left:none;"><div class="skeleton skeleton--text" style="width:80%;"></div></div>
          </div><!-- end alerts-grid -->
        </section>

        <!-- =================================================================
             CRÉDITOS POR VENCER
             ================================================================= -->

        <section>
          <div class="table-card">
            <div class="table-header">
              <div>
                <div class="section-title">Créditos por Cobrar</div>
                <div style="font-size:var(--text-caption);color:var(--color-text-muted);margin-top:2px;" id="credit-alerts-meta">Vencidos: -- / Por vencer: --</div>
              </div>
              <a href="/pos/accounting" class="section-action" style="text-decoration:none;color:inherit;">Ir a contabilidad &rarr;</a>
            </div>
            <div class="table-wrap themed-scrollbar">
              <table>
                <thead>
                  <tr>
                    <th>Cliente</th>
                    <th>Folio</th>
                    <th>Vencimiento</th>
                    <th>Días</th>
                    <th class="align-right">Saldo</th>
                    <th>Estado</th>
                  </tr>
                </thead>
                <tbody id="credit-alerts-tbody">
                  <tr><td colspan="6"><div class="skeleton skeleton--text" style="width:100%;"></div></td></tr>
                  <tr><td colspan="6"><div class="skeleton skeleton--text" style="width:80%;"></div></td></tr>
                </tbody>
              </table>
            </div>
          </div>
        </section>

        <!-- =================================================================
             RECENT SALES TABLE
             ================================================================= -->

        <section style="padding-bottom: var(--space-8);">
          <div class="table-card">
            <div class="table-header">
              <div>
                <div class="section-title">Ventas Recientes</div>
                <div style="font-size:var(--text-caption);color:var(--color-text-muted);margin-top:2px;">Últimas 5 transacciones</div>
              </div>
              <div style="display:flex;gap:var(--space-3);align-items:center;">
                <div style="font-size:var(--text-caption);color:var(--color-text-muted);">
                  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" style="display:inline;vertical-align:middle;margin-right:4px;">
                    <circle cx="6" cy="6" r="4" stroke="currentColor" stroke-width="1.4"/>
                    <circle cx="6" cy="6" r="1.5" fill="currentColor" class="pulse-dot"/>
                  </svg>
                  En vivo
                </div>
                <a href="/pos/reports" class="section-action" style="margin:0;text-decoration:none;color:inherit;">Ver historial &rarr;</a>
              </div>
            </div>
            <div class="table-wrap themed-scrollbar">
              <table>
                <thead>
                  <tr>
                    <th>Hora</th>
                    <th>Cliente</th>
                    <th>Productos</th>
                    <th>Total</th>
                    <th>Método Pago</th>
                  </tr>
                </thead>
                <tbody id="recent-sales-tbody">
                  <tr><td colspan="5"><div class="skeleton skeleton--text" style="width:100%;"></div></td></tr>
                  <tr><td colspan="5"><div class="skeleton skeleton--text" style="width:80%;"></div></td></tr>
                  <tr><td colspan="5"><div class="skeleton skeleton--text" style="width:90%;"></div></td></tr>
                </tbody>
              </table>
            </div>
          </div>
        </section>

      </div><!-- end dashboard -->

    </div><!-- end main -->

  </div><!-- end app-shell -->


  <script src="/pos/static/js/chart.umd.min.js" defer></script>
  <script src="/pos/static/js/i18n.js" defer></script>
  <script src="/pos/static/js/app-init.js" defer></script>
  <script src="/pos/static/js/splash-loader.js?v=33" defer></script>
  <script src="/pos/static/js/pos-utils.js?v=33" defer></script>
  <script src="/pos/static/js/sidebar.js" defer></script>
  <script src="/pos/static/js/dashboard-stats.js?v=33" defer></script>
  <script src="/pos/static/js/dashboard.js?v=33" defer></script>
  <script src="/pos/static/js/sync-engine.js" defer></script>
  <script>if('serviceWorker' in navigator){navigator.serviceWorker.register('/pos/sw.js',{scope:'/pos/'});}</script>
  <script src="/pos/static/js/pwa-install.js" defer></script>

  <script src="/pos/static/js/chat.js" defer></script>
</body>
</html>
