:root{
  --husky-bg-950:#080d13;
  --husky-bg-900:#0b1117;
  --husky-bg-850:#101720;
  --husky-bg-800:#141b24;
  --husky-bg-760:#18212c;
  --husky-surface:#111821;
  --husky-surface-2:#17202b;
  --husky-border:rgba(255,255,255,.08);
  --husky-border-strong:rgba(255,255,255,.14);
  --husky-text:#eef6ff;
  --husky-muted:#9aa7b7;
  --husky-muted-2:#718093;
  --husky-primary:#1aa7a1;
  --husky-primary-600:#15918c;
  --husky-ring:#30d5c8;
  --husky-info:#19c8ff;
  --husky-danger:#e0314b;
  --husky-warning:#f0b429;
  --topbar-height:68px;
  --sidebar-w:292px;
  --sidebar-collapsed-w:86px;
  --radius-xl:18px;
  --radius-lg:14px;
  --shadow-soft:0 18px 45px rgba(0,0,0,.32);
  --transition-fast:.18s ease;
  --transition-normal:.24s ease;
}

*{ box-sizing:border-box; }

html{
  min-height:100%;
  background:var(--husky-bg-900);
}

body.husky-app{
  min-height:100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(26,167,161,.12), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(25,200,255,.08), transparent 28%),
    var(--husky-bg-900);
  color:var(--husky-text);
}

a{ color:inherit; }
a:hover{ color:inherit; }

.bg-husky-900{ background-color:var(--husky-bg-900) !important; }
.bg-husky-800{ background-color:var(--husky-bg-800) !important; }
.text-secondary{ color:var(--husky-muted) !important; }
.min-w-0{ min-width:0 !important; }

/* ─────────────────────────────────────────────────────────────
   Botones / UI base
   ───────────────────────────────────────────────────────────── */

.btn-husky{
  background:linear-gradient(135deg, var(--husky-primary), var(--husky-ring));
  border:none;
  color:#041014;
  font-weight:800;
  box-shadow:0 10px 24px rgba(48,213,200,.25);
}

.btn-husky:hover{
  filter:brightness(.96);
  color:#000;
}

.btn-ghost{
  color:var(--husky-muted);
  border:1px solid transparent;
  background:transparent;
}

.btn-ghost:hover{
  color:#fff;
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.08);
}

.form-control,
.form-select{
  background-color:rgba(255,255,255,.045);
  border:1px solid rgba(255,255,255,.12);
  color:#f1f5f9;
}

.form-control:focus,
.form-select:focus{
  border-color:var(--husky-ring);
  box-shadow:0 0 0 .25rem rgba(48,213,200,.20);
  background-color:rgba(255,255,255,.065);
  color:#fff;
}

.form-control::placeholder{
  color:rgba(226,232,240,.48);
}

.logo-navbar{
  width:28px;
  height:28px;
  object-fit:contain;
}

.logo-login{
  width:120px;
  height:120px;
  object-fit:contain;
  filter:drop-shadow(0 8px 24px rgba(0,0,0,.6));
}

.card-login{
  max-width:880px;
  border:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  backdrop-filter:blur(8px);
  border-radius:18px;
}

/* ─────────────────────────────────────────────────────────────
   Topbar profesional
   ───────────────────────────────────────────────────────────── */

.topbar{
  position:sticky;
  top:0;
  z-index:1030;
  min-height:var(--topbar-height);
  background:rgba(9,14,20,.86);
  border-bottom:1px solid var(--husky-border);
  backdrop-filter:blur(16px);
  box-shadow:0 12px 28px rgba(0,0,0,.20);
}

.topbar-inner{
  min-height:var(--topbar-height);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:10px 20px;
}

.topbar-left,
.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.topbar-actions{
  flex-shrink:0;
}

.topbar-icon-btn,
.topbar-action-btn,
.topbar-user-btn{
  min-height:42px;
  border:1px solid var(--husky-border-strong);
  color:#e8f0f8;
  background:rgba(255,255,255,.035);
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    color var(--transition-fast);
}

.topbar-icon-btn{
  width:42px;
  padding:0;
  color:var(--husky-info);
}

.topbar-icon-btn:hover,
.topbar-action-btn:hover,
.topbar-user-btn:hover{
  color:#fff;
  background:rgba(48,213,200,.10);
  border-color:rgba(48,213,200,.36);
  transform:translateY(-1px);
}

.topbar-brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  text-decoration:none;
}

.topbar-logo-wrap{
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:linear-gradient(145deg, rgba(48,213,200,.13), rgba(255,255,255,.035));
  border:1px solid rgba(48,213,200,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06), 0 10px 28px rgba(0,0,0,.28);
}

.topbar-logo{
  width:34px;
  height:34px;
  object-fit:contain;
  filter:drop-shadow(0 6px 12px rgba(0,0,0,.5));
}

.topbar-title-wrap{
  min-width:0;
  display:flex;
  flex-direction:column;
  line-height:1.1;
}

.topbar-page-title{
  color:#fff;
  font-weight:850;
  letter-spacing:.2px;
  font-size:1.05rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:min(46vw, 560px);
}

.topbar-subtitle{
  display:inline-flex;
  align-items:center;
  gap:5px;
  color:var(--husky-info);
  font-size:.78rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.12em;
  margin-top:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:min(46vw, 560px);
}

.topbar-current-store{
  min-height:42px;
  align-items:center;
  gap:8px;
  max-width:220px;
  padding:0 12px;
  border:1px solid rgba(25,200,255,.18);
  border-radius:999px;
  color:var(--husky-info);
  background:rgba(25,200,255,.07);
  font-size:.88rem;
  font-weight:700;
}

.topbar-current-store span{
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.topbar-store-btn{
  color:var(--husky-info);
}

.topbar-dropdown{
  border:1px solid var(--husky-border-strong);
  background:#111821;
  border-radius:14px;
  overflow:hidden;
  padding:8px;
  min-width:260px;
}

.topbar-dropdown-header{
  display:flex;
  flex-direction:column;
  gap:2px;
  color:var(--husky-info);
  font-weight:800;
  letter-spacing:.04em;
}

.topbar-dropdown-header small{
  color:var(--husky-muted);
  font-weight:500;
  letter-spacing:0;
  text-transform:none;
}

.topbar-store-item{
  border-radius:10px;
  padding:10px 10px;
}

.topbar-store-item.active{
  background:linear-gradient(135deg, rgba(26,167,161,.25), rgba(25,200,255,.18));
  color:#fff;
}

.topbar-store-name{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.topbar-avatar{
  width:28px;
  height:28px;
  object-fit:cover;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  box-shadow:0 4px 12px rgba(0,0,0,.28);
}

.topbar-avatar-lg{
  width:40px;
  height:40px;
}

.topbar-user-btn{
  padding:6px 10px;
}

.topbar-user-meta{
  min-width:0;
  flex-direction:column;
  align-items:flex-start;
  line-height:1.05;
}

.topbar-user-name{
  max-width:150px;
  color:#fff;
  font-weight:750;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.topbar-user-role{
  color:var(--husky-muted);
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.12em;
  margin-top:3px;
}

.topbar-profile-summary{
  min-width:250px;
}

/* ─────────────────────────────────────────────────────────────
   Layout / Sidebar
   ───────────────────────────────────────────────────────────── */

.layout-shell{
  display:flex;
  align-items:stretch;
  min-height:calc(100vh - var(--topbar-height));
  background:transparent;
}

.layout-no-sidebar .content{
  width:100%;
}

.content{
  flex:1 1 auto;
  min-width:0;
  position:relative;
}

.content > .container,
.content > .container-fluid{
  position:relative;
  z-index:1;
}

.sidebar{
  width:var(--sidebar-w);
  flex:0 0 var(--sidebar-w);
  height:calc(100vh - var(--topbar-height));
  position:sticky;
  top:var(--topbar-height);
  z-index:1020;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:
    linear-gradient(180deg, rgba(20,27,36,.98), rgba(11,17,23,.98)),
    var(--husky-bg-800);
  border-right:1px solid var(--husky-border);
  box-shadow:14px 0 34px rgba(0,0,0,.20);
  transition:
    width var(--transition-normal),
    flex-basis var(--transition-normal),
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.sidebar-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:18px 16px 12px;
  flex:0 0 auto;
}

.sidebar-brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  text-decoration:none;
}

.sidebar-logo-wrap{
  width:46px;
  height:46px;
  flex:0 0 46px;
  display:grid;
  place-items:center;
  border-radius:16px;
  background:linear-gradient(145deg, rgba(48,213,200,.13), rgba(255,255,255,.035));
  border:1px solid rgba(48,213,200,.16);
}

.sidebar-logo{
  width:36px;
  height:36px;
  object-fit:contain;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.55));
}

.sidebar-brand-text{
  min-width:0;
  display:flex;
  flex-direction:column;
  line-height:1.1;
}

.sidebar-brand-name{
  color:#fff;
  font-size:1rem;
  font-weight:850;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sidebar-role{
  color:var(--husky-info);
  font-size:.72rem;
  font-weight:850;
  letter-spacing:.14em;
  text-transform:uppercase;
  margin-top:5px;
  white-space:nowrap;
}

.sidebar-collapse-btn{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border:1px solid var(--husky-border);
  border-radius:11px;
  color:var(--husky-muted);
  background:rgba(255,255,255,.035);
  display:grid;
  place-items:center;
  transition:all var(--transition-fast);
}

.sidebar-collapse-btn:hover{
  color:#fff;
  border-color:rgba(48,213,200,.30);
  background:rgba(48,213,200,.10);
}

.sidebar-store{
  margin:0 16px 12px;
  padding:11px 12px;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid rgba(25,200,255,.14);
  border-radius:16px;
  background:linear-gradient(145deg, rgba(25,200,255,.07), rgba(48,213,200,.05));
}

.sidebar-store-icon{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:12px;
  display:grid;
  place-items:center;
  color:var(--husky-info);
  background:rgba(25,200,255,.10);
}

.sidebar-store-text{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}

.sidebar-store-text span{
  color:var(--husky-muted-2);
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.11em;
  font-weight:800;
}

.sidebar-store-text strong{
  color:#fff;
  font-size:.86rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.nav-husky{
  flex:1 1 auto;
  overflow-y:auto;
  overflow-x:hidden;
  padding:6px 12px 14px;
}

.sidebar-section-title{
  color:var(--husky-muted-2);
  font-size:.66rem;
  font-weight:850;
  letter-spacing:.15em;
  text-transform:uppercase;
  padding:14px 12px 8px;
  white-space:nowrap;
}

.nav-husky .nav-link{
  position:relative;
  display:flex;
  align-items:center;
  gap:12px;
  min-height:48px;
  padding:10px 12px;
  margin:3px 0;
  border-radius:15px;
  text-decoration:none;
  color:#c8d2dd;
  border:1px solid transparent;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.nav-husky .nav-link:hover{
  color:#fff;
  background:rgba(255,255,255,.045);
  border-color:rgba(255,255,255,.08);
  transform:translateX(2px);
}

.nav-husky .nav-link.active{
  color:#fff;
  background:linear-gradient(135deg, rgba(48,213,200,.20), rgba(26,167,161,.12));
  border-color:rgba(48,213,200,.18);
  box-shadow:inset 3px 0 0 var(--husky-ring), 0 8px 20px rgba(0,0,0,.16);
}

.nav-icon-wrap{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:grid;
  place-items:center;
  border-radius:12px;
  background:rgba(255,255,255,.035);
  color:var(--husky-muted);
  transition:all var(--transition-fast);
}

.nav-husky .nav-link:hover .nav-icon-wrap,
.nav-husky .nav-link.active .nav-icon-wrap{
  color:var(--husky-info);
  background:rgba(25,200,255,.10);
}

.nav-icon{
  font-size:1.08rem;
  line-height:1;
}

.nav-label{
  min-width:0;
  font-size:.96rem;
  font-weight:650;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sidebar-footer{
  flex:0 0 auto;
  padding:12px 16px 16px;
  border-top:1px solid var(--husky-border);
}

.sidebar-logout{
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  padding:8px 12px;
  border-radius:14px;
  color:#ff6b7a;
  background:rgba(224,49,75,.06);
  border:1px solid rgba(224,49,75,.18);
  text-decoration:none;
  font-weight:750;
  transition:all var(--transition-fast);
}

.sidebar-logout:hover{
  color:#fff;
  background:rgba(224,49,75,.16);
  border-color:rgba(224,49,75,.34);
}

.sidebar-backdrop{
  display:none;
  position:fixed;
  inset:0;
  z-index:1045;
  background:rgba(0,0,0,.58);
  opacity:0;
  pointer-events:none;
  transition:opacity var(--transition-normal);
  backdrop-filter:blur(2px);
}

/* Sidebar colapsado en escritorio */
@media (min-width: 992px){
  body.sidebar-collapsed .sidebar{
    width:var(--sidebar-collapsed-w);
    flex-basis:var(--sidebar-collapsed-w);
  }

  body.sidebar-collapsed .sidebar-head{
    padding-left:12px;
    padding-right:12px;
    justify-content:center;
  }

  body.sidebar-collapsed .sidebar-brand{
    justify-content:center;
  }

  body.sidebar-collapsed .sidebar-logo-wrap{
    width:44px;
    height:44px;
    flex-basis:44px;
  }

  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-store-text,
  body.sidebar-collapsed .sidebar-section-title,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .logout-label{
    width:0;
    opacity:0;
    pointer-events:none;
    overflow:hidden;
  }

  body.sidebar-collapsed .sidebar-collapse-btn{
    position:absolute;
    right:8px;
    top:10px;
    width:26px;
    height:26px;
    border-radius:9px;
  }

  body.sidebar-collapsed .sidebar-collapse-btn i{
    transform:rotate(180deg);
  }

  body.sidebar-collapsed .sidebar-store{
    justify-content:center;
    padding:9px;
    margin-left:12px;
    margin-right:12px;
  }

  body.sidebar-collapsed .nav-husky{
    padding-left:10px;
    padding-right:10px;
  }

  body.sidebar-collapsed .nav-husky .nav-link{
    justify-content:center;
    padding:9px;
  }

  body.sidebar-collapsed .nav-husky .nav-link:hover{
    transform:none;
  }

  body.sidebar-collapsed .sidebar-footer{
    padding-left:12px;
    padding-right:12px;
  }

  body.sidebar-collapsed .sidebar-logout{
    padding:8px;
  }
}

/* Sidebar móvil como drawer */
@media (max-width: 991.98px){
  :root{
    --topbar-height:64px;
  }

  .topbar-inner{
    min-height:var(--topbar-height);
    padding:9px 12px;
    gap:10px;
  }

  .topbar-logo-wrap{
    width:40px;
    height:40px;
    flex-basis:40px;
    border-radius:13px;
  }

  .topbar-logo{
    width:30px;
    height:30px;
  }

  .topbar-page-title{
    max-width:42vw;
    font-size:.96rem;
  }

  .topbar-subtitle{
    max-width:42vw;
    font-size:.70rem;
    letter-spacing:.08em;
  }

  .topbar-actions{
    gap:6px;
  }

  .topbar-action-btn,
  .topbar-user-btn,
  .topbar-icon-btn{
    min-height:40px;
    border-radius:11px;
  }

  .topbar-icon-btn{
    width:40px;
  }

  .layout-shell{
    min-height:calc(100vh - var(--topbar-height));
  }

  .sidebar{
    position:fixed;
    top:0;
    left:0;
    z-index:1050;
    width:min(86vw, 326px);
    height:100vh;
    transform:translateX(-104%);
    border-right:1px solid rgba(255,255,255,.12);
    box-shadow:28px 0 60px rgba(0,0,0,.45);
  }

  body.sidebar-open .sidebar{
    transform:translateX(0);
  }

  .sidebar-backdrop{
    display:block;
  }

  body.sidebar-open .sidebar-backdrop{
    opacity:1;
    pointer-events:auto;
  }

  .sidebar-collapse-btn{
    display:none;
  }

  .content{
    min-height:calc(100vh - var(--topbar-height));
  }
}

@media (max-width: 575.98px){
  .topbar-inner{
    padding-left:10px;
    padding-right:10px;
  }

  .topbar-brand{
    gap:9px;
  }

  .topbar-page-title{
    max-width:36vw;
  }

  .topbar-subtitle{
    max-width:36vw;
  }

  .topbar-action-btn{
    padding-left:10px;
    padding-right:10px;
  }

  .topbar-user-btn{
    padding-left:7px;
    padding-right:7px;
  }
}

/* ─────────────────────────────────────────────────────────────
   Tablas / Cards globales
   ───────────────────────────────────────────────────────────── */

.table > :not(caption) > * > *{
  background-color:transparent;
}

.table thead th{
  color:var(--husky-muted);
  font-weight:700;
  border-color:rgba(255,255,255,.08) !important;
}

.table td,
.table th{
  border-color:rgba(255,255,255,.08) !important;
}

.card{
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.022));
  border:1px solid rgba(255,255,255,.07);
  border-radius:16px;
  box-shadow:0 10px 26px rgba(0,0,0,.16);
}

.pagination .page-link{
  background:transparent;
  border-color:rgba(255,255,255,.18);
  color:#e5e7eb;
}

.pagination .page-item.active .page-link{
  background:linear-gradient(135deg,var(--husky-primary),var(--husky-ring));
  color:#061012;
  border:none;
  font-weight:800;
}

/* Dashboard cards */
.husky-card-link{
  display:block;
  text-decoration:none;
  color:inherit;
  background:rgba(255,255,255,.035);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  transition:
    transform .14s ease,
    border-color .14s ease,
    background .14s ease,
    box-shadow .14s ease;
}

.husky-card-link:hover{
  transform:translateY(-2px);
  border-color:rgba(48,213,200,.35);
  background:rgba(255,255,255,.055);
  box-shadow:0 16px 38px rgba(0,0,0,.22);
}

.husky-card-icon{
  width:44px;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  background:rgba(26,167,161,.15);
  border:1px solid rgba(26,167,161,.25);
}

.husky-card-icon i{
  font-size:1.3rem;
  color:var(--husky-primary);
}

/* Scrollbars */
.custom-scroll,
.nav-husky{
  scrollbar-width:thin;
  scrollbar-color:rgba(255,255,255,.22) transparent;
}

.custom-scroll::-webkit-scrollbar,
.nav-husky::-webkit-scrollbar{
  width:6px;
  height:6px;
}

.custom-scroll::-webkit-scrollbar-track,
.nav-husky::-webkit-scrollbar-track{
  background:transparent;
}

.custom-scroll::-webkit-scrollbar-thumb,
.nav-husky::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.20);
  border-radius:999px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover,
.nav-husky::-webkit-scrollbar-thumb:hover{
  background:rgba(48,213,200,.35);
}

/* Compatibilidad con pantalla completa de módulos */
body.husky-fs .topbar,
body.husky-fs .sidebar,
body.husky-fs .sidebar-backdrop{
  display:none !important;
}

body.husky-fs .layout-shell{
  display:block !important;
  min-height:100vh;
}

body.husky-fs .content{
  min-height:100vh;
  width:100% !important;
}

/* ============================================================
   HUSKY GLOBAL MODAL FIX
   Corrige modales bloqueados por el nuevo header/sidebar/layout.
   Aplica a caja, ventas, cupones, compras y cualquier módulo.
   ============================================================ */

body.modal-open{
  overflow:hidden !important;
}

/* El fondo oscuro del modal debe quedar encima del layout */
body.modal-open .modal-backdrop{
  z-index:9000 !important;
}

/* El modal debe quedar arriba del backdrop */
body.modal-open .modal{
  z-index:9010 !important;
}

/* SweetAlert debe quedar incluso arriba de los modales */
.swal2-container{
  z-index:10050 !important;
}

/* Evita que header/sidebar reciban clicks cuando un modal está abierto */
body.modal-open .topbar,
body.modal-open .sidebar{
  pointer-events:none !important;
}

/* Pero el modal sí debe recibir clicks y teclado */
body.modal-open .modal,
body.modal-open .modal-dialog,
body.modal-open .modal-content{
  pointer-events:auto !important;
}

/* Asegura que inputs dentro de modales sean editables */
body.modal-open .modal input,
body.modal-open .modal textarea,
body.modal-open .modal select,
body.modal-open .modal button{
  pointer-events:auto !important;
}

/* Evita que un modal quede recortado por contenedores del layout */
.modal{
  position:fixed !important;
}

.modal.show{
  display:block !important;
}

/* Mejor comportamiento visual en pantallas pequeñas */
.modal-dialog{
  max-width:min(96vw, var(--bs-modal-width, 500px));
}

.modal-xl{
  --bs-modal-width:1140px;
}

@media (max-width: 768px){
  .modal-dialog,
  .modal-xl{
    max-width:calc(100vw - 16px) !important;
    margin:8px auto !important;
  }

  .modal-content{
    max-height:calc(100vh - 16px);
  }

  .modal-body{
    overflow-y:auto;
  }
}