<!DOCTYPE html>
<html lang="es" data-theme="industrial">
<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/tokens.css" />

  <style>
    /* ==========================================================================
       BASE RESET
       ========================================================================== */

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

    html {
      height: 100%;
    }

    body {
      font-family: var(--font-body);
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-regular);
      background-color: var(--color-bg-base);
      color: var(--color-text-primary);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      transition: background-color var(--duration-normal) var(--ease-in-out),
                  color var(--duration-normal) var(--ease-in-out);
    }

    /* Modern theme dot-grid on body */
    [data-theme="modern"] body {
      background-color: var(--color-bg-base);
      background-image: radial-gradient(
        circle,
        var(--dot-grid-color) 1px,
        transparent 1px
      );
      background-size: var(--dot-grid-size) var(--dot-grid-size);
    }

    a {
      text-decoration: none;
      color: inherit;
    }

    /* ==========================================================================
       THEME SWITCHER BAR (fixed top, 36px)
       ========================================================================== */

    .theme-bar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 36px;
      z-index: var(--z-sticky);
      background-color: var(--color-surface-3);
      border-bottom: 1px solid var(--color-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 var(--space-5);
      font-size: var(--text-caption);
      font-family: var(--font-body);
      color: var(--color-text-muted);
      letter-spacing: var(--tracking-wide);
    }

    .theme-bar__brand {
      font-family: var(--font-heading);
      font-weight: var(--font-weight-bold);
      font-size: 0.8125rem;
      color: var(--color-primary);
      letter-spacing: var(--tracking-wider);
      text-transform: uppercase;
    }

    .theme-bar__controls {
      display: flex;
      align-items: center;
      gap: var(--space-4);
    }

    .theme-bar__label {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
    }

    .theme-switcher {
      display: flex;
      align-items: center;
      gap: var(--space-1);
      background-color: var(--color-surface-2);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-full);
      padding: 2px;
    }

    .theme-btn {
      height: 22px;
      padding: 0 var(--space-3);
      border-radius: var(--radius-full);
      border: none;
      cursor: pointer;
      font-family: var(--font-body);
      font-size: 11px;
      font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-wide);
      text-transform: uppercase;
      background: transparent;
      color: var(--color-text-muted);
      transition: var(--transition-fast);
    }

    .theme-btn.active {
      background-color: var(--color-primary);
      color: var(--color-text-inverse);
    }

    .theme-btn:not(.active):hover {
      color: var(--color-text-primary);
    }

    /* ==========================================================================
       APP SHELL — sidebar + main
       ========================================================================== */

    .app-shell {
      display: flex;
      flex: 1;
      margin-top: 36px; /* offset for fixed theme bar */
      min-height: calc(100vh - 36px);
      position: relative;
    }

    /* ==========================================================================
       SIDEBAR
       ========================================================================== */

    .sidebar {
      width: 260px;
      flex-shrink: 0;
      background-color: var(--color-bg-elevated);
      border-right: 1px solid var(--color-border);
      display: flex;
      flex-direction: column;
      position: fixed;
      top: 36px;
      left: 0;
      bottom: 0;
      z-index: var(--z-dropdown);
      transition: transform var(--duration-normal) var(--ease-in-out);
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    }

    .sidebar__logo {
      padding: var(--space-5) var(--space-5) var(--space-4);
      border-bottom: 1px solid var(--color-border);
    }

    .sidebar__logo-text {
      font-family: var(--font-heading);
      font-weight: var(--heading-weight-primary);
      font-size: 1.125rem;
      letter-spacing: var(--tracking-wider);
      text-transform: uppercase;
      color: var(--color-primary);
      line-height: 1;
    }

    .sidebar__logo-sub {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
      margin-top: 2px;
      letter-spacing: var(--tracking-wide);
      text-transform: uppercase;
    }

    .sidebar__nav {
      flex: 1;
      padding: var(--space-4) 0;
    }

    .sidebar__section-label {
      font-size: 10px;
      font-weight: var(--font-weight-bold);
      letter-spacing: var(--tracking-widest);
      text-transform: uppercase;
      color: var(--color-text-muted);
      padding: var(--space-3) var(--space-5) var(--space-2);
      margin-top: var(--space-2);
    }

    .nav-link {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      padding: var(--space-3) var(--space-5);
      color: var(--color-text-secondary);
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-regular);
      transition: var(--transition-fast);
      border-left: 3px solid transparent;
      position: relative;
    }

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

    .nav-link.active {
      background-color: var(--color-primary-muted);
      color: var(--color-primary);
      border-left-color: var(--color-primary);
      font-weight: var(--font-weight-semibold);
    }

    .nav-link__icon {
      width: 18px;
      height: 18px;
      flex-shrink: 0;
      opacity: 0.7;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .nav-link.active .nav-link__icon {
      opacity: 1;
    }

    .sidebar__footer {
      padding: var(--space-4) var(--space-5);
      border-top: 1px solid var(--color-border);
    }

    .user-chip {
      display: flex;
      align-items: center;
      gap: var(--space-3);
    }

    .user-chip__avatar {
      width: 32px;
      height: 32px;
      border-radius: var(--radius-full);
      background-color: var(--color-primary);
      color: var(--color-text-inverse);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-heading);
      font-weight: var(--font-weight-bold);
      font-size: 13px;
      flex-shrink: 0;
    }

    .user-chip__info {
      flex: 1;
      min-width: 0;
    }

    .user-chip__name {
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .user-chip__role {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
    }

    /* ==========================================================================
       SIDEBAR OVERLAY (mobile backdrop)
       ========================================================================== */

    .sidebar-overlay {
      display: none;
      position: fixed;
      inset: 0;
      top: 36px;
      background-color: var(--overlay-backdrop);
      z-index: calc(var(--z-dropdown) - 1);
    }

    /* ==========================================================================
       MAIN CONTENT
       ========================================================================== */

    .main {
      flex: 1;
      margin-left: 220px;
      min-width: 0;
      display: flex;
      flex-direction: column;
    }

    /* ==========================================================================
       TOP HEADER BAR
       ========================================================================== */

    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: var(--space-4) var(--space-6);
      background-color: var(--color-bg-elevated);
      border-bottom: 1px solid var(--color-border);
      gap: var(--space-4);
      flex-shrink: 0;
    }

    .header__left {
      display: flex;
      align-items: center;
      gap: var(--space-4);
    }

    .hamburger-btn {
      display: none;
      width: 36px;
      height: 36px;
      background: none;
      border: 1px solid var(--color-border);
      border-radius: var(--radius-md);
      cursor: pointer;
      color: var(--color-text-secondary);
      align-items: center;
      justify-content: center;
      transition: var(--transition-fast);
    }

    .hamburger-btn:hover {
      background-color: var(--color-surface-2);
      color: var(--color-text-primary);
    }

    .header__greeting {
      display: flex;
      flex-direction: column;
    }

    .header__title {
      font-family: var(--font-heading);
      font-weight: var(--heading-weight-primary);
      font-size: var(--text-h5);
      letter-spacing: var(--heading-tracking-h5);
      color: var(--color-text-primary);
      line-height: 1.2;
    }

    .header__subtitle {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
      margin-top: 1px;
    }

    .header__right {
      display: flex;
      align-items: center;
      gap: var(--space-3);
    }

    .header__store-badge {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      padding: var(--space-2) var(--space-4);
      background-color: var(--color-primary-muted);
      border: 1px solid var(--color-border-accent);
      border-radius: var(--radius-md);
      font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold);
      color: var(--color-primary);
      letter-spacing: var(--tracking-wide);
    }

    .icon-btn {
      width: 36px;
      height: 36px;
      background: none;
      border: 1px solid var(--color-border);
      border-radius: var(--radius-md);
      cursor: pointer;
      color: var(--color-text-secondary);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: var(--transition-fast);
      position: relative;
    }

    .icon-btn:hover {
      background-color: var(--color-surface-2);
      color: var(--color-text-primary);
    }

    .notif-dot {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 7px;
      height: 7px;
      border-radius: var(--radius-full);
      background-color: var(--color-error);
      border: 1.5px solid var(--color-bg-elevated);
    }

    /* ==========================================================================
       DASHBOARD CONTENT AREA
       ========================================================================== */

    .dashboard {
      flex: 1;
      padding: var(--space-6);
      display: flex;
      flex-direction: column;
      gap: var(--space-6);
      overflow-y: auto;
    }

    /* ==========================================================================
       SECTION TITLE
       ========================================================================== */

    .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: var(--space-4);
    }

    .section-title {
      font-family: var(--font-heading);
      font-weight: var(--heading-weight-secondary);
      font-size: var(--text-h6);
      letter-spacing: var(--heading-tracking-h6);
      text-transform: uppercase;
      color: var(--color-text-secondary);
    }

    .section-action {
      font-size: var(--text-caption);
      color: var(--color-primary);
      font-weight: var(--font-weight-semibold);
      cursor: pointer;
      letter-spacing: var(--tracking-wide);
    }

    .section-action:hover {
      text-decoration: underline;
    }

    /* ==========================================================================
       KPI CARDS ROW
       ========================================================================== */

    .kpi-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-4);
    }

    .kpi-card {
      background-color: var(--color-bg-elevated);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-lg);
      padding: var(--space-5);
      display: flex;
      flex-direction: column;
      gap: var(--space-3);
      transition: var(--transition-normal);
      position: relative;
      overflow: hidden;
    }

    [data-theme="industrial"] .kpi-card {
      box-shadow: var(--shadow-sm);
    }

    [data-theme="modern"] .kpi-card {
      box-shadow: var(--shadow-md);
    }

    .kpi-card:hover {
      border-color: var(--color-border-strong);
      transform: translateY(-1px);
    }

    .kpi-card__accent-bar {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background-color: var(--color-primary);
    }

    .kpi-card__label {
      font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-widest);
      text-transform: uppercase;
      color: var(--color-text-muted);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .kpi-card__icon {
      width: 28px;
      height: 28px;
      border-radius: var(--radius-md);
      background-color: var(--color-primary-muted);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--color-primary);
    }

    .kpi-card__value {
      font-family: var(--font-mono);
      font-size: 1.625rem;
      font-weight: var(--font-weight-bold);
      color: var(--color-text-primary);
      line-height: 1;
      letter-spacing: var(--tracking-tight);
    }

    .kpi-card__meta {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      font-size: var(--text-caption);
    }

    .kpi-tag {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      font-size: 11px;
      font-weight: var(--font-weight-semibold);
      padding: 2px var(--space-2);
      border-radius: var(--radius-full);
    }

    .kpi-tag--up {
      background-color: rgba(34, 197, 94, 0.15);
      color: var(--color-success);
    }

    .kpi-tag--neutral {
      background-color: var(--color-surface-2);
      color: var(--color-text-muted);
    }

    .kpi-meta-text {
      color: var(--color-text-muted);
    }

    /* Progress bar inside KPI */
    .kpi-progress {
      margin-top: var(--space-1);
    }

    .kpi-progress__track {
      height: 4px;
      background-color: var(--color-surface-3);
      border-radius: var(--radius-full);
      overflow: hidden;
    }

    .kpi-progress__fill {
      height: 100%;
      background-color: var(--color-primary);
      border-radius: var(--radius-full);
      transition: width var(--duration-slow) var(--ease-out);
    }

    .kpi-progress__label {
      display: flex;
      justify-content: space-between;
      font-size: 10px;
      color: var(--color-text-muted);
      margin-top: var(--space-1);
    }

    /* ==========================================================================
       SALES CHART SECTION
       ========================================================================== */

    .chart-card {
      background-color: var(--color-bg-elevated);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-lg);
      padding: var(--space-5);
    }

    [data-theme="industrial"] .chart-card {
      box-shadow: var(--shadow-sm);
    }

    [data-theme="modern"] .chart-card {
      box-shadow: var(--shadow-md);
    }

    .chart-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: var(--space-5);
      flex-wrap: wrap;
      gap: var(--space-3);
    }

    .period-selector {
      display: flex;
      gap: var(--space-1);
      background-color: var(--color-surface-2);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-md);
      padding: 3px;
    }

    .period-btn {
      padding: var(--space-1) var(--space-3);
      border-radius: var(--radius-sm);
      border: none;
      font-family: var(--font-body);
      font-size: var(--text-caption);
      font-weight: var(--font-weight-semibold);
      cursor: pointer;
      background: transparent;
      color: var(--color-text-muted);
      transition: var(--transition-fast);
      letter-spacing: var(--tracking-wide);
    }

    .period-btn.active {
      background-color: var(--color-primary);
      color: var(--color-text-inverse);
    }

    .period-btn:not(.active):hover {
      color: var(--color-text-primary);
      background-color: var(--color-surface-3);
    }

    /* Bar chart */
    .bar-chart {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: var(--space-2);
      height: 140px;
      padding-bottom: var(--space-6);
      position: relative;
    }

    /* Horizontal grid lines */
    .bar-chart::before {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: var(--space-6);
      background-image:
        linear-gradient(to bottom,
          var(--color-border) 1px,
          transparent 1px,
          transparent 33%,
          var(--color-border) 33%,
          transparent 34%,
          transparent 66%,
          var(--color-border) 66%,
          transparent 67%
        );
      pointer-events: none;
    }

    .bar-chart__col {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-2);
      min-width: 0;
      position: relative;
      height: 100%;
      justify-content: flex-end;
    }

    .bar-chart__bar-wrap {
      width: 100%;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      flex: 1;
    }

    .bar-chart__bar {
      width: 70%;
      max-width: 36px;
      background-color: var(--color-primary);
      border-radius: var(--radius-sm) var(--radius-sm) 0 0;
      opacity: 0.85;
      transition: opacity var(--transition-fast), transform var(--transition-fast);
      cursor: pointer;
      position: relative;
    }

    .bar-chart__bar.today {
      opacity: 1;
      box-shadow: 0 0 12px rgba(0,0,0,0.3);
    }

    .bar-chart__bar:hover {
      opacity: 1;
      transform: scaleX(1.1);
    }

    /* Tooltip on hover */
    .bar-chart__bar::after {
      content: attr(data-value);
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%);
      background-color: var(--color-surface-3);
      color: var(--color-text-primary);
      font-size: 10px;
      font-family: var(--font-mono);
      padding: 3px var(--space-2);
      border-radius: var(--radius-sm);
      white-space: nowrap;
      opacity: 0;
      pointer-events: none;
      margin-bottom: 4px;
      border: 1px solid var(--color-border);
      transition: opacity var(--transition-fast);
    }

    .bar-chart__bar:hover::after {
      opacity: 1;
    }

    .bar-chart__label {
      font-size: 11px;
      color: var(--color-text-muted);
      font-weight: var(--font-weight-semibold);
      letter-spacing: var(--tracking-wide);
      text-transform: uppercase;
      position: absolute;
      bottom: 0;
    }

    .chart-legend {
      display: flex;
      gap: var(--space-5);
      margin-top: var(--space-3);
      flex-wrap: wrap;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      font-size: var(--text-caption);
      color: var(--color-text-muted);
    }

    .legend-dot {
      width: 8px;
      height: 8px;
      border-radius: var(--radius-full);
      background-color: var(--color-primary);
      flex-shrink: 0;
    }

    .legend-dot--success {
      background-color: var(--color-success);
    }

    /* ==========================================================================
       TWO-COLUMN SECTION (Top Productos / Top Clientes)
       ========================================================================== */

    .two-col-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: var(--space-4);
    }

    .rank-card {
      background-color: var(--color-bg-elevated);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-lg);
      padding: var(--space-5);
    }

    [data-theme="industrial"] .rank-card {
      box-shadow: var(--shadow-sm);
    }

    [data-theme="modern"] .rank-card {
      box-shadow: var(--shadow-md);
    }

    .rank-list {
      display: flex;
      flex-direction: column;
      gap: var(--space-1);
    }

    .rank-item {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      padding: var(--space-3) var(--space-3);
      border-radius: var(--radius-md);
      transition: var(--transition-fast);
    }

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

    .rank-num {
      width: 22px;
      height: 22px;
      border-radius: var(--radius-full);
      background-color: var(--color-surface-3);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: var(--font-weight-bold);
      color: var(--color-text-muted);
      flex-shrink: 0;
    }

    .rank-num--1 {
      background-color: rgba(234, 179, 8, 0.2);
      color: var(--color-warning);
    }

    .rank-num--2 {
      background-color: var(--color-surface-3);
      color: var(--color-text-secondary);
    }

    .rank-item__info {
      flex: 1;
      min-width: 0;
    }

    .rank-item__name {
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .rank-item__sub {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
      margin-top: 1px;
    }

    .rank-item__value {
      font-family: var(--font-mono);
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-bold);
      color: var(--color-primary);
      flex-shrink: 0;
      text-align: right;
    }

    .rank-item__bar-bg {
      position: relative;
      height: 3px;
      background-color: var(--color-surface-3);
      border-radius: var(--radius-full);
      margin-top: var(--space-1);
      overflow: hidden;
    }

    .rank-item__bar-fill {
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      background-color: var(--color-primary);
      border-radius: var(--radius-full);
      opacity: 0.6;
    }

    /* ==========================================================================
       ALERTS SECTION
       ========================================================================== */

    .alerts-grid {
      display: flex;
      flex-direction: column;
      gap: var(--space-3);
    }

    .alert-item {
      display: flex;
      align-items: flex-start;
      gap: var(--space-4);
      padding: var(--space-4);
      background-color: var(--color-bg-elevated);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-lg);
      transition: var(--transition-fast);
    }

    .alert-item:hover {
      border-color: var(--color-border-strong);
    }

    .alert-item--error {
      border-left: 4px solid var(--color-error);
    }

    .alert-item--warning {
      border-left: 4px solid var(--color-warning);
    }

    .alert-item--orange {
      border-left: 4px solid var(--color-primary);
    }

    .alert-badge {
      flex-shrink: 0;
      min-width: 24px;
      height: 24px;
      padding: 0 var(--space-2);
      border-radius: var(--radius-full);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: var(--font-weight-bold);
      letter-spacing: var(--tracking-wide);
    }

    .alert-badge--error {
      background-color: rgba(239, 68, 68, 0.15);
      color: var(--color-error);
    }

    .alert-badge--warning {
      background-color: rgba(234, 179, 8, 0.15);
      color: var(--color-warning);
    }

    .alert-badge--orange {
      background-color: var(--color-primary-muted);
      color: var(--color-primary);
    }

    .alert-icon-wrap {
      width: 36px;
      height: 36px;
      border-radius: var(--radius-md);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .alert-icon-wrap--error {
      background-color: rgba(239, 68, 68, 0.1);
      color: var(--color-error);
    }

    .alert-icon-wrap--warning {
      background-color: rgba(234, 179, 8, 0.1);
      color: var(--color-warning);
    }

    .alert-icon-wrap--orange {
      background-color: var(--color-primary-muted);
      color: var(--color-primary);
    }

    .alert-content {
      flex: 1;
      min-width: 0;
    }

    .alert-title {
      font-size: var(--text-body-sm);
      font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary);
    }

    .alert-desc {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
      margin-top: 2px;
    }

    .alert-action {
      font-size: var(--text-caption);
      color: var(--color-primary);
      font-weight: var(--font-weight-semibold);
      cursor: pointer;
      white-space: nowrap;
      flex-shrink: 0;
      align-self: center;
      padding: var(--space-1) var(--space-3);
      border: 1px solid var(--color-border-accent);
      border-radius: var(--radius-sm);
      transition: var(--transition-fast);
    }

    .alert-action:hover {
      background-color: var(--color-primary-muted);
    }

    /* ==========================================================================
       RECENT SALES TABLE
       ========================================================================== */

    .table-card {
      background-color: var(--color-bg-elevated);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-lg);
      overflow: hidden;
    }

    [data-theme="industrial"] .table-card {
      box-shadow: var(--shadow-sm);
    }

    [data-theme="modern"] .table-card {
      box-shadow: var(--shadow-md);
    }

    .table-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: var(--space-4) var(--space-5);
      border-bottom: 1px solid var(--color-border);
    }

    .table-wrap {
      overflow-x: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: var(--text-body-sm);
      min-width: 520px;
    }

    thead {
      background-color: var(--color-surface-2);
    }

    th {
      padding: var(--space-3) var(--space-5);
      text-align: left;
      font-size: 11px;
      font-weight: var(--font-weight-bold);
      letter-spacing: var(--tracking-widest);
      text-transform: uppercase;
      color: var(--color-text-muted);
      white-space: nowrap;
    }

    td {
      padding: var(--space-4) var(--space-5);
      border-bottom: 1px solid var(--color-border);
      color: var(--color-text-secondary);
      vertical-align: middle;
    }

    tr:last-child td {
      border-bottom: none;
    }

    tr:hover td {
      background-color: var(--color-surface-1);
    }

    .td-mono {
      font-family: var(--font-mono);
      color: var(--color-text-primary);
      font-weight: var(--font-weight-semibold);
    }

    .td-time {
      font-family: var(--font-mono);
      font-size: var(--text-caption);
      color: var(--color-text-muted);
    }

    .td-client {
      font-weight: var(--font-weight-semibold);
      color: var(--color-text-primary);
    }

    .td-products {
      font-size: var(--text-caption);
      color: var(--color-text-muted);
      max-width: 180px;
    }

    .pago-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px var(--space-3);
      border-radius: var(--radius-full);
      font-size: 10px;
      font-weight: var(--font-weight-bold);
      letter-spacing: var(--tracking-wide);
      text-transform: uppercase;
    }

    .pago-badge--efectivo {
      background-color: rgba(34, 197, 94, 0.12);
      color: var(--color-success);
    }

    .pago-badge--tarjeta {
      background-color: rgba(99, 102, 241, 0.12);
      color: #818cf8;
    }

    .pago-badge--transferencia {
      background-color: rgba(234, 179, 8, 0.12);
      color: var(--color-warning);
    }

    .pago-badge--credito {
      background-color: var(--color-primary-muted);
      color: var(--color-primary);
    }

    /* ==========================================================================
       MOBILE — Hamburger Menu & Responsive
       ========================================================================== */

    @media (max-width: 767px) {
      .sidebar {
        transform: translateX(-100%);
      }

      .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
      }

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

      .main {
        margin-left: 0;
      }

      .hamburger-btn {
        display: flex;
      }

      .header__store-badge {
        display: none;
      }

      .dashboard {
        padding: var(--space-4);
        gap: var(--space-5);
      }

      .kpi-card__value {
        font-size: 1.25rem;
      }

      .header {
        padding: var(--space-3) var(--space-4);
      }
    }

    @media (min-width: 768px) {
      .two-col-grid {
        grid-template-columns: 1fr 1fr;
      }

      .alerts-grid {
        display: grid;
        grid-template-columns: 1fr;
      }
    }

    @media (min-width: 1024px) {
      .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
      }

      .alerts-grid {
        grid-template-columns: repeat(3, 1fr);
      }
    }

    @media (min-width: 1280px) {
      .dashboard {
        padding: var(--space-8);
        gap: var(--space-8);
      }
    }

    /* ==========================================================================
       SVG ICONS — Inline utility
       ========================================================================== */

    svg {
      display: block;
    }
  </style>
</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>

        <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">Buenos días, Carlos</div>
            <div class="header__subtitle">Miércoles, 1 de abril de 2026 &nbsp;·&nbsp; Sucursal Centro</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">
            <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">
            <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>
            <span class="section-action">Ver detalle &rarr;</span>
          </div>
          <div class="kpi-grid">

            <!-- Card 1: Ventas Hoy -->
            <div class="kpi-card">
              <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">$45,230</div>
              <div class="kpi-card__meta">
                <span class="kpi-tag kpi-tag--up">
                  <svg width="9" height="9" viewBox="0 0 9 9" fill="none">
                    <path d="M4.5 7V2M2 4.5L4.5 2 7 4.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
                  </svg>
                  +12%
                </span>
                <span class="kpi-meta-text">vs ayer $40,382</span>
              </div>
            </div>

            <!-- Card 2: Ventas Mes -->
            <div class="kpi-card">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Ventas Mes
                <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">$892,150</div>
              <div class="kpi-card__meta">
                <span class="kpi-meta-text">Meta: $1,310,000</span>
              </div>
              <div class="kpi-progress">
                <div class="kpi-progress__track">
                  <div class="kpi-progress__fill" style="width: 68%"></div>
                </div>
                <div class="kpi-progress__label">
                  <span>68% de meta</span>
                  <span>$417,850 restante</span>
                </div>
              </div>
            </div>

            <!-- Card 3: Tickets Hoy -->
            <div class="kpi-card">
              <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">23</div>
              <div class="kpi-card__meta">
                <span class="kpi-tag kpi-tag--neutral">Promedio</span>
                <span class="kpi-meta-text">$1,966 por ticket</span>
              </div>
            </div>

            <!-- Card 4: Utilidad Mes -->
            <div class="kpi-card">
              <div class="kpi-card__accent-bar"></div>
              <div class="kpi-card__label">
                Utilidad Mes
                <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">$178,430</div>
              <div class="kpi-card__meta">
                <span class="kpi-tag kpi-tag--up">20%</span>
                <span class="kpi-meta-text">margen neto</span>
              </div>
            </div>

          </div><!-- end kpi-grid -->
        </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;">
                  Total semana: <strong style="color:var(--color-primary);font-family:var(--font-mono);">$267,840</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: heights are % of max (Jue = max $52k) -->
            <div class="bar-chart" id="bar-chart">

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar" style="height:62%" data-value="$32,100"></div>
                </div>
                <span class="bar-chart__label">Lun</span>
              </div>

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar" style="height:79%" data-value="$41,200"></div>
                </div>
                <span class="bar-chart__label">Mar</span>
              </div>

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar" style="height:71%" data-value="$36,800"></div>
                </div>
                <span class="bar-chart__label">Mié</span>
              </div>

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar" style="height:100%" data-value="$52,000"></div>
                </div>
                <span class="bar-chart__label">Jue</span>
              </div>

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar" style="height:88%" data-value="$45,800"></div>
                </div>
                <span class="bar-chart__label">Vie</span>
              </div>

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar" style="height:55%" data-value="$28,600"></div>
                </div>
                <span class="bar-chart__label">Sáb</span>
              </div>

              <div class="bar-chart__col">
                <div class="bar-chart__bar-wrap">
                  <div class="bar-chart__bar today" style="height:87%" data-value="$45,230 ← Hoy"></div>
                </div>
                <span class="bar-chart__label" style="color:var(--color-primary);font-weight:700;">Dom</span>
              </div>

            </div>

            <div class="chart-legend">
              <div class="legend-item">
                <div class="legend-dot"></div>
                Ventas brutas
              </div>
              <div class="legend-item">
                <div class="legend-dot legend-dot--success"></div>
                Semana anterior promedio: $38,400
              </div>
            </div>

          </div><!-- end chart-card -->
        </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
                </div>
                <div style="font-size:var(--text-caption);color:var(--color-primary);font-weight:var(--font-weight-semibold);cursor:pointer;">Ver todos</div>
              </div>
              <div class="rank-list">

                <div class="rank-item">
                  <div class="rank-num rank-num--1">1</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Balatas Brembo Delanteras</div>
                    <div class="rank-item__sub">SKU-0041 &nbsp;·&nbsp; 84 pzas vendidas</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:100%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$67,200</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num rank-num--2">2</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Filtro de Aceite Mann</div>
                    <div class="rank-item__sub">SKU-0087 &nbsp;·&nbsp; 121 pzas vendidas</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:78%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$52,360</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num">3</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Amortiguador KYB Trasero</div>
                    <div class="rank-item__sub">SKU-0023 &nbsp;·&nbsp; 38 pzas vendidas</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:61%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$41,040</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num">4</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Bujía NGK Iridium</div>
                    <div class="rank-item__sub">SKU-0156 &nbsp;·&nbsp; 204 pzas vendidas</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:49%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$32,844</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num">5</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Banda de Distribución Gates</div>
                    <div class="rank-item__sub">SKU-0072 &nbsp;·&nbsp; 27 pzas vendidas</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:38%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$25,650</div>
                </div>

              </div>
            </div><!-- end Top Productos -->

            <!-- Top Clientes -->
            <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 Clientes
                </div>
                <div style="font-size:var(--text-caption);color:var(--color-primary);font-weight:var(--font-weight-semibold);cursor:pointer;">Ver todos</div>
              </div>
              <div class="rank-list">

                <div class="rank-item">
                  <div class="rank-num rank-num--1">1</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Taller Mecánico Ramírez</div>
                    <div class="rank-item__sub">RFC TMR-210415 &nbsp;·&nbsp; 18 compras/mes</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:100%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$89,400</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num rank-num--2">2</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Distribuidora Automotriz López</div>
                    <div class="rank-item__sub">RFC DAL-190302 &nbsp;·&nbsp; 11 compras/mes</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:74%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$66,100</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num">3</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Servicio Automotriz Torres</div>
                    <div class="rank-item__sub">RFC SAT-180720 &nbsp;·&nbsp; 9 compras/mes</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:57%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$50,820</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num">4</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Flotilla Empresarial Hernández</div>
                    <div class="rank-item__sub">RFC FEH-200115 &nbsp;·&nbsp; 7 compras/mes</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:43%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$38,250</div>
                </div>

                <div class="rank-item">
                  <div class="rank-num">5</div>
                  <div class="rank-item__info">
                    <div class="rank-item__name">Refaccionaria El Pistón</div>
                    <div class="rank-item__sub">RFC REP-221108 &nbsp;·&nbsp; 5 compras/mes</div>
                    <div class="rank-item__bar-bg">
                      <div class="rank-item__bar-fill" style="width:30%"></div>
                    </div>
                  </div>
                  <div class="rank-item__value">$26,700</div>
                </div>

              </div>
            </div><!-- end Top Clientes -->

          </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">

            <!-- Alert 1: Low stock (red) -->
            <div class="alert-item alert-item--error">
              <div class="alert-icon-wrap alert-icon-wrap--error">
                <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
                  <path d="M9 3L16.5 15H1.5L9 3z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
                  <path d="M9 8v3M9 12.5v.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
                </svg>
              </div>
              <div class="alert-content">
                <div style="display:flex;align-items:center;gap:var(--space-2);margin-bottom:3px;">
                  <span class="alert-title">Stock Crítico</span>
                  <span class="alert-badge alert-badge--error">3 items</span>
                </div>
                <div class="alert-desc">Balatas Brembo: <strong>3 unidades</strong> · Filtro Mann: <strong>2 unidades</strong> · Bujía NGK: <strong>5 unidades</strong></div>
              </div>
              <div class="alert-action">Reabastecer</div>
            </div>

            <!-- Alert 2: Pending invoices (yellow) -->
            <div class="alert-item alert-item--warning">
              <div class="alert-icon-wrap alert-icon-wrap--warning">
                <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
                  <path d="M4 2h10a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V3a1 1 0 011-1z" stroke="currentColor" stroke-width="1.5"/>
                  <path d="M6 7h6M6 9.5h4M6 12h2" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
                </svg>
              </div>
              <div class="alert-content">
                <div style="display:flex;align-items:center;gap:var(--space-2);margin-bottom:3px;">
                  <span class="alert-title">Ventas sin Facturar</span>
                  <span class="alert-badge alert-badge--warning">8 ventas</span>
                </div>
                <div class="alert-desc">8 ventas del día sin timbrar ante el SAT · Total: <strong>$34,820</strong> · Plazo límite hoy</div>
              </div>
              <div class="alert-action">Facturar</div>
            </div>

            <!-- Alert 3: Credits due (orange) -->
            <div class="alert-item alert-item--orange">
              <div class="alert-icon-wrap alert-icon-wrap--orange">
                <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
                  <circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.5"/>
                  <path d="M9 5v4l2.5 2.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
              </div>
              <div class="alert-content">
                <div style="display:flex;align-items:center;gap:var(--space-2);margin-bottom:3px;">
                  <span class="alert-title">Crédito Vencido</span>
                  <span class="alert-badge alert-badge--orange">Urgente</span>
                </div>
                <div class="alert-desc">Taller Ramírez: <strong>$12,500</strong> vencido hace 15 días · Distribuidora López: <strong>$8,200</strong> vence hoy</div>
              </div>
              <div class="alert-action">Cobrar</div>
            </div>

          </div><!-- end alerts-grid -->
        </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>
                <div class="section-action" style="margin:0;">Ver historial &rarr;</div>
              </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>
                  <tr>
                    <td><span class="td-time">14:32</span></td>
                    <td><span class="td-client">Taller Ramírez</span></td>
                    <td class="td-products">Balatas Brembo (x2), Filtro Mann (x1)</td>
                    <td><span class="td-mono">$3,840</span></td>
                    <td><span class="pago-badge pago-badge--credito">Crédito 30d</span></td>
                  </tr>
                  <tr>
                    <td><span class="td-time">13:18</span></td>
                    <td><span class="td-client">Público General</span></td>
                    <td class="td-products">Amortiguador KYB (x1), Bujía NGK (x4)</td>
                    <td><span class="td-mono">$2,156</span></td>
                    <td><span class="pago-badge pago-badge--tarjeta">Tarjeta</span></td>
                  </tr>
                  <tr>
                    <td><span class="td-time">12:45</span></td>
                    <td><span class="td-client">Flotilla Hernández</span></td>
                    <td class="td-products">Banda Gates (x3), Filtro aceite (x6)</td>
                    <td><span class="td-mono">$7,380</span></td>
                    <td><span class="pago-badge pago-badge--transferencia">Transferencia</span></td>
                  </tr>
                  <tr>
                    <td><span class="td-time">11:07</span></td>
                    <td><span class="td-client">Servicio Torres</span></td>
                    <td class="td-products">Amortiguador KYB (x2)</td>
                    <td><span class="td-mono">$2,160</span></td>
                    <td><span class="pago-badge pago-badge--efectivo">Efectivo</span></td>
                  </tr>
                  <tr>
                    <td><span class="td-time">10:23</span></td>
                    <td><span class="td-client">Distribuidora López</span></td>
                    <td class="td-products">Bujía NGK (x24), Filtro Mann (x12), Balatas (x4)</td>
                    <td><span class="td-mono">$18,440</span></td>
                    <td><span class="pago-badge pago-badge--transferencia">Transferencia</span></td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </section>

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

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

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


  <script src="/pos/static/js/app-init.js"></script>
  <script src="/pos/static/js/sidebar.js"></script>
  <script src="/pos/static/js/dashboard.js"></script>

</body>
</html>
