/* ============================================================
   ActivosPro — Hoja de estilos principal
   Sistema de Inventario de Activos Fijos
   ============================================================ */

/* Variables CSS globales */
:root {
  --color-primario:       #4F7CAC;
  --color-secundario:     #6C8EBF;
  --color-acento:         #7BB5A0;
  --fondo-general:        #F4F6F9;
  --fondo-sidebar:        #1E2A3A;
  --fondo-card:           #FFFFFF;
  --texto-principal:      #2D3748;
  --texto-secundario:     #718096;
  --texto-sidebar:        #A0AEC0;
  --texto-sidebar-activo: #FFFFFF;
  --borde:                #E2E8F0;
  --sombra:               rgba(0, 0, 0, 0.06);
  --sombra-hover:         rgba(0, 0, 0, 0.10);

  /* Estados */
  --exito-texto:   #48BB78;
  --exito-fondo:   #F0FFF4;
  --error-texto:   #FC8181;
  --error-fondo:   #FFF5F5;
  --warning-texto: #F6AD55;
  --warning-fondo: #FFFAF0;
  --info-texto:    #63B3ED;
  --info-fondo:    #EBF8FF;

  /* Dimensiones sidebar */
  --sidebar-ancho: 260px;
  --navbar-alto:   60px;

  /* Bordes */
  --radius-card:   12px;
  --radius-btn:    8px;
  --radius-input:  8px;
  --radius-badge:  20px;
  --radius-modal:  16px;
}

/* ============================================================
   Base y tipografía
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--texto-principal);
  background-color: var(--fondo-general);
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  color: var(--texto-principal);
}

/* ============================================================
   Layout principal (sidebar + contenido)
   ============================================================ */
.ap-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.ap-sidebar {
  width: var(--sidebar-ancho);
  min-height: 100vh;
  background-color: var(--fondo-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.ap-sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.ap-sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background-color: var(--color-primario);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

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

.ap-sidebar-logo-name {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.ap-sidebar-logo-sub {
  font-size: 10px;
  color: var(--texto-sidebar);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.ap-sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.ap-nav-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(160, 174, 192, 0.5);
  font-weight: 600;
  padding: 12px 20px 6px;
  margin-top: 8px;
}

.ap-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--texto-sidebar);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  margin: 1px 0;
}

.ap-nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ap-nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  text-decoration: none;
}

.ap-nav-item.active {
  background-color: rgba(255, 255, 255, 0.10);
  border-left-color: var(--color-primario);
  color: var(--texto-sidebar-activo);
  font-weight: 500;
}

.ap-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11px;
  color: rgba(160, 174, 192, 0.4);
  text-align: center;
}

/* ============================================================
   Área de contenido principal
   ============================================================ */
.ap-main {
  margin-left: var(--sidebar-ancho);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
  transition: margin-left 0.3s ease;
}

/* ============================================================
   Navbar superior
   ============================================================ */
.ap-navbar {
  height: var(--navbar-alto);
  background-color: #FFFFFF;
  box-shadow: 0 1px 4px var(--sombra);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
  gap: 16px;
  overflow: visible;
}

.ap-navbar-toggle {
  background: none;
  border: none;
  color: var(--texto-secundario);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
}

.ap-navbar-toggle:hover {
  background-color: var(--fondo-general);
}

.ap-navbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--texto-principal);
  flex: 1;
}

.ap-navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Avatar con iniciales */
.ap-avatar {
  width: 36px;
  height: 36px;
  background-color: var(--color-primario);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.ap-user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
  cursor: pointer;
}

.ap-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-principal);
  line-height: 1.2;
}

.ap-user-rol {
  font-size: 11px;
  color: var(--texto-secundario);
  text-transform: capitalize;
}

/* Dropdown usuario */
.ap-dropdown {
  position: relative;
}

.ap-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--fondo-card);
  border: 1px solid var(--borde);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.ap-dropdown.open .ap-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
}

.ap-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--texto-principal);
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.ap-dropdown-item:hover {
  background-color: var(--fondo-general);
  color: var(--texto-principal);
  text-decoration: none;
}

.ap-dropdown-item.danger {
  color: #E53E3E;
}

.ap-dropdown-item.danger:hover {
  background-color: #FFF5F5;
}

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

/* ============================================================
   Contenido de página
   ============================================================ */
.ap-content {
  padding: 28px 28px;
  flex: 1;
}

.ap-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--texto-principal);
  margin-bottom: 6px;
  line-height: 1.3;
}

.ap-page-subtitle {
  font-size: 13px;
  color: var(--texto-secundario);
  margin-bottom: 24px;
}

/* ============================================================
   Cards del dashboard
   ============================================================ */
.ap-stat-card {
  background: var(--fondo-card);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px var(--sombra);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.ap-stat-card:hover {
  box-shadow: 0 4px 16px var(--sombra-hover);
  transform: translateY(-2px);
}

.ap-stat-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ap-stat-card-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.ap-stat-card-label {
  font-size: 12px;
  color: var(--texto-secundario);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.ap-stat-card-icon {
  font-size: 36px;
  opacity: 0.18;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* Colores de cards */
.ap-stat-card.card-azul {
  border-bottom-color: var(--color-primario);
}
.ap-stat-card.card-azul .ap-stat-card-value { color: var(--color-primario); }
.ap-stat-card.card-azul .ap-stat-card-icon  { color: var(--color-primario); }

.ap-stat-card.card-verde {
  border-bottom-color: var(--color-acento);
}
.ap-stat-card.card-verde .ap-stat-card-value { color: var(--color-acento); }
.ap-stat-card.card-verde .ap-stat-card-icon  { color: var(--color-acento); }

.ap-stat-card.card-violeta {
  border-bottom-color: #9B7FD4;
}
.ap-stat-card.card-violeta .ap-stat-card-value { color: #9B7FD4; }
.ap-stat-card.card-violeta .ap-stat-card-icon  { color: #9B7FD4; }

.ap-stat-card.card-rojo {
  border-bottom-color: #FC8181;
}
.ap-stat-card.card-rojo .ap-stat-card-value { color: #FC8181; }
.ap-stat-card.card-rojo .ap-stat-card-icon  { color: #FC8181; }

/* ============================================================
   Cards genéricas
   ============================================================ */
.ap-card {
  background: var(--fondo-card);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px var(--sombra);
  padding: 24px;
  margin-bottom: 20px;
}

.ap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--borde);
}

.ap-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--texto-principal);
  margin: 0;
}

/* ============================================================
   Botones
   ============================================================ */
.btn-ap-primario {
  background-color: var(--color-primario);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(79, 124, 172, 0.3);
  text-decoration: none;
}

.btn-ap-primario:hover {
  background-color: #3D6A99;
  color: white;
  box-shadow: 0 4px 12px rgba(79, 124, 172, 0.4);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-ap-secundario {
  background-color: var(--borde);
  color: #4A5568;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-ap-secundario:hover {
  background-color: #CBD5E0;
  color: #4A5568;
  text-decoration: none;
}

.btn-ap-exito {
  background-color: #48BB78;
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-ap-exito:hover {
  background-color: #38A169;
  color: white;
  text-decoration: none;
}

.btn-ap-peligro {
  background-color: #FC8181;
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-ap-peligro:hover {
  background-color: #E53E3E;
  color: white;
  text-decoration: none;
}

/* Alias corto — usado en vistas de fases 3-6 */
.btn-primario,
.btn-primario:visited {
  background-color: var(--color-primario);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(79, 124, 172, 0.3);
  text-decoration: none;
}
.btn-primario:hover {
  background-color: #3D6A99;
  color: white;
  box-shadow: 0 4px 12px rgba(79, 124, 172, 0.4);
  transform: translateY(-1px);
  text-decoration: none;
}
.btn-primario:disabled,
.btn-primario[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Variante advertencia (warning) */
.btn-ap-warning {
  background-color: #ED8936;
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-ap-warning:hover {
  background-color: #C05621;
  color: white;
  text-decoration: none;
}

/* Variante éxito / success */
.btn-ap-success {
  background-color: #48BB78;
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-ap-success:hover {
  background-color: #38A169;
  color: white;
  text-decoration: none;
}

/* ============================================================
   Formularios e inputs
   ============================================================ */
.ap-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--texto-secundario);
  font-weight: 600;
  margin-bottom: 6px;
}

.ap-input,
.ap-select,
.ap-textarea {
  display: block;
  width: 100%;
  border: 1.5px solid var(--borde);
  border-radius: var(--radius-input);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--texto-principal);
  background-color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.ap-input::placeholder,
.ap-textarea::placeholder {
  color: #A0AEC0;
}

.ap-input:focus,
.ap-select:focus,
.ap-textarea:focus {
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px rgba(79, 124, 172, 0.15);
}

.ap-input.is-invalid,
.ap-select.is-invalid,
.ap-textarea.is-invalid {
  border-color: #FC8181;
}

.ap-input.is-invalid:focus,
.ap-select.is-invalid:focus,
.ap-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.15);
}

.ap-error-msg {
  font-size: 12px;
  color: #E53E3E;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   Badges de estado de activos
   ============================================================ */
.badge-estado,
.badge-inventario {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-bueno     { color: #276749; background-color: #C6F6D5; }
.badge-regular   { color: #744210; background-color: #FEFCBF; }
.badge-malo      { color: #742A2A; background-color: #FED7D7; }
.badge-baja      { color: #4A5568; background-color: #E2E8F0; }
.badge-no-existe { color: #553C9A; background-color: #E9D8FD; }

.badge-en-proceso { color: #2B6CB0; background-color: #BEE3F8; }
.badge-finalizado { color: #276749; background-color: #C6F6D5; }
.badge-cancelado  { color: #742A2A; background-color: #FED7D7; }

/* ============================================================
   Tablas DataTables
   ============================================================ */
.ap-table-wrapper {
  border-radius: var(--radius-card);
  overflow: hidden;
}

table.ap-datatable {
  width: 100% !important;
  border-collapse: collapse;
}

table.ap-datatable thead th {
  background-color: #F7FAFC;
  color: var(--texto-secundario);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--borde);
  border-top: none;
  white-space: nowrap;
}

table.ap-datatable tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--borde);
  border-top: none;
  vertical-align: middle;
  font-size: 13px;
  color: var(--texto-principal);
}

table.ap-datatable tbody tr:nth-child(even) {
  background-color: #FAFBFC;
}

table.ap-datatable tbody tr:hover {
  background-color: #EBF4FF;
}

/* ============================================================
   Botones de acción en tablas  (btn-accion y ap-btn-icon)
   ============================================================ */

/* Contenedor de acciones */
.ap-acciones {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

/* Base unificada */
.btn-accion,
.ap-btn-icon {
  background: none;
  border: 1.5px solid var(--borde);
  border-radius: 7px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  color: var(--texto-secundario);
  margin: 0 1px;
  padding: 0;
  line-height: 1;
}
.btn-accion:hover,
.ap-btn-icon:hover { text-decoration: none; }

/* ── Editar (azul) ── */
.btn-accion-editar,
.ap-btn-icon-edit   { color: var(--color-primario); border-color: #BEE3F8; background: #EBF8FF; }
.btn-accion-editar:hover,
.ap-btn-icon-edit:hover {
  border-color: var(--color-primario);
  background-color: #BEE3F8;
  color: var(--color-primario);
}

/* ── Ver / info (verde-azulado) ── */
.btn-accion-ver,
.ap-btn-icon-info   { color: #319795; border-color: #B2F5EA; background: #E6FFFA; }
.btn-accion-ver:hover,
.ap-btn-icon-info:hover {
  border-color: #319795;
  background-color: #B2F5EA;
  color: #2C7A7B;
}

/* ── Activar / success (verde) ── */
.btn-accion-activar,
.ap-btn-icon-success { color: #276749; border-color: #9AE6B4; background: #F0FFF4; }
.btn-accion-activar:hover,
.ap-btn-icon-success:hover {
  border-color: #48BB78;
  background-color: #C6F6D5;
  color: #276749;
}

/* ── Desactivar / warning (naranja) ── */
.btn-accion-desactivar,
.ap-btn-icon-warning { color: #C05621; border-color: #FBD38D; background: #FFFAF0; }
.btn-accion-desactivar:hover,
.ap-btn-icon-warning:hover {
  border-color: #ED8936;
  background-color: #FEEBC8;
  color: #C05621;
}

/* ── Peligro / eliminar (rojo) ── */
.btn-accion-danger,
.ap-btn-icon-danger  { color: #C53030; border-color: #FEB2B2; background: #FFF5F5; }
.btn-accion-danger:hover,
.ap-btn-icon-danger:hover {
  border-color: #FC8181;
  background-color: #FED7D7;
  color: #C53030;
}

/* ============================================================
   Filtros sobre tablas
   ============================================================ */
.ap-filtros {
  background-color: #F7FAFC;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--borde);
}

.ap-filtros .ap-input,
.ap-filtros .ap-select {
  height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

/* ============================================================
   Modales
   ============================================================ */
.ap-modal .modal-content {
  border-radius: var(--radius-modal);
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.ap-modal .modal-header {
  border-bottom: 1px solid var(--borde);
  padding: 20px 24px 16px;
  background: none;
}

.ap-modal .modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--texto-principal);
}

.ap-modal .modal-body {
  padding: 20px 24px;
}

.ap-modal .modal-footer {
  border-top: 1px solid var(--borde);
  padding: 16px 24px 20px;
  background: none;
  gap: 8px;
}

.ap-modal .btn-close {
  opacity: 0.4;
}

/* Animación modal */
.modal.fade .modal-dialog {
  transform: translateY(-16px) scale(0.98);
  transition: all 0.25s ease;
}

.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

/* Overlay modal */
.modal-backdrop.show {
  backdrop-filter: blur(2px);
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.4);
}

/* ============================================================
   Login page
   ============================================================ */
.ap-login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #EBF0F7 0%, #F4F6F9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ap-login-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.ap-login-logo {
  text-align: center;
  margin-bottom: 8px;
}

.ap-login-logo-icon {
  width: 56px;
  height: 56px;
  background-color: var(--color-primario);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(79, 124, 172, 0.35);
}

.ap-login-logo-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--texto-principal);
  letter-spacing: -0.5px;
}

.ap-login-logo-sub {
  font-size: 12px;
  color: var(--texto-secundario);
  margin-top: 4px;
}

.ap-login-divider {
  height: 1px;
  background-color: var(--borde);
  margin: 24px 0;
}

.ap-login-btn {
  width: 100%;
  height: 44px;
  background-color: var(--color-primario);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 124, 172, 0.3);
}

.ap-login-btn:hover {
  background-color: #3D6A99;
  box-shadow: 0 6px 18px rgba(79, 124, 172, 0.4);
  transform: translateY(-1px);
}

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

.ap-login-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--borde);
  font-size: 11px;
  color: #CBD5E0;
}

.ap-login-alert {
  background-color: var(--error-fondo);
  border: 1px solid #FED7D7;
  color: #742A2A;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   Responsividad móvil
   ============================================================ */
@media (max-width: 768px) {
  .ap-sidebar {
    transform: translateX(-100%);
  }

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

  .ap-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .ap-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .ap-main {
    margin-left: 0;
  }

  .ap-content {
    padding: 16px;
  }

  .ap-page-title {
    font-size: 18px;
  }

  .ap-stat-card {
    padding: 16px;
  }

  .ap-stat-card-value {
    font-size: 22px;
  }

  .ap-stat-card-icon {
    font-size: 28px;
  }
}

@media (max-width: 576px) {
  .ap-login-card {
    padding: 28px 20px;
  }

  .ap-navbar {
    padding: 0 16px;
  }

  .ap-user-info {
    display: none;
  }
}

/* En móvil el dropdown usa position:fixed para escapar el contexto sticky */
@media (max-width: 768px) {
  .ap-dropdown-menu {
    position: fixed;
    top: auto;
    right: 12px;
  }
}

/* ============================================================
   Alertas y notificaciones
   ============================================================ */
.ap-alert {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.ap-alert-exito   { background: var(--exito-fondo);   color: #276749; border: 1px solid #9AE6B4; }
.ap-alert-error   { background: var(--error-fondo);   color: #742A2A; border: 1px solid #FEB2B2; }
.ap-alert-warning { background: var(--warning-fondo); color: #744210; border: 1px solid #FBD38D; }
.ap-alert-info    { background: var(--info-fondo);    color: #2B6CB0; border: 1px solid #90CDF4; }

/* ============================================================
   Utilidades
   ============================================================ */
.text-primario   { color: var(--color-primario); }
.text-secundario { color: var(--texto-secundario); }
.fw-600          { font-weight: 600; }
.fw-700          { font-weight: 700; }
.gap-8           { gap: 8px; }
.d-flex-center   { display: flex; align-items: center; }

/* DataTables: override Bootstrap */
div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
  border: 1.5px solid var(--borde);
  border-radius: var(--radius-input);
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--texto-principal);
  outline: none;
  transition: border-color 0.15s ease;
}

div.dataTables_wrapper div.dataTables_filter input:focus {
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px rgba(79, 124, 172, 0.15);
}

div.dataTables_wrapper div.dataTables_info {
  font-size: 12px;
  color: var(--texto-secundario);
  padding-top: 10px;
}

div.dataTables_wrapper div.dataTables_paginate {
  padding-top: 8px;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button {
  border-radius: 6px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  padding: 4px 10px;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
  background: var(--color-primario);
  color: white !important;
  border: none;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
  background: var(--fondo-general);
  color: var(--texto-principal) !important;
  border: none;
}

/* ============================================================
   Módulo Inventarios — badges de estado y progress bar
   ============================================================ */
.badge-inventario {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-en-proceso { background: #EBF8FF; color: #2B6CB0; }
.badge-finalizado  { background: #F0FFF4; color: #276749; }
.badge-cancelado   { background: #FFF5F5; color: #C53030; }

.inv-progress-wrap  { display: flex; align-items: center; gap: .5rem; min-width: 120px; }
.inv-progress-bar   { flex: 1; height: 6px; background: var(--borde); border-radius: 3px; overflow: hidden; }
.inv-progress-fill  { height: 100%; background: var(--color-primario); border-radius: 3px; }
.inv-progress-label { font-size: 11px; font-weight: 600; color: var(--texto-secundario); white-space: nowrap; }

/* ============================================================
   Módulo Activos — Foto thumbnail y badges de estado
   ============================================================ */
.ap-foto-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--borde);
}

.ap-foto-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--fondo-general);
  border: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--texto-secundario);
  font-size: 20px;
}

/* Foto grande en modal/vista detalle */
.ap-foto-grande {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--borde);
}

/* Área de carga de foto */
.ap-foto-upload {
  border: 2px dashed var(--borde);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--fondo-general);
  position: relative;
}

.ap-foto-upload:hover {
  border-color: var(--color-primario);
  background: #f0f4f8;
}

.ap-foto-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.ap-foto-upload-icono {
  font-size: 2rem;
  color: var(--texto-secundario);
  margin-bottom: .5rem;
}

.ap-foto-upload-texto {
  font-size: 13px;
  color: var(--texto-secundario);
}

.ap-foto-upload-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: .5rem;
  display: none;
}

/* Badges de estado del activo */
.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-bueno     { background: #F0FFF4; color: #38A169; }
.badge-regular   { background: #FFFAF0; color: #C05621; }
.badge-malo      { background: #FFF5F5; color: #E53E3E; }
.badge-baja      { background: #F7FAFC; color: #718096; }
.badge-no-existe { background: #FAF5FF; color: #6B46C1; }

/* Vista detalle activo */
.ap-detalle-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.ap-detalle-foto-col {
  flex: 0 0 220px;
  max-width: 220px;
}

.ap-detalle-foto-placeholder {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  background: var(--fondo-general);
  border: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--texto-secundario);
  font-size: 3rem;
}

.ap-detalle-info {
  flex: 1;
  min-width: 200px;
}

.ap-detalle-codigo {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primario);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}

.ap-detalle-nombre {
  font-size: 22px;
  font-weight: 700;
  color: var(--texto-principal);
  margin-bottom: .5rem;
  line-height: 1.2;
}

.ap-detalle-meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.ap-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.ap-info-item {
  background: var(--fondo-general);
  border-radius: 10px;
  padding: .75rem 1rem;
}

.ap-info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--texto-secundario);
  margin-bottom: .2rem;
}

.ap-info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--texto-principal);
}

/* QR modal */
.ap-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.ap-qr-codigo {
  font-size: 16px;
  font-weight: 700;
  color: var(--texto-principal);
  letter-spacing: .06em;
}

/* Filtros avanzados colapsables */
.filtros-avanzados-panel {
  background: var(--fondo-card);
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio-card);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.25rem;
}

.filtros-avanzados-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primario);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: .75rem;
}

.filtros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
  align-items: end;
}

.filtro-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.filtro-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-secundario);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.filtros-footer {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  justify-content: flex-end;
}

/* Tabs del modal de activos */
.ap-modal-tabs {
  display: flex;
  border-bottom: 2px solid var(--borde);
  margin-bottom: 1.25rem;
  gap: 0;
}

.ap-modal-tab {
  padding: .6rem 1rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-secundario);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

.ap-modal-tab.active {
  color: var(--color-primario);
  border-bottom-color: var(--color-primario);
}

.ap-tab-panel { display: none; }
.ap-tab-panel.active { display: block; }
