/* ==========================================================================
   SICOFIN — Capa visual  (2026-10-07)
   --------------------------------------------------------------------------
   SOLO estilos. No cambia ninguna funcionalidad: no altera rutas, campos,
   IDs, atributos data-* ni scripts. Únicamente colores, tipografía, espaciado,
   bordes y sombras.

   Alcance deliberadamente acotado (para no afectar al dashboard ni al login,
   que tienen sus propios estilos):
     .sf-shell  -> cuerpo de las vistas que usan app/views/layout/header.php
     .sf-main   -> contenido principal de esas vistas

   Paleta y tipografía tomadas de la identidad ya usada en el dashboard
   (Inter, #667eea -> #764ba2, tinta #1a1d29) para que todo el sistema se vea
   como una sola aplicación.
   ========================================================================== */

:root {
  --sf-primary: #667eea;
  --sf-primary-d: #5a67d8;
  --sf-violet: #764ba2;
  --sf-ink: #1a1d29;
  --sf-ink-2: #2d3142;
  --sf-body: #2b3040;
  --sf-muted: #6b7280;
  --sf-line: #e7eaf3;
  --sf-surface: #ffffff;
  --sf-radius: 16px;
  --sf-radius-sm: 12px;
  --sf-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --sf-shadow: 0 8px 24px rgba(23, 31, 56, .08);
  --sf-shadow-lg: 0 18px 45px rgba(23, 31, 56, .14);
  --sf-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --sf-grad-dark: linear-gradient(120deg, #232a45 0%, #1a1d29 55%, #2b2350 100%);
  --sf-t: all .25s cubic-bezier(.4, 0, .2, 1);
  --sf-topbar-h: 62px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

.sf-shell {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--sf-body);
  min-height: 100vh;
  background-color: #eef1f8;
  background-image:
    radial-gradient(60rem 60rem at 12% 4%, rgba(102, 126, 234, .22), transparent 60%),
    radial-gradient(52rem 52rem at 90% 0%, rgba(118, 75, 162, .18), transparent 55%),
    radial-gradient(48rem 48rem at 78% 100%, rgba(56, 189, 248, .16), transparent 60%);
  background-attachment: fixed;
}

.sf-shell h1, .sf-shell h2, .sf-shell h3, .sf-shell h4,
.sf-shell .h1, .sf-shell .h2, .sf-shell .h3, .sf-shell .h4 {
  font-family: 'Sora', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--sf-ink);
}

/* --------------------------------------------------------------------------
   Barra superior
   -------------------------------------------------------------------------- */

.sf-shell .navbar {
  background: var(--sf-grad-dark) !important;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 6px 22px rgba(16, 24, 40, .18);
  position: sticky;
  top: 0;
  z-index: 1030;
  padding-top: .5rem;
  padding-bottom: .5rem;
}

.sf-shell .navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: 'Sora', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: .2px;
  font-size: 1.12rem;
  color: #fff !important;
}

.sf-shell .navbar-brand .sf-logo {
  height: 30px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
}

.sf-shell .navbar .nav-link {
  color: rgba(255, 255, 255, .82) !important;
  font-weight: 500;
  border-radius: 10px;
  padding: .45rem .85rem !important;
  transition: var(--sf-t);
}

.sf-shell .navbar .nav-link:hover,
.sf-shell .navbar .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, .1);
}

.sf-shell .navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, .25);
}

.sf-shell .navbar .dropdown-menu {
  border: 0;
  border-radius: 14px;
  box-shadow: var(--sf-shadow-lg);
  padding: .4rem;
  margin-top: .45rem;
}

.sf-shell .navbar .dropdown-item {
  border-radius: 10px;
  padding: .55rem .7rem;
  font-weight: 500;
  transition: var(--sf-t);
}

.sf-shell .navbar .dropdown-item:hover,
.sf-shell .navbar .dropdown-item:focus {
  background: rgba(102, 126, 234, .12);
  color: var(--sf-primary-d);
}

.sf-shell .navbar .dropdown-divider {
  border-color: var(--sf-line);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Barra lateral
   -------------------------------------------------------------------------- */

.sf-shell .sidebar {
  background: linear-gradient(180deg, rgba(26, 29, 41, .97) 0%, rgba(45, 49, 66, .97) 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, .06) !important;
  border-radius: 0 var(--sf-radius) var(--sf-radius) 0;
  box-shadow: var(--sf-shadow);
  position: sticky;
  top: var(--sf-topbar-h);
  height: calc(100vh - var(--sf-topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 1rem;
}

.sf-shell .sidebar::-webkit-scrollbar { width: 8px; }
.sf-shell .sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  border-radius: 8px;
}
.sf-shell .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .3); }

/* El contenedor interno ya no necesita su propio sticky */
.sf-shell .sidebar .position-sticky {
  position: static !important;
  padding-top: .75rem !important;
}

.sf-shell .sidebar .nav-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255, 255, 255, .45);
  padding: .95rem 1.25rem .4rem;
}

.sf-shell .sidebar .nav-item { margin: .1rem .65rem; }

.sf-shell .sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: rgba(255, 255, 255, .78) !important;
  border-radius: var(--sf-radius-sm);
  padding: .6rem .8rem;
  font-weight: 500;
  font-size: .94rem;
  transition: var(--sf-t);
}

.sf-shell .sidebar .nav-link i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  transition: var(--sf-t);
}

.sf-shell .sidebar .nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, .1);
  transform: translateX(4px);
}

.sf-shell .sidebar .nav-link:hover i { transform: scale(1.12); }

.sf-shell .sidebar .nav-link.active {
  color: #fff !important;
  background: var(--sf-grad);
  box-shadow: 0 8px 20px rgba(102, 126, 234, .38);
}

.sf-shell .sidebar .sf-sidebar-foot {
  margin: 1rem .65rem .25rem;
  padding: .75rem .9rem;
  border-radius: var(--sf-radius-sm);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .6);
  font-size: .78rem;
  line-height: 1.45;
}

.sf-shell .sidebar .sf-sidebar-foot a { color: rgba(255, 255, 255, .82); }

/* --------------------------------------------------------------------------
   Contenido principal
   -------------------------------------------------------------------------- */

.sf-main {
  padding: 1.6rem 1.75rem 3rem;
}

/* Enlaces (sin tocar botones, pestañas ni paginación) */
.sf-main a:not(.btn):not(.nav-link):not(.page-link):not(.dropdown-item):not(.badge) {
  color: var(--sf-primary-d);
  text-decoration: none;
  transition: var(--sf-t);
}

.sf-main a:not(.btn):not(.nav-link):not(.page-link):not(.dropdown-item):not(.badge):hover {
  color: var(--sf-violet);
  text-decoration: underline;
}

.sf-main .text-muted { color: #7b8497 !important; }
.sf-main hr { border-color: var(--sf-line); opacity: 1; }

/* Cabecera de página (patrón repetido en las vistas) */
.sf-main > .d-flex.border-bottom,
.sf-main > .border-bottom {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 1.25rem !important;
}

.sf-main > .d-flex.border-bottom .h2,
.sf-main > .border-bottom .h2,
.sf-main > .d-flex.border-bottom h1,
.sf-main > .border-bottom h1 {
  position: relative;
  padding-bottom: .55rem;
  margin-bottom: 0;
  font-size: 1.55rem;
}

.sf-main > .d-flex.border-bottom .h2::after,
.sf-main > .border-bottom .h2::after,
.sf-main > .d-flex.border-bottom h1::after,
.sf-main > .border-bottom h1::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46px;
  height: 3px;
  border-radius: 3px;
  background: var(--sf-grad);
}

/* Tarjetas */
.sf-main .card {
  border: 1px solid rgba(23, 31, 56, .06);
  border-radius: var(--sf-radius);
  background: var(--sf-surface);
  box-shadow: var(--sf-shadow-sm);
  transition: var(--sf-t);
  overflow: hidden;
}

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

.sf-main .card-header {
  background: #fbfcff;
  border-bottom: 1px solid var(--sf-line);
  font-weight: 600;
  padding: .9rem 1.15rem;
  color: var(--sf-ink-2);
}

.sf-main .card-body { padding: 1.15rem 1.25rem; }
.sf-main .card-footer {
  background: #fbfcff;
  border-top: 1px solid var(--sf-line);
  padding: .85rem 1.15rem;
}

/* Tablas */
.sf-main .table {
  margin-bottom: 0;
  color: var(--sf-body);
  vertical-align: middle;
}

.sf-main .table > thead th {
  background: #f7f9ff;
  color: #56607a;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--sf-line);
  padding: .72rem .9rem;
  white-space: nowrap;
}

.sf-main .table > tbody > tr > td {
  padding: .68rem .9rem;
  border-color: #eef1f8;
}

.sf-main .table > tbody > tr:last-child > td { border-bottom-color: transparent; }

.sf-main .table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: transparent;
  background-color: rgba(102, 126, 234, .06);
}

.sf-main .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: transparent;
  background-color: rgba(102, 126, 234, .03);
}

.sf-main .table-responsive { border-radius: var(--sf-radius-sm); }

.sf-main .table tfoot th,
.sf-main .table tfoot td {
  background: #f7f9ff;
  border-top: 1px solid var(--sf-line);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.sf-main .btn {
  border-radius: 11px;
  font-weight: 600;
  padding: .5rem .95rem;
  transition: var(--sf-t);
}

.sf-main .btn:focus-visible,
.sf-main .btn:focus {
  box-shadow: 0 0 0 .22rem rgba(102, 126, 234, .25);
}

.sf-main .btn-primary {
  background: var(--sf-grad);
  border: 0;
  box-shadow: 0 6px 16px rgba(102, 126, 234, .28);
}

.sf-main .btn-primary:hover,
.sf-main .btn-primary:focus {
  background: var(--sf-grad);
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(102, 126, 234, .35);
}

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

.sf-main .btn-outline-primary {
  color: var(--sf-primary-d);
  border-color: rgba(102, 126, 234, .45);
}

.sf-main .btn-outline-primary:hover,
.sf-main .btn-outline-primary:focus {
  background: var(--sf-grad);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
}

.sf-main .btn-outline-secondary {
  color: #55607a;
  border-color: #d8dde9;
}

.sf-main .btn-outline-secondary:hover,
.sf-main .btn-outline-secondary:focus {
  background: #55607a;
  border-color: #55607a;
  color: #fff;
}

.sf-main .btn-secondary { background: #55607a; border-color: #55607a; }
.sf-main .btn-light { background: #f2f4fa; border-color: #e3e7f1; }
.sf-main .btn-link { text-decoration: none; font-weight: 600; }

.sf-main .btn-sm {
  border-radius: 9px;
  padding: .32rem .7rem;
  font-size: .83rem;
}

.sf-main .btn-lg { border-radius: 13px; }
.sf-main .btn-group > .btn { border-radius: 11px; }

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */

.sf-main .form-label {
  font-weight: 600;
  font-size: .86rem;
  color: #4b5568;
  margin-bottom: .35rem;
}

.sf-main .form-control,
.sf-main .form-select {
  border-radius: 11px;
  border: 1px solid #dfe3ee;
  padding: .55rem .8rem;
  font-size: .95rem;
  color: var(--sf-body);
  background-color: #fff;
  transition: var(--sf-t);
}

.sf-main .form-control::placeholder { color: #9aa3b5; }

.sf-main .form-control:focus,
.sf-main .form-select:focus {
  border-color: var(--sf-primary);
  box-shadow: 0 0 0 .2rem rgba(102, 126, 234, .18);
}

.sf-main textarea.form-control { min-height: 96px; }

.sf-main .input-group { border-radius: 11px; }

.sf-main .input-group > :first-child {
  border-top-left-radius: 11px !important;
  border-bottom-left-radius: 11px !important;
}

.sf-main .input-group > :last-child {
  border-top-right-radius: 11px !important;
  border-bottom-right-radius: 11px !important;
}

.sf-main .input-group-text {
  background: #f7f9ff;
  border-color: #dfe3ee;
  color: #5b6478;
  font-weight: 500;
}

.sf-main .form-text { color: var(--sf-muted); font-size: .82rem; }
.sf-main .form-check-input { border-color: #cfd6e4; }
.sf-main .form-check-input:checked {
  background-color: var(--sf-primary);
  border-color: var(--sf-primary);
}
.sf-main .form-check-input:focus {
  border-color: var(--sf-primary);
  box-shadow: 0 0 0 .2rem rgba(102, 126, 234, .18);
}
.sf-main .form-check-label { font-weight: 500; }
.sf-main .invalid-feedback { font-weight: 500; }

/* Select2 (usado en algunas vistas) */
.sf-main .select2-container--default .select2-selection--single,
.sf-main .select2-container--default .select2-selection--multiple {
  border: 1px solid #dfe3ee;
  border-radius: 11px;
  min-height: 42px;
  padding: .2rem .35rem;
}

.sf-main .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 32px;
  color: var(--sf-body);
}

.sf-main .select2-container--default.select2-container--focus .select2-selection--single,
.sf-main .select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--sf-primary);
  box-shadow: 0 0 0 .2rem rgba(102, 126, 234, .18);
}

.sf-main .select2-dropdown {
  border: 0;
  border-radius: 12px;
  box-shadow: var(--sf-shadow-lg);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Avisos, etiquetas y componentes
   -------------------------------------------------------------------------- */

.sf-main .alert {
  border: 0;
  border-left: 4px solid;
  border-radius: var(--sf-radius-sm);
  box-shadow: var(--sf-shadow-sm);
  font-weight: 500;
  padding: .85rem 1rem;
}

.sf-main .alert-success { background: #eafaf2; border-left-color: #12b76a; color: #05603a; }
.sf-main .alert-danger  { background: #fef2f3; border-left-color: #f04438; color: #7a271a; }
.sf-main .alert-warning { background: #fffaeb; border-left-color: #f79009; color: #7a2e0e; }
.sf-main .alert-info    { background: #eff8ff; border-left-color: #2e90fa; color: #0b4a80; }

.sf-main .alert .btn-close { padding: .85rem 1rem; }

.sf-main .badge {
  border-radius: 8px;
  font-weight: 600;
  padding: .42em .62em;
  letter-spacing: .01em;
}

.sf-main .modal-content {
  border: 0;
  border-radius: var(--sf-radius);
  box-shadow: var(--sf-shadow-lg);
  overflow: hidden;
}

.sf-main .modal-header { border-bottom: 1px solid var(--sf-line); }
.sf-main .modal-footer { border-top: 1px solid var(--sf-line); }

.sf-main .dropdown-menu {
  border: 0;
  border-radius: 14px;
  box-shadow: var(--sf-shadow-lg);
  padding: .4rem;
}

.sf-main .dropdown-item {
  border-radius: 10px;
  padding: .5rem .7rem;
  font-weight: 500;
  transition: var(--sf-t);
}

.sf-main .dropdown-item:hover,
.sf-main .dropdown-item:focus {
  background: rgba(102, 126, 234, .12);
  color: var(--sf-primary-d);
}

.sf-main .pagination { gap: .15rem; }

.sf-main .page-link {
  border: 0;
  border-radius: 10px !important;
  margin: 0 1px;
  color: var(--sf-primary-d);
  font-weight: 600;
  padding: .45rem .7rem;
}

.sf-main .page-item.active .page-link {
  background: var(--sf-grad);
  box-shadow: 0 6px 14px rgba(102, 126, 234, .3);
}

.sf-main .nav-tabs { border-bottom: 1px solid var(--sf-line); gap: .25rem; }

.sf-main .nav-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 10px 10px 0 0;
  color: #5b6478;
  font-weight: 600;
}

.sf-main .nav-tabs .nav-link.active {
  color: var(--sf-primary-d);
  background: transparent;
  border-bottom-color: var(--sf-primary);
}

.sf-main .nav-pills .nav-link { border-radius: 10px; font-weight: 600; color: #5b6478; }
.sf-main .nav-pills .nav-link.active { background: var(--sf-grad); color: #fff; }

.sf-main .list-group-item { border-color: var(--sf-line); padding: .8rem 1rem; }
.sf-main .list-group-item:first-child { border-top-left-radius: var(--sf-radius-sm); border-top-right-radius: var(--sf-radius-sm); }
.sf-main .list-group-item:last-child { border-bottom-left-radius: var(--sf-radius-sm); border-bottom-right-radius: var(--sf-radius-sm); }

.sf-main .progress { height: .62rem; border-radius: 999px; background: #eef1f8; }
.sf-main .progress-bar { background: var(--sf-grad); }

.sf-main .breadcrumb { --bs-breadcrumb-divider-color: #9aa3b5; font-size: .88rem; }
.sf-main .breadcrumb-item.active { color: var(--sf-ink-2); font-weight: 600; }

.sf-main .accordion-item { border-color: var(--sf-line); border-radius: var(--sf-radius-sm) !important; overflow: hidden; margin-bottom: .5rem; }
.sf-main .accordion-button { font-weight: 600; }
.sf-main .accordion-button:not(.collapsed) { background: rgba(102, 126, 234, .08); color: var(--sf-primary-d); box-shadow: none; }

/* --------------------------------------------------------------------------
   Pie de página y ajustes finales
   -------------------------------------------------------------------------- */

.sf-footer {
  margin-top: .5rem;
  padding: 1.1rem 1.75rem;
  border-top: 1px solid rgba(23, 31, 56, .08);
  background: rgba(255, 255, 255, .6);
  backdrop-filter: blur(8px);
  color: #6b7280;
  font-size: .82rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.sf-footer strong { color: var(--sf-ink-2); font-weight: 600; }
.sf-footer .sf-dot { opacity: .45; }

/* --------------------------------------------------------------------------
   Adaptación a pantallas pequeñas e impresión
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
  .sf-main { padding: 1.15rem 1rem 2.25rem; }
  .sf-shell .sidebar { position: static; height: auto; border-radius: 0; }
}

@media (max-width: 767.98px) {
  .sf-main { padding: 1rem .85rem 2rem; }
  .sf-main > .d-flex.border-bottom .h2,
  .sf-main > .border-bottom .h2,
  .sf-main > .d-flex.border-bottom h1,
  .sf-main > .border-bottom h1 { font-size: 1.28rem; }
  .sf-footer { padding: .9rem 1rem; }
}

@media print {
  .sf-shell .navbar,
  .sf-shell .sidebar,
  .sf-footer { display: none !important; }
  .sf-main { padding: 0 !important; }
  .sf-shell { background: #fff !important; }
  .sf-main .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ==========================================================================
   Menú lateral plegable  (botón en la barra superior)
   --------------------------------------------------------------------------
   Solo presentación. El botón añade/quita la clase sf-collapsed en <body>
   (ver assets/js/sicofin-ui.js) y la preferencia se recuerda en el navegador.
   Sin JavaScript el menú simplemente se queda desplegado, como hasta ahora.
   ========================================================================== */

.sf-shell .sf-sidebar-btn {
  display: none;                 /* se muestra solo en escritorio (ver media query) */
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-right: .65rem;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--sf-t);
}

.sf-shell .sf-sidebar-btn:hover {
  background: rgba(255, 255, 255, .16);
  transform: translateY(-1px);
}

.sf-shell .sf-sidebar-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .65);
  outline-offset: 2px;
}

@media (min-width: 992px) {
  .sf-shell .sf-sidebar-btn { display: inline-flex; }
}

/* Escritorio: el menú puede plegarse a modo riel de iconos.
   En pantallas menores el menú vive dentro de la barra superior. */
@media (min-width: 992px) {
.sf-shell .sidebar,
.sf-shell .sf-main {
  transition: width .25s cubic-bezier(.4, 0, .2, 1),
              flex-basis .25s cubic-bezier(.4, 0, .2, 1);
}

/* --- Estado plegado (modo riel de iconos) --- */

.sf-shell.sf-collapsed .sidebar {
  flex: 0 0 76px;
  width: 76px;
  max-width: 76px;
  overflow: visible;             /* deja ver las etiquetas flotantes */
}

.sf-shell.sf-collapsed .sf-main {
  flex: 0 0 auto;
  width: calc(100% - 76px);
  max-width: calc(100% - 76px);
}

.sf-shell.sf-collapsed .sidebar .nav-item { margin: .12rem .5rem; }

.sf-shell.sf-collapsed .sidebar .nav-link {
  position: relative;
  justify-content: center;
  padding: .62rem 0;
}

.sf-shell.sf-collapsed .sidebar .nav-link:hover {
  transform: none;
  background: rgba(255, 255, 255, .14);
}

.sf-shell.sf-collapsed .sidebar .nav-link i { width: auto; font-size: 1.15rem; }

/* Etiqueta flotante al pasar el ratón */
.sf-shell.sf-collapsed .sidebar .nav-link > span {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) scale(.96);
  padding: .35rem .6rem;
  border-radius: 8px;
  background: #11141f;
  color: #fff;
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 3;
}

.sf-shell.sf-collapsed .sidebar .nav-link:hover > span,
.sf-shell.sf-collapsed .sidebar .nav-link:focus-visible > span {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* Separadores de sección en modo riel */
.sf-shell.sf-collapsed .sidebar .nav-section-title {
  font-size: 0;
  color: transparent;
  text-align: center;
  padding: .55rem 0 .3rem;
}

.sf-shell.sf-collapsed .sidebar .nav-section-title::before {
  content: '•••';
  font-size: .55rem;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, .22);
}

/* Pie del menú: solo el icono */
.sf-shell.sf-collapsed .sidebar .sf-sidebar-foot {
  margin: .9rem .5rem .25rem;
  padding: .6rem .2rem;
  font-size: 0;
  line-height: 1;
  text-align: center;
}

.sf-shell.sf-collapsed .sidebar .sf-sidebar-foot i { font-size: 1rem; margin: 0; }
} /* fin @media (min-width: 992px) — menú plegable */

/* --------------------------------------------------------------------------
   Menú lateral: empresa activa, grupos plegables y bloque de usuario
   -------------------------------------------------------------------------- */

.sf-shell .sidebar .sf-empresa {
  margin: .3rem .75rem .7rem;
  padding: .7rem .75rem .8rem;
  border-radius: var(--sf-radius-sm);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
}

.sf-shell .sidebar .sf-empresa-top {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .5rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255, 255, 255, .5);
}

.sf-shell .sidebar .sf-empresa-select {
  width: 100%;
  padding: .5rem 1.9rem .5rem .65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  background-color: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23c3c9dc'%3E%3Cpath d='M8 11 3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: 12px;
  cursor: pointer;
  transition: var(--sf-t);
}

.sf-shell .sidebar .sf-empresa-select:hover { background-color: rgba(255, 255, 255, .16); }

.sf-shell .sidebar .sf-empresa-select:focus {
  outline: none;
  border-color: var(--sf-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .28);
}

.sf-shell .sidebar .sf-empresa-select option {
  background-color: #1a1d29;
  color: #fff;
}

.sf-shell .sidebar .sf-empresa-vacio {
  font-size: .78rem;
  color: rgba(255, 255, 255, .5);
}

.sf-shell .sidebar .sf-hint {
  margin: 0 .75rem .6rem;
  padding: .6rem .7rem;
  border-radius: 10px;
  background: rgba(102, 126, 234, .15);
  border: 1px solid rgba(102, 126, 234, .3);
  color: rgba(255, 255, 255, .72);
  font-size: .76rem;
  line-height: 1.45;
}

.sf-shell .sidebar .sf-hint i { margin-right: .3rem; }

/* Grupos plegables */
.sf-shell .sidebar .sf-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  padding: .85rem 1.25rem .35rem;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255, 255, 255, .45);
  transition: var(--sf-t);
}

.sf-shell .sidebar .sf-group-title:hover { color: rgba(255, 255, 255, .85); }

.sf-shell .sidebar .sf-group-title:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .35);
  outline-offset: -2px;
}

.sf-shell .sidebar .sf-group-title i {
  font-size: .7rem;
  transition: transform .25s ease;
}

/* Grupo cerrado: el <ul> correspondiente es hermano adyacente del botón */
.sf-shell .sidebar .sf-group-title.sf-cerrado + ul { display: none; }
.sf-shell .sidebar .sf-group-title.sf-cerrado i { transform: rotate(-90deg); }

/* Bloque de usuario */
.sf-shell .sidebar .sf-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 1rem .7rem .45rem;
  padding: .7rem .75rem;
  border-radius: var(--sf-radius-sm);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
}

.sf-shell .sidebar .sf-user-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sf-grad);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  box-shadow: 0 6px 14px rgba(102, 126, 234, .35);
}

.sf-shell .sidebar .sf-user-data { flex: 1 1 auto; min-width: 0; }

.sf-shell .sidebar .sf-user-name {
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-shell .sidebar .sf-user-role {
  font-size: .72rem;
  color: rgba(255, 255, 255, .55);
  text-transform: capitalize;
}

.sf-shell .sidebar .sf-user-actions { display: flex; gap: .1rem; }

.sf-shell .sidebar .sf-user-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .7);
  font-size: .85rem;
  transition: var(--sf-t);
}

.sf-shell .sidebar .sf-user-actions a:hover,
.sf-shell .sidebar .sf-user-actions a:focus-visible {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.sf-shell .sidebar .sf-version {
  text-align: center;
  font-size: .68rem;
  color: rgba(255, 255, 255, .35);
  padding: .3rem 0 .6rem;
}

/* Modo riel: el selector de empresa, el aviso, el usuario y la versión se
   ocultan (vuelven al desplegar el menú). Los grupos, en cambio, se muestran
   siempre para no perder acceso a ningún módulo. */
@media (min-width: 992px) {
  .sf-shell.sf-collapsed .sidebar .sf-empresa,
  .sf-shell.sf-collapsed .sidebar .sf-hint,
  .sf-shell.sf-collapsed .sidebar .sf-user,
  .sf-shell.sf-collapsed .sidebar .sf-version { display: none; }

  .sf-shell.sf-collapsed .sidebar .sf-group-title {
    justify-content: center;
    padding: .5rem 0 .25rem;
  }

  .sf-shell.sf-collapsed .sidebar .sf-group-title > span,
  .sf-shell.sf-collapsed .sidebar .sf-group-title i { display: none; }

  .sf-shell.sf-collapsed .sidebar .sf-group-title::before {
    content: '•••';
    font-size: .55rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, .22);
  }

  .sf-shell.sf-collapsed .sidebar .sf-group-title.sf-cerrado + ul { display: block; }
  .sf-shell.sf-collapsed .sidebar .nav-link { padding: .55rem 0; }
}

/* ==========================================================================
   Menú lateral: buscador de módulos y favoritos
   --------------------------------------------------------------------------
   Estas clases las crea el JavaScript, por eso sus reglas NO llevan el prefijo
   .sf-shell: así las mismas mejoras funcionan también en el menú del dashboard.
   ========================================================================== */

.sf-buscar {
  position: relative;
  display: flex;
  align-items: center;
  margin: .1rem .75rem .55rem;
}

.sf-buscar > i {
  position: absolute;
  left: .7rem;
  font-size: .78rem;
  color: rgba(255, 255, 255, .45);
  pointer-events: none;
}

.sf-buscar-input {
  width: 100%;
  padding: .5rem 2.1rem .5rem 2rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: .82rem;
  transition: var(--sf-t);
}

.sf-buscar-input::placeholder { color: rgba(255, 255, 255, .42); }

.sf-buscar-input:focus {
  outline: none;
  border-color: var(--sf-primary);
  background: rgba(255, 255, 255, .13);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .25);
}

.sf-buscar-clear {
  position: absolute;
  right: .35rem;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, .55);
  cursor: pointer;
  transition: var(--sf-t);
}

.sf-buscar.sf-con-texto .sf-buscar-clear { display: inline-flex; }
.sf-buscar-clear:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.sf-sin-resultados {
  margin: 0 .85rem .6rem;
  font-size: .76rem;
  color: rgba(255, 255, 255, .5);
}

/* Favoritos */
.sf-favoritos { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sf-favoritos .sf-group-title { cursor: default; }

/* Estrella para marcar un módulo como favorito */
.sidebar .nav-item { position: relative; }
.sidebar .nav-item.sf-con-fav > .nav-link { padding-right: 2.2rem; }

.sf-fav {
  position: absolute;
  top: 50%;
  right: .45rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: rgba(255, 255, 255, .3);
  font-size: .76rem;
  cursor: pointer;
  opacity: 0;
  transition: var(--sf-t);
}

.sidebar .nav-item:hover > .sf-fav { opacity: 1; }
.sf-fav.sf-fav-on { opacity: 1; color: #fbbf24; }
.sf-fav:hover { background: rgba(255, 255, 255, .14); color: #fbbf24; }

.sf-fav:focus-visible {
  opacity: 1;
  outline: 2px solid rgba(255, 255, 255, .5);
  outline-offset: 1px;
}

/* El filtrado nunca debe depender del display de Bootstrap */
.sidebar .nav-item[hidden] { display: none !important; }
.sidebar .sf-group-title[hidden],
.sidebar .nav-section-title[hidden] { display: none !important; }

/* En modo riel no hay sitio para buscador, favoritos ni estrellas */
@media (min-width: 992px) {
  .sf-shell.sf-collapsed .sidebar .sf-buscar,
  .sf-shell.sf-collapsed .sidebar .sf-sin-resultados,
  .sf-shell.sf-collapsed .sidebar .sf-favoritos,
  .sf-shell.sf-collapsed .sidebar .sf-fav { display: none; }
}
