:root {
  /* Marca */
  --brand-navy: #002850;        /* Azul oscuro tomado del volumen del logo */
  --brand-blue: #0050a2;        /* Azul principal del logo */
  --brand-blue-600: #0050a2;    /* Azul operacional ya usado en el sistema */
  --brand-blue-700: #003a77;
  --brand-sky: #d5e3f2;         /* Reflejos claros de las alas */
  --brand-silver: #c2cbd2;      /* Gris plata del logo */
  --brand-lime: #c7e212;        /* Acento del símbolo & */

  /* Fondos que descansan la vista */
  --bg-app: #f4f7fb;
  --bg-app-soft: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --surface-blue: #eef5ff;

  /* Texto */
  --text-main: #172033;
  --text: #223047;
  --text-soft: #475569;
  --muted: #69707d;
  --muted-2: #94a3b8;

  /* Bordes y sombras */
  --border: #dce6f2;
  --border-soft: #edf2f8;
  --border-strong: #bfd0e5;
  --ring: rgba(0, 80, 162, 0.18);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 22px 55px rgba(15, 23, 42, 0.15);

  /* Estados contables */
  --status-paid-bg: #ecfdf5;
  --status-paid-text: #047857;
  --status-paid-border: #a7f3d0;

  --status-pending-bg: #fff7ed;
  --status-pending-text: #c2410c;
  --status-pending-border: #fed7aa;

  --status-rejected-bg: #fef2f2;
  --status-rejected-text: #b91c1c;
  --status-rejected-border: #fecaca;

  --status-info-bg: #e6eef7;
  --status-info-text: #003a77;
  --status-info-border: #a9c3de;

  /* Medidas */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --font-ui: "Instrument Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-number: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  color-scheme: light;
  font-family: var(--font-ui);
}

/* ==========================================================================
   Base global
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 95% 0%, rgba(0, 80, 162, 0.08), transparent 30%),
    linear-gradient(180deg, var(--bg-app-soft) 0%, var(--bg-app) 100%);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--brand-blue-600);
}

a:hover {
  color: var(--brand-blue-700);
}

::selection {
  background: rgba(199, 226, 18, 0.35);
  color: var(--brand-navy);
}

/* ==========================================================================
   Contenedores y encabezados de página
   ========================================================================== */

.container,
.egresos-page,
.historial-page,
.soportes-page,
.detalle-page {
  width: min(100% - 32px, 1600px);
  margin-inline: auto;
}

.detalle-page {
  max-width: 1480px;
}

.page-head,
.egresos-page .page-head,
.historial-page .page-head,
.detalle-page .page-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  padding: var(--space-5);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.page-head:has(.page-head-right) {
  grid-template-rows: auto auto;
}

.page-head-icon {
  grid-column: 1;
  grid-row: 1;
}

.page-head-left {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.page-head-right {
  grid-column: 1 / -1;
  grid-row: 2;
}

.page-head:has(.page-head-right),
.egresos-page .page-head:has(.page-head-right),
.historial-page .page-head:has(.page-head-right),
.detalle-page .page-head:has(.page-head-right) {
  justify-content: space-between;
}

  .page-head h1,
  .egresos-page .page-head h1,
  .historial-page .page-head h1,
  .home-main .page-head h1 {
    display: block !important;
    width: auto !important;
    white-space: normal !important;
    word-spacing: normal !important;
  }

  .page-head-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    min-width: 0;
    flex: 1 1 auto;
  }

.subtitle-main,
.egresos-page .subtitle-main,
.historial-page .subtitle-main,
.detalle-page .subtitle-main {
  margin: var(--space-1) 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 400;
}

.subtitle-main strong {
  color: var(--brand-navy);
  font-weight: 750;
}

/* ==========================================================================
   Botones y acciones
   ========================================================================== */

.actions,
.page-actions,
.egresos-page .actions,
.historial-page .page-actions,
.cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn,
button,
input[type="button"],
input[type="submit"],
.egresos-page .btn,
.historial-page .btn,
.detalle-page .btn,
.btn-compact {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: #1f2937;
  padding: 10px 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease;
}

.btn:hover,
button:hover,
.egresos-page .btn:hover,
.historial-page .btn:hover,
.detalle-page .btn:hover,
.btn-compact:hover {
  background: #f8fbff;
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active,
button:active,
.egresos-page .btn:active {
  transform: translateY(0) scale(0.98);
}

.btn.primary,
.btn.btn-primary,
.egresos-page .btn.btn-primary,
.egresos-page .btn.primary,
.historial-page .btn.primary,
.detalle-page .btn.primary,
.card .login-submit {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-blue-600), var(--brand-blue));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(0, 80, 162, 0.22);
}

.btn.primary:hover,
.btn.btn-primary:hover,
.egresos-page .btn.btn-primary:hover,
.card .login-submit:hover {
  background: linear-gradient(135deg, var(--brand-blue-700), var(--brand-navy));
  box-shadow: 0 14px 28px rgba(0, 40, 80, 0.28);
}

.btn.danger,
.btn-eliminar {
  background: var(--status-rejected-bg);
  border-color: var(--status-rejected-border);
  color: var(--status-rejected-text);
}

.btn.danger:hover,
.btn-eliminar:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* ==========================================================================
   Formularios, filtros e inputs
   ========================================================================== */

.filters,
.egresos-page .filters,
.egresos-list-page .filters,
.historial-page .filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: end;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.filters label,
.egresos-page .filters label,
.historial-page .filters label,
.field,
.field-row {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea,
.card input,
.egresos-page .filters input[type="text"],
.egresos-page .filters input[type="search"],
.egresos-page .filters input[type="date"],
.historial-page .filters input[type="text"],
.historial-page .filters input[type="date"],
.egresos-page .field-row input,
.egresos-page .field-row select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 450;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus,
.card input:focus,
.egresos-page .filters input:focus,
.historial-page .filters input:focus {
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 4px var(--ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.filters-actions,
.egresos-page .filters-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-soft);
}

/* ==========================================================================
   Tablas empresariales
   ========================================================================== */

.table-wrap,
.egresos-page .table-wrap,
.egresos-list-page .table-wrap,
.historial-page .table-wrap,
.soportes-card,
.section-card,
.home-grid {
  width: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.roles-grid {
  width: 100%;
  overflow: visible !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table-wrap {
  overflow-x: auto;
}

table,
.egresos-page table,
.historial-page .table-wrap table,
.detalle-table,
.soportes-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
}

thead th,
.egresos-page thead th,
.historial-page thead th,
.detalle-table th,
.soportes-table th,
.role-title {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #e6eef7 0%, #d5e3f2 100%);
  color: #334155;
  border-bottom: 1px solid var(--border-strong);
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  white-space: nowrap;
}

tbody td,
.egresos-page tbody td,
.historial-page tbody td,
.detalle-table td,
.soportes-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
  vertical-align: middle;
}

tbody tr:nth-child(even) td,
.egresos-page tbody tr:nth-child(even) td,
.historial-page tbody tr:nth-child(even) td {
  background: #fbfdff;
}

tbody tr:hover td,
.egresos-page tbody tr:hover td,
.historial-page tbody tr:hover td,
.detalle-table tbody tr:hover td,
.soportes-table tbody tr:hover {
  background: #f1f7ff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.text-right,
.money,
.kpi-number,
.egresos-page .text-right,
.egresos-page .kpi-number,
.egresos-page tbody td:nth-child(4),
.egresos-page tbody td:nth-child(5),
.egresos-page tbody td:nth-child(6),
.egresos-page tbody td:nth-child(7) {
  text-align: right;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.money,
.kpi-number {
  color: var(--text-main);
  font-weight: 750;
}

/* ==========================================================================
   Estados, badges y alertas contables
   ========================================================================== */

.alert,
.egresos-page .alert,
.msg {
  margin: 0 0 var(--space-4);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 650;
}

.alert-ok,
.egresos-page .alert-ok,
.status-paid,
.badge-pagado,
.badge-soporte-pago {
  background: var(--status-paid-bg);
  border-color: var(--status-paid-border);
  color: var(--status-paid-text);
}

.alert-error,
.egresos-page .alert-error,
.status-rejected,
.badge-rechazado,
.msg {
  background: var(--status-rejected-bg);
  border-color: var(--status-rejected-border);
  color: var(--status-rejected-text);
}

.status-pending,
.badge-pendiente,
.btn-ver-nota {
  background: var(--status-pending-bg);
  border-color: var(--status-pending-border);
  color: var(--status-pending-text);
}

.badge-resumen-pago,
.status-info {
  background: var(--status-info-bg);
  border-color: var(--status-info-border);
  color: var(--status-info-text);
}

.badge-tipo,
.status-paid,
.status-pending,
.status-rejected,
.status-info,
.badge-pagado,
.badge-pendiente,
.badge-rechazado {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

/* ==========================================================================
   Layout: topbar y sidebar
   ========================================================================== */

/* ===== SIDEBAR CORPORATIVO MEJORADO ===== */

.sidebar {
  background: linear-gradient(180deg, #003a77 0%, #002850 100%) !important;
  border-radius: 0 !important;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15) !important;
  padding: 22px 16px !important;
}

.sidebar-header {
  border-bottom: 1px solid rgba(255,255,255,0.18) !important;
  padding-bottom: 18px !important;
}

.sidebar .logo {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 10px 0 !important;
  width: 100% !important;
}

.sidebar .logo img {
  height: 180px !important;
  max-width: 92% !important;
  width: auto !important;
  filter: none !important;
  box-shadow: none !important;
}

.sidebar-nav a,
.nav-group-toggle {
  color: rgba(255,255,255,0.92) !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  font-weight: 600 !important;
  background: transparent !important;
}

.sidebar-nav a i,
.nav-group-toggle i {
  filter: brightness(0) invert(1) !important;
  opacity: 0.9;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav a:hover,
.nav-group-toggle:hover {
  background: rgba(255,255,255,0.12) !important;
  color: #ffffff !important;
}

.sidebar-nav a.active,
.sidebar-nav a[aria-current="page"] {
  background: #0050a2 !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(0, 40, 80, 0.35) !important;
}

.sidebar-nav a.active i,
.sidebar-nav a[aria-current="page"] i {
  filter: brightness(0) invert(1) !important;
  opacity: 1;
}

/* Submenú configuración */
.nav-group-menu a {
  color: rgba(255,255,255,0.82) !important;
  padding-left: 38px !important;
}

.nav-group-menu a:hover {
  background: rgba(255,255,255,0.12) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   Login
   ========================================================================== */

.card {
  border: 1px solid rgba(220, 230, 242, 0.95);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-lg);
}

.logo-intro,
body .logo-intro {
  background:
    radial-gradient(circle at center, rgba(0, 80, 162, 0.12), transparent 35%),
    linear-gradient(135deg, #f8fbff 0%, #eef4fb 100%);
}

.logo-intro-btn img,
.logo-box img {
  filter: drop-shadow(0 18px 28px rgba(0, 40, 80, 0.18));
}

/* ==========================================================================
   Componentes específicos
   ========================================================================== */

.home-card,
.role-card,
.note-card-premium {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.home-card:hover,
.role-card:hover,
.note-card-premium:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.users-toolbar {
  background: #e6eef7;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
}

.users-tab.is-active {
  background: #ffffff;
  color: var(--brand-blue);
  box-shadow: var(--shadow-xs);
}

.user-item {
  border-color: var(--border);
  border-radius: var(--radius-md);
}

.user-item:hover {
  background: #f1f7ff;
  border-color: var(--border-strong);
}

.drop-zone {
  border-color: var(--border);
  background: var(--surface-soft);
}

.drop-zone:hover {
  border-color: var(--brand-blue-600);
  background: #f0f6ff;
}

/* ==========================================================================
   Modales
   ========================================================================== */

.modal,
.egresos-page .modal,
.modal-confirm-eliminar {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.modal-content,
.egresos-page .modal-content,
.modal-confirm-eliminar .modal-content {
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-blue-600);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Accesibilidad y responsive
   ========================================================================== */

:focus-visible {
  outline: 4px solid var(--ring);
  outline-offset: 2px;
}

@media (max-width: 1200px) {
  .page-head,
  .egresos-page .page-head,
  .historial-page .page-head,
  .detalle-page .page-head {
    flex-direction: row;
    align-items: center;
    padding: var(--space-4);
  }

  .actions,
  .page-actions,
  .egresos-page .actions {
    justify-content: stretch;
  }

  .actions .btn,
  .page-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .page-head-right .actions {
    flex-direction: column !important;
    width: 100%;
    gap: 10px;
  }

  .page-head-right .actions form {
    width: 100%;
    margin: 0;
  }

  .page-head-right .actions .btn {
    width: 100%;
  }
  
  .filters,
  .egresos-page .filters,
  .historial-page .filters {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }

  .filters-actions,
  .egresos-page .filters-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .filters-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* Encabezado con ícono */
.page-head {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
}

.page-head-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #e6eef7;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
  box-sizing: border-box;
}

.page-head-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-head-left {
  flex: 0 1 auto;
}

/* Íconos dentro de labels de filtros */
.filters label,
.egresos-page .filters label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
}

.filters label i,
.egresos-page .filters label i,
.filters label svg,
.egresos-page .filters label svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
  color: #64748b;
  stroke-width: 2.2;
  order: -1;
}

/* Ícono dentro del botón Filtrar */
.btn.btn-primary i,
.egresos-page .btn.btn-primary i {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
  stroke-width: 2.4;
}

.filters-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid #edf2f8;
}

.filters-header-text {
  flex: 0 1 auto;
}

.filters-header:has(.filters-header-export) {
  justify-content: space-between;
}

.filters-header-export {
  flex: 0 0 auto;
  margin-left: auto;
}

.filters-header i {
  width: 20px;
  height: 20px;
  color: #0050a2;
  stroke-width: 2.2;
}

.filters-header-text h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0050a2;
}

.filters-header-text p {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 400;
  color: #64748b;
}

.egresos-page thead th,
.table-wrap thead th {
  background: #d5e3f2 !important;
  color: #003a77 !important;
  border-bottom: 2px solid #a9c3de !important;
}

.egresos-page .filters,
.egresos-page .action-toolbar,
.egresos-page .table-wrap {
  margin-bottom: 20px !important;
  border: 1px solid #d5e3f2 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

/* ===== Breadcrumb ===== */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #64748b;
  white-space: nowrap;
}

.breadcrumb-root {
  color: #94a3b8;
}

.breadcrumb-sep {
  color: #cbd5e1;
}

.breadcrumb-current {
  color: #0f172a;
  font-weight: 700;
}

/* ===== Fecha ===== */
.topbar-date {
  font-size: 14px;
  color: #64748b;
  white-space: nowrap;
  margin-right: 20px;
}

.topbar-date::first-letter {
  text-transform: uppercase;
}

/* ===== Perfil con dropdown ===== */
.profile-section {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid #d5e3f2;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.profile-trigger:hover {
  box-shadow: 0 4px 12px rgba(0, 80, 162, 0.10);
  border-color: #a9c3de;
}

.profile-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.topbar-username {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.topbar-role {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  text-transform: capitalize;
}

.profile-caret {
  font-size: 11px;
  color: #94a3b8;
  margin-left: 2px;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid #d5e3f2;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  padding: 6px;
  display: none;
  z-index: 200;
}

.profile-dropdown.open {
  display: block;
}

.profile-dropdown form {
  margin: 0;
}

.dropdown-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dropdown-logout-btn:hover {
  background: #fef2f2;
}

.dropdown-logout-btn .logout-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) saturate(100%) invert(14%) sepia(97%) saturate(7447%) hue-rotate(355deg) brightness(103%) contrast(114%);
}

/* Topbar layout ajustado */
.topbar {
  gap: 20px !important;
}

@media (max-width: 860px) {
  .topbar-breadcrumb,
  .topbar-date {
    display: none;
  }
}

/* Botón "Limpiar Filtros" estilo punteado */
.field-reset {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.field-reset label {
  visibility: hidden;
}

.btn-reset-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 18px;
  border: 1px solid #d5e3f2;
  border-radius: 10px;
  background: #f8fafc;
  color: #0050a2;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-reset-filters i {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
  flex-shrink: 0;
}

.btn-reset-filters:hover {
  background: #e6eef7;
  border-color: #a9c3de;
}

/* Barra de búsqueda completa + botones */
.filters-search-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.filters-search-row .search-control {
  position: relative;
  flex: 1 1 auto;
}

.filters-search-row .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
}

.filters-search-row input {
  width: 100% !important;
  height: 44px !important;
  border-radius: 10px !important;
  border: 1px solid #dbe3f1 !important;
  background: #ffffff !important;
  padding: 10px 14px 10px 42px !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
}

.filters-search-row .btn {
  height: 44px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 24px;
  flex: 0 0 auto;
}

.filters-search-row .btn i {
  width: 15px;
  height: 15px;
}

@media (max-width: 768px) {
  .page-head, .egresos-page .page-head, .historial-page .page-head, .detalle-page .page-head {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }
}

.page-head-right {
  margin-left: auto;
  flex: 0 0 auto;
}

.page-head-right .context-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #e6eef7;
  border: 1px solid #a9c3de;
  color: #003a77;
  font-size: 13px;
  line-height: 1;
}

.page-head-right .context-badge-label {
  font-weight: 600;
  color: #46638d;
}

.page-head-right .context-badge strong {
  font-weight: 700;
  color: #003a77;
}

.egresos-page .filters {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(200px, 1fr)) !important;
  gap: 14px !important;
}

.egresos-page .filters .field {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.egresos-page .filters-search-row {
  grid-column: 1 / -1 !important;
}

.drop-content .icon {
  width: 32px;
  height: 32px;
  color: #64748b;
  stroke-width: 1.6;
  display: block;
  margin: 0 auto;
}

.home-card {
  padding: 20px 20px 16px !important;
}

.home-grid {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.home-card {
  padding: 20px 20px 16px !important;
}

/* 4 columnas en una sola fila */
.upload-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

/* Reduce la altura de los drop-zones */
.drop-zone {
  aspect-ratio: unset !important;
  height: 140px !important;
}

.drop-content .icon {
  width: 26px !important;
  height: 26px !important;
}

.drop-content p {
  font-size: 12px !important;
}

/* Iguala tamaño de texto con "Filtros de Consulta" */
.home-card .filters-header-text h2 {
  font-size: 15px !important;
}

.home-card .filters-header-text p {
  font-size: 12px !important;
}

.field .label-text {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #64748b !important;
}

@media (max-width: 1100px) {
  .upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .upload-grid {
    grid-template-columns: 1fr !important;
  }
}

.home-main {
  max-width: 1600px !important;
  width: min(100% - 32px, 1600px) !important;
  margin-inline: auto !important;
}

.filters-header-export .btn.btn-primary {
  height: 40px;
  padding: 0 18px;
  white-space: nowrap;
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff5f5;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-danger-outline i {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.btn-danger-outline:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.historial-page .filters {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(200px, 1fr)) !important;
  gap: 14px !important;
}

.historial-page .filters .field {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.filters-header-export .limpiar-historial-btn {
  height: 40px;
  padding: 0 18px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filters-header-export .limpiar-historial-btn i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.filters-header-export .btn-icon-export {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.filters-header-export .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}


/* ===== RESPONSIVE: sidebar como overlay en móvil/tablet ===== */
@media (max-width: 1200px) {
  body:has(.sidebar) {
    padding-left: 0 !important;
  }

  .page-head {
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
  }

  .page-head-icon {
    flex-shrink: 0;
  }

  .page-head-left {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }

  .page-head h1,
  .egresos-page .page-head h1,
  .historial-page .page-head h1 {
    width: 100% !important;
    max-width: none !important;
  }

  .page-head .subtitle-main,
  .egresos-page .page-head .subtitle-main {
    width: 100% !important;
    max-width: none !important;
  }

  .page-head-left h1 {
    font-size: 18px !important;
    white-space: normal;
  }

  .page-head-left .subtitle-main {
    font-size: 12px !important;
    white-space: normal;
  }

  .filters-header {
    display: grid !important;
    grid-template-columns: 20px 1fr !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .filters-header:has(.filters-header-export) {
    grid-template-columns: 20px 1fr !important;
    grid-template-rows: auto auto !important;
  }

  .filters-header i {
    grid-column: 1;
    grid-row: 1;
    flex-shrink: 0;
  }

  .filters-header-text {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
  }

  .filters-header-export {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-left: 0 !important;
    width: 100%;
  }

  .filters-header-export .btn {
    width: 100%;
    justify-content: center;
  }

  .sidebar-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.15s ease;
  }

  .sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
  }

  .topbar {
    left: 0 !important;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 300;
    width: 280px !important;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25) !important;
  }

  /* En móvil, "sidebar-collapsed" pasa a significar "abierto" (overlay completo) */
  body.sidebar-collapsed {
    padding-left: 0 !important;
  }

  body.sidebar-collapsed .topbar {
    left: 0 !important;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(0);
    width: 280px !important;
    padding: 18px 14px !important;
  }

  body.sidebar-collapsed .sidebar-nav a,
  body.sidebar-collapsed .nav-group-toggle {
    justify-content: flex-start !important;
    padding: 12px 14px !important;
  }

  body.sidebar-collapsed .sidebar-nav a span,
  body.sidebar-collapsed .nav-group-toggle span,
  body.sidebar-collapsed .nav-submenu {
    display: none;
  }

  body.sidebar-collapsed .nav-submenu {
    display: flex !important;
    flex-direction: column !important;
  }

  body.sidebar-collapsed .nav-submenu a {
    justify-content: flex-start !important;
    padding: 8px 10px !important;
  }

  body.sidebar-collapsed .nav-group-caret {
    display: inline-block !important;
    margin-left: auto !important;
  }

  body.sidebar-collapsed .sidebar-nav a i,
  body.sidebar-collapsed .nav-group-toggle i {
    display: inline-block !important;
  }

  body.sidebar-collapsed .logo img {
    height: 60px !important;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 250;
  }

  body.sidebar-collapsed .sidebar-overlay {
    display: block;
  }
}

@media (max-width: 1150px) {
  .egresos-page .filters,
  .historial-page .filters {
    grid-template-columns: 1fr !important;
  }

  .action-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .action-toolbar-actions {
    width: 100%;
    justify-content: center !important;
  }

  .page-actions.actions-bar-right {
    width: 100%;
    justify-content: center !important;
  }

  .export-inline {
    width: 100%;
    justify-content: center;
  }

  .filters-header:has(.filters-header-export) {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .filters-header-export {
    margin-left: 0 !important;
    width: 100%;
  }

  .filters-header-export .btn {
    width: 100%;
    justify-content: center;
  }

  .filters-search-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .filters-search-row .btn {
    width: 100%;
    justify-content: center;
  }

  .page-head {
    flex-wrap: wrap;
  }

  .page-head-right {
    margin-left: 0 !important;
    width: 100%;
  }
}

.sidebar-close-btn {
  display: none;
}

@media (max-width: 1200px) {
  .page-head {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  .page-head-icon {
    flex: 0 0 48px !important;
  }

  .page-head-left {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: auto !important;
    display: block !important;
  }

  .page-head-left h1,
  .page-head h1 {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    font-size: 18px !important;
    white-space: normal !important;
    word-spacing: normal !important;
  }

  .page-head-left .subtitle-main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 12px !important;
    white-space: normal !important;
  }
}

@media (max-width: 1200px) {
  .page-head {
    display: grid !important;
    grid-template-columns: 48px 1fr !important;
    align-items: center !important;
    gap: 14px !important;
  }

  .page-head:has(.page-head-right) {
    grid-template-columns: 48px 1fr !important;
    grid-template-rows: auto auto !important;
  }

  .page-head-icon {
    grid-column: 1;
    grid-row: 1;
  }

  .page-head-left {
    grid-column: 2;
    grid-row: 1;
    width: 100% !important;
    min-width: 0 !important;
  }

  .page-head-left h1 {
    width: 100% !important;
  }

  .page-head-right {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-left: 0 !important;
    width: 100%;
  }
}

.users-toolbar {
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.users-toolbar .users-tab {
  flex: 1;
  justify-content: center;
}

.kebab-dropdown {
  z-index: 500 !important;
}

.role-card {
  position: relative;
}

.role-card:has(.kebab-dropdown.active) {
  z-index: 400;
}

@media (min-width: 1201px) {
  body {
    font-size: 13px;
  }

  .page-head h1,
  .egresos-page .page-head h1,
  .historial-page .page-head h1 {
    font-size: 1.4rem !important;
  }

  .subtitle-main {
    font-size: 0.85rem;
  }

  .btn,
  button,
  .egresos-page .btn,
  .historial-page .btn,
  .btn-compact {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .filters-header-text h2 {
    font-size: 14px !important;
  }

  .filters-header-text p {
    font-size: 11px !important;
  }

  thead th,
  .egresos-page thead th,
  .historial-page thead th {
    padding: 10px 12px;
    font-size: 10px;
  }

  tbody td,
  .egresos-page tbody td,
  .historial-page tbody td {
    padding: 9px 12px;
    font-size: 12px;
  }

  .page-head,
  .egresos-page .page-head,
  .historial-page .page-head {
    padding: 14px !important;
  }

  .filters,
  .egresos-page .filters,
  .historial-page .filters {
    padding: 14px !important;
    gap: 10px !important;
  }
}

@media (min-width: 601px) and (max-width: 1024px) {
  .egresos-page .table-wrap,
  .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .egresos-page table,
  .table-wrap table {
    min-width: 700px !important;
  }
}

body.sidebar-collapsed .sidebar-nav a,
body.sidebar-collapsed .nav-group-toggle {
  position: relative;
}

@media (min-width: 1201px) {
  body.sidebar-collapsed .sidebar-nav a::after,
  body.sidebar-collapsed .nav-group-toggle::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #002850;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 400;
  }

  body.sidebar-collapsed .sidebar-nav a:hover::after,
  body.sidebar-collapsed .nav-group-toggle:hover::after {
    opacity: 1;
  }
}

@media (max-width: 1200px) {
  body.sidebar-collapsed .sidebar-nav a span,
  body.sidebar-collapsed .nav-group-toggle span,
  body.sidebar-collapsed .nav-submenu {
    display: inline !important;
  }

  body.sidebar-collapsed .nav-submenu {
    display: flex !important;
    flex-direction: column !important;
  }
}

.nota-detalle-page .page-head {
  justify-content: flex-start !important;
}

