/* ===================================================================
   Skin "Santa Barbara" para AdminLTE 4 / Bootstrap 5.3
   -------------------------------------------------------------------
   PRINCIPIO: lo UNICO que cambia respecto de AdminLTE 4 es la PALETA.
   No se toca layout, estructura, tipografia, espaciado ni comportamiento.
   Todo se resuelve remapeando tokens (CSS custom properties) de
   Bootstrap y AdminLTE. Para cambiar la identidad, editar SOLO este archivo.
   =================================================================== */

:root {
  /* Identidad del Arma de Artilleria */
  --sb-punzo: #c8102e;          /* Primary */
  --sb-punzo-rgb: 200, 16, 46;
  --sb-punzo-dark: #9e0c24;     /* hover/active */
  --sb-negro: #121214;          /* sidebar / superficies oscuras */
  --sb-negro-panel: #1c1c20;    /* paneles en dark */
  --sb-oro: #c9a227;            /* acento (metal del escudo) */
  --sb-oro-rgb: 201, 162, 39;
  --sb-acero: #4a5568;          /* acento neutro secundario */
  --sb-acero-rgb: 74, 85, 104;
}

/* --- Primary de Bootstrap -> punzo (claro y oscuro) --- */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-primary: var(--sb-punzo);
  --bs-primary-rgb: var(--sb-punzo-rgb);
  --bs-link-color: var(--sb-punzo);
  --bs-link-color-rgb: var(--sb-punzo-rgb);
  --bs-link-hover-color: var(--sb-punzo-dark);
  --bs-link-hover-color-rgb: 158, 12, 36;
}

[data-bs-theme="light"] {
  --bs-primary-text-emphasis: #7d0a1d;
  --bs-primary-bg-subtle: #f8dbe0;
  --bs-primary-border-subtle: #e7a6af;
}

/* Modo oscuro: casi-negro coherente con la identidad rojo+negro */
[data-bs-theme="dark"] {
  --bs-primary-text-emphasis: #ef8f9c;
  --bs-primary-bg-subtle: #2a0a10;
  --bs-primary-border-subtle: #5c1420;
  --bs-link-color: #ef6d7e;
  --bs-link-color-rgb: 239, 109, 126;
  --bs-link-hover-color: #f59aa6;
  --bs-body-bg: var(--sb-negro);
  --bs-body-bg-rgb: 18, 18, 20;
  --bs-secondary-bg: var(--sb-negro-panel);
  --bs-secondary-bg-rgb: 28, 28, 32;
  --bs-tertiary-bg: #17171b;
}

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

/* --- Focus / checks de formularios (color, no estructura) --- */
.form-control:focus,
.form-select:focus {
  border-color: #e07d8a;
  box-shadow: 0 0 0 0.25rem rgba(var(--sb-punzo-rgb), 0.25);
}
.form-check-input:checked {
  background-color: var(--sb-punzo);
  border-color: var(--sb-punzo);
}
.form-check-input:focus {
  border-color: #e07d8a;
  box-shadow: 0 0 0 0.25rem rgba(var(--sb-punzo-rgb), 0.25);
}

/* --- Paginacion y nav-pills --- */
.pagination {
  --bs-pagination-color: var(--sb-punzo);
  --bs-pagination-hover-color: var(--sb-punzo-dark);
  --bs-pagination-active-bg: var(--sb-punzo);
  --bs-pagination-active-border-color: var(--sb-punzo);
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(var(--sb-punzo-rgb), 0.25);
}
.nav-pills {
  --bs-nav-pills-link-active-bg: var(--sb-punzo);
}

/* --- Sidebar de AdminLTE: marca oscura + activo punzo --- */
.app-sidebar {
  --lte-sidebar-menu-active-bg: var(--sb-punzo);
  --lte-sidebar-menu-active-color: #ffffff;
  --lte-sidebar-submenu-active-bg: rgba(var(--sb-punzo-rgb), 0.85);
  --lte-sidebar-submenu-active-color: #ffffff;
  --lte-sidebar-hover-bg: rgba(255, 255, 255, 0.06);
}
.brand-link { color: #fff; }
.sb-brand-emblem { filter: drop-shadow(0 2px 5px rgba(var(--sb-punzo-rgb), 0.5)); }

/* --- Tarjetas KPI (small-box): identidad, no azul/verde/amarillo demo --- */
/* Utilidades de color de identidad (solo cambian color). */
.text-bg-sb-punzo { background-color: var(--sb-punzo) !important; color: #fff !important; }
.text-bg-sb-oro { background-color: var(--sb-oro) !important; color: #201607 !important; }
.text-bg-sb-acero { background-color: var(--sb-acero) !important; color: #fff !important; }
.text-bg-sb-grafito { background-color: #26262c !important; color: #fff !important; }

.text-sb-oro { color: var(--sb-oro) !important; }
.text-sb-acero { color: var(--sb-acero) !important; }
.border-sb-punzo { border-color: var(--sb-punzo) !important; }

/* ===================================================================
   MEJORAS DE DISEÑO (acabados profesionales)
   Tipografía Inter, sidebar oscuro legible, KPIs con profundidad,
   tarjetas/tablas/navbar refinadas. Cosmético; no altera la estructura.
   =================================================================== */

/* --- Tipografía Inter (vendorizada) --- */
@font-face {
  font-family: "InterVariable";
  src: url("../vendor/inter/inter-variable.260c81a4759b.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --sb-font: "InterVariable", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-family: var(--sb-font);
}
body,
.app-wrapper,
.btn,
.form-control,
.form-select,
.nav,
.dropdown-menu,
input,
select,
textarea {
  font-family: var(--sb-font) !important;
}
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}

/* Fondo de la app un punto más frío y limpio */
body.bg-body-tertiary { background-color: #f3f5f8; }
[data-bs-theme="dark"] body.bg-body-tertiary { background-color: #0d0e12; }

/* --- Navbar --- */
.app-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(16, 18, 22, 0.04);
}
[data-bs-theme="dark"] .app-header { border-bottom-color: rgba(255, 255, 255, 0.06); }
.app-header .nav-link { border-radius: 8px; }

/* --- Título de la cabecera de contenido --- */
.app-content-header h3 { font-weight: 700; letter-spacing: -0.02em; }

/* ===================================================================
   Sidebar: SIEMPRE oscuro (identidad) y legible, con nav tipo "pill".
   (Corrige el bajo contraste: fondo oscuro real + texto claro.)
   =================================================================== */
.app-sidebar {
  background: linear-gradient(180deg, #191c23 0%, #0f1116 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.sidebar-brand {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.85rem 1rem;
}
.brand-link,
.brand-link .brand-text {
  color: #ffffff !important;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.brand-link .brand-text { font-size: 1.02rem; }

/* Marca en el login más nítida (blanco) */
body.login-page .login-logo a,
body.login-page .login-logo b {
  color: #ffffff !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sb-brand-emblem {
  background: linear-gradient(135deg, #23272f, #12141a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.app-sidebar .nav-header {
  color: #7f8797 !important;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  font-weight: 600;
  padding: 1rem 1rem 0.35rem;
}
.app-sidebar .sidebar-menu .nav-link {
  color: #c7ccd6 !important;
  border-radius: 9px;
  margin: 1px 0.6rem;
  font-weight: 450;
  transition: background 0.12s ease, color 0.12s ease;
}
.app-sidebar .sidebar-menu .nav-link .nav-icon { color: #8b93a2; }
.app-sidebar .sidebar-menu .nav-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.06) !important;
}
.app-sidebar .sidebar-menu .nav-link:hover .nav-icon { color: #ffffff; }
.app-sidebar .sidebar-menu > .nav-item > .nav-link.active,
.app-sidebar .sidebar-menu > .nav-item.menu-open > .nav-link.active {
  background: linear-gradient(90deg, #d21832, #a10d22) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 18px -10px rgba(200, 16, 46, 0.75);
}
.app-sidebar .sidebar-menu .nav-link.active .nav-icon { color: #ffffff; }
.app-sidebar .nav-treeview .nav-link { color: #aab1bd !important; }
.app-sidebar .nav-treeview .nav-link:hover { color: #ffffff !important; }

/* --- Tarjetas --- */
.card {
  border: 1px solid rgba(16, 18, 22, 0.07);
  border-radius: 14px;
  box-shadow: 0 4px 18px -12px rgba(16, 18, 22, 0.4);
}
[data-bs-theme="dark"] .card {
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 6px 22px -14px rgba(0, 0, 0, 0.7);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid rgba(16, 18, 22, 0.06);
}
[data-bs-theme="dark"] .card-header { border-bottom-color: rgba(255, 255, 255, 0.06); }
.card-title { font-weight: 600; letter-spacing: -0.01em; }

/* --- Tarjetas KPI (small-box): profundidad y microinteracción --- */
.small-box {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 26px -16px rgba(16, 18, 22, 0.6);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.small-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px -18px rgba(16, 18, 22, 0.6);
}
.small-box .inner h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.small-box .inner p { opacity: 0.92; font-weight: 500; }
.small-box .small-box-icon { opacity: 0.26; font-size: 4.4rem; }
.text-bg-sb-punzo { background-image: linear-gradient(135deg, #e01f3a, #a20d22) !important; }
.text-bg-sb-acero { background-image: linear-gradient(135deg, #5b6678, #39424f) !important; }
.text-bg-sb-grafito { background-image: linear-gradient(135deg, #2b2e36, #14161b) !important; }
.text-bg-sb-oro { background-image: linear-gradient(135deg, #d8b23c, #b58c1e) !important; }

/* --- Tablas --- */
.table thead th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--bs-secondary-color);
}
.table { --bs-table-hover-bg: rgba(200, 16, 46, 0.05); }

/* --- Botones --- */
.btn { border-radius: 9px; font-weight: 500; }
.btn-sm { border-radius: 8px; }

/* --- Scrollbars --- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 130, 0.4);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-clip: content-box; background-color: rgba(120, 120, 130, 0.6); }

/* ===================================================================
   SISTEMA VISUAL PREMIUM (dashboard y componentes)
   Superficies claras, acentos sutiles, jerarquía tipográfica fuerte.
   =================================================================== */

/* Tarjetas: sombra suave en capas, hairline, más aire */
.card {
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 18, 22, 0.03), 0 10px 30px -22px rgba(16, 18, 22, 0.5);
}
[data-bs-theme="dark"] .card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -20px rgba(0, 0, 0, 0.8);
}
.card-header { padding: 1rem 1.25rem; }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.25rem; }

/* Tablas con más aire */
.table > :not(caption) > * > * { padding: 0.8rem 1.25rem; }

/* --- Chips (metadatos del período) --- */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sb-punzo) 12%, transparent);
  color: var(--sb-punzo);
}
.chip-muted { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }

/* --- Stat cards (KPIs) modernas --- */
.stat-card {
  --sc-accent: var(--sb-punzo);
  position: relative;
  height: 100%;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  padding: 1.15rem 1.3rem 1.1rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 18, 22, 0.03), 0 10px 28px -20px rgba(16, 18, 22, 0.55);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
[data-bs-theme="dark"] .stat-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -20px rgba(0, 0, 0, 0.8);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px -6px rgba(16, 18, 22, 0.12), 0 22px 40px -22px rgba(16, 18, 22, 0.55);
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--sc-accent);
}
.stat-card--punzo { --sc-accent: #c8102e; }
.stat-card--acero { --sc-accent: #4a5568; }
.stat-card--oro { --sc-accent: #b7891a; }
.stat-card--danger { --sc-accent: #dc3545; }

.stat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: var(--bs-secondary-color);
}
.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 0.45rem;
  color: var(--bs-emphasis-color);
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 0.8rem; color: var(--bs-secondary-color); margin-top: 0.3rem; }
.stat-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: color-mix(in srgb, var(--sc-icon, var(--sb-punzo)) 14%, transparent);
  color: var(--sc-icon, var(--sb-punzo));
}
.stat-icon--punzo { --sc-icon: #c8102e; }
.stat-icon--acero { --sc-icon: #4a5568; }
.stat-icon--oro { --sc-icon: #b7891a; }
.stat-icon--danger { --sc-icon: #dc3545; }

/* --- Barra de progreso (tasa de cobro) --- */
.sb-progress { height: 10px; border-radius: 999px; background: var(--bs-secondary-bg); }
.sb-progress .progress-bar {
  background: linear-gradient(90deg, #e01f3a, #c8102e);
  border-radius: 999px;
}

/* --- Empty state --- */
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state-icon {
  width: 74px;
  height: 74px;
  border-radius: 20px;
  margin: 0 auto 1.1rem;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: color-mix(in srgb, var(--sb-punzo) 12%, transparent);
  color: var(--sb-punzo);
}

/* Breadcrumb activo en punzó, resto sutil */
.breadcrumb-item.active { color: var(--bs-secondary-color); }
