/* ============================================================
   APP.CSS — Estilos del panel administrativo Lebytek ERP
   Sistema: MVC + Onion Architecture — PHP puro + Bootstrap 5
   ============================================================ */

/* ── Variables CSS ─────────────────────────────────────────── */
/*
   NOTA: --app-primary, --app-navbar-bg y --app-body-bg NO se definen aquí.
   Se inyectan desde base.php en un <style> inline que carga DESPUÉS de este
   archivo, garantizando que los valores de la base de datos siempre ganen en
   cascada. Los fallbacks quedan sólo en los puntos de uso (var(--x, fallback)).
*/
:root {
  --sidebar-width:            260px;
  --sidebar-width-collapsed:  64px;
  --topbar-height:            60px;
  --sidebar-bg:               #1a1d2e;
  --sidebar-text:             rgba(255,255,255,0.78);
  --sidebar-text-muted:       rgba(255,255,255,0.42);
  --sidebar-active-bg:        rgba(255,255,255,0.1);
  --sidebar-active-text:      #fff;
  --sidebar-hover-bg:         rgba(255,255,255,0.06);

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --transition:       220ms ease;
  --transition-med:   300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Espaciado sistémico */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* Padding principal del contenido */
  --main-padding: 1.5rem;
}

/* Dark mode override */
[data-bs-theme="dark"] {
  --sidebar-bg:         #111827;
  --sidebar-active-bg:  rgba(255,255,255,0.12);
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* background-color: establecido por inline style de base.php */
}

/* ============================================================
   LAYOUT SIDEBAR
   ============================================================ */

.layout-side-wrapper {
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e));
  color: var(--sidebar-text);
  flex-shrink: 0;
  transition: width var(--transition-med);
  will-change: width;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 1030;
}

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

/* Elementos que se ocultan al colapsar: transición suave con opacity + max-width */
.sidebar .nav-label,
.sidebar .sidebar-brand-text,
.sidebar .submenu-arrow,
.sidebar .sidebar-user-info {
  opacity: 1;
  max-width: 200px;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--transition-med), max-width var(--transition-med);
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .submenu-arrow,
.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  max-width: 0;
}

.sidebar.collapsed .sidebar-footer .sidebar-avatar {
  margin: 0 auto;
}

/* En sidebar colapsada: ocultar logo, centrar botón toggle */
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
.sidebar.collapsed .sidebar-logo-full,
.sidebar.collapsed .sidebar-icon-brand,
.sidebar.collapsed .sidebar-brand-text {
  display: none !important;
}
.sidebar.collapsed #sidebarToggle {
  margin-left: 0 !important;
  transform: rotate(180deg);
}

/* En sidebar colapsada: suprimir la apertura de los collapse panels de Bootstrap */
.sidebar.collapsed .sidebar-nav .collapse.show {
  height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
}

/* Flyout de submenú — aparece flotando a la derecha del sidebar colapsado */
.sidebar-flyout {
  position: fixed;
  left: var(--sidebar-width-collapsed, 64px);
  top: 0;
  min-width: 200px;
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e));
  border-radius: 0 var(--radius) var(--radius);
  box-shadow: 4px 8px 24px rgba(0,0,0,.35);
  z-index: 1060;
  padding: 0.4rem;
  margin: 2px;
  animation: fadeIn 0.15s ease;
  border: 1px solid rgba(255,255,255,0.07);
  border-left: none;
}

.sidebar-flyout-title {
  padding: 0.35rem 0.75rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sidebar-text-muted, rgba(255,255,255,0.4));
}

.sidebar-flyout .sidebar-link {
  white-space: nowrap;
  border-radius: var(--radius-sm);
  opacity: 1 !important;
  max-width: none !important;
}

.sidebar-flyout .nav-label {
  opacity: 1 !important;
  max-width: none !important;
}

/* Marca */
.sidebar-brand {
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 0.6rem;
  min-height: var(--topbar-height);
}

.sidebar-icon-brand {
  width: 34px;
  height: 34px;
  background: var(--app-primary, #0d6efd);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

/* Logo icono pequeño (modo colapsado o cuando se usa como icono) */
.sidebar-logo {
  max-height: 34px;
  max-width: 34px;
  object-fit: contain;
}

/* Logo completo: ocupa el espacio disponible en el brand bar */
.sidebar-logo-full {
  max-height: 40px;
  max-width: 160px;
  object-fit: contain;
  flex: 1;
  min-width: 0;
  transition: max-width var(--transition-med), opacity var(--transition-med);
}

/* En sidebar colapsado: el logo completo se convierte en icono cuadrado */
.sidebar.collapsed .sidebar-logo-full {
  max-width: 36px;
  max-height: 36px;
  flex: none;
}

.sidebar-brand-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}

#sidebarToggle {
  color: var(--sidebar-text-muted) !important;
  font-size: 0.85rem;
  transition: color var(--transition), transform var(--transition-med);
  flex-shrink: 0;
}

#sidebarToggle:hover { color: #fff !important; }

.sidebar.collapsed #sidebarToggle {
  transform: rotate(180deg);
}

/* Nav links */
.sidebar-nav {
  padding-top: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-link {
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background var(--transition), color var(--transition),
              gap var(--transition-med);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 400;
  position: relative;
}

.sidebar.collapsed .sidebar-link { gap: 0; }
.sidebar.collapsed .sidebar-footer .d-flex { gap: 0 !important; }

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--app-primary, #0d6efd);
}

.sidebar-sublink {
  font-size: 0.84rem;
  color: var(--sidebar-text-muted);
  padding: 0.4rem 0.75rem;
}

.sidebar-sublink:hover,
.sidebar-sublink.active {
  color: #fff;
}

.nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

.sidebar-link.active .nav-icon { opacity: 1; }

.submenu-arrow {
  font-size: 0.65rem;
  transition: transform var(--transition);
  margin-left: auto;
}

.sidebar-link[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}

/* Footer */
.sidebar-footer {
  background: rgba(0,0,0,0.15);
}

.sidebar-avatar,
.topbar-avatar,
.table-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--app-primary, #0d6efd);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}

.table-product-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-tertiary-bg, #f8f9fa);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.table-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Layout content ────────────────────────────────────────── */
.layout-side-content {
  min-width: 0;
  background: var(--bs-body-bg);
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e));
  border-bottom: 1px solid var(--app-navbar-sep, rgba(255,255,255,0.1));
  color: var(--app-navbar-text, rgba(255,255,255,0.88));
  position: sticky;
  top: 0;
  z-index: 1020;
  gap: 0.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
  overflow: visible;
}

/* Breadcrumb del topbar */
.topbar-crumb-home,
.topbar-crumb-home:link,
.topbar-crumb-home:visited,
.topbar-crumb-home:active {
  font-size: 0.84rem;
  color: var(--app-navbar-muted, rgba(255,255,255,0.55)) !important;
  text-decoration: none !important;
  transition: color var(--transition);
}
.topbar-crumb-home:hover {
  color: var(--app-navbar-text, rgba(255,255,255,0.9)) !important;
  text-decoration: none !important;
}
.topbar-crumb-sep {
  font-size: 0.84rem;
  color: var(--app-navbar-muted, rgba(255,255,255,0.3));
  user-select: none;
}
.topbar-crumb-current {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--app-navbar-text, rgba(255,255,255,0.88));
}

/* Botones en topbar */
.topbar .btn-ghost {
  color: var(--app-navbar-text, rgba(255,255,255,0.88));
}
.topbar .btn-ghost:hover {
  background: var(--app-navbar-sep, rgba(255,255,255,0.1));
  color: #fff;
}

/* Notificación: badge que no se recorte */
.topbar-notif-btn {
  overflow: visible;
}
.topbar-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.55rem;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  line-height: 16px;
  pointer-events: none;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.btn-ghost:hover {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  min-height: calc(100vh - var(--topbar-height) - 40px);
  padding: var(--main-padding);
}

@media (max-width: 575.98px) {
  :root { --main-padding: 0.75rem; }
}
@media (min-width: 576px) and (max-width: 991.98px) {
  :root { --main-padding: 1rem; }
}
@media (min-width: 992px) {
  :root { --main-padding: 1.5rem; }
}
@media (min-width: 1400px) {
  :root { --main-padding: 2rem; }
}

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  background: var(--bs-body-bg);
}

/* ============================================================
   LAYOUT TOP NAV
   ============================================================ */

.topnav {
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e)) !important;
  height: var(--topbar-height);
  color: var(--app-navbar-text, rgba(255,255,255,0.88));
}
.topnav .navbar-brand,
.topnav .navbar-toggler-icon { color: var(--app-navbar-text, rgba(255,255,255,0.88)); filter: brightness(10); }
.topnav .navbar-toggler { border-color: var(--app-navbar-sep, rgba(255,255,255,0.2)); }
.topnav .nav-link { color: var(--app-navbar-text, rgba(255,255,255,0.78)) !important; border-radius: var(--radius-sm); }
.topnav .nav-link:hover { background: var(--sidebar-hover-bg); color: var(--app-navbar-text, #fff) !important; }
.topnav .nav-link.active { color: #fff !important; background: var(--sidebar-active-bg); }

.layout-top-wrapper {
  background: var(--bs-body-bg);
}

/* ============================================================
   LAYOUT BOTTOM NAV (móvil)
   ============================================================ */

.bottomnav {
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e));
  height: 60px;
  z-index: 1040;
  box-shadow: 0 -2px 12px rgba(0,0,0,.18);
  border-top: 1px solid rgba(255,255,255,0.07);
}

.bottomnav-item,
.bottomnav-item:link,
.bottomnav-item:visited {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--app-navbar-muted, rgba(255,255,255,0.5)) !important;
  text-decoration: none !important;
  padding: 6px 4px;
  gap: 2px;
  transition: color var(--transition);
}
.bottomnav-item i           { font-size: 1.25rem; line-height: 1; }
.bottomnav-item span        { line-height: 1; }
.bottomnav-item.active,
.bottomnav-item:hover       { color: var(--app-navbar-text, rgba(255,255,255,0.95)) !important; }
.bottomnav-item.active i    { color: var(--app-primary, #0d6efd) !important; }
.bottomnav-item:active      { opacity: 0.75; }

/* Botones de submenú en la bottomnav (misma apariencia que links) */
.bottomnav-sub-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  text-align: center;
}

/* POST /logout desde la barra inferior */
.bottomnav-logout-form {
  align-items: stretch;
  min-width: 0;
}

/* BottomNav "más" — overlay y panel expandible */
.bottomnav-more-overlay {
  position: fixed;
  inset: 0;
  bottom: 60px;
  background: rgba(0,0,0,0.45);
  z-index: 1038;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-med), visibility var(--transition-med);
}
.bottomnav-more-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottomnav-more-panel {
  position: fixed;
  bottom: 60px;
  left: 0; right: 0;
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e));
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 -4px 24px rgba(0,0,0,.35);
  z-index: 1039;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.bottomnav-more-panel.open {
  transform: translateY(0);
}

.bottomnav-more-item,
.bottomnav-more-item:link,
.bottomnav-more-item:visited {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0.65rem 0.25rem;
  font-size: 0.65rem;
  color: var(--app-navbar-muted, rgba(255,255,255,0.55)) !important;
  text-decoration: none !important;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.bottomnav-more-item i { font-size: 1.25rem; line-height: 1; }
.bottomnav-more-item:hover,
.bottomnav-more-item.active {
  background: rgba(255,255,255,0.08);
  color: var(--app-navbar-text, #fff) !important;
}
.bottomnav-more-item.active i { color: var(--app-primary, #0d6efd) !important; }

/* BottomNav — panel de submenú dinámico */
.bottomnav-sub-panel {
  position: fixed;
  bottom: 60px;
  left: 0; right: 0;
  background: var(--app-navbar-bg, var(--sidebar-bg, #1a1d2e));
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 -4px 24px rgba(0,0,0,.35);
  z-index: 1039;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.bottomnav-sub-panel.open {
  transform: translateY(0);
}

.bottomnav-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
}

.bottomnav-sub-viewall {
  font-size: 0.72rem;
  color: var(--app-primary, #0d6efd);
  text-decoration: none;
  opacity: 0.9;
}
.bottomnav-sub-viewall:hover { opacity: 1; text-decoration: underline; }

.bottomnav-sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
}

/* Botón "más" — mismo estilo que los ítems de la barra */
.bottomnav-more-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  font-size: 0.65rem;
  color: var(--app-navbar-muted, rgba(255,255,255,0.5));
  cursor: pointer;
  transition: color var(--transition);
  outline: none;
}
.bottomnav-more-btn i { font-size: 1.25rem; line-height: 1; }
.bottomnav-more-btn span { line-height: 1; }
.bottomnav-more-btn:hover,
.bottomnav-more-btn.active {
  color: var(--app-navbar-text, rgba(255,255,255,0.95));
}
.bottomnav-more-btn.active i { color: var(--app-primary, #0d6efd); }

/* Wrapper del layout bottom: deja espacio para la nav fija */
.layout-bottom-wrapper {
  min-height: 100vh;
  padding-bottom: 60px;
  box-sizing: border-box;
}

/* En pantallas md+ la bottom nav se oculta → quitar el padding extra */
@media (min-width: 768px) {
  .layout-bottom-wrapper {
    padding-bottom: 0;
  }
}

/* Overlay del sidebar: invisible por defecto en todos los tamaños */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1039;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-med), visibility var(--transition-med);
  pointer-events: none;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============================================================
   RESPONSIVE — Sidebar móvil
   ============================================================ */

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-med);
    will-change: transform;
    z-index: 1040;
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.25);
  }

  /* En mobile, labels siempre visibles (no aplica el colapso de desktop) */
  .sidebar .nav-label,
  .sidebar .sidebar-brand-text,
  .sidebar .submenu-arrow,
  .sidebar .sidebar-user-info {
    opacity: 1 !important;
    max-width: 200px !important;
  }

  .layout-side-content { width: 100%; }
}

/* ============================================================
   COMPONENTES COMUNES
   ============================================================ */

/* Cards */
.card {
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}
.card-header { font-size: 0.88rem; }

/* KPI Cards */
.kpi-card {
  border-radius: var(--radius);
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1) !important;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.kpi-icon-primary  { background: color-mix(in srgb, #0d6efd 15%, transparent); color: #0d6efd; }
.kpi-icon-success  { background: color-mix(in srgb, #198754 15%, transparent); color: #198754; }
.kpi-icon-warning  { background: color-mix(in srgb, #ffc107 15%, transparent); color: #d4a000; }
.kpi-icon-danger   { background: color-mix(in srgb, #dc3545 15%, transparent); color: #dc3545; }
.kpi-icon-info     { background: color-mix(in srgb, #0dcaf0 15%, transparent); color: #087990; }

.kpi-value { font-size: 1.6rem; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.78rem; }

/* Dashboard: filas KPI en móvil — la columna debe poder encoger por debajo del ancho intrínseco del texto */
.dashboard-kpi-row > [class*="col-"] {
  min-width: 0;
}

.kpi-card .card-body {
  min-width: 0;
}

.kpi-card .kpi-body-text {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.dashboard-activity-card ul.list-unstyled > li.d-flex > .flex-grow-1 {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.dashboard-system-card .card-header {
  min-width: 0;
}

.dashboard-system-card .card-body {
  min-width: 0;
}

.dashboard-system-card .list-unstyled li {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Tables */
.table th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table td { vertical-align: middle; }
.table .sortable { cursor: pointer; user-select: none; }
.table .sortable:hover { background: var(--bs-tertiary-bg); }

/* Badges */
.badge.bg-success-subtle  { background: color-mix(in srgb, #198754 12%, transparent) !important; }
.badge.bg-secondary-subtle { background: var(--bs-tertiary-bg) !important; }

/* Forms */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--app-primary, #0d6efd);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary, #0d6efd) 18%, transparent);
}

/* Buttons */
.btn {
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--app-primary, #0d6efd);
  border-color: var(--app-primary, #0d6efd);
}
.btn-primary:hover { background: var(--app-primary-hover, #0a58ca); border-color: var(--app-primary-hover, #0a58ca); }

/* Alerts */
.alert {
  border-radius: var(--radius);
  border: none;
  font-size: 0.88rem;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  background: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
}

.login-wrapper { padding: 1.5rem; }

.login-card {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 820px;
  border-radius: var(--radius-lg) !important;
  overflow: hidden;
  min-height: 480px;
}

.login-brand {
  width: 320px;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--app-primary, #0d6efd) 0%, color-mix(in srgb, var(--app-primary, #0d6efd) 65%, #764ba2) 100%);
}

.login-brand-icon {
  width: 64px;
  height: 64px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  backdrop-filter: blur(4px);
}

.login-form-side { flex: 1; min-width: 0; }

@media (max-width: 767.98px) {
  .login-card { flex-direction: column; max-width: 440px; }
  .login-brand { width: 100%; min-height: 160px; }
}

/* ============================================================
   AJUSTES — Color picker
   ============================================================ */

.color-preview-swatch {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  transition: background 0.2s;
}

.color-preset {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
  background-clip: content-box;
}

.color-preset:hover {
  transform: scale(1.25);
  border-color: var(--bs-border-color);
}

/* ============================================================
   STYLE PANEL — Drawer flotante de personalización rápida
   ============================================================ */

#stylePanel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--bs-body-bg);
  border-left: 1px solid var(--bs-border-color);
  z-index: 1055;
  transform: translateX(100%);
  transition: transform var(--transition-med);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 32px rgba(0,0,0,0.12);
  overflow: hidden;
}

#stylePanel.open {
  transform: translateX(0);
}

.style-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.style-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scrollbar-width: thin;
}

.style-panel-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bs-secondary-color);
  margin-bottom: 0.75rem;
}

.style-panel-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--bs-border-color);
  flex-shrink: 0;
}

/* Overlay para el style panel */
#stylePanelOverlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1054;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-med), visibility var(--transition-med);
}

#stylePanelOverlay.active {
  opacity: 1;
  visibility: visible;
}

/* Presets en el style panel */
.style-panel-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Layout selector cards */
.layout-option {
  flex: 1;
  min-width: 70px;
  border: 2px solid var(--bs-border-color);
  border-radius: var(--radius);
  padding: 0.6rem 0.5rem;
  text-align: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: border-color var(--transition), background var(--transition);
  background: transparent;
  color: var(--bs-body-color);
}

.layout-option:hover {
  border-color: var(--app-primary, #0d6efd);
  background: color-mix(in srgb, var(--app-primary, #0d6efd) 8%, transparent);
}

.layout-option.active {
  border-color: var(--app-primary, #0d6efd);
  background: color-mix(in srgb, var(--app-primary, #0d6efd) 12%, transparent);
  color: var(--app-primary, #0d6efd);
  font-weight: 600;
}

.layout-option i {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

/* ============================================================
   UTILIDADES
   ============================================================ */

.font-monospace { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; }

/* Scrollbar personalizado */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.55); }

/* Animaciones de entrada */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.main-content > * {
  animation: fadeInUp 0.28s ease forwards;
}

/* Stagger CSS puro — sin dependencia AOS */
.fade-stagger {
  animation: fadeInUp 0.3s ease both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

/* Activity placeholder */
.activity-placeholder {
  min-height: 120px;
}

/* Responsive helpers */
@media (max-width: 575.98px) {
  .hide-xs { display: none !important; }
}

/* Accesibilidad: respetar preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
