/* ============================================================
   WMS v3 — Hoja de estilos principal
   Diseño: Sidebar oscuro + contenido limpio + accent índigo
   ============================================================ */

/* ---------- Variables ---------- */
:root {
  --sidebar-w: 260px;
  --sidebar-collapsed: 64px;
  --topbar-h: 60px;

  /* Colores principales */
  --bg-sidebar:    #0f172a;
  --bg-sidebar-2:  #1e293b;
  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-light:  #eef2ff;

  /* Semáforos */
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #0ea5e9;

  /* Grises */
  --bg-body:   #f1f5f9;
  --bg-card:   #ffffff;
  --border:    #e2e8f0;
  --text-main: #1e293b;
  --text-muted:#64748b;
  --text-white:#ffffff;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);

  /* Radios */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  /* Transiciones */
  --trans: all .22s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-body);
  min-height: 100vh;
  display: flex;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: var(--trans);
  z-index: 1000;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

/* Logo / Marca */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: var(--topbar-h);
  cursor: pointer;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-brand .brand-text {
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-brand .brand-name {
  font-size: 16px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden;
}
.sidebar-brand .brand-version {
  font-size: 11px; color: var(--text-muted); letter-spacing: .5px;
}
.sidebar.collapsed .brand-text { display: none; }
.brand-logo-devnia {
  height: 30px;
  border-radius: 5px;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.sidebar.collapsed .brand-logo-devnia { display: none; }

/* Navegación */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .nav-section { opacity: 0; }

/* Sección de nav con toggle */
.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px 10px 12px;
  margin: 4px 8px 2px;
  border-radius: 7px;
  background: rgba(255,255,255,.06);
  border-left: 3px solid var(--accent);
  color: rgba(255,255,255,.75);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  transition: background .2s ease, color .2s ease;
}
.nav-section-toggle:hover {
  background: rgba(255,255,255,.11);
  color: #fff;
}

/* Chevron indicador */
.nav-chevron {
  font-size: 10px;
  color: var(--accent);
  transition: transform .25s ease;
  flex-shrink: 0;
}
.nav-chevron--up { transform: rotate(-90deg); }
.sidebar.collapsed .nav-chevron { display: none; }

/* Grupo colapsable */
.nav-group {
  overflow: hidden;
  max-height: 600px;
  transition: max-height .3s ease, opacity .25s ease;
  opacity: 1;
}
.nav-group--closed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  color: rgba(255,255,255,.65);
  transition: var(--trans);
  white-space: nowrap;
  cursor: pointer;
  font-size: 13.5px;
}
.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.nav-link.active {
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius-sm);
  margin: 0 8px;
  padding: 9px 12px;
}
.sidebar.collapsed .nav-link.active { margin: 0 4px; padding: 9px 14px; }

.nav-link .nav-icon {
  width: 20px; text-align: center;
  font-size: 16px; flex-shrink: 0;
}
.nav-link .nav-label { overflow: hidden; }
.sidebar.collapsed .nav-label { display: none; }
.nav-link .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-badge { display: none; }

/* Tooltip en sidebar colapsado */
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-sidebar-2);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  z-index: 2000;
  pointer-events: none;
  box-shadow: var(--shadow);
}

/* Pie del sidebar */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--trans);
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.sidebar.collapsed .sidebar-user .user-info { display: none; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; color: #fff; font-weight: 600; }
.user-info .user-role { font-size: 11px; color: var(--text-muted); }

/* ---------- Layout principal ---------- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--trans);
  flex: 1;
  width: calc(100% - var(--sidebar-w));
}
.main-wrapper.expanded {
  margin-left: var(--sidebar-collapsed);
  width: calc(100% - var(--sidebar-collapsed));
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--trans);
}
.topbar-toggle:hover { background: var(--bg-body); color: var(--text-main); }

.topbar-search {
  flex: 1; max-width: 340px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-body);
  font-size: 13px;
  color: var(--text-main);
  transition: var(--trans);
  outline: none;
}
.topbar-search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.topbar-search .search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
  pointer-events: none;
}

/* Dropdown búsqueda global */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 1100;
  overflow: hidden;
  max-height: 360px;
  overflow-y: auto;
}
.sr-item {
  display: grid;
  grid-template-columns: 70px 1fr;
  grid-template-rows: auto auto;
  gap: 1px 8px;
  padding: 9px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg-body); }
.sr-tipo {
  grid-row: 1 / 3;
  align-self: center;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  background: rgba(99,102,241,.08);
  border-radius: 4px;
  padding: 3px 6px;
  text-align: center;
  white-space: nowrap;
}
.sr-label {
  font-size: 13px; font-weight: 600; color: var(--text-main);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-sub {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 17px;
  transition: var(--trans);
}
.topbar-btn:hover { background: var(--bg-body); color: var(--text-main); }
.topbar-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.topbar-divider { width: 1px; height: 24px; background: var(--border); }

.topbar-avatar {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 4px 8px;
  display: flex; align-items: center; gap: 8px;
  transition: var(--trans);
}
.topbar-avatar:hover { background: var(--bg-body); }
.topbar-avatar .ta-name { font-size: 13px; font-weight: 600; }
.topbar-avatar .ta-role { font-size: 11px; color: var(--text-muted); }

/* ---------- Pie de página de la app ---------- */
.app-footer {
  padding: 10px 24px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.app-footer-sep { opacity: 0.4; }

/* ---------- Contenido ---------- */
.content-area {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  width: 100%;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title .title-icon {
  width: 38px; height: 38px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  list-style: none;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb .sep { color: var(--border); }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
}

/* Stat cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.indigo   { background: #eef2ff; color: #6366f1; }
.stat-icon.sky      { background: #e0f2fe; color: #0ea5e9; }
.stat-icon.emerald  { background: #dcfce7; color: #10b981; }
.stat-icon.amber    { background: #fef3c7; color: #f59e0b; }
.stat-icon.rose     { background: #fee2e2; color: #ef4444; }
.stat-icon.violet   { background: #f5f3ff; color: #8b5cf6; }
.stat-icon.cyan     { background: #cffafe; color: #06b6d4; }
.stat-icon.pink     { background: #fce7f3; color: #ec4899; }

.stat-data { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-main); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-trend { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ---------- Tablas ---------- */
.table-scroll-wrapper {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: clip;
}
.table-top-scroll {
  overflow-x: scroll;
  overflow-y: hidden;
  height: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.table-top-scroll::-webkit-scrollbar { height: 4px; }
.table-top-scroll::-webkit-scrollbar-track { background: transparent; }
.table-top-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
.table-top-scroll-inner { height: 1px; }
.table-container {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.table-container::-webkit-scrollbar { height: 0; }
table.wms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.wms-table thead th {
  background: var(--bg-body);
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.wms-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.wms-table tbody tr:last-child td { border-bottom: none; }
.wms-table tbody tr:hover { background: #f8fafc; }
.wms-table .actions { display: flex; gap: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--trans);
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; gap: 0; }
.btn-icon.btn-sm { padding: 5px; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover   { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(99,102,241,.35); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover   { background: #0d9e6e; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover   { background: #d97706; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #dc2626; }
.btn-info      { background: var(--info); color: #fff; }
.btn-info:hover      { background: #0284c7; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-main);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-body); color: var(--text-main); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2px;
}
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-warning  { background: #fef9c3; color: #a16207; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-info     { background: #e0f2fe; color: #0369a1; }
.badge-neutral  { background: var(--bg-body); color: var(--text-muted); border: 1px solid var(--border); }
.badge-indigo   { background: #eef2ff; color: #4338ca; }
.badge-violet   { background: #f5f3ff; color: #6d28d9; }

/* Mapeo estado → badge */
.estado-pendiente   { background: #fef9c3; color: #a16207; }
.estado-aprobada,
.estado-procesado   { background: #e0f2fe; color: #0369a1; }
.estado-recibida,
.estado-reparado,
.estado-entregado,
.estado-despachado,
.estado-pagado      { background: #dcfce7; color: #15803d; }
.estado-cancelado,
.estado-anulado,
.estado-vencido     { background: #fee2e2; color: #b91c1c; }
.estado-en_proceso,
.estado-en_revision,
.estado-preparando  { background: #fce7f3; color: #be185d; }
.estado-cerrada,
.estado-listo,
.estado-preparado   { background: #e0f2fe; color: #0369a1; }

/* ---------- Formularios ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-main);
  background: #fff;
  transition: var(--trans);
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control:disabled { background: var(--bg-body); color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Grid de formulario */
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Alertas Flash ---------- */
.flash-container {
  position: fixed;
  top: 72px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.flash-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  font-size: 13.5px;
  animation: slideIn .3s ease;
}
.flash-msg.success { border-color: var(--success); }
.flash-msg.danger  { border-color: var(--danger);  }
.flash-msg.warning { border-color: var(--warning); }
.flash-msg.info    { border-color: var(--info);    }
.flash-msg .flash-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.flash-msg.success .flash-icon { color: var(--success); }
.flash-msg.danger  .flash-icon { color: var(--danger);  }
.flash-msg.warning .flash-icon { color: var(--warning); }
.flash-msg.info    .flash-icon { color: var(--info);    }
.flash-msg .flash-close {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: var(--text-muted); font-size: 16px;
  padding: 0; flex-shrink: 0;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ---------- Filtros / Search bar ---------- */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-bar .filter-search {
  position: relative; flex: 1; min-width: 220px;
}
.filter-bar .filter-search input {
  padding-left: 36px;
}
.filter-bar .filter-search .fi {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
  pointer-events: none;
}
.filter-bar select { min-width: 140px; width: auto; }

/* ---------- Paginación ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.pagination .page-item .page-link {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  transition: var(--trans);
  background: var(--bg-card);
}
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-item .page-link:hover { border-color: var(--accent); color: var(--accent); }
.pagination .page-item.disabled .page-link { opacity: .4; pointer-events: none; }

/* ---------- Modal de confirmación ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: popIn .2s ease;
}
@keyframes popIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-icon { font-size: 40px; margin-bottom: 12px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-body { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.empty-state .es-icon { font-size: 52px; opacity: .3; margin-bottom: 16px; }
.empty-state .es-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.empty-state .es-text { font-size: 13px; color: var(--text-muted); max-width: 360px; }

/* ---------- Gráficos wrapper ---------- */
.chart-container { position: relative; width: 100%; }

/* ---------- Etiqueta imprimible ---------- */
@media print {
  .sidebar, .topbar, .page-header .page-actions, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; width: 100% !important; }
  .content-area { padding: 0; }
  body { background: #fff; }
}
.label-print {
  border: 2px solid #000;
  padding: 16px;
  display: inline-block;
  font-family: monospace;
  font-size: 14px;
  max-width: 300px;
}
.label-print .lp-pn { font-size: 16px; font-weight: 700; }
.label-print .lp-barcode { font-size: 28px; letter-spacing: 4px; margin: 8px 0; }

/* ---------- Login ---------- */
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 12% 18%,  rgba(45,212,191,.18) 0%, transparent 42%),
    radial-gradient(ellipse at 88% 82%,  rgba(99,102,241,.22) 0%, transparent 44%),
    radial-gradient(ellipse at 78% 10%,  rgba(99,102,241,.12) 0%, transparent 32%),
    radial-gradient(ellipse at 25% 90%,  rgba(45,212,191,.10) 0%, transparent 35%),
    linear-gradient(150deg, #090f1e 0%, #101828 55%, #0b1930 100%);
  position: relative;
  overflow: hidden;
  padding: 24px 16px;
}
/* Textura de puntos */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
/* Glow teal animado */
.login-page::after {
  content: '';
  position: absolute;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(45,212,191,.10) 0%, transparent 68%);
  top: 50%; left: 5%;
  transform: translateY(-50%);
  border-radius: 50%;
  animation: loginGlow 7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes loginGlow {
  from { opacity: .55; transform: translateY(-50%) scale(1);    }
  to   { opacity: 1;   transform: translateY(-54%) scale(1.12); }
}
.login-card {
  background: #ffffff;
  border: 1px solid #e2e6ed;
  border-radius: 16px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.10);
  position: relative;
  z-index: 1;
}
@media (max-width: 480px) {
  .login-card { padding: 32px 20px 28px; border-radius: 12px; }
  .login-logo img.login-logo-img { width: 90px; }
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid #eef0f4;
}
.login-logo img.login-logo-img {
  width: 110px;
  max-width: 80%;
  object-fit: contain;
}
.login-brand-name {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}
.login-logo .login-sys-name {
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: .4px;
}
.login-card .form-label {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.login-card .form-control {
  background: #f1f5fb;
  border-color: #e2e6ed;
  color: #1e293b;
}
.login-card .form-control::placeholder { color: #94a3b8; }
.login-card .form-control:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
  color: #1e293b;
}
.login-card .form-control + i,
.login-card [style*="position:absolute"] i { color: #94a3b8 !important; }
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--trans);
  margin-top: 8px;
}
.login-btn:hover { background: var(--accent-hover); box-shadow: 0 6px 20px rgba(99,102,241,.3); }
.login-footer-text { color: rgba(255,255,255,.25) !important; }

/* ---------- Dashboard específico ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .form-row.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper, .main-wrapper.expanded {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .content-area { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar-search { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- Utilidades ---------- */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.fw-bold { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.w-100 { width: 100%; }
.overflow-hidden { overflow: hidden; }

/* ---- Tom Select: igualar alto, alineación y tipografía con form-control ----
   Tom Select fuerza font-size:13px/line-height:18px en .ts-control; los sobreescribimos
   con valores explícitos para que placeholder e items queden igual que .form-control. */
.ts-wrapper.form-control {
  font-size: 13.5px !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-weight: 400 !important;
}
.ts-wrapper.form-control .ts-control {
  border: none;
  padding: 0 28px 0 0;
  background: transparent;
  line-height: normal;
  min-height: 0;
  font-size: 13.5px !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-weight: 400 !important;
  color: inherit;
  flex-wrap: nowrap;
  overflow: hidden;
  align-items: center;
}
.ts-wrapper.form-control .ts-control .item,
.ts-wrapper.form-control .ts-control .ts-placeholder {
  font-size: 13.5px !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-weight: 400 !important;
  line-height: normal;
  color: inherit;
}
.ts-wrapper.form-control .ts-control > input {
  line-height: normal;
  font-size: 13.5px !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-weight: 400 !important;
  color: inherit;
  min-width: 0 !important;
  width: 0;
}
