/**
 * ═══════════════════════════════════════════════════════════════════════════
 *  TechnoVision Hardware UI — Design System
 *  Sistema de Ferretería Empresarial
 *  Identidad Industrial: Acero · Concreto · Cobre · Precisión · Control
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ── Imports de Tipografía ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

/* ══════════════════════════════════════════════════════════════════════════
   1. VARIABLES CSS — TechnoVision Hardware Palette (Modo Claro por Defecto)
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  /* ── Fondos (Modo Claro) ─────────────────────────────────────────────── */
  --hw-bg-base:       #F1F5F9;
  --hw-bg-surface:    #FFFFFF;
  --hw-bg-elevated:   #F8FAFC;
  --hw-bg-overlay:    #E2E8F0;
  --hw-bg-hover:      #F1F5F9;
  --hw-bg-active:     #E2E8F0;

  /* ── Colores Industriales ────────────────────────────────────────────── */
  --hw-steel:         #4D6B83;
  --hw-steel-light:   #3A526A;
  --hw-steel-dark:    #6989A3;
  --hw-orange:        #F97316;
  --hw-orange-light:  #FB923C;
  --hw-orange-dark:   #EA6900;
  --hw-copper:        #C7783A;
  --hw-copper-light:  #D9935A;
  --hw-copper-dark:   #A85E28;
  --hw-yellow:        #F4B942;
  --hw-yellow-light:  #F7CC72;
  --hw-yellow-dark:   #D99B28;

  /* ── Estados ─────────────────────────────────────────────────────────── */
  --hw-green:         #16A34A;
  --hw-green-light:   #22C55E;
  --hw-green-dark:    #15803D;
  --hw-red:           #DC2626;
  --hw-red-light:     #EF4444;
  --hw-red-dark:      #B91C1C;
  --hw-blue:          #2563EB;
  --hw-blue-light:    #3B82F6;
  --hw-blue-dark:     #1D4ED8;
  --hw-purple:        #7C3AED;

  /* ── Texto ───────────────────────────────────────────────────────────── */
  --hw-text-primary:  #0F172A;
  --hw-text-secondary:#334155;
  --hw-text-muted:    #64748B;
  --hw-text-faint:    #94A3B8;
  --hw-text-disabled: #CBD5E1;

  /* ── Bordes ──────────────────────────────────────────────────────────── */
  --hw-border:        #E2E8F0;
  --hw-border-light:  #F1F5F9;
  --hw-border-focus:  #F97316;
  --hw-border-hover:  #94A3B8;

  /* ── Sombras ─────────────────────────────────────────────────────────── */
  --hw-shadow-sm:     0 1px 3px rgba(15, 23, 42, 0.06);
  --hw-shadow-md:     0 4px 12px rgba(15, 23, 42, 0.06);
  --hw-shadow-lg:     0 8px 32px rgba(15, 23, 42, 0.08);
  --hw-shadow-xl:     0 16px 64px rgba(15, 23, 42, 0.1);
  --hw-shadow-orange: 0 4px 20px rgba(249, 115, 22, 0.15);
  --hw-shadow-steel:  0 4px 20px rgba(77, 107, 131, 0.1);

  /* ── Tipografía (Compartida) ─────────────────────────────────────────── */
  --hw-font-display:  'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --hw-font-body:     'Inter', system-ui, sans-serif;
  --hw-font-mono:     'JetBrains Mono', 'Fira Code', monospace;

  /* ── Espaciados (Compartida) ─────────────────────────────────────────── */
  --hw-spacing-xs:    0.25rem;   /* 4px  */
  --hw-spacing-sm:    0.5rem;    /* 8px  */
  --hw-spacing-md:    1rem;      /* 16px */
  --hw-spacing-lg:    1.5rem;    /* 24px */
  --hw-spacing-xl:    2rem;      /* 32px */
  --hw-spacing-2xl:   3rem;      /* 48px */
  --hw-spacing-3xl:   4rem;      /* 64px */

  /* ── Radios (Compartida) ─────────────────────────────────────────────── */
  --hw-radius-sm:     4px;
  --hw-radius-md:     8px;
  --hw-radius-lg:     12px;
  --hw-radius-xl:     16px;
  --hw-radius-full:   9999px;

  /* ── Transiciones (Compartida) ───────────────────────────────────────── */
  --hw-transition-fast:  150ms cubic-bezier(0.4, 0, 0.2, 1);
  --hw-transition-base:  250ms cubic-bezier(0.4, 0, 0.2, 1);
  --hw-transition-slow:  400ms cubic-bezier(0.4, 0, 0.2, 1);
  --hw-transition-spring:350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Sidebar (Compartida) ────────────────────────────────────────────── */
  --hw-sidebar-width:     260px;
  --hw-sidebar-collapsed: 64px;
  --hw-topbar-height:     60px;
}

/* ── MODULACIÓN MODO OSCURO (Anulación de Variables de Color) ──────────── */
[data-theme="dark"] {
  --hw-bg-base:       #0D1117;
  --hw-bg-surface:    #151B23;
  --hw-bg-elevated:   #1B2430;
  --hw-bg-overlay:    #232D3B;
  --hw-bg-hover:      #263547;
  --hw-bg-active:     #2E3F57;

  --hw-steel:         #4D6B83;
  --hw-steel-light:   #6989A3;
  --hw-steel-dark:    #3A526A;

  --hw-green:         #22C55E;
  --hw-green-light:   #4ADE80;
  --hw-green-dark:    #16A34A;
  --hw-red:           #EF4444;
  --hw-red-light:     #F87171;
  --hw-red-dark:      #DC2626;
  --hw-blue:          #3B82F6;
  --hw-blue-light:    #60A5FA;
  --hw-blue-dark:     #2563EB;
  --hw-purple:        #8B5CF6;

  --hw-text-primary:  #F8FAFC;
  --hw-text-secondary:#CBD5E1;
  --hw-text-muted:    #94A3B8;
  --hw-text-faint:    #64748B;
  --hw-text-disabled: #334155;

  --hw-border:        #1E2A38;
  --hw-border-light:  #263344;
  --hw-border-focus:  #F97316;
  --hw-border-hover:  #4D6B83;

  --hw-shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.4);
  --hw-shadow-md:     0 4px 12px rgba(0, 0, 0, 0.5);
  --hw-shadow-lg:     0 8px 32px rgba(0, 0, 0, 0.6);
  --hw-shadow-xl:     0 16px 64px rgba(0, 0, 0, 0.7);
  --hw-shadow-orange: 0 4px 20px rgba(249, 115, 22, 0.25);
  --hw-shadow-steel:  0 4px 20px rgba(77, 107, 131, 0.2);
}

/* ══════════════════════════════════════════════════════════════════════════
   2. RESET Y BASE
   ══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--hw-font-body);
  background-color: var(--hw-bg-base);
  color: var(--hw-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--hw-bg-surface); }
::-webkit-scrollbar-thumb { background: var(--hw-border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--hw-steel); }

/* Selección de texto */
::selection {
  background: rgba(249, 115, 22, 0.25);
  color: var(--hw-text-primary);
}

/* ══════════════════════════════════════════════════════════════════════════
   3. TIPOGRAFÍA
   ══════════════════════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--hw-font-display);
  font-weight: 700;
  color: var(--hw-text-primary);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { color: var(--hw-text-secondary); line-height: 1.7; }
small { font-size: 0.8125rem; color: var(--hw-text-muted); }

.hw-mono {
  font-family: var(--hw-font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

/* Texto de estado */
.hw-text-primary   { color: var(--hw-text-primary) !important; }
.hw-text-muted     { color: var(--hw-text-muted) !important; }
.hw-text-orange    { color: var(--hw-orange) !important; }
.hw-text-steel     { color: var(--hw-steel-light) !important; }
.hw-text-copper    { color: var(--hw-copper-light) !important; }
.hw-text-green     { color: var(--hw-green) !important; }
.hw-text-red       { color: var(--hw-red) !important; }
.hw-text-yellow    { color: var(--hw-yellow) !important; }

/* ══════════════════════════════════════════════════════════════════════════
   4. LAYOUT — SIDEBAR + TOPBAR
   ══════════════════════════════════════════════════════════════════════════ */

/* Contenedor raíz del app */
.hw-app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--hw-bg-base);
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.hw-sidebar {
  width: var(--hw-sidebar-width);
  min-width: var(--hw-sidebar-width);
  background: var(--hw-bg-surface);
  border-right: 1px solid var(--hw-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--hw-transition-base);
  position: relative;
  z-index: 100;
}

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

/* Logo / Brand */
.hw-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--hw-border);
  min-height: var(--hw-topbar-height);
  overflow: hidden;
  white-space: nowrap;
}

.hw-sidebar-brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--hw-radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.hw-sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--hw-orange), var(--hw-copper));
  border-radius: var(--hw-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hw-sidebar-brand-name {
  font-family: var(--hw-font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--hw-text-primary);
  letter-spacing: -0.01em;
  transition: opacity var(--hw-transition-base);
}

.hw-sidebar.collapsed .hw-sidebar-brand-name { opacity: 0; width: 0; }

/* Navegación del Sidebar */
.hw-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
}

.hw-nav-section {
  margin-bottom: 24px;
}

.hw-nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hw-text-faint);
  padding: 0 8px 6px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--hw-transition-base);
}

.hw-sidebar.collapsed .hw-nav-section-label { opacity: 0; }

.hw-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--hw-radius-md);
  color: var(--hw-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: all var(--hw-transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.hw-nav-item:hover {
  background: var(--hw-bg-hover);
  color: var(--hw-text-primary);
}

.hw-nav-item.active {
  background: rgba(249, 115, 22, 0.12);
  color: var(--hw-orange);
  border-left: 3px solid var(--hw-orange);
  padding-left: 7px;
}

.hw-nav-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.hw-nav-item.active .hw-nav-item-icon { opacity: 1; }

.hw-nav-item-label {
  transition: opacity var(--hw-transition-base);
}

.hw-sidebar.collapsed .hw-nav-item-label { opacity: 0; width: 0; }

.hw-nav-badge {
  margin-left: auto;
  background: var(--hw-red);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--hw-radius-full);
  line-height: 1;
  flex-shrink: 0;
  transition: opacity var(--hw-transition-base);
}

.hw-sidebar.collapsed .hw-nav-badge { opacity: 0; }

/* Sidebar Footer */
.hw-sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--hw-border);
}

/* ── Área de Contenido Principal ────────────────────────────────────── */
.hw-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────────────────── */
.hw-topbar {
  height: var(--hw-topbar-height);
  min-height: var(--hw-topbar-height);
  background: var(--hw-bg-surface);
  border-bottom: 1px solid var(--hw-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 50;
  position: relative;
}

.hw-topbar-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--hw-radius-md);
  border: none;
  background: none;
  color: var(--hw-text-muted);
  cursor: pointer;
  transition: all var(--hw-transition-fast);
  flex-shrink: 0;
}

.hw-topbar-toggle:hover {
  background: var(--hw-bg-hover);
  color: var(--hw-text-primary);
}

/* Barra de búsqueda en topbar */
.hw-topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.hw-topbar-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hw-bg-elevated);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-md);
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--hw-transition-fast);
  color: var(--hw-text-faint);
  font-size: 0.875rem;
  font-family: var(--hw-font-body);
}

.hw-topbar-search-btn:hover {
  border-color: var(--hw-border-hover);
  color: var(--hw-text-muted);
}

.hw-topbar-search-kbd {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.hw-kbd {
  background: var(--hw-bg-overlay);
  border: 1px solid var(--hw-border-light);
  border-radius: var(--hw-radius-sm);
  padding: 2px 6px;
  font-family: var(--hw-font-mono);
  font-size: 0.6875rem;
  color: var(--hw-text-faint);
}

/* Acciones del Topbar */
.hw-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.hw-topbar-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--hw-radius-md);
  border: none;
  background: none;
  color: var(--hw-text-muted);
  cursor: pointer;
  transition: all var(--hw-transition-fast);
  position: relative;
  text-decoration: none;
}

.hw-topbar-action-btn:hover {
  background: var(--hw-bg-hover);
  color: var(--hw-text-primary);
}

.hw-topbar-action-btn .hw-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hw-red);
  border: 2px solid var(--hw-bg-surface);
}

/* Avatar de usuario */
.hw-topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--hw-radius-md);
  background: linear-gradient(135deg, var(--hw-steel), var(--hw-steel-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--hw-transition-fast);
  overflow: hidden;
  text-decoration: none;
}

.hw-topbar-avatar:hover {
  border-color: var(--hw-orange);
}

.hw-topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Área de Contenido ───────────────────────────────────────────────── */
.hw-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  max-width: 1920px;
  width: 100%;
}

/* Page header */
.hw-page-header {
  margin-bottom: 24px;
}

.hw-page-title {
  font-family: var(--hw-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--hw-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.hw-page-subtitle {
  font-size: 0.875rem;
  color: var(--hw-text-muted);
}

.hw-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--hw-text-faint);
  margin-bottom: 8px;
}

.hw-breadcrumb a { color: var(--hw-steel-light); text-decoration: none; }
.hw-breadcrumb a:hover { color: var(--hw-orange); }

/* ══════════════════════════════════════════════════════════════════════════
   5. COMPONENTE — HWCard
   ══════════════════════════════════════════════════════════════════════════ */
.hw-card {
  background: var(--hw-bg-surface);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-lg);
  overflow: hidden;
  transition: all var(--hw-transition-base);
}

.hw-card:hover { border-color: var(--hw-border-light); }

.hw-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hw-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.hw-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--hw-text-primary);
  letter-spacing: -0.01em;
}

.hw-card-subtitle {
  font-size: 0.8125rem;
  color: var(--hw-text-muted);
  margin-top: 2px;
}

.hw-card-body { padding: 20px; }
.hw-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--hw-border);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Card industrial con borde de acento */
.hw-card-orange { border-top: 3px solid var(--hw-orange); }
.hw-card-steel  { border-top: 3px solid var(--hw-steel); }
.hw-card-copper { border-top: 3px solid var(--hw-copper); }
.hw-card-green  { border-top: 3px solid var(--hw-green); }
.hw-card-red    { border-top: 3px solid var(--hw-red); }

/* ══════════════════════════════════════════════════════════════════════════
   6. COMPONENTE — HWStat (Métrica)
   ══════════════════════════════════════════════════════════════════════════ */
.hw-stat {
  background: var(--hw-bg-surface);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: all var(--hw-transition-base);
}

.hw-stat:hover {
  border-color: var(--hw-border-light);
  transform: translateY(-1px);
  box-shadow: var(--hw-shadow-md);
}

.hw-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--hw-accent-color, var(--hw-steel));
}

.hw-stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hw-stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--hw-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hw-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--hw-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.hw-stat-value {
  font-family: var(--hw-font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--hw-text-primary);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hw-stat-value.mono {
  font-family: var(--hw-font-mono);
  letter-spacing: -0.02em;
}

.hw-stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.hw-stat-trend.up   { color: var(--hw-green); }
.hw-stat-trend.down { color: var(--hw-red); }
.hw-stat-trend.flat { color: var(--hw-text-muted); }

.hw-stat-sub {
  font-size: 0.8125rem;
  color: var(--hw-text-muted);
}

/* Variantes de color de acento para stats */
.hw-stat-orange { --hw-accent-color: var(--hw-orange); }
.hw-stat-steel  { --hw-accent-color: var(--hw-steel); }
.hw-stat-copper { --hw-accent-color: var(--hw-copper); }
.hw-stat-green  { --hw-accent-color: var(--hw-green); }
.hw-stat-red    { --hw-accent-color: var(--hw-red); }
.hw-stat-yellow { --hw-accent-color: var(--hw-yellow); }

/* ══════════════════════════════════════════════════════════════════════════
   7. COMPONENTE — HWButton
   ══════════════════════════════════════════════════════════════════════════ */
.hw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--hw-radius-md);
  font-family: var(--hw-font-body);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--hw-transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.hw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.hw-btn:focus-visible {
  outline: 2px solid var(--hw-orange);
  outline-offset: 2px;
}

/* Primary — Naranja Industrial */
.hw-btn-primary {
  background: var(--hw-orange);
  color: white;
  border-color: var(--hw-orange);
  box-shadow: var(--hw-shadow-orange);
}

.hw-btn-primary:hover {
  background: var(--hw-orange-dark);
  border-color: var(--hw-orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(249, 115, 22, 0.35);
}

.hw-btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--hw-shadow-orange);
}

/* Steel */
.hw-btn-steel {
  background: var(--hw-steel);
  color: white;
  border-color: var(--hw-steel);
}

.hw-btn-steel:hover {
  background: var(--hw-steel-dark);
  transform: translateY(-1px);
}

/* Outline (Ghost) */
.hw-btn-outline {
  background: transparent;
  color: var(--hw-text-secondary);
  border-color: var(--hw-border-light);
}

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

/* Ghost */
.hw-btn-ghost {
  background: transparent;
  color: var(--hw-text-muted);
  border-color: transparent;
}

.hw-btn-ghost:hover {
  background: var(--hw-bg-hover);
  color: var(--hw-text-primary);
}

/* Danger */
.hw-btn-danger {
  background: var(--hw-red);
  color: white;
  border-color: var(--hw-red);
}

.hw-btn-danger:hover {
  background: var(--hw-red-dark);
  transform: translateY(-1px);
}

/* Success */
.hw-btn-success {
  background: var(--hw-green);
  color: white;
  border-color: var(--hw-green);
}

.hw-btn-success:hover {
  background: var(--hw-green-dark);
  transform: translateY(-1px);
}

/* Tamaños */
.hw-btn-xs { padding: 5px 10px; font-size: 0.75rem; }
.hw-btn-sm { padding: 7px 12px; font-size: 0.8125rem; }
.hw-btn-lg { padding: 12px 24px; font-size: 1rem; }
.hw-btn-xl { padding: 14px 32px; font-size: 1.0625rem; }
.hw-btn-icon { width: 36px; height: 36px; padding: 0; }
.hw-btn-icon.hw-btn-sm { width: 30px; height: 30px; }
.hw-btn-block { width: 100%; }

/* ══════════════════════════════════════════════════════════════════════════
   8. COMPONENTE — HWInput
   ══════════════════════════════════════════════════════════════════════════ */
.hw-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hw-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hw-text-secondary);
  letter-spacing: 0.01em;
}

.hw-label .required { color: var(--hw-orange); margin-left: 2px; }

.hw-input, .hw-select, .hw-textarea {
  width: 100%;
  background: var(--hw-bg-elevated);
  border: 1px solid var(--hw-border-light);
  border-radius: var(--hw-radius-md);
  color: var(--hw-text-primary);
  font-family: var(--hw-font-body);
  font-size: 0.9375rem;
  padding: 10px 14px;
  transition: all var(--hw-transition-fast);
  outline: none;
  -webkit-appearance: none;
}

.hw-input:focus, .hw-select:focus, .hw-textarea:focus {
  border-color: var(--hw-border-focus);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
  background: var(--hw-bg-surface);
}

.hw-input:hover, .hw-select:hover {
  border-color: var(--hw-border-hover);
}

.hw-input::placeholder, .hw-textarea::placeholder {
  color: var(--hw-text-disabled);
}

.hw-input.error   { border-color: var(--hw-red); }
.hw-input.success { border-color: var(--hw-green); }
.hw-input.mono    { font-family: var(--hw-font-mono); }

/* Input con ícono */
.hw-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.hw-input-group .hw-input {
  padding-left: 40px;
}

.hw-input-prefix, .hw-input-suffix {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hw-text-faint);
  width: 40px;
  height: 100%;
  pointer-events: none;
}

.hw-input-prefix { left: 0; }
.hw-input-suffix { right: 0; }

.hw-input-group:focus-within .hw-input-prefix,
.hw-input-group:focus-within .hw-input-suffix {
  color: var(--hw-orange);
}

.hw-form-help {
  font-size: 0.75rem;
  color: var(--hw-text-muted);
}

.hw-form-error {
  font-size: 0.75rem;
  color: var(--hw-red);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════
   9. COMPONENTE — HWTable
   ══════════════════════════════════════════════════════════════════════════ */
.hw-table-wrapper {
  overflow-x: auto;
  border-radius: var(--hw-radius-lg);
  border: 1px solid var(--hw-border);
}

.hw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.hw-table thead {
  background: var(--hw-bg-elevated);
  border-bottom: 1px solid var(--hw-border);
}

.hw-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hw-text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--hw-transition-fast);
}

.hw-table thead th:hover { color: var(--hw-text-primary); }

.hw-table thead th.sorted { color: var(--hw-orange); }

.hw-table tbody tr {
  border-bottom: 1px solid var(--hw-border);
  transition: background var(--hw-transition-fast);
}

.hw-table tbody tr:last-child { border-bottom: none; }

.hw-table tbody tr:hover {
  background: var(--hw-bg-hover);
}

.hw-table tbody td {
  padding: 13px 16px;
  color: var(--hw-text-secondary);
  vertical-align: middle;
}

.hw-table tbody td .mono {
  font-family: var(--hw-font-mono);
  font-size: 0.8125rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   10. COMPONENTE — HWBadge / HWStockBadge
   ══════════════════════════════════════════════════════════════════════════ */
.hw-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--hw-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.hw-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Stock badges */
.hw-stock-badge-disponible  { background: rgba(34,197,94,0.12);  color: var(--hw-green);  }
.hw-stock-badge-minimo      { background: rgba(244,185,66,0.12);  color: var(--hw-yellow); }
.hw-stock-badge-critico     { background: rgba(239,68,68,0.15);   color: var(--hw-red-light); }
.hw-stock-badge-agotado     { background: rgba(100,116,139,0.12); color: var(--hw-text-muted); }
.hw-stock-badge-reservado   { background: rgba(59,130,246,0.12);  color: var(--hw-blue-light); }

/* Status badges */
.hw-badge-orange  { background: rgba(249,115,22,0.12);  color: var(--hw-orange); }
.hw-badge-steel   { background: rgba(77,107,131,0.15);  color: var(--hw-steel-light); }
.hw-badge-green   { background: rgba(34,197,94,0.12);   color: var(--hw-green); }
.hw-badge-red     { background: rgba(239,68,68,0.12);   color: var(--hw-red-light); }
.hw-badge-yellow  { background: rgba(244,185,66,0.12);  color: var(--hw-yellow); }
.hw-badge-blue    { background: rgba(59,130,246,0.12);  color: var(--hw-blue-light); }
.hw-badge-copper  { background: rgba(199,120,58,0.15);  color: var(--hw-copper-light); }
.hw-badge-muted   { background: rgba(100,116,139,0.1);  color: var(--hw-text-muted); }

/* ══════════════════════════════════════════════════════════════════════════
   11. COMPONENTE — HWModal
   ══════════════════════════════════════════════════════════════════════════ */
.hw-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hw-modal {
  background: var(--hw-bg-surface);
  border: 1px solid var(--hw-border-light);
  border-radius: var(--hw-radius-xl);
  box-shadow: var(--hw-shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.hw-modal-lg { max-width: 860px; }
.hw-modal-xl { max-width: 1100px; }
.hw-modal-sm { max-width: 380px; }

.hw-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--hw-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.hw-modal-title {
  font-family: var(--hw-font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--hw-text-primary);
}

.hw-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--hw-text-muted);
  cursor: pointer;
  border-radius: var(--hw-radius-md);
  transition: all var(--hw-transition-fast);
}

.hw-modal-close:hover {
  background: var(--hw-bg-hover);
  color: var(--hw-text-primary);
}

.hw-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.hw-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--hw-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   12. COMPONENTE — HWDrawer (Panel Lateral)
   ══════════════════════════════════════════════════════════════════════════ */
.hw-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 800;
}

.hw-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 95vw;
  background: var(--hw-bg-surface);
  border-left: 1px solid var(--hw-border);
  box-shadow: var(--hw-shadow-xl);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: transform var(--hw-transition-slow);
}

.hw-drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--hw-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.hw-drawer-title {
  font-family: var(--hw-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--hw-text-primary);
}

.hw-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.hw-drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--hw-border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   13. COMPONENTE — HWToast
   ══════════════════════════════════════════════════════════════════════════ */
.hw-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  width: calc(100vw - 48px);
}

.hw-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--hw-bg-overlay);
  border: 1px solid var(--hw-border-light);
  border-radius: var(--hw-radius-lg);
  padding: 14px 16px;
  box-shadow: var(--hw-shadow-lg);
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--hw-steel);
}

.hw-toast.success { border-left-color: var(--hw-green); }
.hw-toast.error   { border-left-color: var(--hw-red); }
.hw-toast.warning { border-left-color: var(--hw-yellow); }
.hw-toast.info    { border-left-color: var(--hw-blue); }

.hw-toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.hw-toast.success .hw-toast-icon { color: var(--hw-green); }
.hw-toast.error   .hw-toast-icon { color: var(--hw-red); }
.hw-toast.warning .hw-toast-icon { color: var(--hw-yellow); }
.hw-toast.info    .hw-toast-icon { color: var(--hw-blue-light); }

.hw-toast-content { flex: 1; }

.hw-toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--hw-text-primary);
  margin-bottom: 2px;
}

.hw-toast-message {
  font-size: 0.8125rem;
  color: var(--hw-text-muted);
}

.hw-toast-close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--hw-text-faint);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--hw-radius-sm);
  transition: color var(--hw-transition-fast);
}

.hw-toast-close:hover { color: var(--hw-text-muted); }

/* ══════════════════════════════════════════════════════════════════════════
   14. COMPONENTE — HWCommandPalette (Ctrl+K)
   ══════════════════════════════════════════════════════════════════════════ */
.hw-command-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.hw-command-palette {
  background: var(--hw-bg-elevated);
  border: 1px solid var(--hw-border-light);
  border-radius: var(--hw-radius-xl);
  box-shadow: var(--hw-shadow-xl);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
}

.hw-command-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hw-border);
}

.hw-command-search-icon {
  color: var(--hw-text-faint);
  flex-shrink: 0;
}

.hw-command-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--hw-font-body);
  font-size: 1rem;
  color: var(--hw-text-primary);
}

.hw-command-input::placeholder { color: var(--hw-text-faint); }

.hw-command-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.hw-command-group-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hw-text-faint);
  padding: 6px 12px 4px;
}

.hw-command-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--hw-radius-md);
  cursor: pointer;
  transition: background var(--hw-transition-fast);
  text-decoration: none;
  color: var(--hw-text-secondary);
}

.hw-command-item:hover, .hw-command-item.selected {
  background: var(--hw-bg-hover);
  color: var(--hw-text-primary);
}

.hw-command-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--hw-radius-sm);
  background: var(--hw-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hw-steel-light);
  flex-shrink: 0;
}

.hw-command-item-text { font-size: 0.875rem; font-weight: 500; }
.hw-command-item-sub  { font-size: 0.75rem; color: var(--hw-text-faint); }

.hw-command-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--hw-border);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--hw-text-faint);
}

/* ══════════════════════════════════════════════════════════════════════════
   15. COMPONENTE — HWLoader (Pantalla de Carga)
   ══════════════════════════════════════════════════════════════════════════ */
.hw-loader-screen {
  position: fixed;
  inset: 0;
  background: var(--hw-bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.hw-loader-gear {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.hw-loader-gear-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hw-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--hw-orange);
  border-right-color: var(--hw-copper);
  animation: hw-spin 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.hw-loader-ring-2 {
  inset: 8px;
  border-top-color: var(--hw-steel);
  border-right-color: transparent;
  border-left-color: var(--hw-steel-light);
  animation-direction: reverse;
  animation-duration: 0.9s;
}

.hw-loader-center {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--hw-orange), var(--hw-copper));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hw-pulse-scale 2s ease-in-out infinite;
}

.hw-loader-text {
  font-family: var(--hw-font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--hw-text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

.hw-loader-module {
  font-size: 0.75rem;
  color: var(--hw-text-faint);
  margin-top: 6px;
  font-family: var(--hw-font-mono);
}

/* Skeleton loading */
.hw-skeleton {
  background: linear-gradient(
    90deg,
    var(--hw-bg-elevated) 25%,
    var(--hw-bg-overlay) 50%,
    var(--hw-bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: hw-shimmer 1.8s infinite;
  border-radius: var(--hw-radius-md);
}

/* ══════════════════════════════════════════════════════════════════════════
   16. COMPONENTE — HWTimeline
   ══════════════════════════════════════════════════════════════════════════ */
.hw-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 8px;
}

.hw-timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  flex: 1;
  position: relative;
}

.hw-timeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--hw-border-light);
  z-index: 0;
}

.hw-timeline-step.completed::after { background: var(--hw-orange); }

.hw-timeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hw-bg-overlay);
  border: 2px solid var(--hw-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: all var(--hw-transition-base);
}

.hw-timeline-step.completed .hw-timeline-dot {
  background: var(--hw-orange);
  border-color: var(--hw-orange);
  color: white;
}

.hw-timeline-step.active .hw-timeline-dot {
  border-color: var(--hw-orange);
  background: rgba(249, 115, 22, 0.15);
  color: var(--hw-orange);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.hw-timeline-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--hw-bg-hover);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--hw-text-primary);
  margin-top: 4px;
}

.hw-timeline-step.active .hw-timeline-count {
  background: rgba(249, 115, 22, 0.2);
  color: var(--hw-orange);
}

.hw-timeline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hw-text-muted);
  text-align: center;
  margin-top: 6px;
}

.hw-timeline-step.active .hw-timeline-label { color: var(--hw-orange); }
.hw-timeline-step.completed .hw-timeline-label { color: var(--hw-text-secondary); }

/* ══════════════════════════════════════════════════════════════════════════
   17. COMPONENTE — HWAlert
   ══════════════════════════════════════════════════════════════════════════ */
.hw-alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--hw-radius-md);
  border: 1px solid;
  font-size: 0.875rem;
}

.hw-alert-info    { background: rgba(59,130,246,0.08);   border-color: rgba(59,130,246,0.25);  color: var(--hw-blue-light); }
.hw-alert-success { background: rgba(34,197,94,0.08);    border-color: rgba(34,197,94,0.25);   color: var(--hw-green); }
.hw-alert-warning { background: rgba(244,185,66,0.08);   border-color: rgba(244,185,66,0.25);  color: var(--hw-yellow); }
.hw-alert-danger  { background: rgba(239,68,68,0.08);    border-color: rgba(239,68,68,0.25);   color: var(--hw-red-light); }
.hw-alert-orange  { background: rgba(249,115,22,0.08);   border-color: rgba(249,115,22,0.25);  color: var(--hw-orange); }

.hw-alert-icon { flex-shrink: 0; width: 20px; height: 20px; }
.hw-alert-content { flex: 1; }
.hw-alert-title { font-weight: 700; margin-bottom: 4px; color: inherit; }
.hw-alert-message { color: var(--hw-text-secondary); font-size: 0.8125rem; }

/* ══════════════════════════════════════════════════════════════════════════
   18. INDICADOR DE MODO SUPLANTACIÓN
   ══════════════════════════════════════════════════════════════════════════ */
.hw-assistance-banner {
  background: linear-gradient(90deg, rgba(249,115,22,0.15), rgba(199,120,58,0.1));
  border-bottom: 2px solid var(--hw-orange);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hw-orange);
  flex-shrink: 0;
}

.hw-assistance-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hw-orange);
  animation: hw-pulse 2s ease-in-out infinite;
}

.hw-assistance-banner-exit {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--hw-orange);
  text-decoration: none;
  border: 1px solid rgba(249,115,22,0.4);
  padding: 4px 10px;
  border-radius: var(--hw-radius-full);
  transition: all var(--hw-transition-fast);
}

.hw-assistance-banner-exit:hover {
  background: var(--hw-orange);
  color: white;
}

/* ══════════════════════════════════════════════════════════════════════════
   19. GRIDS Y LAYOUTS
   ══════════════════════════════════════════════════════════════════════════ */
.hw-grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.hw-grid-mosaic {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.hw-col-2  { grid-column: span 2; }
.hw-col-3  { grid-column: span 3; }
.hw-col-4  { grid-column: span 4; }
.hw-col-6  { grid-column: span 6; }
.hw-col-8  { grid-column: span 8; }
.hw-col-12 { grid-column: span 12; }

.hw-flex { display: flex; align-items: center; }
.hw-flex-between { display: flex; align-items: center; justify-content: space-between; }
.hw-flex-col { display: flex; flex-direction: column; }
.hw-gap-2 { gap: 8px; }
.hw-gap-3 { gap: 12px; }
.hw-gap-4 { gap: 16px; }
.hw-gap-6 { gap: 24px; }

/* ══════════════════════════════════════════════════════════════════════════
   20. ANIMACIONES
   ══════════════════════════════════════════════════════════════════════════ */
@keyframes hw-spin {
  to { transform: rotate(360deg); }
}

@keyframes hw-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

@keyframes hw-pulse-scale {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

@keyframes hw-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes hw-slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes hw-slide-in-right {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes hw-scale-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes hw-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hw-animate-slide-up       { animation: hw-slide-up 0.3s var(--hw-transition-spring) forwards; }
.hw-animate-slide-in-right { animation: hw-slide-in-right 0.3s ease-out forwards; }
.hw-animate-scale-in       { animation: hw-scale-in 0.25s var(--hw-transition-spring) forwards; }
.hw-animate-fade-in        { animation: hw-fade-in 0.3s ease-out forwards; }

/* Stagger animation delays */
.hw-stagger-1 { animation-delay: 0.05s; }
.hw-stagger-2 { animation-delay: 0.10s; }
.hw-stagger-3 { animation-delay: 0.15s; }
.hw-stagger-4 { animation-delay: 0.20s; }
.hw-stagger-5 { animation-delay: 0.25s; }

/* ══════════════════════════════════════════════════════════════════════════
   21. UTILIDADES
   ══════════════════════════════════════════════════════════════════════════ */
.hw-divider {
  border: none;
  border-top: 1px solid var(--hw-border);
  margin: 16px 0;
}

.hw-hidden    { display: none !important; }
.hw-sr-only   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.hw-truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-break-all { word-break: break-all; }

.hw-p-0  { padding: 0 !important; }
.hw-p-4  { padding: 16px !important; }
.hw-p-6  { padding: 24px !important; }
.hw-mb-4 { margin-bottom: 16px !important; }
.hw-mb-6 { margin-bottom: 24px !important; }
.hw-mt-4 { margin-top: 16px !important; }
.hw-mt-6 { margin-top: 24px !important; }

.hw-split-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
}

@media (max-width: 992px) {
  .hw-split-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   22. RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .hw-col-3 { grid-column: span 4; }
  .hw-col-4 { grid-column: span 6; }
  .hw-col-8 { grid-column: span 12; }
}

@media (max-width: 768px) {
  .hw-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    transition: left var(--hw-transition-base);
    z-index: 200;
    width: 260px !important;
  }

  .hw-sidebar.open {
    left: 0 !important;
  }

  /* Mostrar boton hamburguesa en móvil y ocultar en escritorio */
  #hw-mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .hw-topbar-toggle:not(#hw-mobile-menu-btn) {
    display: none !important;
  }

  /* Ajustes de layouts de dashboard y grid general */
  .hw-dashboard-mosaic, .hw-grid-mosaic {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .hw-col-1, .hw-col-2, .hw-col-3, .hw-col-4, .hw-col-5, .hw-col-6, .hw-col-7, .hw-col-8, .hw-col-9, .hw-col-10, .hw-col-11, .hw-col-12 {
    grid-column: span 12 !important;
    width: 100% !important;
  }

  /* Asegurar que las tablas tengan scroll horizontal nativo y no deformen el layout */
  .hw-table-responsive, [style*="overflow-x: auto"], table {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Robustez para inputs rígidos y cabeceras flex */
  .hw-card-header, 
  [style*="display: flex; justify-content: space-between"], 
  [style*="display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap"],
  .hw-page-header > div:last-child {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  /* Robustecer los filtros y barras de búsqueda superior de los listados */
  form[method="get"], form[method="GET"], form[style*="display: flex"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
  }

  form[method="get"] select, 
  form[method="get"] input, 
  form[method="get"] button,
  form[method="GET"] select, 
  form[method="GET"] input, 
  form[method="GET"] button {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  /* Optimizar cabeceras de página y sus botones principales */
  .hw-page-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .hw-page-header .hw-btn, 
  .hw-page-header a.hw-btn,
  .hw-page-header button {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    margin: 0 !important;
  }

  /* Forzar inputs rígidos en línea a 100% en móviles */
  .hw-card-header input[style*="width:"], 
  .hw-card-header div[style*="position: relative"] input[style*="width:"],
  form input[style*="width:"],
  [style*="width: 300px"],
  [style*="width: 320px"],
  [style*="width: 180px"] {
    width: 100% !important;
  }

  .hw-card {
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .hw-card-body {
    width: 100% !important;
    overflow-x: auto !important;
    padding: 12px !important;
  }

  .hw-content {
    padding: 12px !important;
  }

  .hw-grid-stats {
    grid-template-columns: 1fr !important;
  }

  .hw-topbar-search {
    display: none !important;
  }

  .hw-drawer {
    width: 100% !important;
  }

  /* Reducir titulos para mejor legibilidad */
  .hw-page-title {
    font-size: 1.25rem !important;
  }
}


@media (max-width: 480px) {
  .hw-grid-stats { grid-template-columns: 1fr; }
  .hw-toast-container { bottom: 12px; right: 12px; }
}

/* Ultrawide: limitar ancho */
@media (min-width: 1920px) {
  .hw-content {
    max-width: 1800px;
    margin: 0 auto;
  }
}

/* Backdrop para cerrar menú en móviles */
.hw-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(4px);
  z-index: 199; /* Justo debajo del sidebar (z-index: 200) */
  transition: opacity var(--hw-transition-base);
}

/* ── Mayúsculas Visuales Industriales Coherentes ────────────────────────── */
body, 
button, 
select, 
a, 
span, 
p, 
h1, 
h2, 
h3, 
h4, 
h5, 
h6, 
td, 
th, 
label, 
textarea:not(.no-uppercase),
input:not([type="password"]):not([type="email"]):not(.no-uppercase):not(#hw-command-input):not(#hw-topbar-search-btn) {
  text-transform: uppercase;
}

input[type="password"],
input.password-input,
input[type="email"],
#hw-command-input,
.no-uppercase,
.no-uppercase * {
  text-transform: none !important;
}


