/* =============================================================================
   MegaCity Platform — main.css
   Framework principal de estilos. Diseño moderno y limpio.
   Bootstrap 5 se carga via CDN en el layout HTML.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. GOOGLE FONTS — Inter
   ----------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* -----------------------------------------------------------------------------
   2. CSS CUSTOM PROPERTIES — Variables base (tema por defecto: blue)
   ----------------------------------------------------------------------------- */
:root {
  /* Colores del tema (overrideables por themes.css) */
  --primary:          #3b82f6;
  --primary-dark:     #2563eb;
  --primary-light:    #dbeafe;
  --primary-rgb:      59, 130, 246;
  --primary-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);

  /* Superficies */
  --bg-body:          #f8fafc;
  --bg-card:          #ffffff;
  --bg-sidebar:       #1e293b;
  --bg-sidebar-dark:  #0f172a;
  --bg-navbar:        rgba(255, 255, 255, 0.95);
  --bg-input:         #ffffff;

  /* Texto */
  --text-primary:     #0f172a;
  --text-secondary:   #64748b;
  --text-muted:       #94a3b8;
  --text-sidebar:     #cbd5e1;
  --text-sidebar-muted: #64748b;
  --text-input:       #0f172a;

  /* Bordes */
  --border-color:     #e2e8f0;
  --border-radius:    12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;

  /* Sombras */
  --shadow-sm:        0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:           0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-md:        0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -2px rgba(0,0,0,.03);
  --shadow-lg:        0 20px 25px -5px rgba(0,0,0,.07), 0 10px 10px -5px rgba(0,0,0,.03);

  /* Layout */
  --sidebar-width:    260px;
  --navbar-height:    64px;
  --content-padding:  24px;

  /* Transiciones */
  --transition-fast:  all .15s ease;
  --transition:       all .25s ease;
  --transition-slow:  all .4s ease;

  /* Tipografía */
  --font-family:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base:   0.9375rem; /* 15px */
  --line-height:      1.6;
}

/* -----------------------------------------------------------------------------
   2b. BOOTSTRAP COMPONENT OVERRIDES — sincroniza btn-primary, text-primary, etc.
       con nuestro sistema de temas vía CSS variables.
   ----------------------------------------------------------------------------- */

/* Texto y links */
.text-primary          { color: var(--primary) !important; }
.bg-primary            { background-color: var(--primary) !important; }
.border-primary        { border-color: var(--primary) !important; }
a                      { color: var(--primary); }
a:hover                { color: var(--primary-dark, var(--primary)); }

/* btn-primary */
.btn-primary {
  --bs-btn-bg:                var(--primary);
  --bs-btn-border-color:      var(--primary);
  --bs-btn-hover-bg:          var(--primary-dark, var(--primary));
  --bs-btn-hover-border-color:var(--primary-dark, var(--primary));
  --bs-btn-active-bg:         var(--primary-dark, var(--primary));
  --bs-btn-active-border-color:var(--primary-dark, var(--primary));
  --bs-btn-disabled-bg:       var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
  --bs-btn-focus-shadow-rgb:  var(--primary-rgb);
}

/* btn-outline-primary */
.btn-outline-primary {
  --bs-btn-color:              var(--primary);
  --bs-btn-border-color:       var(--primary);
  --bs-btn-hover-bg:           var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-active-bg:          var(--primary);
  --bs-btn-active-border-color:var(--primary);
  --bs-btn-focus-shadow-rgb:   var(--primary-rgb);
}

/* Badges y alerts */
.badge.bg-primary            { background-color: var(--primary) !important; }
.badge.text-bg-primary       { background-color: var(--primary) !important; }
.bg-primary-subtle           { background-color: var(--primary-light) !important; }
.text-primary-emphasis       { color: var(--primary) !important; }
.border-primary-subtle       { border-color: rgba(var(--primary-rgb), .35) !important; }

/* Form focus ring */
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .2);
}

/* Form switch checked */
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Spinner */
.text-primary.spinner-border,
.spinner-border.text-primary { color: var(--primary) !important; }

/* -----------------------------------------------------------------------------
   3. RESET Y BASE
   ----------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  font-family:      var(--font-family);
  font-size:        var(--font-size-base);
  line-height:      var(--line-height);
  color:            var(--text-primary);
  background-color: var(--bg-body);
  margin:           0;
  padding:          0;
  overflow-x:       hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color:           var(--primary);
  text-decoration: none;
  transition:      var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height:    auto;
}

h1, h2, h3, h4, h5, h6 {
  font-weight:   700;
  line-height:   1.3;
  margin-bottom: .5rem;
  color:         var(--text-primary);
}

p {
  margin-bottom: 1rem;
  color:         var(--text-secondary);
}

::selection {
  background: rgba(var(--primary-rgb), .2);
  color:      var(--text-primary);
}

/* -----------------------------------------------------------------------------
   4. SCROLLBAR PERSONALIZADA
   ----------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width:  6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background:    rgba(var(--primary-rgb), .35);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), .6);
}

/* Sidebar scrollbar especial */
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.3);
}

/* -----------------------------------------------------------------------------
   5. APP WRAPPER — Layout principal
   ----------------------------------------------------------------------------- */
.app-wrapper {
  display:       flex;
  min-height:    100vh;
  position:      relative;
  padding-top:   var(--navbar-height);
}

/* -----------------------------------------------------------------------------
   6. SIDEBAR
   ----------------------------------------------------------------------------- */
.sidebar {
  width:       var(--sidebar-width);
  height:      calc(100vh - var(--navbar-height));
  min-height:  0;
  background:  var(--bg-sidebar);
  position:    fixed;
  top:         var(--navbar-height);
  left:        0;
  z-index:     1040;
  display:     flex;
  flex-direction: column;
  overflow-y:  auto;
  overflow-x:  hidden;
  transition:  transform .3s cubic-bezier(.4, 0, .2, 1),
               width .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow:  4px 0 24px rgba(0,0,0,.12);
}

/* Sidebar Brand / Logo */
.sidebar-brand {
  display:       flex;
  align-items:   center;
  gap:           12px;
  padding:       16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-decoration: none;
  flex-shrink:   0;
  min-height:    64px;
}

.sidebar-brand-icon {
  width:         40px;
  height:        40px;
  border-radius: 10px;
  background:    var(--primary-gradient);
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex-shrink:   0;
  font-size:     18px;
  color:         #fff;
  box-shadow:    0 4px 12px rgba(var(--primary-rgb), .4);
}

.sidebar-brand-text {
  display:     flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-size:   1rem;
  font-weight: 700;
  color:       #f1f5f9;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.sidebar-brand-tagline {
  font-size: .7rem;
  color:     var(--text-sidebar-muted);
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Admin "Admin" badge en la marca */
.sidebar-brand-badge {
  font-size:      .6rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding:        2px 7px;
  border-radius:  20px;
  background:     rgba(var(--primary-rgb), .25);
  color:          var(--primary);
  width:          fit-content;
  margin-top:     2px;
}

/* Avatar admin (cuadrado con borde del primary) */
.sidebar-user-avatar--admin {
  border-radius: 8px;
  box-shadow:    0 0 0 2px rgba(var(--primary-rgb), .5);
}

/* Sidebar Navigation */
.sidebar-nav {
  padding:  8px 12px;
  flex:     1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-menu {
  list-style: none;
  margin:     0;
  padding:    0;
}

/* Separator label between groups */
.sidebar-separator {
  padding:    20px 8px 6px;
  list-style: none;
}

.sidebar-separator span {
  font-size:      .65rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color:          rgba(255,255,255,.25);
  display:        block;
}

/* Each nav item */
.sidebar-menu-item {
  list-style: none;
  margin-bottom: 2px;
}

.sidebar-link {
  display:       flex;
  align-items:   center;
  gap:           10px;
  padding:       9px 12px;
  color:         var(--text-sidebar, #cbd5e1);
  font-size:     .875rem;
  font-weight:   500;
  border-radius: 8px;
  text-decoration: none;
  transition:    background .15s, color .15s;
  position:      relative;
  white-space:   nowrap;
  overflow:      hidden;
}

.sidebar-icon {
  font-size:   1rem;
  width:       20px;
  text-align:  center;
  flex-shrink: 0;
  color:       rgba(255,255,255,.4);
  transition:  color .15s;
}

.sidebar-label {
  flex:          1;
  overflow:      hidden;
  text-overflow: ellipsis;
  line-height:   1;
}

.sidebar-badge {
  font-size:     .65rem;
  font-weight:   700;
  padding:       2px 7px;
  border-radius: 20px;
  background:    rgba(var(--primary-rgb), .25);
  color:         var(--primary);
  flex-shrink:   0;
  min-width:     20px;
  text-align:    center;
}

/* Hover state */
.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color:      #f1f5f9;
}

.sidebar-link:hover .sidebar-icon {
  color: var(--primary);
}

/* Active state */
.sidebar-menu-item.active .sidebar-link {
  background: rgba(var(--primary-rgb), .2);
  color:      #fff;
  font-weight: 600;
}

.sidebar-menu-item.active .sidebar-icon {
  color: var(--primary);
}

/* Thin left accent on active */
.sidebar-menu-item.active .sidebar-link::before {
  content:       '';
  position:      absolute;
  left:          0;
  top:           20%;
  height:        60%;
  width:         3px;
  border-radius: 0 2px 2px 0;
  background:    var(--primary);
}

/* Close button (mobile only) */
.sidebar-close-btn {
  display:    none;
  background: none;
  border:     none;
  color:      rgba(255,255,255,.4);
  font-size:  1.1rem;
  cursor:     pointer;
  padding:    4px;
  margin-left: auto;
  transition: color .15s;
}

.sidebar-close-btn:hover { color: #fff; }

@media (max-width: 991px) {
  .sidebar-close-btn { display: flex; align-items: center; justify-content: center; }
}

/* Sidebar Divider */
.sidebar-divider {
  height:     1px;
  background: rgba(255,255,255,.06);
  margin:     10px 12px;
}

/* ─── Sidebar Footer ────────────────────────────────────────────────────────── */
.sidebar-footer {
  padding:    12px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-user-info {
  display:       flex;
  align-items:   center;
  gap:           10px;
  padding:       8px 10px;
  border-radius: 10px;
  background:    rgba(255,255,255,.04);
  transition:    background .15s;
}

.sidebar-user-info:hover {
  background: rgba(255,255,255,.08);
}

.sidebar-user-avatar {
  width:         34px;
  height:        34px;
  border-radius: 8px;
  background:    var(--primary-gradient);
  display:       flex;
  align-items:   center;
  justify-content: center;
  color:         #fff;
  font-size:     .8rem;
  font-weight:   700;
  flex-shrink:   0;
  box-shadow:    0 2px 8px rgba(var(--primary-rgb), .35);
}

.sidebar-user-details {
  flex:     1;
  overflow: hidden;
  min-width: 0;
}

.sidebar-user-name {
  font-size:     .82rem;
  font-weight:   600;
  color:         #e2e8f0;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  line-height:   1.2;
}

.sidebar-user-role {
  font-size:  .7rem;
  color:      rgba(255,255,255,.3);
  white-space: nowrap;
  margin-top:  1px;
}

.sidebar-logout-btn {
  display:       flex;
  align-items:   center;
  justify-content: center;
  width:         28px;
  height:        28px;
  border-radius: 6px;
  color:         rgba(255,255,255,.3);
  text-decoration: none;
  flex-shrink:   0;
  transition:    all .15s;
  font-size:     .9rem;
}

.sidebar-logout-btn:hover {
  background: rgba(239,68,68,.15);
  color:      #f87171;
}

/* Overlay para móvil */
.sidebar-overlay {
  display:    none;
  position:   fixed;
  top:        0;
  left:       0;
  width:      100%;
  height:     100%;
  background: rgba(0,0,0,.5);
  z-index:    1039;
  backdrop-filter: blur(2px);
  opacity:    0;
  transition: opacity .3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* -----------------------------------------------------------------------------
   7. MAIN CONTENT
   ----------------------------------------------------------------------------- */
.main-content {
  flex:        1;
  margin-left: var(--sidebar-width);
  min-height:  100vh;
  display:     flex;
  flex-direction: column;
  transition:  margin-left .3s cubic-bezier(.4, 0, .2, 1);
}

/* -----------------------------------------------------------------------------
   8. NAVBAR TOP — full width, fixed above sidebar
   ----------------------------------------------------------------------------- */
.navbar-top {
  position:    fixed;
  top:         0;
  left:        0;
  right:       0;
  z-index:     1050;
  height:      var(--navbar-height);
  background:  var(--bg-navbar);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow:  var(--shadow-sm);
  display:     flex;
  align-items: center;
  padding:     0 24px;
  gap:         16px;
  transition:  background .25s ease, box-shadow .25s ease;
}

/* Navbar frosted glass on scroll */
.navbar-scrolled {
  background:      rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: saturate(200%) blur(20px) !important;
  -webkit-backdrop-filter: saturate(200%) blur(20px) !important;
  box-shadow:      0 2px 24px rgba(0, 0, 0, .08) !important;
  border-bottom-color: rgba(0, 0, 0, .06) !important;
  transition: background .25s ease, box-shadow .25s ease, backdrop-filter .25s ease;
}

/* Mobile sidebar header (close button only, no brand) */
.sidebar-mobile-header {
  display:         flex;
  align-items:     center;
  justify-content: flex-end;
  padding:         12px 16px;
  border-bottom:   1px solid rgba(255,255,255,.08);
  flex-shrink:     0;
}

.navbar-toggler-btn {
  display:       none;
  align-items:   center;
  justify-content: center;
  width:         36px;
  height:        36px;
  border:        none;
  background:    transparent;
  border-radius: var(--border-radius-sm);
  color:         var(--text-secondary);
  cursor:        pointer;
  transition:    var(--transition-fast);
  font-size:     1.1rem;
}

.navbar-toggler-btn:hover {
  background: rgba(var(--primary-rgb), .1);
  color:      var(--primary);
}

.navbar-search {
  flex:     1;
  max-width: 380px;
}

.navbar-search .search-input-wrap {
  position: relative;
}

.navbar-search .search-input-wrap .search-icon {
  position:  absolute;
  left:      12px;
  top:       50%;
  transform: translateY(-50%);
  color:     var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
}

.navbar-search input {
  width:         100%;
  padding:       8px 12px 8px 36px;
  background:    #f1f5f9;
  border:        1px solid transparent;
  border-radius: var(--border-radius-sm);
  font-size:     .875rem;
  color:         var(--text-primary);
  font-family:   var(--font-family);
  transition:    var(--transition-fast);
  outline:       none;
}

.navbar-search input:focus {
  background:   #fff;
  border-color: rgba(var(--primary-rgb), .4);
  box-shadow:   0 0 0 3px rgba(var(--primary-rgb), .1);
}

.navbar-search input::placeholder {
  color: var(--text-muted);
}

.navbar-actions {
  display:     flex;
  align-items: center;
  gap:         4px;
  margin-left: auto;
}

.navbar-action-btn {
  display:       flex;
  align-items:   center;
  justify-content: center;
  width:         38px;
  height:        38px;
  border:        none;
  background:    transparent;
  border-radius: var(--border-radius-sm);
  color:         var(--text-secondary);
  cursor:        pointer;
  transition:    var(--transition-fast);
  font-size:     1rem;
  position:      relative;
  text-decoration: none;
}

.navbar-action-btn:hover {
  background: rgba(var(--primary-rgb), .1);
  color:      var(--primary);
}

.navbar-action-btn .action-badge {
  position:      absolute;
  top:           4px;
  right:         4px;
  width:         16px;
  height:        16px;
  border-radius: 50%;
  background:    var(--primary);
  color:         #fff;
  font-size:     .6rem;
  font-weight:   700;
  display:       flex;
  align-items:   center;
  justify-content: center;
  border:        2px solid var(--bg-navbar);
}

/* Avatar en navbar */
.navbar-avatar {
  width:         36px;
  height:        36px;
  border-radius: 50%;
  background:    var(--primary-gradient);
  display:       flex;
  align-items:   center;
  justify-content: center;
  color:         #fff;
  font-size:     .8rem;
  font-weight:   700;
  cursor:        pointer;
  border:        2px solid rgba(var(--primary-rgb), .3);
  transition:    var(--transition-fast);
  overflow:      hidden;
}

.navbar-avatar:hover {
  border-color: var(--primary);
  box-shadow:   0 0 0 3px rgba(var(--primary-rgb), .2);
}

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

/* Navbar layout: left / right */
.navbar-left {
  display:     flex;
  align-items: center;
  gap:         12px;
  flex:        1;
  min-width:   0;
}

.navbar-right {
  display:     flex;
  align-items: center;
  gap:         4px;
  flex-shrink: 0;
}

/* Brand area inside navbar */
.navbar-brand-area {
  display:     flex;
  align-items: center;
  gap:         8px;
  min-width:   0;
}

.navbar-brand-icon {
  font-size:  1.1rem;
  color:      var(--primary);
  flex-shrink: 0;
}

.navbar-platform-name {
  font-size:      .95rem;
  font-weight:    700;
  color:          var(--text-primary);
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
  letter-spacing: -.01em;
}

/* User button in navbar */
.navbar-user-btn {
  display:       flex;
  align-items:   center;
  gap:           8px;
  background:    transparent;
  border:        none;
  cursor:        pointer;
  padding:       4px 6px;
  border-radius: var(--border-radius-sm);
  transition:    var(--transition-fast);
  color:         var(--text-primary);
}

.navbar-user-btn:hover {
  background: rgba(var(--primary-rgb), .08);
}

.navbar-username {
  font-size:   .85rem;
  font-weight: 600;
  color:       var(--text-primary);
  max-width:   120px;
  overflow:    hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Toggler visible on mobile */
@media (max-width: 991px) {
  .navbar-toggler-btn { display: flex; }
}

/* Content area padding */
.content-area {
  padding: var(--content-padding);
  flex:    1;
}

/* -----------------------------------------------------------------------------
   9. PAGE CONTENT AREA
   ----------------------------------------------------------------------------- */
.page-content {
  padding: var(--content-padding);
  flex:    1;
}

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

.page-header-inner {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  gap:             16px;
  flex-wrap:       wrap;
}

.page-title {
  font-size:   1.5rem;
  font-weight: 800;
  color:       var(--text-primary);
  margin:      0 0 4px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.page-subtitle {
  font-size:  .875rem;
  color:      var(--text-muted);
  margin:     0;
}

/* Breadcrumb */
.breadcrumb {
  background:    transparent;
  padding:       0;
  margin:        0 0 6px;
  font-size:     .8rem;
  display:       flex;
  align-items:   center;
  gap:           4px;
  flex-wrap:     wrap;
}

.breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-muted);
}

.breadcrumb-item a:hover {
  color: var(--primary);
}

.breadcrumb-item.active {
  color: var(--text-secondary);
  font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color:   var(--border-color);
  margin-right: 4px;
}

/* -----------------------------------------------------------------------------
   10. CARDS
   ----------------------------------------------------------------------------- */
.card {
  background:    var(--bg-card);
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow:    var(--shadow-sm);
  border-left:   4px solid var(--primary);
  transition:    var(--transition);
  overflow:      hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background:    transparent;
  border-bottom: 1px solid var(--border-color);
  padding:       16px 20px;
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  gap:           12px;
}

.card-title {
  font-size:   .9375rem;
  font-weight: 700;
  color:       var(--text-primary);
  margin:      0;
}

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

.card-body {
  padding: 20px;
}

.card-footer {
  background:  transparent;
  border-top:  1px solid var(--border-color);
  padding:     12px 20px;
}

/* Card sin borde izquierdo */
.card-plain {
  border-left-width: 1px;
}

/* Card con borde superior */
.card-border-top {
  border-left:  1px solid var(--border-color);
  border-top:   3px solid var(--primary);
}

/* -----------------------------------------------------------------------------
   11. STAT CARDS
   ----------------------------------------------------------------------------- */
.stat-card {
  background:    var(--bg-card);
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow:    var(--shadow-sm);
  padding:       20px;
  display:       flex;
  align-items:   flex-start;
  gap:           16px;
  transition:    var(--transition);
  cursor:        default;
  position:      relative;
  overflow:      hidden;
}

.stat-card::before {
  content:    '';
  position:   absolute;
  top:        0;
  left:       0;
  right:      0;
  height:     3px;
  background: var(--primary-gradient);
  opacity:    0;
  transition: var(--transition-fast);
}

.stat-card:hover {
  transform:  translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-icon {
  width:         52px;
  height:        52px;
  border-radius: var(--border-radius-sm);
  background:    rgba(var(--primary-rgb), .12);
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     1.4rem;
  color:         var(--primary);
  flex-shrink:   0;
  transition:    var(--transition);
}

.stat-card:hover .stat-card-icon {
  background: var(--primary);
  color:      #fff;
  transform:  scale(1.05);
}

.stat-card-content {
  flex: 1;
  min-width: 0;
}

.stat-card-value {
  font-size:   1.75rem;
  font-weight: 800;
  color:       var(--text-primary);
  line-height: 1;
  margin:      0 0 4px;
  letter-spacing: -.02em;
}

.stat-card-label {
  font-size:  .8125rem;
  color:      var(--text-muted);
  font-weight: 500;
  margin:     0;
}

.stat-card-trend {
  display:     flex;
  align-items: center;
  gap:         4px;
  font-size:   .75rem;
  font-weight: 600;
  margin-top:  6px;
}

.stat-card-trend.up   { color: #10b981; }
.stat-card-trend.down { color: #ef4444; }

/* -----------------------------------------------------------------------------
   12. BOTONES
   ----------------------------------------------------------------------------- */
.btn {
  font-family:   var(--font-family);
  font-weight:   600;
  font-size:     .875rem;
  border-radius: var(--border-radius-sm);
  padding:       9px 18px;
  transition:    var(--transition-fast);
  cursor:        pointer;
  display:       inline-flex;
  align-items:   center;
  gap:           7px;
  line-height:   1.4;
  white-space:   nowrap;
  border:        1px solid transparent;
  text-decoration: none;
  vertical-align: middle;
}

.btn:disabled,
.btn.disabled {
  opacity:        .55;
  cursor:         not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background:   var(--primary);
  border-color: var(--primary);
  color:        #fff;
  box-shadow:   0 2px 8px rgba(var(--primary-rgb), .3);
}

.btn-primary:hover {
  background:   var(--primary-dark);
  border-color: var(--primary-dark);
  color:        #fff;
  box-shadow:   0 4px 16px rgba(var(--primary-rgb), .4);
  transform:    translateY(-1px);
}

.btn-primary:active {
  transform:  translateY(0);
  box-shadow: 0 2px 6px rgba(var(--primary-rgb), .3);
}

.btn-primary:focus {
  outline:    none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .3);
}

/* Outline Primary */
.btn-outline-primary {
  background:   transparent;
  border-color: var(--primary);
  color:        var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  color:      #fff;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), .3);
  transform:  translateY(-1px);
}

.btn-outline-primary:active { transform: translateY(0); }

.btn-outline-primary:focus {
  outline:    none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .2);
}

/* Secondary */
.btn-secondary {
  background:   #f1f5f9;
  border-color: #e2e8f0;
  color:        var(--text-secondary);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color:      var(--text-primary);
  transform:  translateY(-1px);
}

.btn-secondary:active { transform: translateY(0); }

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

.btn-ghost:hover {
  background: rgba(var(--primary-rgb), .08);
  color:      var(--primary);
}

/* Success / Danger / Warning */
.btn-success  { background: #10b981; border-color: #10b981; color: #fff; }
.btn-success:hover  { background: #059669; border-color: #059669; color: #fff; transform: translateY(-1px); }

.btn-danger   { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn-danger:hover   { background: #dc2626; border-color: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-warning  { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-warning:hover  { background: #d97706; border-color: #d97706; color: #fff; transform: translateY(-1px); }

/* Tamaños */
.btn-sm {
  font-size: .8125rem;
  padding:   6px 13px;
}

.btn-lg {
  font-size: 1rem;
  padding:   12px 24px;
}

.btn-icon {
  padding:    8px;
  width:      36px;
  height:     36px;
  justify-content: center;
}

.btn-icon.btn-sm {
  width:  30px;
  height: 30px;
  padding: 5px;
}

/* -----------------------------------------------------------------------------
   13. BADGES
   ----------------------------------------------------------------------------- */
.badge {
  font-family: var(--font-family);
  font-weight: 600;
  font-size:   .7rem;
  padding:     3px 8px;
  border-radius: 20px;
  line-height: 1.4;
  display:     inline-flex;
  align-items: center;
  gap:         4px;
  letter-spacing: .02em;
}

.badge-primary,
.badge-custom {
  background: rgba(var(--primary-rgb), .15);
  color:      var(--primary);
}

.badge-success { background: rgba(16,185,129,.15);  color: #059669; }
.badge-danger  { background: rgba(239,68,68,.15);   color: #dc2626; }
.badge-warning { background: rgba(245,158,11,.15);  color: #d97706; }
.badge-info    { background: rgba(59,130,246,.15);  color: #2563eb; }
.badge-muted   { background: rgba(100,116,139,.12); color: #64748b; }

.badge-solid-primary { background: var(--primary); color: #fff; }
.badge-solid-success { background: #10b981;          color: #fff; }
.badge-solid-danger  { background: #ef4444;          color: #fff; }
.badge-solid-warning { background: #f59e0b;          color: #fff; }

/* Dot indicator */
.badge-dot {
  display:     inline-flex;
  align-items: center;
  gap:         6px;
  font-size:   .8125rem;
}

.badge-dot::before {
  content:       '';
  width:         8px;
  height:        8px;
  border-radius: 50%;
  background:    currentColor;
  flex-shrink:   0;
}

/* -----------------------------------------------------------------------------
   14. TABLAS
   ----------------------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.table {
  width:         100%;
  border-collapse: collapse;
  font-size:     .875rem;
  color:         var(--text-primary);
}

.table th {
  background:    #f8fafc;
  color:         var(--text-muted);
  font-size:     .7rem;
  font-weight:   600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding:       11px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space:   nowrap;
  text-align:    left;
}

.table td {
  padding:       13px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color:         var(--text-secondary);
}

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

.table tbody tr {
  transition: var(--transition-fast);
}

.table tbody tr:hover {
  background: rgba(var(--primary-rgb), .04);
}

.table tbody tr:hover td {
  color: var(--text-primary);
}

/* Sortable */
.table th.sortable {
  cursor:      pointer;
  user-select: none;
}

.table th.sortable:hover {
  color:      var(--primary);
  background: rgba(var(--primary-rgb), .06);
}

.table th.sort-asc::after  { content: ' ↑'; color: var(--primary); }
.table th.sort-desc::after { content: ' ↓'; color: var(--primary); }

/* Checkbox column */
.table td.col-check,
.table th.col-check {
  width:   44px;
  padding: 13px 8px 13px 16px;
}

/* -----------------------------------------------------------------------------
   15. FORMULARIOS
   ----------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display:       block;
  font-size:     .8125rem;
  font-weight:   600;
  color:         var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.form-label .required {
  color:      #ef4444;
  margin-left: 3px;
}

.form-control,
.form-select,
.form-textarea {
  width:         100%;
  padding:       9px 13px;
  background:    var(--bg-input);
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size:     .875rem;
  font-family:   var(--font-family);
  color:         var(--text-input);
  transition:    var(--transition-fast);
  outline:       none;
  line-height:   1.5;
}

.form-control:hover,
.form-select:hover {
  border-color: rgba(var(--primary-rgb), .4);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow:   0 0 0 3px rgba(var(--primary-rgb), .15);
}

.form-control::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #ef4444;
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}

.form-control.is-valid {
  border-color: #10b981;
}

.form-control.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
}

.form-feedback {
  font-size:  .75rem;
  margin-top: 5px;
}

.form-feedback.invalid { color: #ef4444; }
.form-feedback.valid   { color: #10b981; }

.form-hint {
  font-size:  .75rem;
  color:      var(--text-muted);
  margin-top: 5px;
}

/* Input group */
.input-group {
  display:  flex;
  position: relative;
}

.input-group-text {
  padding:       9px 13px;
  background:    #f1f5f9;
  border:        1px solid var(--border-color);
  color:         var(--text-muted);
  font-size:     .875rem;
  white-space:   nowrap;
  display:       flex;
  align-items:   center;
}

.input-group-text:first-child {
  border-right:        0;
  border-radius:       var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.input-group-text:last-child {
  border-left:         0;
  border-radius:       0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.input-group .form-control:not(:first-child) {
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.input-group .form-control:not(:last-child) {
  border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

/* Checkbox / Radio modernos */
.form-check-modern {
  display:     flex;
  align-items: center;
  gap:         10px;
  cursor:      pointer;
  padding:     8px 12px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-fast);
}

.form-check-modern:hover {
  background: rgba(var(--primary-rgb), .06);
}

.form-check-modern input[type="checkbox"],
.form-check-modern input[type="radio"] {
  width:         18px;
  height:        18px;
  accent-color:  var(--primary);
  cursor:        pointer;
  flex-shrink:   0;
}

/* Toggle Switch */
.toggle-switch {
  position:   relative;
  display:    inline-flex;
  align-items: center;
  gap:        10px;
  cursor:     pointer;
  user-select: none;
}

.toggle-switch input { display: none; }

.toggle-switch-track {
  width:         44px;
  height:        24px;
  background:    #cbd5e1;
  border-radius: 12px;
  transition:    var(--transition-fast);
  position:      relative;
  flex-shrink:   0;
}

.toggle-switch-track::after {
  content:       '';
  position:      absolute;
  top:           3px;
  left:          3px;
  width:         18px;
  height:        18px;
  border-radius: 50%;
  background:    #fff;
  transition:    var(--transition-fast);
  box-shadow:    var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-switch-track::after {
  transform: translateX(20px);
}

.toggle-switch-label {
  font-size:  .875rem;
  font-weight: 500;
  color:      var(--text-secondary);
}

/* -----------------------------------------------------------------------------
   16. LOADING SPINNER
   ----------------------------------------------------------------------------- */
.spinner {
  display:       inline-block;
  width:         20px;
  height:        20px;
  border:        2.5px solid rgba(var(--primary-rgb), .2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation:     spin .7s linear infinite;
}

.spinner-sm {
  width:  14px;
  height: 14px;
  border-width: 2px;
}

.spinner-lg {
  width:  36px;
  height: 36px;
  border-width: 3.5px;
}

.spinner-white {
  border-color:     rgba(255,255,255,.3);
  border-top-color: #fff;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Loading overlay */
.loading-overlay {
  position:        absolute;
  inset:           0;
  background:      rgba(255,255,255,.75);
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   inherit;
  z-index:         10;
  backdrop-filter: blur(2px);
}

/* Skeleton loader */
.skeleton {
  background:              linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size:         200% 100%;
  animation:               skeleton-loading 1.5s infinite;
  border-radius:           var(--border-radius-sm);
  display:                 block;
}

@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* -----------------------------------------------------------------------------
   17. TOAST NOTIFICATIONS
   ----------------------------------------------------------------------------- */
.toast-container {
  position:  fixed;
  bottom:    24px;
  right:     24px;
  z-index:   9999;
  display:   flex;
  flex-direction: column;
  gap:       10px;
  max-width: 360px;
  width:     calc(100% - 48px);
}

.toast-item {
  background:    #fff;
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow:    var(--shadow-lg);
  padding:       14px 16px;
  display:       flex;
  align-items:   flex-start;
  gap:           12px;
  animation:     toast-in .35s cubic-bezier(.4, 0, .2, 1);
  position:      relative;
  overflow:      hidden;
}

.toast-item::before {
  content:    '';
  position:   absolute;
  left:       0;
  top:        0;
  bottom:     0;
  width:      4px;
  border-radius: 4px 0 0 4px;
}

.toast-item.toast-success::before { background: #10b981; }
.toast-item.toast-danger::before  { background: #ef4444; }
.toast-item.toast-warning::before { background: #f59e0b; }
.toast-item.toast-info::before    { background: var(--primary); }

.toast-icon {
  width:       32px;
  height:      32px;
  border-radius: 50%;
  display:     flex;
  align-items: center;
  justify-content: center;
  font-size:   .9rem;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: rgba(16,185,129,.12);  color: #10b981; }
.toast-danger  .toast-icon { background: rgba(239,68,68,.12);   color: #ef4444; }
.toast-warning .toast-icon { background: rgba(245,158,11,.12);  color: #f59e0b; }
.toast-info    .toast-icon { background: rgba(var(--primary-rgb),.12); color: var(--primary); }

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size:   .875rem;
  font-weight: 700;
  color:       var(--text-primary);
  margin:      0 0 2px;
}

.toast-message {
  font-size: .8125rem;
  color:     var(--text-muted);
  margin:    0;
  line-height: 1.5;
}

.toast-close {
  background: transparent;
  border:     none;
  color:      var(--text-muted);
  cursor:     pointer;
  padding:    2px;
  font-size:  .9rem;
  transition: var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}

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

.toast-progress {
  position: absolute;
  bottom:   0;
  left:     0;
  height:   2px;
  background: var(--primary);
  animation: toast-progress linear forwards;
  opacity:  .5;
}

@keyframes toast-in {
  from {
    opacity:   0;
    transform: translateX(20px) scale(.97);
  }
  to {
    opacity:   1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity:   0;
    transform: translateX(20px) scale(.97);
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0; }
}

/* -----------------------------------------------------------------------------
   18. MODAL
   ----------------------------------------------------------------------------- */
.modal-content {
  border:        none;
  border-radius: var(--border-radius-lg);
  box-shadow:    var(--shadow-lg);
  overflow:      hidden;
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding:       18px 24px;
}

.modal-title {
  font-size:   1rem;
  font-weight: 700;
  color:       var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding:    16px 24px;
  gap:        10px;
}

/* Confirm dialog especial */
.confirm-dialog .modal-body {
  text-align: center;
  padding:    32px 24px 24px;
}

.confirm-dialog-icon {
  width:         64px;
  height:        64px;
  border-radius: 50%;
  background:    rgba(239,68,68,.1);
  color:         #ef4444;
  font-size:     1.75rem;
  display:       flex;
  align-items:   center;
  justify-content: center;
  margin:        0 auto 16px;
}

/* -----------------------------------------------------------------------------
   19. DROPDOWN
   ----------------------------------------------------------------------------- */
.dropdown-menu {
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow:    var(--shadow-md);
  padding:       6px;
  font-size:     .875rem;
  min-width:     180px;
  animation:     dropdown-in .15s ease;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
  display:       flex;
  align-items:   center;
  gap:           9px;
  padding:       8px 12px;
  border-radius: var(--border-radius-sm);
  color:         var(--text-secondary);
  font-weight:   500;
  transition:    var(--transition-fast);
}

.dropdown-item:hover {
  background: rgba(var(--primary-rgb), .08);
  color:      var(--primary);
}

.dropdown-item.active {
  background: rgba(var(--primary-rgb), .1);
  color:      var(--primary);
}

.dropdown-item.danger:hover {
  background: rgba(239,68,68,.08);
  color:      #ef4444;
}

.dropdown-divider {
  height:     1px;
  background: var(--border-color);
  margin:     4px 0;
}

/* -----------------------------------------------------------------------------
   20. PROGRESS BARS
   ----------------------------------------------------------------------------- */
.progress-wrap {
  margin-bottom: 8px;
}

.progress-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   6px;
  font-size:       .8125rem;
}

.progress-label  { font-weight: 500; color: var(--text-secondary); }
.progress-value  { font-weight: 700; color: var(--text-primary); }

.progress {
  height:        8px;
  background:    #e2e8f0;
  border-radius: 10px;
  overflow:      hidden;
}

.progress-bar {
  height:        100%;
  background:    var(--primary-gradient);
  border-radius: 10px;
  transition:    width .6s cubic-bezier(.4, 0, .2, 1);
  position:      relative;
  overflow:      hidden;
}

.progress-bar::after {
  content:    '';
  position:   absolute;
  top:        0; bottom: 0; left: -100%;
  width:      100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  animation:  progress-shine 2s infinite;
}

@keyframes progress-shine {
  to { left: 200%; }
}

/* Tamaños */
.progress-sm { height: 4px; }
.progress-lg { height: 12px; }

/* -----------------------------------------------------------------------------
   21. ALERTS
   ----------------------------------------------------------------------------- */
.alert {
  border:        none;
  border-radius: var(--border-radius);
  padding:       14px 18px;
  display:       flex;
  align-items:   flex-start;
  gap:           12px;
  font-size:     .875rem;
  border-left:   4px solid transparent;
}

.alert-icon {
  font-size:   1.1rem;
  flex-shrink: 0;
  margin-top:  1px;
}

.alert-body { flex: 1; }
.alert-title { font-weight: 700; margin-bottom: 2px; }

.alert-primary { background: rgba(var(--primary-rgb),.1); border-left-color: var(--primary); color: var(--primary-dark); }
.alert-success { background: rgba(16,185,129,.1);  border-left-color: #10b981; color: #047857; }
.alert-danger  { background: rgba(239,68,68,.1);   border-left-color: #ef4444; color: #b91c1c; }
.alert-warning { background: rgba(245,158,11,.1);  border-left-color: #f59e0b; color: #b45309; }
.alert-info    { background: rgba(59,130,246,.1);  border-left-color: #3b82f6; color: #1e40af; }

/* -----------------------------------------------------------------------------
   22. TABS
   ----------------------------------------------------------------------------- */
.tabs-modern {
  display:       flex;
  gap:           2px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.tabs-modern .tab-link {
  padding:       10px 18px;
  font-size:     .875rem;
  font-weight:   600;
  color:         var(--text-muted);
  border:        none;
  background:    transparent;
  cursor:        pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition:    var(--transition-fast);
  display:       flex;
  align-items:   center;
  gap:           7px;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
  text-decoration: none;
}

.tabs-modern .tab-link:hover {
  color:      var(--primary);
  background: rgba(var(--primary-rgb), .06);
}

.tabs-modern .tab-link.active {
  color:        var(--primary);
  border-bottom-color: var(--primary);
  background:   rgba(var(--primary-rgb), .06);
}

/* -----------------------------------------------------------------------------
   23. EMPTY STATE
   ----------------------------------------------------------------------------- */
.empty-state {
  text-align:      center;
  padding:         48px 24px;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
}

.empty-state-icon {
  width:         72px;
  height:        72px;
  border-radius: 50%;
  background:    rgba(var(--primary-rgb), .08);
  color:         rgba(var(--primary-rgb), .5);
  font-size:     2rem;
  display:       flex;
  align-items:   center;
  justify-content: center;
  margin:        0 auto 20px;
}

.empty-state-title {
  font-size:   1.0625rem;
  font-weight: 700;
  color:       var(--text-primary);
  margin:      0 0 8px;
}

.empty-state-desc {
  font-size:  .875rem;
  color:      var(--text-muted);
  max-width:  320px;
  margin:     0 auto 20px;
  line-height: 1.6;
}

/* -----------------------------------------------------------------------------
   24. AVATAR
   ----------------------------------------------------------------------------- */
.avatar {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  border-radius:   50%;
  font-weight:     700;
  color:           #fff;
  background:      var(--primary-gradient);
  flex-shrink:     0;
  overflow:        hidden;
}

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

.avatar-xs  { width: 24px; height: 24px; font-size: .65rem; }
.avatar-sm  { width: 32px; height: 32px; font-size: .75rem; }
.avatar-md  { width: 40px; height: 40px; font-size: .875rem; }
.avatar-lg  { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-xl  { width: 68px; height: 68px; font-size: 1.4rem; }

.avatar-group {
  display: flex;
  align-items: center;
}

.avatar-group .avatar {
  border:       2px solid var(--bg-card);
  margin-right: -8px;
  transition:   var(--transition-fast);
}

.avatar-group .avatar:hover {
  transform:  translateY(-3px);
  z-index:    1;
  margin-right: 0;
}

/* -----------------------------------------------------------------------------
   25. PAGINATION
   ----------------------------------------------------------------------------- */
.pagination {
  display:     flex;
  align-items: center;
  gap:         4px;
  list-style:  none;
  padding:     0;
  margin:      0;
}

.page-link {
  display:       flex;
  align-items:   center;
  justify-content: center;
  width:         36px;
  height:        36px;
  border-radius: var(--border-radius-sm);
  border:        1px solid var(--border-color);
  color:         var(--text-secondary);
  font-size:     .875rem;
  font-weight:   600;
  text-decoration: none;
  transition:    var(--transition-fast);
  cursor:        pointer;
  background:    var(--bg-card);
}

.page-link:hover {
  background:   rgba(var(--primary-rgb), .08);
  border-color: rgba(var(--primary-rgb), .4);
  color:        var(--primary);
}

.page-item.active .page-link {
  background:   var(--primary);
  border-color: var(--primary);
  color:        #fff;
  box-shadow:   0 2px 8px rgba(var(--primary-rgb), .3);
}

.page-item.disabled .page-link {
  opacity: .45;
  cursor:  not-allowed;
  pointer-events: none;
}

/* -----------------------------------------------------------------------------
   26. FOOTER
   ----------------------------------------------------------------------------- */
.app-footer {
  padding:       16px 24px;
  border-top:    1px solid var(--border-color);
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  gap:           12px;
  flex-wrap:     wrap;
  font-size:     .8125rem;
  color:         var(--text-muted);
  background:    var(--bg-card);
}

.footer-brand {
  font-weight: 700;
  color:       var(--primary);
}

/* -----------------------------------------------------------------------------
   27. UTILIDADES
   ----------------------------------------------------------------------------- */
/* Texto */
.text-primary-custom { color: var(--primary) !important; }
.text-muted-custom   { color: var(--text-muted) !important; }
.fw-500              { font-weight: 500 !important; }
.fw-600              { font-weight: 600 !important; }
.fw-700              { font-weight: 700 !important; }
.fw-800              { font-weight: 800 !important; }

/* Gap helpers */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Borders */
.border-primary { border-color: var(--primary) !important; }

/* Focus ring */
.focus-ring:focus {
  outline:    none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .25);
}

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Opacity */
.opacity-50  { opacity: .5; }
.opacity-75  { opacity: .75; }

/* Overflow */
.text-truncate {
  overflow:      hidden;
  white-space:   nowrap;
  text-overflow: ellipsis;
}

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

/* Dot separator */
.dot-sep {
  width:         4px;
  height:        4px;
  border-radius: 50%;
  background:    var(--text-muted);
  display:       inline-block;
  vertical-align: middle;
}

/* Highlight */
.highlight-box {
  background:    rgba(var(--primary-rgb), .07);
  border:        1px solid rgba(var(--primary-rgb), .2);
  border-radius: var(--border-radius);
  padding:       12px 16px;
}

/* Superficie neutra */
.surface {
  background:    #f8fafc;
  border:        1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding:       16px;
}

/* Code */
code {
  font-family:   'Courier New', monospace;
  font-size:     .85em;
  background:    rgba(var(--primary-rgb), .08);
  color:         var(--primary-dark);
  padding:       2px 6px;
  border-radius: 4px;
}

pre code {
  background: transparent;
  padding:    0;
  color:      inherit;
}

pre {
  background:    #1e293b;
  color:         #e2e8f0;
  padding:       20px;
  border-radius: var(--border-radius);
  overflow-x:    auto;
  font-size:     .875rem;
  line-height:   1.6;
}

/* -----------------------------------------------------------------------------
   28. SIDEBAR COLLAPSED STATE
   ----------------------------------------------------------------------------- */
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

body.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* Sidebar mini (solo iconos) */
body.sidebar-mini .sidebar {
  width: 68px;
  overflow: visible;
}

body.sidebar-mini .sidebar-brand-text,
body.sidebar-mini .sidebar-section-label,
body.sidebar-mini .nav-text,
body.sidebar-mini .nav-badge,
body.sidebar-mini .sidebar-user-info {
  display: none;
}

body.sidebar-mini .sidebar-brand {
  justify-content: center;
  padding: 20px 14px 16px;
}

body.sidebar-mini .sidebar-nav .nav-link {
  justify-content: center;
  padding:         10px 0;
  border-left:     none;
  border-radius:   0;
}

body.sidebar-mini .sidebar-nav .nav-link .nav-icon {
  font-size: 1.2rem;
  width:     auto;
}

body.sidebar-mini .sidebar-user {
  justify-content: center;
}

body.sidebar-mini .main-content {
  margin-left: 68px;
}

/* Tooltip en sidebar mini */
body.sidebar-mini .sidebar-nav .nav-link {
  position: relative;
}

body.sidebar-mini .sidebar-nav .nav-link::after {
  content:       attr(data-label);
  position:      absolute;
  left:          calc(100% + 10px);
  top:           50%;
  transform:     translateY(-50%);
  background:    #1e293b;
  color:         #f1f5f9;
  padding:       5px 10px;
  border-radius: 6px;
  font-size:     .8rem;
  white-space:   nowrap;
  opacity:       0;
  pointer-events: none;
  transition:    opacity .2s ease;
  box-shadow:    var(--shadow-md);
  z-index:       100;
}

body.sidebar-mini .sidebar-nav .nav-link:hover::after {
  opacity: 1;
}

/* -----------------------------------------------------------------------------
   29. RESPONSIVE — TABLET (max 991px)
   ----------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .navbar-toggler-btn {
    display: flex;
  }

  .navbar-search {
    max-width: 260px;
  }

  body.sidebar-mini .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  body.sidebar-mini .main-content {
    margin-left: 0;
  }
}

/* -----------------------------------------------------------------------------
   30. RESPONSIVE — MÓVIL (max 576px)
   ----------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  :root {
    --content-padding: 16px;
    --navbar-height:   56px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .navbar-search {
    display: none;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }

  .card-body {
    padding: 16px;
  }

  .toast-container {
    bottom:     16px;
    right:      16px;
    max-width:  calc(100vw - 32px);
    width:      auto;
  }

  .page-header-inner {
    flex-direction: column;
    align-items:    stretch;
  }

  .app-footer {
    flex-direction: column;
    text-align:     center;
  }

  .tabs-modern {
    overflow-x: auto;
    flex-wrap:  nowrap;
    padding-bottom: 0;
  }

  .tabs-modern .tab-link {
    white-space: nowrap;
  }
}

/* -----------------------------------------------------------------------------
   31. PRINT
   ----------------------------------------------------------------------------- */
@media print {
  .sidebar,
  .navbar-top,
  .navbar-toggler-btn,
  .sidebar-overlay,
  .toast-container {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
