/* ==========================================================================
   DPC POS — Clean Pro Design System (2026-08)
   Inspiración: Plusval Inmobiliaria — colores sólidos, sin gradientes,
   fondos blancos, un solo acento fuerte, tipografía limpia.
   Tipografía: Outfit (display) + DM Sans (body) + JetBrains Mono (números).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Variables
   -------------------------------------------------------------------------- */
:root {
  /* Superficies — limpias, sin gradientes */
  --ink:            #1e293b;
  --ink-light:      #334155;
  --ink-muted:      #475569;
  --surface:        #f8fafc;
  --surface-cool:   #f1f5f9;
  --card:           #ffffff;

  /* Accent: teal sólido */
  --accent:         #0891b2;
  --accent-soft:    #ecfeff;
  --accent-hover:   #0e7490;
  --accent-glow:    rgba(8, 145, 178, .15);
  --accent-deep:    #155e75;

  /* Semánticos */
  --success:        #059669;
  --success-soft:   #ecfdf5;
  --warn:           #d97706;
  --warn-soft:      #fffbeb;
  --danger:         #dc2626;
  --danger-soft:    #fef2f2;
  --info:           #2563eb;
  --info-soft:      #eff6ff;

  /* Neutros */
  --muted:          #64748b;
  --muted-light:    #94a3b8;
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;

  /* Bootstrap overrides */
  --bs-primary:           var(--accent);
  --bs-primary-rgb:       8, 145, 178;
  --bs-link-color:        var(--accent);
  --bs-link-color-rgb:    8, 145, 178;
  --bs-link-hover-color:  var(--accent-hover);
  --bs-body-bg:           var(--surface);
  --bs-body-color:        #1e293b;
  --bs-border-color:      var(--border);
  --bs-border-radius:     .5rem;
  --bs-border-radius-lg:  .75rem;
  --bs-border-radius-sm:  .375rem;

  /* Shell */
  --app-sidebar-w:           260px;
  --app-sidebar-w-collapsed: 72px;
  --app-topbar-h:            60px;
  --app-sidebar-bg:          var(--ink);

  /* Sombras — sutiles */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, .04);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, .07);
  --shadow-lg:  0 12px 32px rgba(0, 0, 0, .1);

  /* Curvas de easing */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

html { font-size: 15px; }

body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--surface);
  color: var(--bs-body-color);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: "Outfit", "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   2. Shell
   -------------------------------------------------------------------------- */

/* Sidebar */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--app-sidebar-w);
  background: var(--ink);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width .25s var(--ease-out), transform .25s var(--ease-out);
}

.app-sidebar-logo {
  height: var(--app-topbar-h);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.app-sidebar-logo .logo-mark {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: .5rem;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
}

.app-sidebar-logo .logo-text {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.15;
}
.app-sidebar-logo .logo-text small {
  display: block;
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  font-size: .65rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Navegación sidebar */
.app-sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .75rem .7rem 1.2rem;
}
.app-sidebar-nav::-webkit-scrollbar { width: 4px; }
.app-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.menu-section {
  font-family: "Outfit", sans-serif;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 1rem .7rem .35rem;
}

.app-sidebar-nav a.menu-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  margin-bottom: 1px;
  border-radius: .55rem;
  color: rgba(255,255,255,.55);
  font-size: .87rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s var(--ease-out);
  position: relative;
}
.app-sidebar-nav a.menu-item i.menu-icon {
  font-size: 1rem;
  color: rgba(255,255,255,.3);
  transition: color .15s var(--ease-out);
  width: 20px;
  text-align: center;
}

/* Hover: sutil highlight */
.app-sidebar-nav a.menu-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.app-sidebar-nav a.menu-item:hover i.menu-icon { color: rgba(255,255,255,.7); }

/* Activo: borde izquierdo teal + texto blanco */
.app-sidebar-nav a.menu-item.active {
  background: rgba(8, 145, 178, .12);
  color: #fff;
  font-weight: 600;
}
.app-sidebar-nav a.menu-item.active i.menu-icon { color: var(--accent); }
.app-sidebar-nav a.menu-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

/* Submenús */
.app-sidebar-nav .menu-sub-link,
.sidebar-flyout .menu-sub-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .7rem .4rem 2.2rem;
  border-radius: .45rem;
  color: rgba(255,255,255,.4);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s var(--ease-out);
}
.app-sidebar-nav .menu-sub-link:hover,
.sidebar-flyout .menu-sub-link:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
}
.app-sidebar-nav .menu-sub-link.active,
.sidebar-flyout .menu-sub-link.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(8, 145, 178, .1);
}
.app-sidebar-nav .menu-sub-link i,
.sidebar-flyout .menu-sub-link i {
  font-size: .85rem;
  opacity: .6;
}

.menu-arrow {
  margin-left: auto;
  font-size: .7rem;
  transition: transform .2s var(--ease-out);
  color: rgba(255,255,255,.2);
}
a.menu-item[aria-expanded="true"] .menu-arrow { transform: rotate(90deg); }

/* Footer sidebar */
.app-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .75rem 1rem;
  flex-shrink: 0;
  background: rgba(0,0,0,.15);
}
.app-sidebar-footer .fw-semibold {
  color: rgba(255,255,255,.92);
}
.app-sidebar-footer .text-muted {
  color: rgba(255,255,255,.45) !important;
}
.app-sidebar-footer .btn-soft-blue {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.6);
  border-color: rgba(255,255,255,.1);
}
.app-sidebar-footer .btn-soft-blue:hover {
  background: rgba(255,255,255,.14);
  color: #fff;
}

/* Topbar */
.app-topbar {
  position: fixed;
  top: 0; right: 0;
  left: var(--app-sidebar-w);
  height: var(--app-topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 1030;
  transition: left .25s var(--ease-out);
  box-shadow: var(--shadow-xs);
}

.app-topbar .topbar-title {
  font-family: "Outfit", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.topbar-toggle {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s var(--ease-out);
}
.topbar-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(8,145,178,.25);
}

/* Contenido */
.app-main {
  margin-left: var(--app-sidebar-w);
  padding: calc(var(--app-topbar-h) + 1.25rem) 1.5rem 2.5rem;
  min-height: 100vh;
  transition: margin-left .25s var(--ease-out);
}
.app-content {
  max-width: 1440px;
  margin: 0 auto;
}

/* Sidebar collapsed */
body.sidebar-collapsed .app-sidebar { width: var(--app-sidebar-w-collapsed); }
body.sidebar-collapsed .app-topbar { left: var(--app-sidebar-w-collapsed); }
body.sidebar-collapsed .app-main { margin-left: var(--app-sidebar-w-collapsed); }
body.sidebar-collapsed .app-sidebar-logo .logo-text,
body.sidebar-collapsed .app-sidebar-nav .menu-section,
body.sidebar-collapsed .app-sidebar-nav .menu-item > span:not(.menu-icon),
body.sidebar-collapsed .app-sidebar-nav .collapse,
body.sidebar-collapsed .app-sidebar-footer .menu-user-text,
body.sidebar-collapsed .app-sidebar-footer .menu-logout-text { display: none; }
body.sidebar-collapsed .app-sidebar-logo { justify-content: center; padding: 0; }
body.sidebar-collapsed .app-sidebar-nav a.menu-item { justify-content: center; padding: .55rem 0; }
body.sidebar-collapsed .app-sidebar-nav a.menu-item .menu-arrow { display: none; }
body.sidebar-collapsed .app-sidebar-footer .btn { justify-content: center; }

/* Flyout al hover (solo sidebar colapsada en escritorio) */
.sidebar-flyout {
  display: none;
  position: absolute;
  left: calc(100% + 10px);
  top: 0;
  min-width: 215px;
  max-height: min(480px, calc(100vh - 32px));
  overflow-y: auto;
  background: #16233a;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: .7rem;
  padding: .45rem;
  box-shadow: 0 14px 34px rgba(2, 8, 20, .5);
  z-index: 60;
}
.sidebar-flyout.show { display: block; }
.sidebar-flyout::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 14px;
  width: 12px;
  height: 12px;
  background: #16233a;
  transform: rotate(45deg);
  border-left: 1px solid rgba(255,255,255,.09);
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-flyout .flyout-title {
  font-family: "Outfit", sans-serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: .3rem .7rem .35rem;
}
.sidebar-flyout .menu-sub-link {
  padding-left: .7rem;
  white-space: nowrap;
}

/* Mobile */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-collapsed .app-sidebar,
  body.sidebar-collapsed .app-sidebar-logo .logo-text,
  body.sidebar-collapsed .app-sidebar-nav .menu-section,
  body.sidebar-collapsed .app-sidebar-nav .menu-item > span:not(.menu-icon),
  body.sidebar-collapsed .app-sidebar-footer .menu-user-text { display: initial; }
  body.sidebar-collapsed .app-sidebar-nav .menu-item > span:not(.menu-icon) { display: inline; }
  body.sidebar-collapsed .app-sidebar-nav .collapse.show { display: block; }
  body.sidebar-collapsed .app-sidebar-nav a.menu-item { justify-content: flex-start; padding: .55rem .7rem; }
  body.sidebar-collapsed .app-sidebar-logo { justify-content: flex-start; padding: 0 1.15rem; }
  body.sidebar-collapsed .app-sidebar-nav .menu-arrow { display: inline; }
  .app-topbar { left: 0; }
  .app-main { margin-left: 0; padding: calc(var(--app-topbar-h) + 1rem) 1rem 2rem; }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 25, 35, .55);
    backdrop-filter: blur(2px);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease-out);
  }
  body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
}

/* --------------------------------------------------------------------------
   3. Componentes
   -------------------------------------------------------------------------- */

/* Tarjetas */
.card {
  border: 1px solid var(--border);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--card);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.card .card-header {
  background: var(--card);
  border-bottom: 1px solid var(--border-light);
  padding: .85rem 1.15rem;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  border-radius: calc(var(--bs-border-radius-lg) - 1px) calc(var(--bs-border-radius-lg) - 1px) 0 0;
}
.card .card-body { padding: 1.15rem; }
.card-hover { transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* KPI cards — legacy (stat-card still used in other pages) */
.stat-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  border-radius: var(--bs-border-radius-lg);
}
.stat-icon {
  width: 48px; height: 48px;
  flex-shrink: 0;
  border-radius: .75rem;
  display: grid; place-items: center;
  font-size: 1.25rem;
}
.stat-icon.blue   { background: var(--accent-soft); color: var(--accent); }
.stat-icon.green  { background: var(--success-soft); color: var(--success); }
.stat-icon.amber  { background: var(--warn-soft); color: var(--warn); }
.stat-icon.red    { background: var(--danger-soft); color: var(--danger); }
.stat-icon.teal   { background: #f0fdfa; color: #0d9488; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }

/* === Dashboard KPI Hero card === */
.kpi-hero {
  background: var(--ink);
  color: #fff;
  border: none;
  overflow: hidden;
  position: relative;
}
.kpi-hero-inner {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  position: relative;
  z-index: 1;
}
.kpi-hero-icon {
  width: 56px; height: 56px;
  border-radius: .75rem;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
.kpi-hero-data {
  display: flex;
  flex-direction: column;
}
.kpi-hero-label {
  font-size: .78rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.kpi-hero-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  letter-spacing: -.02em;
}
.kpi-hero-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.45);
  margin-top: .15rem;
}
.kpi-hero-sparkline {
  margin-top: .85rem;
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.kpi-sparkline-bar {
  height: 100%;
  width: var(--spark-pct, 5%);
  background: var(--accent);
  border-radius: 4px;
  transition: width .8s var(--ease-out);
}

/* === Dashboard KPI Compact card === */
.kpi-compact {
  text-align: center;
}
.kpi-compact .card-body {
  padding: 1.25rem 1rem;
}
.kpi-compact-icon {
  width: 44px; height: 44px;
  border-radius: .7rem;
  display: inline-grid; place-items: center;
  font-size: 1.15rem;
  margin-bottom: .6rem;
}
.kpi-compact-icon.blue   { background: var(--accent-soft); color: var(--accent); }
.kpi-compact-icon.green  { background: var(--success-soft); color: var(--success); }
.kpi-compact-icon.amber  { background: var(--warn-soft); color: var(--warn); }
.kpi-compact-icon.red    { background: var(--danger-soft); color: var(--danger); }
.kpi-compact-icon.teal   { background: #f0fdfa; color: #0d9488; }
.kpi-compact-icon.purple { background: #f5f3ff; color: #7c3aed; }
.kpi-compact-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-compact-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: .1rem;
}
.kpi-alert {
  border-color: rgba(220,38,38,.25) !important;
  background: #fff;
}
.kpi-alert .kpi-compact-icon {
  animation: alertPulse 2s ease-in-out infinite;
}
@keyframes alertPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* === Dashboard KPI Stat card === */
.kpi-stat {
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.kpi-stat-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: .7rem;
  display: grid; place-items: center;
  font-size: 1.15rem;
}
.kpi-stat-icon.blue   { background: var(--accent-soft); color: var(--accent); }
.kpi-stat-icon.green  { background: var(--success-soft); color: var(--success); }
.kpi-stat-icon.amber  { background: var(--warn-soft); color: var(--warn); }
.kpi-stat-icon.red    { background: var(--danger-soft); color: var(--danger); }
.kpi-stat-icon.teal   { background: #f0fdfa; color: #0d9488; }
.kpi-stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.kpi-stat-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-stat-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Botones */
.btn { border-radius: .5rem; font-weight: 600; font-size: .87rem; }
.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: #0c5e73;
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-bg: var(--muted-light);
  --bs-btn-disabled-border-color: transparent;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  transition: transform .12s var(--ease-out), box-shadow .2s var(--ease-out), background .2s ease;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  transform: translateY(-1px);
}
.btn-primary:active, .btn-primary.active {
  background: #0c5e73;
  transform: scale(0.98);
}
.btn-primary:disabled, .btn-primary.disabled {
  box-shadow: none;
  transform: none;
}

.btn-outline-primary {
  --bs-btn-color: var(--accent);
  --bs-btn-border-color: rgba(8,145,178,.35);
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--accent-hover);
  --bs-btn-active-border-color: var(--accent-hover);
  --bs-btn-disabled-color: var(--muted-light);
  --bs-btn-disabled-border-color: var(--border);
}

.btn-light {
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--surface-cool);
}

.btn-soft-blue {
  background: rgba(8,145,178,.08);
  color: var(--accent);
  border: 1px solid rgba(8,145,178,.15);
}
.btn-soft-blue:hover {
  background: rgba(8,145,178,.15);
  color: var(--accent-hover);
}

.btn-sm { border-radius: .4rem; font-size: .8rem; }
.btn-lg { border-radius: .6rem; padding: .65rem 1.3rem; }

.btn:focus-visible, .btn:active:focus, .btn-link.nav-link:focus {
  box-shadow: 0 0 0 .25rem var(--accent-glow) !important;
}

/* Formularios */
.form-control, .form-select {
  border-radius: .5rem;
  border-color: var(--border);
  padding: .5rem .8rem;
  font-size: .88rem;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .22rem var(--accent-glow);
}
.form-control-sm, .form-select-sm { border-radius: .4rem; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--accent-glow); border-color: var(--accent); }
.form-label {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: .8rem;
  color: var(--ink-muted);
}
.input-group-text {
  border-color: var(--border);
  background: var(--surface);
  font-size: .85rem;
  color: var(--muted);
}
.form-control::placeholder { color: var(--muted-light); }

/* Inputs numéricos: ocultar spin buttons del navegador */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* Tablas */
.table { --bs-table-hover-bg: var(--accent-soft); }
.table > :not(caption) > * > * {
  border-bottom-color: var(--border-light);
  padding-top: .6rem;
  padding-bottom: .6rem;
}
.table thead th {
  font-family: "Outfit", sans-serif;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-hover > tbody > tr:hover > * {
  background-color: var(--accent-soft);
  transition: background-color .12s var(--ease-out);
}

/* Table dark (POS grid) */
.table-dark {
  --bs-table-color: #fff;
  --bs-table-bg: var(--ink);
  --bs-table-border-color: var(--ink-muted);
  --bs-table-striped-bg: var(--ink-light);
  --bs-table-striped-color: #fff;
  --bs-table-active-bg: var(--ink-muted);
  --bs-table-active-color: #fff;
  --bs-table-hover-bg: var(--ink-muted);
  --bs-table-hover-color: #fff;
  color: #fff;
}
.table-dark th {
  background: var(--ink) !important;
  color: rgba(255,255,255,.7) !important;
  border-bottom-color: rgba(255,255,255,.1) !important;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Badges soft */
.badge-soft-blue   { background: rgba(8,145,178,.1); color: var(--accent); }
.badge-soft-green  { background: var(--success-soft); color: #047857; }
.badge-soft-amber  { background: var(--warn-soft); color: #b45309; }
.badge-soft-red    { background: var(--danger-soft); color: #b91c1c; }
.badge-soft-teal   { background: #f0fdfa; color: #0d9488; }
.badge-soft-gray   { background: var(--surface); color: var(--muted); }
.badge-soft-purple { background: #f5f3ff; color: #6d28d9; }

/* Alertas */
.alert { border-radius: .6rem; border-width: 0; border-left: 4px solid; }
.alert-success { background: var(--success-soft); color: #065f46; border-left-color: var(--success); }
.alert-danger  { background: var(--danger-soft); color: #991b1b; border-left-color: var(--danger); }
.alert-warning { background: var(--warn-soft); color: #92400e; border-left-color: var(--warn); }
.alert-info    { background: var(--info-soft); color: #1e40af; border-left-color: var(--info); }

/* Modales */
.modal-content {
  border: 0;
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 1.25rem;
}
.modal-title {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}
.modal-footer { border-top: 1px solid var(--border-light); }
/* REMOVIDO: .modal-backdrop.show opacity/backdrop-filter override
   causaba conflicto con Bootstrap's own .modal-backdrop.show opacity.
   Bootstrap usa --bs-backdrop-opacity: 0.5. */

/* Dropdowns */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: .6rem;
  box-shadow: var(--shadow-md);
  padding: .35rem;
  background: var(--card);
}
.dropdown-item {
  border-radius: .4rem;
  padding: .5rem .7rem;
  font-size: .85rem;
  transition: all .1s var(--ease-out);
}
.dropdown-item:hover { background: var(--accent-soft); color: var(--accent-hover); }
.dropdown-item:active { background: var(--accent); color: #fff; }
.dropdown-header {
  font-family: "Outfit", sans-serif;
  font-size: .68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

/* Paginación */
.pagination {
  --bs-pagination-active-bg: var(--accent);
  --bs-pagination-active-border-color: var(--accent);
  --bs-pagination-color: var(--accent);
  --bs-pagination-hover-color: var(--accent-hover);
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem var(--accent-glow);
}

/* Nav tabs */
.nav-tabs { border-bottom-color: var(--border); }
.nav-tabs .nav-link {
  color: var(--muted);
  font-weight: 500;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: .55rem .85rem;
  transition: all .15s var(--ease-out);
}
.nav-tabs .nav-link:hover { color: var(--accent); }
.nav-tabs .nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
  font-weight: 600;
}

/* Avatar */
.avatar-user {
  width: 36px; height: 36px;
  border-radius: .5rem;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: .82rem;
  box-shadow: 0 2px 8px rgba(8, 145, 178, .35);
}

/* Page heading */
.page-heading { margin-bottom: 1.25rem; }
.page-heading h4 {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  margin: 0;
}
.page-heading .page-sub { color: var(--muted); font-size: .85rem; margin: 0; }

/* Scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }

/* --------------------------------------------------------------------------
   4. Login / Auth
   -------------------------------------------------------------------------- */
body.auth-body { margin: 0; background: var(--card); }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 42%) 1fr;
}

.auth-brand {
  position: relative;
  background:
    radial-gradient(1000px 500px at -5% -5%, rgba(6, 182, 212, .15), transparent 50%),
    radial-gradient(800px 400px at 105% 105%, rgba(8, 145, 178, .2), transparent 50%),
    linear-gradient(160deg, var(--ink) 0%, var(--ink-light) 40%, #0c2d48 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 2.8rem;
  overflow: hidden;
}

/* Círculos decorativos (cool teal glow) */
.auth-brand::after {
  content: "";
  position: absolute;
  right: -120px; bottom: -120px;
  width: 380px; height: 380px;
  border-radius: 50%;
  border: 2px solid rgba(8, 145, 178, .12);
}
.auth-brand::before {
  content: "";
  position: absolute;
  right: -30px; bottom: -30px;
  width: 240px; height: 240px;
  border-radius: 50%;
  border: 2px solid rgba(6, 182, 212, .15);
}

.auth-brand .auth-tagline {
  position: relative; z-index: 1;
  max-width: 420px;
}
.auth-brand .auth-tagline h2 {
  color: #fff;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 2.6rem;
  line-height: 1.12;
  margin-bottom: .8rem;
}
.auth-brand .auth-tagline .accent-gradient {
  background: linear-gradient(135deg, #22d3ee, #0891b2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-brand .auth-tagline p {
  color: rgba(255, 255, 255, .55);
  font-size: .95rem;
  line-height: 1.6;
}

.auth-brand .auth-features {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  position: relative;
  z-index: 1;
}
.auth-brand .auth-feat {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
  color: rgba(255, 255, 255, .7);
}
.auth-brand .auth-feat i {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(8, 145, 178, .15);
  color: #22d3ee;
  display: grid; place-items: center;
  font-size: .8rem;
  flex-shrink: 0;
}

.auth-brand .auth-foot {
  position: relative; z-index: 1;
  font-size: .75rem;
  color: rgba(255,255,255,.35);
}

.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--card);
}

.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-card .card { border: 0; box-shadow: none; }
.auth-card .auth-card-title {
  font-family: "Outfit", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}
.auth-card .auth-card-sub { color: var(--muted); font-size: .88rem; }

@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* --------------------------------------------------------------------------
   5. POS (Facturación)
   -------------------------------------------------------------------------- */
.pos-panel { border-radius: var(--bs-border-radius-lg); }
#txtCodigoP {
  border: 2px solid var(--accent);
  font-family: "JetBrains Mono", "DM Sans", monospace;
  font-size: 1rem;
}
#txtCodigoP:focus {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 .25rem var(--accent-glow);
}

/* Mobile POS bar */
.pos-mobile-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1045;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 25, 35, .08);
}
.pos-mobile-total {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
  min-width: 0;
}
.pos-mobile-total span:last-child {
  font-family: "Outfit", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
}
.pos-mobile-btns { display: flex; flex: 1 1 auto; gap: .5rem; justify-content: flex-end; min-width: 0; }
.pos-mobile-btns .btn {
  min-height: 46px;
  border-radius: .55rem;
  padding-left: .85rem;
  padding-right: .85rem;
  white-space: nowrap;
}
.pos-mobile-btns #btnNuevaMovil { flex: 0 0 auto; width: 50px; }

@media (max-width: 991.98px) {
  body.pos-has-mobile-bar .app-main { padding-bottom: 130px; }
  #griDetalle { font-size: .82rem; }
  #griDetalle > thead th { font-size: .68rem; padding-top: .45rem; padding-bottom: .45rem; }
}

/* --------------------------------------------------------------------------
   6. Print
   -------------------------------------------------------------------------- */
@media print {
  .app-sidebar, .app-topbar, .sidebar-overlay, .app-footer, .reporte-acciones, .reporte-no-print, .d-print-none {
    display: none !important;
  }
  .app-main { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
}

/* --------------------------------------------------------------------------
   7. Utilidades extra
   -------------------------------------------------------------------------- */
.text-accent { color: var(--accent) !important; }
.bg-accent { background: var(--accent) !important; }
.border-accent { border-color: rgba(8,145,178,.3) !important; }
.gradient-accent { background: var(--accent); color: #fff; }

/* Divider */
.divider-warm {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

/* --------------------------------------------------------------------------
   8. Animaciones suaves
   Emil Design Engineering: solo transform/opacity, ease-out, <300ms,
   nunca animar acciones de teclado, scale(0.98) en active.
   -------------------------------------------------------------------------- */

/* — Page load: fade-in del contenido principal —
   REMOVIDO: la animación en .app-content rompía modales Bootstrap
   porque opacity:0 del fill-mode both ocultaba todo el contenido
   incluyendo modales position:fixed. Los modales de Bootstrap
   manejan sus propias transiciones (fade). */
.app-content {
  /* animation removed — Bootstrap modal transitions are sufficient */
}

/* — Page load: fade-in suave — solo opacity, sin transform
   (sin transform no crea containing block para position:fixed) */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* — Card entrance: stagger para tarjetas hijos — */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.card {
  animation: cardIn .35s var(--ease-out) both;
}
.card:nth-child(1) { animation-delay: .04s; }
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .16s; }
.card:nth-child(5) { animation-delay: .20s; }
.card:nth-child(6) { animation-delay: .24s; }

/* — KPI stat cards: pop-in con scale — */
@keyframes statPop {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.stat-card {
  animation: statPop .4s var(--ease-out) both;
}

/* — Sidebar nav items: slide-in desde la izquierda — */
@keyframes navSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.app-sidebar-nav a.menu-item {
  animation: navSlideIn .3s var(--ease-out) both;
}
.app-sidebar-nav a.menu-item:nth-child(1) { animation-delay: .05s; }
.app-sidebar-nav a.menu-item:nth-child(2) { animation-delay: .08s; }
.app-sidebar-nav a.menu-item:nth-child(3) { animation-delay: .11s; }
.app-sidebar-nav a.menu-item:nth-child(4) { animation-delay: .14s; }
.app-sidebar-nav a.menu-item:nth-child(5) { animation-delay: .17s; }
.app-sidebar-nav a.menu-item:nth-child(6) { animation-delay: .20s; }
.app-sidebar-nav a.menu-item:nth-child(7) { animation-delay: .23s; }
.app-sidebar-nav a.menu-item:nth-child(8) { animation-delay: .26s; }
.app-sidebar-nav a.menu-item:nth-child(9) { animation-delay: .29s; }
.app-sidebar-nav a.menu-item:nth-child(10) { animation-delay: .32s; }

/* — Botones: micro-interacción hover + active — */
.btn {
  transition: transform .12s var(--ease-out), box-shadow .2s var(--ease-out),
              background .2s ease, border-color .2s ease, color .2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translateY(-1px);
  }
}
.btn:active {
  transform: scale(0.97) !important;
  transition-duration: .08s;
}

/* — Botones primarios: glow pulse sutil en hover — */
.btn-primary {
  position: relative;
  overflow: hidden;
}
/* Button hover shine removed — clean solid style */

/* — Sidebar toggle: rotación suave del icono — */
.topbar-toggle i {
  transition: transform .25s var(--ease-out);
}
.topbar-toggle:active {
  transform: scale(0.92);
}

/* — Tabla rows: hover lift sutil — */
.table-hover > tbody > tr {
  transition: background-color .15s var(--ease-out), transform .15s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .table-hover > tbody > tr:hover {
    transform: scale(1.002);
  }
}

/* — Dropdown: entrance scale — solo cuando se muestra — */
.dropdown-menu.show {
  animation: dropIn .2s var(--ease-out);
  transform-origin: top center;
}
@keyframes dropIn {
  from { opacity: 0; transform: scaleY(.95) translateY(-4px); }
  to   { opacity: 1; transform: scaleY(1) translateY(0); }
}

/* — Modal: REMOVIDO — Bootstrap maneja sus propias transiciones fade.
   Las animaciones custom en .modal-content causaban que el contenido
   quedara invisible (opacity:0) cuando el navegador no reproducía
   la animación correctamente. */
/* .modal.show .modal-content { animation: modalIn .3s var(--ease-out); } */
/* .modal-backdrop.show { animation: backdropIn .25s ease; } */

/* — Badge: pop-in — */
.badge {
  transition: transform .15s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .badge:hover {
    transform: scale(1.08);
  }
}

/* — Alert: slide-in desde arriba — */
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert {
  animation: alertIn .35s var(--ease-out) both;
}

/* — Form focus: glow ring animation — */
@keyframes focusRing {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  100% { box-shadow: 0 0 0 .22rem var(--accent-glow); }
}
.form-control:focus, .form-select:focus {
  animation: focusRing .2s var(--ease-out) both;
}

/* — Nav tabs: underline slide — */
.nav-tabs .nav-link {
  position: relative;
}
.nav-tabs .nav-link::after {
  content: "";
  position: absolute;
  bottom: 0; left: 50%;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width .25s var(--ease-out), left .25s var(--ease-out);
  border-radius: 2px;
}
.nav-tabs .nav-link:hover::after {
  width: 60%;
  left: 20%;
}
.nav-tabs .nav-link.active::after {
  width: 100%;
  left: 0;
}

/* — Avatar user: breathe glow on hover — */
.avatar-user {
  transition: transform .2s var(--ease-out), box-shadow .3s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .avatar-user:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(8, 145, 178, .45);
  }
}

/* — Scroll-triggered: fade-in para elementos con [data-animate] — */
[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s var(--ease-out), transform .5s var(--ease-out);
}
[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* — POS input: pulse ring al enfocar — */
@keyframes posPulse {
  0%   { box-shadow: 0 0 0 0 rgba(8,145,178,.3); }
  70%  { box-shadow: 0 0 0 6px rgba(8,145,178,0); }
  100% { box-shadow: 0 0 0 0 rgba(8,145,178,0); }
}
#txtCodigoP:focus {
  animation: posPulse .6s var(--ease-out);
}

/* — Page heading entrance — */
.page-heading {
  animation: fadeIn .35s var(--ease-out) both;
}

/* — Sidebar footer: fade-in — */
.app-sidebar-footer {
  animation: fadeIn .4s var(--ease-out) .2s both;
}

/* — Pagination: hover lift — */
.pagination .page-link {
  transition: transform .12s var(--ease-out), background .15s ease, color .15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .pagination .page-link:hover {
    transform: translateY(-1px);
  }
}
.pagination .page-item.active .page-link {
  transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   9. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .app-content { animation: none; }
  .card { animation: none; }
  .stat-card { animation: none; }
  .app-sidebar-nav a.menu-item { animation: none; }
  .alert { animation: none; }
  [data-animate] { opacity: 1; transform: none; }
}
