/* =========================================================
   IT Inventario — style.css
   Diseño minimalista, sin frameworks externos.
   ========================================================= */

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

/* =========================================================================
   SISTEMA DE DISEÑO — Tokens (modo claro)
   Nombres antiguos (--color-*) se conservan como alias para compatibilidad
   con el CSS existente; se añaden tokens nuevos del design system.
   ========================================================================= */
:root {
  /* ----- Marca y acción ----- */
  --brand:            #10b981;
  --brand-600:        #059669;
  --brand-700:        #047857;
  --brand-50:         #ecfdf5;
  --primary:          #2563eb;
  --primary-600:      #1d4ed8;
  --primary-50:       #eff6ff;

  /* ----- Superficies ----- */
  --bg:               #f4f6fb;
  --surface:          #ffffff;
  --surface-2:        #f8fafc;

  /* ----- Sidebar (oscuro fijo en ambos modos) ----- */
  --sidebar-bg:       #0f172a;
  --sidebar-bg-2:     #111c30;
  --sidebar-text:     #cbd5e1;
  --sidebar-text-dim: #64748b;

  /* ----- Texto ----- */
  --text:             #1e293b;
  --text-soft:        #475569;
  --muted:            #64748b;

  /* ----- Bordes ----- */
  --border:           #e5e9f0;
  --border-strong:    #d5dbe6;

  /* ----- Estados semánticos ----- */
  --success:  #16a34a;  --success-bg: #f0fdf4;  --success-fg: #166534;
  --danger:   #dc2626;  --danger-bg:  #fef2f2;  --danger-fg:  #991b1b;
  --warning:  #d97706;  --warning-bg: #fffbeb;  --warning-fg: #92400e;
  --info:     #0891b2;  --info-bg:    #ecfeff;  --info-fg:    #155e75;
  --purple:   #7c3aed;  --purple-bg:  #f5f3ff;

  /* ----- Acentos KPI ----- */
  --kpi-1: #2563eb;  --kpi-2: #16a34a;  --kpi-3: #7c3aed;
  --kpi-4: #0891b2;  --kpi-5: #d97706;  --kpi-6: #dc2626;

  /* ----- Tipografía ----- */
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --fs-xs:.75rem; --fs-sm:.8125rem; --fs-base:.875rem; --fs-md:.9375rem;
  --fs-lg:1.0625rem; --fs-xl:1.375rem; --fs-2xl:1.75rem;

  /* ----- Spacing (escala 4px) ----- */
  --sp-1:.25rem; --sp-2:.5rem; --sp-3:.75rem; --sp-4:1rem;
  --sp-5:1.25rem; --sp-6:1.5rem; --sp-8:2rem; --sp-10:2.5rem;

  /* ----- Radios ----- */
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-full:999px;

  /* ----- Sombras ----- */
  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 10px 24px rgba(16,24,40,.12);

  /* ----- Layout ----- */
  --sidebar-w:            236px;
  --sidebar-w-collapsed:  68px;
  --topbar-h:             60px;
  --transition: .18s cubic-bezier(.4,0,.2,1);

  /* =======================================================================
     ALIAS DE COMPATIBILIDAD (nombres antiguos usados por el CSS existente)
     ======================================================================= */
  --color-bg:        var(--bg);
  --color-surface:   var(--surface);
  --color-border:    var(--border);
  --color-text:      var(--text);
  --color-muted:     var(--muted);
  --color-primary:   var(--primary);
  --color-primary-h: var(--primary-600);
  --color-secondary: var(--text-soft);
  --color-danger:    var(--danger);
  --color-danger-h:  #b91c1c;
  --color-success:   var(--success);
  --color-warning:   var(--warning);
  --color-info:      var(--info);
  --color-admin:     var(--purple);
  --color-viewer:    var(--info);
  --radius:          var(--r-sm);
  --radius-lg:       var(--r-md);
  --shadow:          var(--shadow-sm);
  --shadow-md:       var(--shadow-lg);
  --navbar-h:        58px;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Navbar ----- */
/* ===== SIDEBAR vertical ===== */
:root { --sidebar-w: 230px; --topbar-h: 56px; }

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;              /* respeta las barras del navegador movil */
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transition: width var(--transition);
}
/* Scrollbar sutil dentro del sidebar oscuro */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 8px; }

.sidebar-brand {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  min-height: 56px;
  flex-shrink: 0;              /* no se comprime al hacer scroll del menu */
}
.sidebar-brand a { width: 100%; }
.sidebar-brand a {
  font-weight: var(--fw-black, 800);
  font-size: var(--fs-md);
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: 100%;
  min-width: 0;
}
.sidebar-brand a .brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.15;
}
.sidebar-brand a .brand-text small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--sidebar-text-dim);
  letter-spacing: .02em;
}
/* Logo en chip: cuando no hay imagen se usa el emoji dentro de un cuadro con degradado */
.sidebar-brand .side-ico {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--primary));
  display: grid; place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.sidebar-logo-img {
  height: 34px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
  background: #fff;
  padding: 4px 6px;
  border-radius: 8px;
}
.sidebar-nav {
  padding: var(--sp-3) var(--sp-2);
  padding-bottom: 3rem;          /* espacio para que el ultimo item (Ajustes) sea accesible */
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 auto;                /* ocupa el espacio y permite scroll */
}
.side-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 0 var(--sp-1);
  padding: .55rem .8rem;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: var(--fs-base);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}
.side-link:hover  { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side-link.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-600));
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.side-ico { width: 1.4em; text-align: center; flex-shrink: 0; opacity: .9; }
.sidebar-sep {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--sidebar-text-dim);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  margin-top: var(--sp-1);
}
/* Insignia de conteo dentro del link (solicitudes pendientes) */
.side-link .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ===== Sidebar colapsado (solo iconos) ===== */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .side-link span:not(.side-ico):not(.nav-badge),
body.sidebar-collapsed .sidebar .sidebar-sep { display: none; }
body.sidebar-collapsed .sidebar .side-link { justify-content: center; gap: 0; }
body.sidebar-collapsed .sidebar .side-link .nav-badge {
  position: absolute; top: 4px; right: 4px; margin: 0;
}
body.sidebar-collapsed .sidebar-brand { display: flex; justify-content: center; }
body.sidebar-collapsed .content-area,
body.sidebar-collapsed .topbar { transition: all var(--transition); }
@media (min-width: 901px) {
  body.sidebar-collapsed .content-area { margin-left: var(--sidebar-w-collapsed); }
  body.sidebar-collapsed .topbar { left: var(--sidebar-w-collapsed); }
}

/* ===== Topbar (herramientas) ===== */
.topbar {
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-w);
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 var(--sp-6);
  z-index: 150;
  transition: left var(--transition);
}
.topbar-spacer { flex: 1; }
/* Título centrado en la franja de la topbar */
.topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .3px;
  color: var(--color-text);
  white-space: nowrap;
  pointer-events: none;        /* no estorba a los botones */
}
.sidebar-toggle { display: none; }
/* Botón de contraer el sidebar (solo escritorio) */
.sidebar-collapse-btn { display: inline-flex; }
body.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg); }
@media (max-width: 900px) {
  .sidebar-collapse-btn { display: none; }
}
@media (max-width: 640px) { .topbar-title { display: none; } }

/* ===== Área de contenido (a la derecha del sidebar) ===== */
.content-area {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-backdrop { display: none; }

/* ----- Contenedor principal ----- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  flex: 1;
}

/* Login (sin sidebar): el content-area ocupa todo */
body:not(.has-sidebar) .content-area { margin-left: 0; padding-top: 0; }

/* ----- Footer ----- */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: .8rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* ----- Alertas / Flash ----- */
.alerts { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }

.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  border-left: 4px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: var(--color-success); color: #166534; }
.alert-danger  { background: #fef2f2; border-color: var(--color-danger);  color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--color-warning); color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: var(--color-info);    color: #0c4a6e; }

/* ----- Botones ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary:hover, .btn-secondary:hover, .btn-danger:hover { box-shadow: var(--shadow-md); }

.btn-primary   { background: var(--color-primary);   color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-h); border-color: var(--color-primary-h); }

.btn-secondary { background: var(--color-secondary); color: #fff; border-color: var(--color-secondary); }
.btn-secondary:hover { background: #334155; border-color: #334155; }

.btn-danger    { background: var(--color-danger);    color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-h); border-color: var(--color-danger-h); }

.btn-outline   { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover { background: var(--color-bg); }

.btn-sm { padding: .3rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .25em .7em;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .01em;
}
.badge-admin   { background: var(--purple-bg);  color: var(--purple); }
.badge-viewer  { background: var(--info-bg);    color: var(--info-fg); }
.badge-compras { background: var(--success-bg); color: var(--success-fg); }
.badge-rrhh    { background: var(--warning-bg); color: var(--warning-fg); }
.badge-empleado{ background: var(--surface-2);  color: var(--muted); border: 1px solid var(--border); }
.badge-active  { background: var(--success-bg); color: var(--success-fg); }
.badge-inactive{ background: var(--surface-2);  color: var(--muted); border: 1px solid var(--border); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg); }
.badge-state   { background: var(--surface-2);  color: var(--text-soft); border: 1px solid var(--border); }
.badge-you     { background: var(--warning-bg); color: var(--warning-fg); }
.badge-count   { background: var(--surface-2); color: var(--muted);
                 border: 1px solid var(--border);
                 border-radius: var(--r-full); padding: .1em .55em;
                 font-size: var(--fs-sm); font-weight: 500; }

/* ----- Page header ----- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-header h2 { font-size: var(--fs-xl); font-weight: 800; display: flex; align-items: center; gap: .5rem; color: var(--text); }

.header-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ----- Buscador ----- */
.search-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.search-input { flex: 1; min-width: 220px; }

/* ----- Formularios ----- */
.form-control {
  width: 100%;
  padding: .5rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
textarea.form-control { resize: vertical; }

.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .1rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--color-secondary); }

.form-hint  { font-size: .78rem; color: var(--color-muted); margin-top: .2rem; }
.required   { color: var(--color-danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-section-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: .35rem;
  margin: 1rem 0 .75rem;
}

.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}
.form-card-sm { max-width: 720px; }

/* ----- Tablas ----- */
.table-responsive { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  font-size: .88rem;
}
.table thead tr {
  background: var(--surface-2);
  border-bottom: 1px solid var(--color-border);
}
.table th {
  padding: .65rem 1rem;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
  white-space: nowrap;
}
.table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table-sm th, .table-sm td { padding: .4rem .75rem; }

.td-id      { color: var(--color-muted); font-size: .8rem; width: 48px; }
.td-actions { white-space: nowrap; width: 1%; }
.td-licenses{ max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-inactive td { opacity: .55; }

.link-strong { color: var(--color-text); font-weight: 600; }
.link-strong:hover { color: var(--color-primary); text-decoration: none; }

/* ----- Inline form (para borrar dentro de tabla) ----- */
.inline-form { display: inline-flex; }

/* ----- Empty state ----- */
.empty-state {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  color: var(--color-muted);
}
.empty-hint {
  color: var(--muted); font-size: var(--fs-sm); font-style: normal;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); text-align: center;
  padding: var(--sp-8) var(--sp-4);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.empty-hint::before {
  content: "📊"; font-size: 1.75rem; opacity: .45; line-height: 1;
}

/* ----- Dashboard: header de bienvenida ----- */
.dash-welcome {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}
.dash-welcome-text h2 {
  margin: 0; font-size: var(--fs-2xl); font-weight: 800; color: var(--text);
}
.dash-welcome-text p {
  margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--fs-md);
}
.dash-welcome-side { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.dash-date {
  text-align: right; font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft);
  line-height: 1.3;
}
.dash-date small { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }

/* Encabezado de panel con enlace "ver todos" */
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.dash-panel-head h3 { margin-bottom: 0; }
.dash-panel-link { font-size: var(--fs-sm); font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; }
.dash-panel-link:hover { text-decoration: none; opacity: .8; }

/* Lista de actividad reciente (timeline) */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-ico {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--r-md);
  display: grid; place-items: center; font-size: .95rem;
  background: var(--surface-2); color: var(--text-soft);
}
.activity-body { min-width: 0; }
.activity-text { font-size: var(--fs-base); color: var(--text); }
.activity-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

/* ----- Dashboard stats ----- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
/* Responsivo: 3 por fila en pantallas medianas, 2 en chicas */
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
/* Acento de color en el borde superior (rota por nth-child) */
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stats-grid .stat-card:nth-child(6n+1) { --accent: var(--kpi-1); }
.stats-grid .stat-card:nth-child(6n+2) { --accent: var(--kpi-2); }
.stats-grid .stat-card:nth-child(6n+3) { --accent: var(--kpi-3); }
.stats-grid .stat-card:nth-child(6n+4) { --accent: var(--kpi-4); }
.stats-grid .stat-card:nth-child(6n+5) { --accent: var(--kpi-5); }
.stats-grid .stat-card:nth-child(6n+6) { --accent: var(--kpi-6); }

/* Icono dentro de chip de color suave */
.stat-icon  {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 1.2rem; line-height: 1;
  background: color-mix(in srgb, var(--accent, var(--primary)) 14%, transparent);
  color: var(--accent, var(--primary));
}
.stat-body { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: var(--fs-2xl); font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: var(--fs-sm); color: var(--muted); }
.stat-link  {
  font-size: var(--fs-sm); color: var(--primary); margin-top: var(--sp-2);
  font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem;
}
.stat-link:hover { gap: .5rem; text-decoration: none; }
/* Las tarjetas de alerta/warn conservan su acento semántico por encima del rotativo */
.stat-card-alert { --accent: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.stat-card-warn  { --accent: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, var(--border)); }

/* Responsivo: en pantallas chicas reducir el mínimo para caber 2 por fila */
@media (max-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ----- Dashboard charts (bar tables) ----- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.chart-card h3 {
  font-size: var(--fs-md); margin-bottom: var(--sp-4); color: var(--text-soft);
  text-transform: none; letter-spacing: 0; font-weight: 700;
}
/* Contenedor de gráficas Chart.js: altura fija para consistencia */
.chart-canvas-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}
.chart-canvas-wrap canvas { max-width: 100%; }

.bar-cell { width: 120px; padding-right: .5rem; }
.bar {
  height: 8px;
  background: var(--color-primary);
  border-radius: 4px;
  min-width: 4px;
  transition: width .3s;
}
.bar-os    { background: #0891b2; }
.bar-model { background: #7c3aed; }

/* ----- Vista de detalle ----- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.detail-card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.detail-list { display: grid; gap: .6rem; }
.detail-list dt {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
}
.detail-list dd { font-size: .92rem; }

/* ----- Gestión de usuarios de login ----- */
.select-inline {
  padding: .25rem .5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .83rem;
  background: var(--color-surface);
  cursor: pointer;
}

.pw-row td { background: #f8fafc; }
.pw-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .5rem 0;
}
.pw-label { font-size: .85rem; white-space: nowrap; }
.pw-input { width: 180px; }

.section-divider { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0 1.25rem; }

/* ----- Página de login ----- */
.login-page {
  background:
    radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--brand) 12%, transparent), transparent),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-4);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-10) var(--sp-8);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo    {
  font-size: 2.2rem; text-align: center; margin: 0 auto var(--sp-4);
  width: 64px; height: 64px; border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--primary));
}
.login-logo-img { max-height: 80px; max-width: 240px; width: auto; object-fit: contain; }
/* Si hay imagen de logo, la tarjeta no fuerza el degradado del chip */
.login-logo:has(.login-logo-img) { background: transparent; width: auto; height: auto; }

/* ----- Ajustes: preview del logo ----- */
.logo-setting-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview {
  flex-shrink: 0;
  width: 90px; height: 90px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--color-bg);
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview-emoji { font-size: 2.2rem; }
.logo-setting-controls { flex: 1; min-width: 220px; }
.login-title   { font-size: var(--fs-xl); font-weight: 800; text-align: center; margin-bottom: var(--sp-1); color: var(--text); }
.login-subtitle{ font-size: var(--fs-sm); color: var(--muted); text-align: center; margin-bottom: var(--sp-6); }

/* ----- Página de error ----- */
.error-page {
  text-align: center;
  padding: 5rem 1rem;
}
.error-code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--color-border);
  line-height: 1;
  margin-bottom: .5rem;
}
.error-msg { font-size: 1.1rem; color: var(--color-muted); margin-bottom: 1.5rem; }

/* ----- Utilidades ----- */
.text-muted { color: var(--color-muted); }
.text-sm    { font-size: .82rem; }

/* ----- Responsive ----- */
@media (max-width: 900px) {
  /* Sidebar deslizable en móvil/tablet, por encima de todo cuando está abierto */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    z-index: 300;                 /* por encima de topbar y backdrop */
    background: var(--sidebar-bg); /* opaco, nunca translúcido */
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .topbar { left: 0; }
  .content-area { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }

  /* Backdrop oscuro tras el menú abierto */
  .sidebar-backdrop { display: none; }
  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 290;                 /* debajo del sidebar (300), encima del resto */
  }
  /* Evita el scroll del fondo cuando el menú está abierto */
  body.sidebar-open { overflow: hidden; }
}

@media (max-width: 768px) {
  .container { padding: 1.25rem 1rem; }
  .stats-grid,
  .charts-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pw-input { width: 140px; }
  .td-licenses { max-width: 140px; }
}

@media (max-width: 480px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .search-form { flex-direction: column; }
  .search-input { min-width: unset; }
  .login-card { padding: 1.5rem 1.25rem; }
}

/* ----- Grupo de exportación ----- */
.export-group {
  display: flex;
  gap: .35rem;
}
.export-group .btn {
  border-color: var(--color-border);
  color: var(--color-secondary);
  font-weight: 500;
}
.export-group .btn:hover {
  background: #f0fdf4;
  border-color: var(--color-success);
  color: var(--color-success);
  text-decoration: none;
}

/* ----- Selección de filas ----- */
.sel-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .5rem .75rem;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.sel-hint  { font-size: .8rem; color: var(--color-muted); margin-left: auto; }
.sel-count {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #eff6ff;
  color: var(--color-primary);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: .15rem .65rem;
  font-size: .83rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .88rem;
  cursor: pointer;
  user-select: none;
}

.th-chk, .td-chk { width: 36px; text-align: center; padding-right: 0 !important; }

.row-chk {
  width: 15px; height: 15px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.laptop-row { cursor: pointer; }
.laptop-row:hover   { background: #f0f7ff !important; }
.row-selected       { background: #eff6ff !important; }
.row-selected td    { border-bottom-color: #bfdbfe; }

/* ----- Columnas ordenables ----- */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover {
  background: #eef2ff;
  color: var(--color-primary);
}
th.sort-asc,
th.sort-desc {
  background: #eff6ff;
  color: var(--color-primary);
}
.sort-icon {
  font-style: normal;
  font-size: .8rem;
  margin-left: .15rem;
  color: var(--color-primary);
}

/* ----- Badges de estado de laptop ----- */
.badge-estado-entregada  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-estado-disponible { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-estado-critico    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; font-weight: 700; }
.badge-estado-pendiente  { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.badge-estado-baja       { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; text-decoration: line-through; }
.badge-estado-reparacion { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.badge-estado-perdida    { background: #1f2937; color: #fca5a5; border: 1px solid #111827; font-weight: 700; }
.badge-estado-default    { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* ----- Separación entre select y campo libre de estado ----- */
.mt-2 { margin-top: .5rem; }

/* ----- PowerShell uploader ----- */
.ps-uploader {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.ps-uploader-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid #bae6fd;
}
.ps-uploader-icon { font-size: 1.75rem; line-height: 1; }
.ps-uploader-header strong { font-size: .95rem; color: #0c4a6e; }
.ps-uploader-header p { font-size: .83rem; color: #0369a1; margin: .2rem 0 0; }
.ps-uploader-body { padding: .85rem 1.25rem 1rem; }

.ps-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border: 2px dashed #7dd3fc;
  border-radius: var(--radius);
  background: #fff;
  color: #0369a1;
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: center;
  padding: .75rem 1rem;
}
.ps-drop-zone:hover,
.ps-drop-zone.drag-over {
  background: #e0f2fe;
  border-color: #38bdf8;
}

.ps-status {
  margin-top: .6rem;
  padding: .5rem .85rem;
  border-radius: var(--radius);
  font-size: .88rem;
}
.ps-status-ok   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.ps-status-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Animación al rellenar un campo desde el archivo */
@keyframes fieldFilled {
  0%   { background: #d1fae5; }
  100% { background: transparent; }
}
.field-filled { animation: fieldFilled 2s ease-out; }

/* ----- Campo clave Windows ----- */
.key-input-wrap {
  display: flex;
  gap: .5rem;
  align-items: center;
}

/* ----- Selector de modo de contraseña ----- */
.pw-mode-tabs {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.pw-mode-opt {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  font-size: .92rem;
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-weight: normal;
}
.key-input {
  font-family: 'Courier New', monospace;
  letter-spacing: .08em;
  flex: 1;
}
.key-toggle { flex-shrink: 0; }
.windows-key {
  font-family: 'Courier New', monospace;
  letter-spacing: .1em;
  font-size: .95rem;
  color: var(--color-secondary);
  display: block;
  margin-bottom: .35rem;
}

/* ----- Serial duplicado ----- */
.ps-status-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.field-error {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

/* ============================================================
   IMPRESIÓN — acuse de recibo (body.print-acuse)
   ============================================================ */
.acuse { display: none; }

@media print {
  /* --- ACUSE --- */
  /* Ocultar navbar, footer y todo el contenido salvo el acuse
     (display:none evita las páginas en blanco que deja visibility:hidden) */
  body.print-acuse .sidebar,
  body.print-acuse .topbar,
  body.print-acuse .footer,
  body.print-acuse #gsearch-overlay,
  body.print-acuse main > *:not(#acuse-recibo),
  body.print-acuse #detail-view,
  body.print-acuse .detail-section,
  body.print-acuse .page-header,
  body.print-acuse .alerts { display: none !important; }
  body.print-acuse main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  body.print-acuse .acuse {
    display: block !important;
    width: 100%;
    font-family: Arial, sans-serif;
    color: #000;
    background: #fff;
    box-sizing: border-box;
  }
  /* Cada copia ocupa una página completa */
  body.print-acuse .acuse-copia {
    font-size: 11pt;
    padding: 1.5cm 2cm;
    box-sizing: border-box;
  }
  /* La 1ª copia fuerza salto DESPUÉS; la 2ª no deja rastro tras ella */
  body.print-acuse .acuse-copia:first-child { page-break-after: always; }
  body.print-acuse .acuse-copia:last-child  { page-break-after: avoid; }
  /* Márgenes de página cero para que no aparezcan hojas fantasma */
  @page { margin: 0; }
  body.print-acuse .acuse-corte { display: none !important; }

  /* --- ETIQUETAS --- */
  body.print-etiquetas * { visibility: hidden; }
  body.print-etiquetas .etiquetas-grid,
  body.print-etiquetas .etiquetas-grid * { visibility: visible !important; }
  body.print-etiquetas .etiquetas-grid {
    display: grid !important;
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 6mm;
    padding: 8mm;
    box-sizing: border-box;
  }
  body.print-etiquetas .etiqueta {
    border: 1.5px solid #333 !important;
    border-radius: 4px !important;
    padding: 4mm 5mm !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    background: #fff !important;
  }

  /* Cabecera */
  .acuse-header {
    text-align: center;
    margin-bottom: 1.2em;
    border-bottom: 2px solid #000;
    padding-bottom: .75em;
  }
  .acuse-logo {
    font-size: 13pt;
    font-weight: bold;
    margin-bottom: .3em;
  }
  .acuse-title {
    font-size: 16pt;
    font-weight: bold;
    letter-spacing: .05em;
    margin-bottom: .15em;
  }
  .acuse-subtitle {
    font-size: 10pt;
    color: #444;
  }

  .acuse-intro {
    font-size: 10pt;
    margin: 1em 0;
    line-height: 1.6;
    text-align: justify;
  }

  /* Secciones */
  .acuse-section-title {
    font-size: 9.5pt;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: #222;
    color: #fff;
    padding: .25em .6em;
    margin: 1em 0 .4em;
  }

  /* Tabla de datos */
  .acuse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    margin-bottom: .5em;
  }
  .acuse-table th {
    background: #f0f0f0;
    font-weight: bold;
    padding: .3em .5em;
    border: 1px solid #bbb;
    width: 18%;
    white-space: nowrap;
  }
  .acuse-table td {
    padding: .3em .5em;
    border: 1px solid #bbb;
    width: 32%;
  }

  /* Condiciones */
  .acuse-condiciones {
    font-size: 9.5pt;
    margin: .5em 0 .5em 1.2em;
    line-height: 1.7;
  }

  /* Firmas */
  .acuse-firmas {
    display: flex;
    justify-content: space-around;
    margin-top: 2.5em;
    gap: 2em;
  }
  .acuse-firma {
    text-align: center;
    flex: 1;
  }
  .firma-linea {
    border-top: 1.5px solid #000;
    margin-bottom: .4em;
  }
  .firma-nombre {
    font-weight: bold;
    font-size: 10pt;
  }
  .firma-cargo {
    font-size: 9pt;
    color: #555;
    margin-bottom: .3em;
  }
  .firma-fecha {
    font-size: 9pt;
  }

  /* Footer */
  .acuse-footer {
    margin-top: 2em;
    font-size: 8pt;
    color: #777;
    text-align: center;
    border-top: 1px solid #ccc;
    padding-top: .5em;
  }
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: .35rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.25rem;
}
.tab-btn {
  padding: .5rem 1.1rem;
  border: none;
  background: none;
  font-size: .9rem;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover  { color: var(--color-text); background: var(--color-bg); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); background: none; }

/* ============================================================
   ETIQUETAS — pantalla
   ============================================================ */
.etiquetas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.etiquetas-toolbar-right { display: flex; align-items: center; gap: .75rem; }

.etiquetas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .5rem;
}

.etiqueta {
  background: var(--color-surface);
  border: 1.5px solid #444;
  border-radius: var(--radius);
  padding: .45rem .6rem;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.etq-empresa {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--color-primary);
}
.etq-device {
  font-size: .82rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.2;
  word-break: break-all;
}
.etq-usuario {
  font-size: .75rem;
  color: var(--color-secondary);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.etq-sep {
  border-top: 1px solid #333;
  margin: .15rem 0;
}
.etq-datos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .15rem .35rem;
}
.etq-dato { display: flex; flex-direction: column; }
.etq-dato-label {
  font-size: .55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
}
.etq-dato-value {
  font-size: .72rem;
  color: var(--color-text);
  word-break: break-all;
}
.etq-serial { font-family: monospace; font-weight: 700; }
.etq-id {
  position: absolute;
  top: .3rem; right: .4rem;
  font-size: .55rem;
  color: var(--color-border);
}

/* estilos de etiquetas para pantalla ya definidos arriba */

/* ============================================================
   HISTÓRICO / DESCONTINUADO
   ============================================================ */

/* Badge de conteo en la tab */
.tab-badge {
  display: inline-block;
  background: var(--color-warning);
  color: #fff;
  border-radius: 20px;
  padding: .05em .5em;
  font-size: .7rem;
  font-weight: 700;
  margin-left: .3rem;
  vertical-align: middle;
}

/* Botón warning (Archivar) */
.btn-warning {
  background: var(--color-warning);
  color: #fff;
  border-color: var(--color-warning);
}
.btn-warning:hover {
  background: #b45309;
  border-color: #b45309;
}

/* Banner explicativo del histórico */
.historico-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.historico-icon { font-size: 1.75rem; line-height: 1; }
.historico-banner strong { font-size: .95rem; color: #92400e; }
.historico-banner p {
  font-size: .83rem;
  color: #a16207;
  margin: .25rem 0 0;
  line-height: 1.5;
}

/* Tabla del histórico — aspecto atenuado */
.historico-table tbody tr { opacity: .85; }
.historico-table tbody tr:hover { opacity: 1; background: #fffbeb; }

.historico-motivo {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border-radius: var(--radius);
  padding: .1em .5em;
  font-size: .8rem;
}

/* ============================================================
   SOLICITUDES DE EQUIPOS
   ============================================================ */

/* Badge en el navbar */
.nav-badge {
  display: inline-block;
  background: var(--color-danger);
  color: #fff;
  border-radius: 20px;
  padding: .05em .45em;
  font-size: .68rem;
  font-weight: 700;
  margin-left: .25rem;
  vertical-align: middle;
}

/* Badges neutros en tabs de filtro */
.tab-badge-neutral {
  display: inline-block;
  background: var(--color-bg);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: .05em .5em;
  font-size: .7rem;
  margin-left: .25rem;
}

/* Tarjeta de stats en alerta (dashboard) */
.stat-card-alert {
  border-color: #fca5a5;
  background: #fef2f2;
}
.stat-card-alert .stat-value { color: var(--color-danger); }

/* ---- Lista de solicitudes ---- */
.req-list {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.req-card {
  display: flex;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}
.req-card-main    { flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.req-card-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  align-items: flex-end;
  justify-content: flex-start;
  min-width: 130px;
}

/* Borde izquierdo según estado */
.req-card-pendiente { border-left-color: var(--color-warning); }
.req-card-aprobada  { border-left-color: var(--color-success); }
.req-card-rechazada { border-left-color: var(--color-danger); }
.req-card-entregada { border-left-color: var(--color-info); }

.req-card-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.req-tipo {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--color-text);
}
.req-qty {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .05em .4em;
  font-size: .8rem;
  font-weight: 700;
  color: var(--color-secondary);
}
.req-detail {
  font-size: .92rem;
  color: var(--color-text);
}
.req-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .83rem;
  color: var(--color-secondary);
}
.req-justif {
  font-size: .85rem;
  color: var(--color-secondary);
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: .45rem .7rem;
  font-style: italic;
}
.req-review {
  font-size: .82rem;
  color: var(--color-muted);
  border-top: 1px dashed var(--color-border);
  padding-top: .5rem;
}

/* ---- Badges de estado ---- */
.req-pendiente { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.req-aprobada  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.req-rechazada { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.req-entregada { background: #f0f9ff; color: #0c4a6e; border: 1px solid #bae6fd; }

/* ---- Badges de prioridad ---- */
.prio-urgente { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.prio-alta    { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.prio-normal  { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.prio-baja    { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* Responsive */
@media (max-width: 640px) {
  .req-card { flex-direction: column; }
  .req-card-actions {
    flex-direction: row;
    align-items: center;
    min-width: 0;
    flex-wrap: wrap;
  }
}

/* ============================================================
   AUDITORÍA
   ============================================================ */
.audit-filters {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.audit-filters .form-group { margin-bottom: 0; min-width: 160px; }
.audit-filter-actions { display: flex; gap: .5rem; }

.audit-action {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 20px;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.audit-create  { background: #f0fdf4; color: #166534; }
.audit-update  { background: #eff6ff; color: #1e40af; }
.audit-delete  { background: #fef2f2; color: #991b1b; }
.audit-archive { background: #fffbeb; color: #92400e; }
.audit-restore { background: #f0f9ff; color: #0c4a6e; }

.audit-changes { font-size: .82rem; max-width: 380px; }
.audit-changes > div { margin-bottom: .15rem; }
.audit-old { color: var(--color-danger); text-decoration: line-through; }
.audit-new { color: var(--color-success); font-weight: 600; }

/* ============================================================
   FILTROS COMBINABLES
   ============================================================ */
.filtros-panel {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.filtros-panel .form-group { margin-bottom: 0; min-width: 150px; }
.filtros-actions { display: flex; align-items: flex-end; }

/* ============================================================
   BULK ACTIONS
   ============================================================ */
.bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.bulk-sep { color: var(--color-border); margin: 0 .3rem; }

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: .75rem 0;
}
.pag-info { font-size: .85rem; color: var(--color-muted); }
.pag-controls { display: flex; align-items: center; gap: .4rem; }
.pag-current {
  font-size: .85rem;
  font-weight: 700;
  color: var(--color-primary);
  padding: 0 .5rem;
}
.pag-size { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.pag-size select { width: auto; padding: .25rem .5rem; }

/* ============================================================
   DASHBOARD — KPIs y gráfica de evolución
   ============================================================ */
.stat-card-warn {
  border-color: #fde68a;
  background: #fffbeb;
}
.stat-card-warn .stat-value { color: var(--color-warning); }

.bar-req   { background: #7c3aed; }

/* Gráfica de barras verticales (evolución mensual) */
.evolution-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: .4rem;
  height: 160px;
  padding-top: .5rem;
}
.evo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}
.evo-bar-wrap {
  display: flex;
  align-items: flex-end;
  height: 110px;
  width: 100%;
  justify-content: center;
}
.evo-bar {
  width: 60%;
  min-height: 3px;
  background: linear-gradient(to top, var(--color-primary), #60a5fa);
  border-radius: 4px 4px 0 0;
  transition: height .3s;
}
.evo-val   { font-size: .8rem; font-weight: 700; color: var(--color-text); margin-top: .25rem; }
.evo-label { font-size: .68rem; color: var(--color-muted); margin-top: .1rem; }

/* ============================================================
   BÚSQUEDA GLOBAL (Ctrl+K)
   ============================================================ */
.gsearch-trigger {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .3rem .6rem;
  font-size: .82rem;
  color: var(--color-muted);
  cursor: pointer;
  transition: background .15s;
}
.gsearch-trigger:hover { background: #eef2ff; color: var(--color-primary); }
.gsearch-kbd {
  font-size: .68rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: .05em .35em;
}

.gsearch-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.gsearch-box {
  width: 100%;
  max-width: 600px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.gsearch-input {
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  outline: none;
  font-family: var(--font);
}
.gsearch-results {
  overflow-y: auto;
  padding: .5rem 0;
}
.gsearch-hint {
  padding: 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: .9rem;
}
.gsearch-group {
  padding: .5rem 1.25rem .25rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
}
.gsearch-item {
  display: flex;
  flex-direction: column;
  padding: .5rem 1.25rem;
  text-decoration: none;
  color: var(--color-text);
  cursor: pointer;
}
.gsearch-item:hover, .gsearch-item.active {
  background: #eff6ff;
  text-decoration: none;
}
.gsearch-item-title { font-weight: 600; font-size: .92rem; }
.gsearch-item-sub   { font-size: .78rem; color: var(--color-muted); }
.gsearch-footer {
  display: flex;
  gap: 1rem;
  padding: .6rem 1.25rem;
  border-top: 1px solid var(--color-border);
  background: #f8fafc;
  font-size: .75rem;
  color: var(--color-muted);
}
.gsearch-footer kbd {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: .05em .35em;
  font-size: .7rem;
  margin-right: .15rem;
}

@media (max-width: 640px) {
  .gsearch-kbd { display: none; }
}

/* ============================================================
   2FA / PERFIL
   ============================================================ */
.navbar-profile {
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
}
.navbar-profile:hover { color: var(--color-primary); text-decoration: underline; }

.twofa-steps { margin: 0 0 1rem 1.1rem; font-size: .9rem; line-height: 1.7; }
.twofa-qr {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin: .5rem auto 1rem;
  width: fit-content;
}
.twofa-qr svg { width: 220px; height: 220px; }
.twofa-secret {
  display: inline-block;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .3em .7em;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: .1em;
  margin-top: .3rem;
}

/* ============================================================
   IMPORTACIÓN
   ============================================================ */
.import-intro {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.import-intro p { font-size: .9rem; color: #0369a1; margin-bottom: .75rem; }

.import-resumen {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.import-stat {
  flex: 1;
  min-width: 120px;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.import-num { font-size: 2rem; font-weight: 800; color: var(--color-text); }
.import-lbl { font-size: .82rem; color: var(--color-muted); }
.import-ok  { border-color: #bbf7d0; }
.import-ok .import-num  { color: var(--color-success); }
.import-err { border-color: #fecaca; }
.import-err .import-num { color: var(--color-danger); }

/* ============================================================
   MODO OSCURO
   ============================================================ */
[data-theme="dark"] {
  /* Tokens nuevos del design system (el sidebar sigue oscuro fijo) */
  --bg:            #0b1220;
  --surface:       #131c2e;
  --surface-2:     #1a2436;
  --text:          #e6edf6;
  --text-soft:     #b6c2d4;
  --muted:         #8b98ad;
  --border:        #223049;
  --border-strong: #2c3d5a;

  --success-bg: #0f2a1a; --success-fg: #4ade80;
  --danger-bg:  #2a1414; --danger-fg:  #f87171;
  --warning-bg: #2a2110; --warning-fg: #fbbf24;
  --info-bg:    #0d2830; --info-fg:    #22d3ee;
  --purple-bg:  #1e1a35;
  --primary-50: #16233d;
  --brand-50:   #0e2a20;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.6);

  /* Alias antiguos (derivan de los nuevos) */
  --color-bg:      var(--bg);
  --color-surface: var(--surface);
  --color-border:  var(--border);
  --color-text:    var(--text);
  --color-muted:   var(--muted);
  --shadow:        var(--shadow-sm);
  --shadow-md:     var(--shadow-lg);
}
[data-theme="dark"] body { background: var(--color-bg); color: var(--color-text); }
[data-theme="dark"] .navbar,
[data-theme="dark"] .topbar,
[data-theme="dark"] .footer { background: var(--color-surface); }
/* El sidebar se mantiene oscuro fijo en ambos modos: NO se sobreescribe aquí. */
[data-theme="dark"] .table thead tr { background: var(--surface-2); }
[data-theme="dark"] .table tbody tr:hover { background: var(--surface-2); }
[data-theme="dark"] .navbar-links a.active { background: #1e3a5f; }
[data-theme="dark"] .form-control {
  background: var(--surface-2); color: var(--text); border-color: var(--border-strong);
}
[data-theme="dark"] .gsearch-item:hover,
[data-theme="dark"] .gsearch-item.active { background: #1e3a5f; }
[data-theme="dark"] .badge-count,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .detail-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .etiqueta,
[data-theme="dark"] .req-card,
[data-theme="dark"] .asig-card,
[data-theme="dark"] .empty-state { background: var(--color-surface); }
[data-theme="dark"] .table td { border-color: var(--color-border); }
[data-theme="dark"] a { color: #60a5fa; }

/* --- Legibilidad de textos apagados en modo oscuro --- */
/* Cabeceras de tabla: más claras */
[data-theme="dark"] .table th { color: #cbd5e1; }
/* Textos secundarios / muted: subir contraste */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-hint,
[data-theme="dark"] .sel-hint,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .detail-list dt,
[data-theme="dark"] .etq-dato-label,
[data-theme="dark"] .etq-lbl,
[data-theme="dark"] .attach-meta,
[data-theme="dark"] .req-meta,
[data-theme="dark"] .asig-email,
[data-theme="dark"] .pol-meta,
[data-theme="dark"] .sidebar-sep { color: #94a3b8; }
/* Etiquetas de formulario: bien visibles */
[data-theme="dark"] .form-group label,
[data-theme="dark"] .checkbox-label,
[data-theme="dark"] .form-section-title { color: #e2e8f0; }
/* Título de tarjetas de detalle */
[data-theme="dark"] .detail-card-title,
[data-theme="dark"] .chart-card h3,
[data-theme="dark"] .pol-cat-title { color: #cbd5e1; }
/* Filas de alerta (stock bajo / inactivo) sobre fondo oscuro */
[data-theme="dark"] .row-lowstock { background: #422006; }
[data-theme="dark"] .row-inactive td { opacity: .6; }
/* Selects y textareas igual que inputs */
[data-theme="dark"] select.form-control,
[data-theme="dark"] textarea.form-control { background: var(--surface-2); color: var(--text); }
/* Tabs */
[data-theme="dark"] .tab-btn { color: #94a3b8; }
[data-theme="dark"] .tab-btn:hover { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .tab-btn.active { color: #60a5fa; }
/* Cajas con fondo claro hardcoded */
[data-theme="dark"] .reemplazo-box,
[data-theme="dark"] .sel-toolbar,
[data-theme="dark"] .filtros-panel,
[data-theme="dark"] .audit-filters,
[data-theme="dark"] .modal-box,
[data-theme="dark"] .notif-dropdown,
[data-theme="dark"] .consumible-form,
[data-theme="dark"] .empleado-form { background: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .destino-op { border-color: var(--color-border); }
[data-theme="dark"] .destino-op:hover { background: #0f172a; }
/* Badge count e iconos */
[data-theme="dark"] .badge-count,
[data-theme="dark"] .tab-badge-neutral,
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .gsearch-trigger { background: #0f172a; color: #cbd5e1; border-color: var(--color-border); }

/* --- Paneles con fondo claro fijo (políticas, importación) --- */
[data-theme="dark"] .import-intro {
  background: #0f2942;
  border-color: #1e3a5f;
}
[data-theme="dark"] .import-intro p { color: #93c5fd; }
[data-theme="dark"] .pol-card,
[data-theme="dark"] .import-stat { background: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .pol-title { color: #e2e8f0; }

/* --- Select inline (cambiar rol) y badges de estado --- */
[data-theme="dark"] .select-inline {
  background: #0f172a;
  color: var(--color-text);
  border-color: var(--color-border);
}
[data-theme="dark"] .badge-inactive {
  background: #334155;
  color: #cbd5e1;
}
[data-theme="dark"] .badge-info {
  background: #0f2942;
  color: #93c5fd;
}
[data-theme="dark"] .badge-active {
  background: #14532d;
  color: #bbf7d0;
}
[data-theme="dark"] .row-inactive { background: #1a1f2e; }
/* Hover y selección de filas en modo oscuro (evita fondo claro con texto oscuro) */
[data-theme="dark"] .laptop-row:hover { background: #273449 !important; }
[data-theme="dark"] .row-selected     { background: #1e3a5f !important; }
[data-theme="dark"] .row-selected td  { border-bottom-color: #334155; }

/* Etiquetas: siempre fondo blanco y texto oscuro (se ven como se imprimen) */
[data-theme="dark"] .etiqueta {
  background: #fff;
  border-color: #333;
}
[data-theme="dark"] .etq-nombre,
[data-theme="dark"] .etq-device,
[data-theme="dark"] .etq-val,
[data-theme="dark"] .etq-serial { color: #111; }
[data-theme="dark"] .etq-lbl,
[data-theme="dark"] .etq-dato-label { color: #555; }
[data-theme="dark"] .etq-sep { border-top-color: #333; }
[data-theme="dark"] .etq-empresa { color: #2563eb; }

/* --- Section divider y títulos "Crear nuevo…" --- */
[data-theme="dark"] .section-divider { border-color: var(--color-border); }
[data-theme="dark"] h3 { color: #e2e8f0; }

/* --- Alertas informativas con fondo claro fijo --- */
[data-theme="dark"] .alert-success { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .alert-danger  { background: #4c1d1d; color: #fecaca; }
[data-theme="dark"] .alert-warning { background: #422006; color: #fde68a; }
[data-theme="dark"] .alert-info    { background: #0f2942; color: #93c5fd; }

/* ============================================================
   BOTONES DE ICONO / MODO OSCURO / NOTIFICACIONES
   ============================================================ */
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-soft);
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.notif-wrap { position: relative; display: inline-block; }
.notif-btn { position: relative; }
.notif-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--r-full);
  font-size: .62rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--danger);
}
.notif-dropdown {
  position: absolute;
  top: 130%; right: 0;
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: modalFade var(--transition);
}
.notif-header {
  padding: var(--sp-3) var(--sp-4);
  font-weight: 700;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  position: sticky; top: 0; background: var(--surface);
}
.notif-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-base);
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--r-md);
  display: grid; place-items: center; font-size: .95rem;
  background: var(--surface-2);
}
.notif-empty { padding: var(--sp-6); text-align: center; color: var(--muted); font-size: var(--fs-sm); }

/* ============================================================
   ALERTAS DASHBOARD
   ============================================================ */
.dash-alerts { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.25rem; }
.dash-alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  border-left: 4px solid;
}
.dash-alert-warn   { background: #fffbeb; border-color: var(--color-warning); color: #92400e; }
.dash-alert-danger { background: #fef2f2; border-color: var(--color-danger); color: #991b1b; }
.dash-alert-chip {
  display: inline-block;
  background: rgba(0,0,0,.06);
  border-radius: 20px;
  padding: .1em .55em;
  font-size: .78rem;
  margin: .1rem .15rem 0;
}

/* ============================================================
   ETIQUETAS con QR
   ============================================================ */
.etiqueta { flex-direction: row; align-items: center; gap: .5rem; }
.etq-contenido { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.etq-qr { flex-shrink: 0; }
.etq-qr img { width: 62px; height: 62px; display: block; }

/* ============================================================
   ADJUNTOS Y MANTENIMIENTO
   ============================================================ */
.detail-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 1.25rem;
}
.detail-section .page-header { margin-bottom: .75rem; }
.detail-section h3 { font-size: 1rem; }

.attach-form, .maint-form {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1rem;
}
.attach-form .form-control { max-width: 300px; }
.maint-form .form-control { flex: 1; min-width: 120px; }

.attach-list { display: flex; flex-direction: column; gap: .4rem; }
.attach-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.attach-icon { font-size: 1.3rem; }
.attach-info { flex: 1; display: flex; flex-direction: column; }
.attach-meta { font-size: .75rem; color: var(--color-muted); }

/* ============================================================
   TIMELINE (historial del equipo)
   ============================================================ */
.timeline { display: flex; flex-direction: column; gap: .2rem; padding-left: .5rem; }
.timeline-item { display: flex; gap: .75rem; }
.timeline-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--color-primary);
  margin-top: .35rem; flex-shrink: 0;
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-border);
}
.timeline-dot.audit-create  { background: var(--color-success); }
.timeline-dot.audit-delete  { background: var(--color-danger); }
.timeline-dot.audit-archive { background: var(--color-warning); }
.timeline-body {
  flex: 1; padding-bottom: .9rem;
  border-left: 2px solid var(--color-border);
  margin-left: -.35rem; padding-left: 1rem;
}
.timeline-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.timeline-time { font-size: .8rem; color: var(--color-muted); }
.timeline-changes { font-size: .82rem; margin-top: .3rem; }

/* ============================================================
   CONSUMIBLES / STOCK
   ============================================================ */
.row-lowstock { background: #fffbeb; }
.stock-qty { font-weight: 700; font-size: 1rem; }
.stock-low { color: var(--color-danger); }
.stock-alert { font-size: .72rem; color: var(--color-danger); margin-left: .3rem; }

/* ============================================================
   PANEL ASIGNACIONES
   ============================================================ */
.asig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.asig-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.asig-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.asig-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.asig-nombre { font-weight: 700; }
.asig-email  { font-size: .78rem; color: var(--color-muted); }
.asig-count {
  margin-left: auto;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 20px; padding: .1em .6em; font-weight: 700; font-size: .85rem;
}

/* Persona con MÁS de una laptop: tarjeta roja completa */
.asig-card-multi {
  background: #fef2f2;
  border-color: var(--color-danger);
  border-width: 2px;
}
.asig-card-multi .asig-avatar { background: var(--color-danger); }
.asig-card-multi .asig-count {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.asig-card-multi .asig-laptop { background: #fff; }
.asig-warning {
  background: var(--color-danger);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  padding: .3em .6em;
  border-radius: var(--radius);
  margin-bottom: .6rem;
  text-align: center;
}
.asig-laptops { display: flex; flex-direction: column; gap: .4rem; }
.asig-laptop {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .5rem .65rem;
  background: var(--color-bg);
  border-radius: var(--radius);
  text-decoration: none; color: var(--color-text);
}
.asig-laptop:hover { background: #eef2ff; text-decoration: none; }
.asig-laptop-name  { font-weight: 600; font-size: .9rem; }
.asig-laptop-model { font-size: .76rem; color: var(--color-muted); }

/* Item unificado (laptop o activo) */
.asig-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .65rem;
  background: var(--color-bg);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
}
.asig-item:hover { background: #eef2ff; text-decoration: none; }
.asig-item-icon { font-size: 1.4rem; flex-shrink: 0; }
.asig-item-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
[data-theme="dark"] .asig-item { background: #0f172a; }
[data-theme="dark"] .asig-item:hover { background: #1e3a5f; }

/* ============================================================
   REPORTE EJECUTIVO
   ============================================================ */
.reporte {
  background: var(--surface); color: var(--text);
  max-width: 860px; margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  box-shadow: var(--shadow-sm);
}
.reporte-header {
  text-align: center; border-bottom: 2px solid var(--border-strong);
  padding-bottom: var(--sp-4); margin-bottom: var(--sp-6);
}
.reporte-header h1 { font-size: var(--fs-2xl); font-weight: 800; color: var(--text); }
.reporte-header p { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.reporte-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.reporte-kpi {
  text-align: center; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-5) var(--sp-4);
}
.rk-num { font-size: var(--fs-2xl); font-weight: 800; color: var(--primary); line-height: 1; }
.rk-lbl { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--sp-2); }
.reporte h3 {
  margin: var(--sp-6) 0 var(--sp-3); font-size: var(--fs-md); font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border); padding-bottom: var(--sp-2);
  text-transform: none; letter-spacing: 0;
}
.reporte-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.reporte-table th, .reporte-table td {
  border: 1px solid var(--border); padding: .45rem .7rem; text-align: left;
}
.reporte-table th { background: var(--surface-2); font-weight: 700; color: var(--text-soft); }
.reporte-footer {
  margin-top: var(--sp-8); text-align: center; font-size: var(--fs-xs); color: var(--muted);
  border-top: 1px solid var(--border); padding-top: var(--sp-3);
}
/* Gráficas del reporte ejecutivo */
.reporte-charts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-5); margin-bottom: var(--sp-6);
}
.reporte-chart { text-align: center; }
.reporte-chart h3 { border: none; margin: 0 0 var(--sp-2); text-align: center; }
.reporte-canvas { position: relative; height: 200px; }
@media print {
  .reporte-charts { page-break-inside: avoid; }
  .reporte-canvas { height: 180px; }
}

@media print {
  /* Reporte ejecutivo: ocultar todo salvo el reporte con display:none
     (evita la hoja en blanco que deja visibility:hidden) */
  body.print-reporte .sidebar,
  body.print-reporte .topbar,
  body.print-reporte .footer,
  body.print-reporte #gsearch-overlay,
  body.print-reporte main > *:not(#reporte),
  body.print-reporte .no-print { display: none !important; }
  body.print-reporte main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  body.print-reporte .reporte {
    border: none !important;
    margin: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  /* Forzar blanco/negro legible al imprimir, sin importar el tema */
  body.print-reporte .reporte-header h1,
  body.print-reporte .reporte h3,
  body.print-reporte .reporte-table th,
  body.print-reporte .reporte-table td,
  body.print-reporte .rk-num { color: #000 !important; }
  body.print-reporte .reporte-header p,
  body.print-reporte .rk-lbl,
  body.print-reporte .reporte-footer { color: #555 !important; }
  body.print-reporte .reporte-kpi,
  body.print-reporte .reporte-table th { background: #f0f0f0 !important; }
  body.print-reporte .reporte-kpi,
  body.print-reporte .reporte-table th,
  body.print-reporte .reporte-table td { border-color: #ccc !important; }
}

/* Etiqueta de copia en el acuse (visible solo al imprimir) */
.acuse-copia-label {
  display: inline-block;
  margin-top: .3em;
  font-size: 9pt;
  font-weight: bold;
  letter-spacing: .05em;
  background: #222;
  color: #fff;
  padding: .15em .8em;
  border-radius: 3px;
}
.acuse-corte { display: none; }

/* ============================================================
   POLÍTICAS
   ============================================================ */
.pol-upload { margin-top: .75rem; }

.pol-categoria { margin-bottom: 1.5rem; }
.pol-cat-title {
  font-size: 1rem;
  color: var(--color-secondary);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: .35rem;
  margin-bottom: .85rem;
}

.pol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: .85rem;
}
.pol-card {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: .85rem 1rem;
  box-shadow: var(--shadow);
}
/* Fila superior: icono + info */
.pol-head { display: flex; align-items: flex-start; gap: .75rem; }
.pol-icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.pol-info { flex: 1; min-width: 0; }
.pol-title {
  font-weight: 700; font-size: .95rem; line-height: 1.3;
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.pol-vis-badge { font-size: .7rem; font-weight: 600; padding: .05rem .4rem;
                 border-radius: 999px; white-space: nowrap; }
.pol-desc  { font-size: .82rem; color: var(--color-secondary); margin-top: .15rem;
             overflow-wrap: anywhere; }
.pol-meta  { font-size: .72rem; color: var(--color-muted); margin-top: .2rem;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Acciones: fila propia abajo, se envuelven si no caben */
.pol-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
               padding-top: .5rem; border-top: 1px solid var(--color-border); }

@media (max-width: 640px) {
  .pol-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MODAL (asignar suministro)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: modalFade var(--transition);
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  width: 100%;
  max-width: 460px;
  animation: modalPop var(--transition);
}
@keyframes modalPop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box h3 {
  margin-bottom: var(--sp-4);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   BLOQUE DE REEMPLAZO (modal asignar)
   ============================================================ */
.reemplazo-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem;
  margin: .75rem 0;
}
.reemplazo-box .checkbox-label { font-size: .88rem; }
#reemplazo-campos { margin-top: .75rem; padding-top: .5rem; border-top: 1px dashed var(--color-border); }

.destino-opciones { display: flex; flex-direction: column; gap: .4rem; }
.destino-op {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .88rem;
}
.destino-op:hover { background: var(--color-surface); }
.destino-op small { color: var(--color-muted); }

/* ============================================================
   REPORTE DE COMPRAS / REPOSICIÓN
   ============================================================ */
.compras-intro { font-size: .9rem; color: #444; margin-bottom: 1rem; }
.col-sugerido { font-weight: 700; color: var(--color-primary); text-align: center; }
.col-cero { color: var(--color-danger); font-weight: 700; }
.reporte-table tfoot td { background: #f8fafc; padding: .5rem .6rem; }

.compras-ok {
  background: #f0fdf4; color: #166534;
  border: 1px solid #bbf7d0; border-radius: var(--radius);
  padding: 1rem; text-align: center; font-size: .95rem;
}
.compras-firma {
  display: flex; justify-content: space-around; gap: 2rem; margin-top: 2.5rem;
}
.compras-firma-col { text-align: center; flex: 1; font-size: .85rem; }
.firma-linea-c { border-top: 1.5px solid #333; margin-bottom: .4rem; }

@media print {
  body.print-compras .sidebar,
  body.print-compras .topbar,
  body.print-compras .footer,
  body.print-compras #gsearch-overlay,
  body.print-compras main > *:not(#reporte-compras),
  body.print-compras .no-print { display: none !important; }
  body.print-compras main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  body.print-compras .reporte {
    border: none !important; margin: 0 !important; max-width: none !important; box-shadow: none !important;
  }
}

/* ----- Barra de progreso (offboarding) ----- */
.progress-track {
  width: 100%;
  height: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  overflow: hidden;
  margin-top: .5rem;
}
.progress-fill {
  height: 100%;
  background: var(--color-success, #10b981);
  transition: width .3s ease;
}
[data-theme="dark"] .progress-track { background: #1e293b; }

/* ---- Selección de roles múltiples ---- */
.roles-check { display: flex; flex-direction: column; gap: .35rem; margin-top: .25rem; }
.roles-check .checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.roles-inline { display: flex; flex-wrap: wrap; gap: .35rem; }
.role-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem;
             padding: .1rem .45rem; border: 1px solid var(--color-border);
             border-radius: 999px; background: var(--color-surface); cursor: pointer; }
.role-chip input { margin: 0; }
