@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ══════════════════════════════════════════════════════════════════════════
   1. VARIABLES — Modo Oscuro (default)
══════════════════════════════════════════════════════════════════════════ */
:root {
  --color-primary:      #f97316;
  --color-primary-rgb:  249, 115, 22;
  --color-action:       #f97316;
  --color-action-rgb:   249, 115, 22;
  --color-alert:        #fbbf24;
  --color-success:      #22c55e;
  --color-danger:       #ef4444;
  --color-info:         #06b6d4;

  --bg-body:            #09090b;
  --bg-sidebar:         #0c0c0f;
  --bg-sidebar-dark:    #080809;
  --bg-card:            #18181b;
  --bg-card2:           #1f1f23;
  --bg-header:          #0d0d10;
  --bg-hover:           #27272a;

  --text-primary:       #f4f4f5;
  --text-secondary:     #a1a1aa;
  --text-muted:         #52525b;
  --text-sidebar:       #a1a1aa;
  --text-sidebar-active:#ffffff;

  --border-color:       rgba(255,255,255,0.07);
  --border-strong:      rgba(255,255,255,0.12);

  --shadow-sm:          0 1px 3px rgba(0,0,0,.4);
  --shadow-md:          0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:          0 8px 32px rgba(0,0,0,.6);

  --sidebar-width:      240px;
  --sidebar-collapsed:  60px;
  --header-height:      60px;

  --radius-sm:          8px;
  --radius-md:          12px;
  --radius-lg:          16px;
  --radius-xl:          20px;

  --font-body:          'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:          'JetBrains Mono', monospace;
  --transition:         0.18s ease;
}

/* ══════════════════════════════════════════════════════════════════════════
   2. MODO CLARO
══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg-body:            #f4f6f9;
  --bg-sidebar:         #1a1a2e;
  --bg-sidebar-dark:    #12121f;
  --bg-card:            #ffffff;
  --bg-card2:           #f8f9fb;
  --bg-header:          #ffffff;
  --bg-hover:           #f1f3f6;

  --text-primary:       #18181b;
  --text-secondary:     #52525b;
  --text-muted:         #a1a1aa;
  --text-sidebar:       rgba(255,255,255,0.72);
  --text-sidebar-active:#ffffff;

  --border-color:       #e4e4e7;
  --border-strong:      #d4d4d8;

  --shadow-sm:          0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:          0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:          0 8px 32px rgba(0,0,0,.10);
}

/* ══════════════════════════════════════════════════════════════════════════
   3. RESET & BASE
══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: var(--font-body); }

/* ══════════════════════════════════════════════════════════════════════════
   4. LAYOUT GENERAL
══════════════════════════════════════════════════════════════════════════ */
.app-wrapper { display: flex; min-height: 100vh; }

.main-content {
  margin-left: 0 !important;
  width: 100% !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-body {
  flex: 1;
  padding: 28px 32px;
  padding-top: 36px;
  margin-top: var(--header-height);
}

/* ══════════════════════════════════════════════════════════════════════════
   5. SIDEBAR
══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 150;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 24px rgba(0,0,0,.5);
  border-right: 1px solid rgba(249,115,22,0.1);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.open { transform: translateX(0); }

/* Línea naranja decorativa lateral */
.sidebar::before {
  content: '';
  position: absolute;
  left: 0; top: 15%; bottom: 15%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(249,115,22,0.5), transparent);
  border-radius: 2px;
  pointer-events: none;
}

/* Logo ComercialOS */
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 34px; height: 34px;
  background: var(--color-primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(249,115,22,0.3);
}

.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text strong { color: #fff; font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.logo-text span { color: rgba(255,255,255,0.35); font-size: 9.5px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  padding: 10px 16px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}

.nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav-text { transition: opacity 0.2s ease; }

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.nav-item:hover i { opacity: 1; }

.nav-item.active {
  background: rgba(249,115,22,0.15);
  color: var(--color-primary);
  font-weight: 600;
}
.nav-item.active i { opacity: 1; }
.nav-item.active::after {
  content: '';
  position: absolute;
  right: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--color-primary);
  border-radius: 2px 0 0 2px;
}

/* Sub-items */
.nav-subitem {
  padding-left: 32px !important;
  font-size: 12px !important;
  opacity: 0.85;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.user-avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(249,115,22,0.2);
  border: 1px solid rgba(249,115,22,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.user-mini-info strong { display: block; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.2; }
.user-mini-info span { color: rgba(255,255,255,0.35); font-size: 10px; }

/* Sidebar overlay */
#sidebarOverlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 149;
  cursor: pointer;
}
#sidebarOverlay.open { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   6. HEADER
══════════════════════════════════════════════════════════════════════════ */
.app-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  transition: background var(--transition), border-color var(--transition);
  gap: 12px;
}

.header-module { flex: 1; min-width: 0; }
.header-module h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-module .breadcrumb-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Empresa del cliente */
.header-empresa {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(249,115,22,0.25);
  background: rgba(249,115,22,0.06);
  flex: 1;
  max-width: 500px;
  overflow: hidden;
}
.header-empresa-logo {
  height: 28px; max-width: 90px;
  object-fit: contain; flex-shrink: 0;
  border-radius: 5px;
}
.header-empresa-nombre {
  font-size: 14px; font-weight: 800;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

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

.btn-header-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer;
  transition: all var(--transition);
}
.btn-header-icon:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(249,115,22,0.08);
}

.header-divider { width: 1px; height: 22px; background: var(--border-color); margin: 0 2px; }

.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(249,115,22,0.2);
  border: 1px solid rgba(249,115,22,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--color-primary);
}

/* ══════════════════════════════════════════════════════════════════════════
   7. STAT CARDS
══════════════════════════════════════════════════════════════════════════ */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.turquesa::before { background: var(--color-primary); }
.stat-card.azul::before     { background: var(--color-info); }
.stat-card.verde::before    { background: var(--color-success); }
.stat-card.alerta::before   { background: var(--color-alert); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.stat-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 17px; }

.stat-card.turquesa .stat-icon { background: rgba(249,115,22,0.12); color: var(--color-primary); }
.stat-card.azul .stat-icon     { background: rgba(6,182,212,0.12); color: var(--color-info); }
.stat-card.verde .stat-icon    { background: rgba(34,197,94,0.12); color: var(--color-success); }
.stat-card.alerta .stat-icon   { background: rgba(251,191,36,0.12); color: var(--color-alert); }

.stat-value { font-size: 24px; font-weight: 800; color: var(--text-primary); letter-spacing: -1px; line-height: 1; margin-bottom: 5px; }
.stat-trend { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.stat-trend.positive { color: var(--color-success); }
.stat-trend.warning  { color: var(--color-alert); }
.stat-trend.negative { color: var(--color-danger); }

/* ══════════════════════════════════════════════════════════════════════════
   8. CARD PANELS
══════════════════════════════════════════════════════════════════════════ */
.card-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
}
.card-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.card-panel-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.card-panel-body { padding: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   9. TABLAS
══════════════════════════════════════════════════════════════════════════ */
.sales-table { width: 100%; border-collapse: collapse; }
.sales-table th {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text-muted);
  padding: 10px 18px; background: var(--bg-card2);
  border-bottom: 1px solid var(--border-color); text-align: left;
}
.sales-table td {
  padding: 12px 18px; font-size: 13px; color: var(--text-primary);
  border-bottom: 1px solid var(--border-color); vertical-align: middle;
}
.sales-table tr:last-child td { border-bottom: none; }
.sales-table tr:hover td { background: var(--bg-hover); }

.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.badge-pagado    { background: rgba(34,197,94,0.12);  color: var(--color-success); }
.badge-pagado::before { background: var(--color-success); }
.badge-pendiente { background: rgba(251,191,36,0.12); color: var(--color-alert); }
.badge-pendiente::before { background: var(--color-alert); }
.badge-anulado   { background: rgba(239,68,68,0.1);   color: var(--color-danger); }
.badge-anulado::before { background: var(--color-danger); }

/* ══════════════════════════════════════════════════════════════════════════
   10. PRODUCT CARDS
══════════════════════════════════════════════════════════════════════════ */
.product-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border-color); padding: 18px;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(249,115,22,0.25); }
.product-card-icon {
  width: 44px; height: 44px; background: rgba(249,115,22,0.1);
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; font-size: 20px; color: var(--color-primary); margin-bottom: 12px;
}
.product-card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; line-height: 1.3; }
.product-card-sku { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.product-card-category {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 20px;
  background: rgba(249,115,22,0.1); color: var(--color-primary); margin-bottom: 14px;
}
.product-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border-color); }
.product-price { font-size: 16px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.stock-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.stock-ok  { background: rgba(34,197,94,0.12); color: var(--color-success); }
.stock-low { background: rgba(251,191,36,0.12); color: var(--color-alert); }
.stock-out { background: rgba(239,68,68,0.10); color: var(--color-danger); }
.product-card-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ══════════════════════════════════════════════════════════════════════════
   11. BOTONES
══════════════════════════════════════════════════════════════════════════ */
.btn-action {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-action-primary {
  background: var(--color-primary); color: #fff;
}
.btn-action-primary:hover {
  background: #ea6c0a;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(249,115,22,0.35);
  color: #fff;
}
.btn-action-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-action-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(249,115,22,0.07);
}
.btn-action-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 12px;
}
.btn-action-ghost:hover {
  color: var(--color-primary);
  background: rgba(249,115,22,0.07);
}
.btn-sm { padding: 6px 13px; font-size: 12px; }

/* ══════════════════════════════════════════════════════════════════════════
   12. TOOLBAR / FILTROS
══════════════════════════════════════════════════════════════════════════ */
.page-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.search-input-wrap { position: relative; flex: 1; max-width: 320px; }
.search-input-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.search-input {
  width: 100%; padding: 9px 13px 9px 34px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary);
  font-family: var(--font-body); font-size: 13px; transition: all var(--transition);
}
.search-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(249,115,22,0.12); }
.filter-select {
  padding: 9px 30px 9px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-card);
  color: var(--text-secondary); font-family: var(--font-body); font-size: 13px;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2371717a' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; transition: all var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--color-primary); }

/* ══════════════════════════════════════════════════════════════════════════
   13. PAGE HEADER
══════════════════════════════════════════════════════════════════════════ */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header-title h2 { font-size: 21px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; line-height: 1.2; }
.page-header-title p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════════════════
   14. PLACEHOLDER
══════════════════════════════════════════════════════════════════════════ */
.placeholder-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 380px; text-align: center; gap: 14px; }
.placeholder-icon { width: 68px; height: 68px; border-radius: var(--radius-xl); background: rgba(249,115,22,0.1); display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--color-primary); }
.placeholder-box h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.placeholder-box p { font-size: 13px; color: var(--text-secondary); max-width: 300px; line-height: 1.6; }

/* ══════════════════════════════════════════════════════════════════════════
   15. FOOTER
══════════════════════════════════════════════════════════════════════════ */
.app-footer {
  padding: 12px 28px;
  border-top: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-header);
  transition: background var(--transition);
}
.app-footer span { font-size: 11.5px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════
   16. ANIMACIONES
══════════════════════════════════════════════════════════════════════════ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalPop { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rowFlash { 0% { background: rgba(249,115,22,.15); } 100% { background: transparent; } }

.animate-in { animation: fadeInUp 0.3s ease both; }
.animate-in:nth-child(1) { animation-delay: 0.04s; }
.animate-in:nth-child(2) { animation-delay: 0.08s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.16s; }
.animate-in:nth-child(5) { animation-delay: 0.20s; }
.animate-in:nth-child(6) { animation-delay: 0.24s; }

.row-flash { animation: rowFlash 900ms ease; }

/* ══════════════════════════════════════════════════════════════════════════
   17. SCANNER
══════════════════════════════════════════════════════════════════════════ */
.inventory-scan { width: 100%; }
.scan-zone {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color); background: var(--bg-card);
  transition: all var(--transition); overflow: hidden;
}
.scan-zone:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(249,115,22,0.12); }
.scan-icon { font-size: 17px; color: var(--text-muted); }
.scan-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 0 5px rgba(34,197,94,.12); flex-shrink: 0; }
.scan-kbd { margin-left: auto; font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); padding: 3px 7px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-hover); }
.scan-zone input { width: 100%; border: none; outline: none; background: transparent; color: var(--text-primary); font-size: 13.5px; padding: 5px 0; }

/* ══════════════════════════════════════════════════════════════════════════
   18. MODALES
══════════════════════════════════════════════════════════════════════════ */
.sale-overlay {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 9999;
}
.sale-overlay.open { display: flex; }
.sale-modal {
  width: 100%; max-width: 520px; background: var(--bg-card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 20px; animation: modalPop .16s ease;
}
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 1000;
  align-items: center; justify-content: center; padding: 18px;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-height: 90vh; overflow-y: auto; animation: modalPop .15s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border-color);
}
.modal-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 16px; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════════════════════
   19. SIDEBAR COLAPSADO (legacy)
══════════════════════════════════════════════════════════════════════════ */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .user-mini-info { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-logo { padding: 18px 0; display: flex; justify-content: center; }
.sidebar.collapsed .logo-mark { justify-content: center; }
.sidebar.collapsed .sidebar-nav { display: flex; flex-direction: column; align-items: center; padding: 8px 0; }
.sidebar.collapsed .nav-item { width: 42px; height: 42px; justify-content: center; padding: 0; margin: 2px auto; gap: 0; }
.sidebar.collapsed .nav-item i { width: auto; font-size: 17px; }
.sidebar.collapsed .nav-item.active::after { display: none; }
.sidebar.collapsed .sidebar-footer { display: flex; justify-content: center; padding: 10px 0; }
.sidebar.collapsed .user-mini { justify-content: center; padding: 6px 0; gap: 0; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* ══════════════════════════════════════════════════════════════════════════
   20. RESPONSIVE MOBILE
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --header-height: 54px; }
  .page-body { padding: 14px; padding-top: 20px; }
  .app-header { padding: 0 12px; gap: 8px; }
  .header-module h1 { font-size: 14px; }
  .header-module .breadcrumb-sub { display: none; }
  .sidebar { width: min(var(--sidebar-width), 85vw); }
  .header-empresa { display: none; }
}

@media (max-width: 1024px) {
  main.page-body > div[style*="grid-template-columns:2fr 1fr"],
  main.page-body > div[style*="grid-template-columns: 2fr 1fr"],
  main.page-body > div[style*="grid-template-columns:1fr 2fr 1fr"],
  main.page-body > div[style*="grid-template-columns: 1fr 2fr 1fr"] {
    display: flex !important; flex-direction: column !important;
  }
}

@media (max-width: 768px) {
  main.page-body > div[style*="grid-template-columns:repeat(auto-fit"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .page-toolbar { flex-direction: column; align-items: stretch; }
  .search-input-wrap { max-width: 100%; }
  .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .aj-grid-2, .aj-grid-3 { grid-template-columns: 1fr !important; }
  table { min-width: 540px; }
  div[style*="overflow-x:auto"] { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 900px) {
  .pos-layout { flex-direction: column !important; height: auto !important; overflow: visible !important; }
  .pos-left { height: auto !important; min-height: 55vh; border-right: none !important; border-bottom: 1px solid var(--border-color); }
  .pos-right { height: auto !important; min-height: 38vh; }
  .products-scroll { max-height: 55vh; overflow-y: auto; }
  .sc-chips { flex-wrap: wrap !important; gap: 5px !important; }
  .sc-chip { font-size: 11px !important; padding: 4px 9px !important; }
  .products-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr !important; }
  .cobro-overlay { padding: 0 !important; align-items: flex-end !important; }
  .cobro-modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important; max-height: 95vh !important; overflow-y: auto; width: 100% !important; max-width: 100% !important; }
  .cobro-layout { flex-direction: column !important; }
  .sale-modal { padding: 14px; }
  .deptos-mgr-overlay { align-items: flex-end !important; }
  .deptos-mgr-modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important; max-height: 90vh; width: 100% !important; max-width: 100% !important; }
  .depto-price-overlay { align-items: flex-end !important; padding: 0 !important; }
  .depto-price-modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important; width: 100% !important; }
}

@media (max-width: 768px) {
  .filtros-bar { flex-direction: column; align-items: stretch; }
  .filtros-bar .fg { flex: 1; }
  .filtros-bar input[type=date] { width: 100%; }
  .btn-buscar, .btn-pdf { width: 100%; justify-content: center; }
  .filtros-hint { margin-left: 0; width: 100%; }
  .metodos-grid { grid-template-columns: 1fr !important; }
  .resumen-total { flex-direction: column; align-items: stretch; gap: 10px !important; padding: 14px !important; }
  .rt-item { text-align: left !important; display: flex; justify-content: space-between; align-items: center; min-width: unset !important; }
  .rt-arrow { display: none; }
  table.dt thead th:nth-child(n+5), table.dt tbody td:nth-child(n+5) { display: none; }
  .nav-item { min-height: 42px; }
  ::-webkit-scrollbar { width: 0; height: 0; }
}
