:root {
  /* Brand colors */
  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --brand-soft: rgba(59, 130, 246, 0.12);
  --brand-2: #10b981;
  
  /* Text colors */
  --text: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  /* Backgrounds */
  --app-page-bg: #f8fafc;
  --app-navbar-bg: #ffffff;
  --app-sidebar-bg: #0f172a;
  --app-card-bg: #ffffff;
  
  /* Sidebar Specific */
  --app-sidebar-text: rgba(248, 250, 252, 0.92);
  --app-sidebar-muted: rgba(248, 250, 252, 0.65);
  --app-sidebar-border: rgba(248, 250, 252, 0.1);
  --app-sidebar-active-bg: rgba(59, 130, 246, 0.15);
  
  /* Borders & Shadows */
  --border: #e2e8f0;
  --app-card-border: #e2e8f0;
  --app-card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  
  /* Inputs */
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-focus: #3b82f6;
}

html[data-theme="dark"] {
  /* Brand colors */
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --brand-soft: rgba(59, 130, 246, 0.2);
  
  /* Text colors */
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  /* Backgrounds */
  --app-page-bg: #0b1220;
  --app-navbar-bg: #0f172a;
  --app-sidebar-bg: #0a0f1d;
  --app-card-bg: #111c33;
  
  /* Sidebar Specific (Dark Theme) */
  --app-sidebar-text: rgba(241, 245, 249, 0.92);
  --app-sidebar-muted: rgba(241, 245, 249, 0.65);
  --app-sidebar-border: rgba(255, 255, 255, 0.08);
  --app-sidebar-active-bg: rgba(59, 130, 246, 0.25);
  
  /* Borders & Shadows */
  --border: rgba(255, 255, 255, 0.1);
  --app-card-border: rgba(255, 255, 255, 0.08);
  --app-card-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  
  /* Inputs */
  --input-bg: #1a2234;
  --input-border: rgba(255, 255, 255, 0.1);
}

body.app-body {
  background: var(--app-page-bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
}

.app-navbar {
  background: var(--app-navbar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1030;
  height: 56px;
  display: flex;
  align-items: center;
}

/* Forzar visibilidad y contraste en botones de la navbar (light/dark themes) */
.app-navbar .btn-outline-light {
  color: var(--text) !important;
  border-color: var(--border) !important;
  background-color: transparent !important;
}

.app-navbar .btn-outline-light:hover,
.app-navbar .btn-outline-light:focus,
.app-navbar .btn-outline-light:active {
  background-color: var(--brand-soft) !important;
  color: var(--brand) !important;
  border-color: var(--brand) !important;
}

.navbar-brand {
  color: var(--brand) !important;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.app-sidebar-static {
  width: 280px;
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-text);
  border-right: 1px solid var(--app-sidebar-border);
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: margin-left 0.25s ease-in-out, width 0.25s ease-in-out;
}

/* Colapsar menú lateral */
.sidebar-collapsed .app-sidebar-static {
  margin-left: -280px;
}

.app-sidebar-content {
  flex: 1;
  padding: 1.5rem 0;
}

.app-nav-section {
  margin-bottom: 1.5rem;
}

.app-nav-title {
  color: var(--app-sidebar-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  padding: 0 1.5rem;
}

.app-sidebar-static .nav-link {
  color: var(--app-sidebar-muted);
  padding: 0.625rem 1.5rem;
  display: flex;
  align-items: center;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.app-sidebar-static .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--app-sidebar-text);
}

.app-sidebar-static .nav-link.active {
  background: var(--app-sidebar-active-bg);
  color: var(--brand);
}

.app-sidebar-static .nav-link i {
  font-size: 1.1rem;
  width: 1.5rem;
  margin-right: 0.5rem;
}

.app-sidebar-footer {
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: var(--app-sidebar-muted);
  border-top: 1px solid var(--app-sidebar-border);
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 2rem;
}

.card {
  background: var(--app-card-bg);
  border: 1px solid var(--app-card-border);
  border-radius: 1rem;
  box-shadow: var(--app-card-shadow);
}

.form-control, .form-select {
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
}

.form-control:focus {
  background-color: var(--input-bg);
  border-color: var(--brand);
  color: var(--text);
  box-shadow: 0 0 0 0.25rem var(--brand-soft);
}

/* Auth Pages */
.app-auth {
  background: radial-gradient(1200px 600px at 20% 0%, rgba(59, 130, 246, 0.18), transparent 55%), 
              radial-gradient(1000px 500px at 80% 10%, rgba(16, 185, 129, 0.14), transparent 60%), 
              #0b1220;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-auth .card {
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: rgba(255, 255, 255, 0.95); /* Fondo casi blanco para la tarjeta */
  color: #1e293b; /* Texto oscuro para la tarjeta */
  backdrop-filter: blur(10px);
}

.app-auth .form-label {
  color: #475569; /* Gris para las etiquetas */
  font-weight: 500;
}

.app-auth .form-control {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important; /* Texto gris para los campos */
}

.app-auth .form-control::placeholder {
  color: #94a3b8 !important; /* Gris más claro para el placeholder */
}

.app-auth .input-group-text {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #64748b;
}

.app-auth input.form-control:-webkit-autofill {
  -webkit-text-fill-color: #475569 !important;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.app-auth .nav-tabs .nav-link {
  color: #64748b;
  background: #f1f5f9;
}

.app-auth .nav-tabs .nav-link.active {
  color: var(--brand);
  background: #ffffff;
}

.font-small { font-size: 0.875rem; }
.font-xxs { font-size: 0.65rem; }
.op-60 { opacity: 0.6; }
.italic { font-style: italic; }
