/* ───── Variables ───── */
:root {
  --sidebar-w: 260px;
  --sidebar-bg: #e8f0f7;
  --sidebar-hover: #d4e5f7;
  --sidebar-active: #c2dff0;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --topbar-h: 60px;
  --text-muted-custom: #94a3b8;
  --card-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* ───── Reset base ───── */
*, *::before, *::after { box-sizing: border-box; }
body:not(.login-page) {
  font-family: 'Inter', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ───── Sidebar ───── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.sidebar-collapse-control {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
@media (min-width: 992px) {
  body.sidebar-compact { --sidebar-w: 80px; }
  .sidebar-compact .sidebar-logo { padding: 12px 4px; }
  .sidebar-compact .sidebar-logo img { padding: 2px; }
  .sidebar-compact .sidebar-nav .nav-link {
    justify-content: center;
    padding: 12px 8px;
    gap: 0;
  }
  .sidebar-compact .sidebar-nav .nav-link span,
  .sidebar-compact .sidebar-nav .nav-link .arrow,
  .sidebar-compact .sidebar-nav .nav-label,
  .sidebar-compact .submenu .nav-link::before,
  .sidebar-compact .sidebar-footer .user-info > :not(.btn-logout) { display: none; }
  .sidebar-compact .sidebar-nav .nav-link i { font-size: 1.2rem; }
  .sidebar-compact .sidebar-footer { padding: 12px 8px; }
  .sidebar-compact .sidebar-footer .btn-logout { margin: 0 auto !important; }
  .sidebar-compact #menu-dashboard > .submenu { display: none; }
  .sidebar-compact #menu-dashboard > .submenu.sidebar-flyout {
    display: block;
    position: fixed;
    width: 260px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-active);
    border-radius: 0 10px 10px 0;
    box-shadow: 6px 6px 20px rgba(0,0,0,.16);
  }
  body.dark-mode.sidebar-compact #menu-dashboard > .submenu.sidebar-flyout {
    background: #1f2937;
    border-color: #475569;
  }
  .sidebar-flyout::before {
    content: attr(data-title);
    display: block;
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--sidebar-active);
  }
  .sidebar-compact .sidebar-nav .sidebar-flyout .nav-link {
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 16px;
  }
  .sidebar-compact .sidebar-nav .sidebar-flyout .nav-link span,
  .sidebar-compact .sidebar-nav .sidebar-flyout .nav-link .arrow { display: block; }
  .sidebar-compact .sidebar-nav .sidebar-flyout .submenu-level-2 .nav-link {
    padding-left: 28px;
  }
}

/* Logo area */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  background: #e8f0f7;
}
.sidebar-logo img {
  width: 100%;
  max-height: 80px;
  object-fit: contain;
  background: transparent;
  border-radius: 8px;
  padding: 8px;
}

/* Nav */
.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}
.nav-label {
  color: #2c5aa0;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 16px 20px 6px;
}
.sidebar-nav .nav-link {
  color: #0a1929;
  padding: 9px 20px;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .845rem;
  font-weight: 500;
  transition: background .2s, color .2s;
  cursor: pointer;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #0a1929; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #2c5aa0; border-left: 3px solid var(--accent); }
.sidebar-nav .nav-link .arrow {
  margin-left: auto;
  font-size: .7rem;
  transition: transform .25s;
}
.sidebar-nav .nav-link[aria-expanded="true"] .arrow { transform: rotate(90deg); }

/* Submenu */
.submenu { background: rgba(255,255,255,.03); }
.submenu .nav-link {
  padding: 7px 20px 7px 48px;
  font-size: .8rem;
  font-weight: 400;
  color: #0f172a;
}
.submenu .nav-link::before {
  content: '';
  width: 5px; height: 5px;
  background: #475569;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}
.submenu .nav-link:hover { color: #0a1929; }
.submenu .nav-link:hover::before { background: var(--accent); }
.submenu .nav-link.active { color: #0a1929; }
.submenu .nav-link.active::before { background: var(--accent); }
.submenu .submenu-toggle { font-weight: 600; }
.submenu-level-2 { background: rgba(15, 23, 42, .035); }
.submenu-level-2 .nav-link { padding-left: 62px; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,.08);
  flex-shrink: 0;
}
.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0a1929;
}
.sidebar-footer .avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: #fff;
  flex-shrink: 0;
}
.sidebar-footer .user-name { font-size: .82rem; font-weight: 600; color: #0a1929; }
.sidebar-footer .user-role { font-size: .7rem; color: #2c5aa0; }
.sidebar-footer .btn-logout {
  background: #1e293b;
  color: #f8fafc;
}
.sidebar-footer .btn-logout:hover {
  background: #0f172a;
  color: #fff;
}

/* ───── Topbar ───── */
#topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #d4e5f7;
  border-bottom: 1px solid #b8d4f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  z-index: 1030;
  transition: left .3s;
}
#topbar .page-title { font-size: 1rem; font-weight: 600; color: #1e293b; flex: 1; }
#topbar .topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-search-input {
  width: 240px;
  height: 36px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 0 10px;
  color: #1e293b;
  font-size: .82rem;
}
.topbar-search-input:focus {
  outline: 0;
  border-color: #60a5fa;
  box-shadow: 0 0 0 .2rem rgba(96, 165, 250, .22);
}
.btn-topbar {
  width: 36px; height: 36px;
  border: none; background: #f1f5f9;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; cursor: pointer;
  position: relative;
  transition: background .2s;
}
.btn-topbar:hover { background: #e2e8f0; color: #1e293b; }
.user-menu .user-menu-toggle {
  border: none;
  background: #f1f5f9;
  border-radius: 10px;
  height: 36px;
  padding: 0 10px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
  font-size: .8rem;
  font-weight: 600;
}
.user-menu .user-menu-toggle:hover {
  background: #e2e8f0;
}
.user-menu .user-menu-toggle::after {
  margin-left: 2px;
}
.user-menu .avatar {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: #fff;
}
.user-menu-dropdown {
  border: 1px solid #d9e7f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}
.user-menu-dropdown .dropdown-item {
  font-size: .82rem;
}
.badge-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid #fff;
}

/* ───── Notificaciones panel ───── */
.notif-dropdown { position: relative; }
.notif-panel {
  width: 340px;
  max-height: 420px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d9e7f0;
  box-shadow: 0 8px 24px rgba(15,23,42,.14);
  border-radius: 12px;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 600;
  font-size: .88rem;
  border-bottom: 1px solid #e9eff5;
  background: #f8fafc;
}
.btn-notif-clear {
  background: none;
  border: none;
  font-size: .75rem;
  color: var(--primary, #0ea5e9);
  cursor: pointer;
  padding: 0;
}
.btn-notif-clear:hover { text-decoration: underline; }
.notif-list {
  overflow-y: auto;
  max-height: 360px;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.notif-item:hover { background: #f0f7ff; }
.notif-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #e0f2fe;
  color: var(--primary, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.notif-body { flex: 1; min-width: 0; }
.notif-text {
  margin: 0 0 3px;
  font-size: .82rem;
  color: #1e293b;
  line-height: 1.4;
  white-space: normal;
}
.notif-fecha {
  font-size: .72rem;
  color: #94a3b8;
}
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: #94a3b8;
  font-size: .82rem;
  gap: 8px;
}
.notif-empty i { font-size: 1.8rem; }

/* Toggle sidebar (mobile) */
#sidebarToggle { display: none; }

/* ───── Main content ───── */
#main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  flex: 1 0 auto;
  min-height: 0;
  transition: margin-left .3s;
}
.content-wrapper { padding: 28px 28px 40px; }

/* ───── Footer ───── */
#appFooter {
  margin-left: var(--sidebar-w);
  margin-top: auto;
  background: #d4e5f7;
  border-top: 1px solid #b8d4f0;
  color: #1e293b;
}
#appFooter .footer-content {
  min-height: 52px;
  padding: 8px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: .78rem;
  line-height: 1.25;
  font-weight: 500;
}

/* ───── Page header ───── */
.page-header {
  margin-bottom: 24px;
}
.page-header h1,
.page-header h2 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { margin: 0; font-size: .78rem; }
.page-header .breadcrumb-item + .breadcrumb-item::before { content: '/'; }

/* Shared page headers and dashboard shortcuts */
.page-hero {
  border: 1px solid #d7e6f7;
  border-radius: 16px;
  padding: 22px 24px;
  background: linear-gradient(135deg, #0b4f8a 0%, #0ea5b7 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11, 79, 138, .2);
}
.page-hero h1,
.page-hero h2,
.page-hero h3 { color: #fff; font-weight: 700; }
.page-hero p { color: rgba(255, 255, 255, .82); }
.page-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.module-card {
  height: 100%;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.module-card h2 {
  margin: 0 0 12px;
  font-size: .9rem;
  font-weight: 700;
}
#moduleSearchResults { scroll-margin-top: calc(var(--topbar-h) + 16px); }
body.dark-mode #moduleSearchResults {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
body.dark-mode #moduleSearchResults .text-muted { color: #cbd5e1 !important; }
body.dark-mode #moduleSearchResults a { color: #93c5fd; }
.module-search-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
}
.module-search-card h3 { font-size: 1rem; font-weight: 700; margin: 0 0 10px; }
.module-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 1.4rem;
}
.module-search-description { font-size: .85rem; color: #475569; margin-bottom: 20px; }
body.dark-mode .module-search-card { background: #0f172a; border-color: #475569; }
body.dark-mode .module-search-description { color: #cbd5e1; }
body.dark-mode .module-search-icon { background: #1e3a5f; color: #93c5fd; }
body.dark-mode #moduleSearchResults a:hover { color: #fff; }
.module-card .module-subtitle {
  margin: 14px 0 6px;
  color: #64748b;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .45px;
  text-transform: uppercase;
}
.module-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #1e293b;
  font-size: .83rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.module-link:hover {
  background: #eff6ff;
  color: #0b4f8a;
}
.module-link i { color: #0b73a7; }
.error-code {
  margin: 4px 0 8px;
  color: #0b4f8a;
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: 1;
}

/* ───── Stat Cards ───── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #e2e8f0;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .78rem; color: #64748b; margin-top: 2px; }
.stat-badge {
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 6px;
  display: inline-block;
}

/* ───── Generic card ───── */
.dash-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.dash-card .card-header-custom {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-card .card-header-custom h5 {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
}
.dash-card .card-body-custom { padding: 20px; }

/* ───── Info cards (horizontal) ───── */
.info-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  border: 1px solid #e2e8f0;
  padding: 18px 20px;
  height: 100%;
}
.info-card .ic-title { font-size: .75rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; }
.info-card .ic-val { font-size: 1.5rem; font-weight: 700; margin: 4px 0 2px; }
.info-card .ic-sub { font-size: .78rem; color: #64748b; }

/* ───── Progress ───── */
.progress { height: 6px; border-radius: 4px; background: #f1f5f9; }

/* ───── Badges ───── */
.badge-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-status.entregado   { background: #dcfce7; color: #16a34a; }
.badge-status.transito    { background: #dbeafe; color: #2563eb; }
.badge-status.pendiente   { background: #fef9c3; color: #854d0e; }
.badge-status.preparacion { background: #ede9fe; color: #7c3aed; }
.badge-status.retrasado   { background: #fee2e2; color: #b91c1c; }

/* ───── Table toolbar ───── */
#filtroCedisEmpleado { height: 36px; }
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.table-toolbar .search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.table-toolbar .search-box i {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: .85rem;
}
.table-toolbar .search-box input {
  padding-left: 32px;
  font-size: .83rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  height: 36px;
  width: 100%;
}
.table-toolbar .search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

/* ───── DataTables override ───── */
.dataTables_wrapper .dataTables_filter { display: none; }
.dataTables_wrapper .dataTables_length label { font-size: .8rem; }
.dataTables_wrapper .dataTables_info { font-size: .78rem; color: #64748b; }
.dataTables_wrapper .dataTables_paginate .paginate_button { font-size: .78rem !important; }
.dataTables_wrapper .dt-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.dataTables_wrapper .dt-buttons .btn { margin: 0; border-radius: 7px; }
.btn.btn-excel,
.dataTables_wrapper .dt-buttons .btn.btn-excel {
  color: #198754;
  background: transparent;
  border: 1px solid #198754;
  border-radius: 7px;
  padding: .25rem .5rem;
  font-size: .875rem;
  line-height: 1.5;
  box-shadow: none;
  text-shadow: none;
}
.btn.btn-excel:hover:not(:disabled),
.btn.btn-excel:active:not(:disabled),
.dataTables_wrapper .dt-buttons .btn.btn-excel:hover:not(:disabled),
.dataTables_wrapper .dt-buttons .btn.btn-excel:active:not(:disabled) {
  color: #fff;
  background: #198754;
  border-color: #198754;
}
.btn.btn-excel:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 .25rem rgba(25,135,84,.25);
}
.btn.btn-excel:disabled { opacity: .65; }
.dataTables_wrapper .dataTables_length select { border: 1px solid #cbd5e1; border-radius: 7px; padding: 4px 22px 4px 8px; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  border: 1px solid #0b73a7 !important;
  border-radius: 7px;
  background: #0b73a7 !important;
  color: #fff !important;
}
table.dataTable thead th {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0 !important;
}
table.dataTable tbody td { font-size: .82rem; vertical-align: middle; }
table.dataTable tbody tr:hover { background: #f8fafc; }
.table-responsive { border-radius: 10px; }
.table > :not(caption) > * > * { padding: .72rem .8rem; }
.table {
  --bs-table-striped-bg: transparent;
}
.table > tbody > tr:nth-child(odd) > * {
  --bs-table-bg: #fff;
  background-color: #fff;
}
.table > tbody > tr:nth-child(even) > * {
  --bs-table-bg: #f8fafc;
  background-color: #f8fafc;
}
body.dark-mode .table > tbody > tr:nth-child(odd) > * {
  --bs-table-bg: #0f172a;
  background-color: #0f172a;
}
body.dark-mode .table > tbody > tr:nth-child(even) > * {
  --bs-table-bg: #1e293b;
  background-color: #1e293b;
}
table.table > thead > tr > * {
  --bs-table-bg: #e0f2fe;
  background-color: #e0f2fe;
  color: #075985;
}
body.dark-mode .table > thead > tr > * {
  --bs-table-bg: #164e63;
  background-color: #164e63;
  color: #e0f2fe;
}
.table > :not(caption) > * > :not(:last-child) {
  border-right: 1px solid #e2e8f0;
}
body.dark-mode .table > :not(caption) > * > :not(:last-child) {
  border-right-color: #334155;
}
.modal-content {
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}
.modal-header { background: #f8fafc; border-bottom-color: #e2e8f0; }
.modal-footer { background: #fbfdff; border-top-color: #e2e8f0; }
.modal-title { color: #1e293b; font-size: 1rem; font-weight: 700; }
.form-label { color: #334155; font-size: .82rem; font-weight: 600; }
.btn { transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s, transform .15s; }
.btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(14, 165, 183, .24);
}

@media (max-width: 575.98px) {
  .content-wrapper { padding: 18px 14px 28px; }
  .page-hero { padding: 18px; }
  .dataTables_wrapper .dt-buttons { margin-top: 8px; }
}

/* ───── Timeline ───── */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 14px; top: 0; bottom: 0;
  width: 2px;
  background: #e2e8f0;
}
.timeline li {
  padding: 0 0 18px 36px;
  position: relative;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: 6px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .55rem;
  border: 2px solid #fff;
}
.tl-title { font-size: .83rem; font-weight: 600; }
.tl-meta  { font-size: .73rem; color: #94a3b8; }

/* ───── Dark mode (header/footer + menu) ───── */
body.dark-mode #topbar,
body.dark-mode #appFooter {
  background: #0f172a;
  border-color: #1e293b;
  color: #e2e8f0;
}
body.dark-mode #topbar .page-title {
  color: #e2e8f0;
}
body.dark-mode #appFooter .footer-content {
  color: #cbd5e1;
}

body.dark-mode #sidebar,
body.dark-mode .sidebar-logo,
body.dark-mode .sidebar-footer,
body.dark-mode .submenu {
  background: #1f2937;
}
body.dark-mode .sidebar-logo {
  border-bottom: 1px solid rgba(255,255,255,.1);
}
body.dark-mode .sidebar-logo img {
  background: #fff;
}
body.dark-mode .sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.1);
}
body.dark-mode .nav-label {
  color: #93c5fd;
}
body.dark-mode .sidebar-nav .nav-link {
  color: #e2e8f0;
}
body.dark-mode .sidebar-nav .nav-link:hover {
  background: #334155;
  color: #fff;
}
body.dark-mode .sidebar-nav .nav-link.active {
  background: #3b4253;
  color: #93c5fd;
}
body.dark-mode .submenu .nav-link,
body.dark-mode .submenu .nav-link:hover,
body.dark-mode .submenu .nav-link.active {
  color: #dbeafe;
}
body.dark-mode .submenu .nav-link::before {
  background: #94a3b8;
}
body.dark-mode .sidebar-footer .user-info,
body.dark-mode .sidebar-footer .user-name {
  color: #e2e8f0;
}
body.dark-mode .sidebar-footer .user-role {
  color: #93c5fd;
}

body.dark-mode .btn-topbar,
body.dark-mode .user-menu .user-menu-toggle {
  background: #1e293b;
  color: #cbd5e1;
}
body.dark-mode .topbar-search-input {
  background: #111827;
  border-color: #334155;
  color: #e2e8f0;
}
body.dark-mode .topbar-search-input::placeholder {
  color: #94a3b8;
}
body.dark-mode .btn-topbar:hover,
body.dark-mode .user-menu .user-menu-toggle:hover {
  background: #334155;
  color: #fff;
}
body.dark-mode .user-menu-dropdown {
  background: #0f172a;
  border-color: #334155;
}
body.dark-mode .user-menu-dropdown .dropdown-item {
  color: #cbd5e1;
}
body.dark-mode .user-menu-dropdown .dropdown-item:hover {
  background: #1e293b;
  color: #fff;
}
body.dark-mode .user-menu-dropdown .dropdown-divider {
  border-top-color: #334155;
}

/* ───── Responsive ───── */
@media (max-width: 991.98px) {
  .sidebar-collapse-control { display: none; }
  #sidebar { transform: translateX(-100%); }
  #sidebar.show { transform: translateX(0); }
  #topbar { left: 0; }
  #main   { margin-left: 0; }
  #appFooter { margin-left: 0; }
  .user-menu .user-name-header { display: none; }
  .topbar-search-input { width: 170px; }
  #sidebarToggle { display: flex; }
  .overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1039;
  }

  @media (max-width: 575.98px) {
    .topbar-search-input { width: 135px; }
  }
  .overlay.show { display: block; }
}


/* Accordion de permisos */
#accordionPermisos .accordion-button:not(.collapsed) {
    background-color: #e8f0fe;
    color: #0d47a1;
}

#accordionPermisos .accordion-button:not(.collapsed) i {
    color: #0d47a1 !important;
}

#accordionPermisos .form-check-input:checked {
    background-color: #198754;
    border-color: #198754;
}

#accordionPermisos .accordion-item {
    border-left: 3px solid transparent;
}

#accordionPermisos .accordion-item:has(.accordion-button:not(.collapsed)) {
    border-left-color: #0d47a1;
}
/* ───── Modales con presentación ───── */
.modal-app .modal-content { border: 0; border-radius: 18px; }
.modal-app .modal-header-app {
  padding: 18px 22px;
  border-bottom: 0;
  background: linear-gradient(135deg, #0b4f8a 0%, #0ea5b7 100%);
  color: #fff;
}
.modal-app .modal-header-app.modal-header-edit {
  background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%);
}
.modal-app .modal-header-app .modal-title { color: #fff; font-size: 1.08rem; margin: 0; }
.modal-app .modal-subtitle-app { color: rgba(255, 255, 255, .85); font-size: .78rem; }
.modal-app .modal-icon-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .35);
  font-size: 1.3rem;
}
.modal-app .modal-body { background: #f4f8fc; padding: 20px 22px; }
.modal-app .modal-footer { background: #fff; padding: 12px 22px; }

.form-section-app {
  position: relative;
  margin-bottom: 16px;
  padding: 16px 18px 18px;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0ea5b7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}
.form-section-app:nth-of-type(2) { border-left-color: #3b82f6; }
.form-section-app:nth-of-type(3) { border-left-color: #8b5cf6; }
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #0b4f8a;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.form-section-title i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0284c7;
  font-size: .9rem;
}
.form-section-app:nth-of-type(2) .form-section-title i { background: #dbeafe; color: #2563eb; }
.form-section-app:nth-of-type(3) .form-section-title i { background: #ede9fe; color: #7c3aed; }

.modal-app .input-group-text {
  min-width: 40px;
  justify-content: center;
  border-color: #dbe4f0;
  background: #f1f7fd;
  color: #0b4f8a;
}
.modal-app .form-control,
.modal-app .form-select { border-color: #dbe4f0; }
.modal-app .form-control:focus,
.modal-app .form-select:focus {
  border-color: #0ea5b7;
  box-shadow: 0 0 0 .2rem rgba(14, 165, 183, .18);
}
.modal-app .form-control[readonly],
.modal-app .form-select:disabled { background: #eef2f7; color: #64748b; }
.form-hint-app {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: .78rem;
}

.btn-gradient-app,
.btn-warning-app {
  border: 0;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(11, 79, 138, .22);
}
.btn-gradient-app { background: linear-gradient(135deg, #0b4f8a 0%, #0ea5b7 100%); }
.btn-warning-app { background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%); box-shadow: 0 6px 14px rgba(180, 83, 9, .22); }
.btn-gradient-app:hover,
.btn-warning-app:hover { color: #fff; filter: brightness(1.07); transform: translateY(-1px); }

.modal-app #accordionPermisos { border: 0 !important; }
.modal-app #accordionPermisos .accordion-item {
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.modal-app #accordionPermisos .accordion-button:not(.collapsed) { background: #e0f2fe; color: #0b4f8a; }

.pago-flujo {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.pago-flujo > div {
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}
.pago-flujo span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  height: 36px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0b4f8a;
  font-weight: 700;
}
.pago-flujo small { color: #64748b; }
.pago-captura { background: #f8fafc; }
.pago-pasos { gap: 6px; }
.pago-pasos .nav-link {
  border: 1px solid #dbe5ef;
  background: #fff;
  color: #475569;
  font-size: .8rem;
}
.pago-pasos .nav-link.active { background: #0b4f8a; }
.pago-resumen {
  position: sticky;
  top: 0;
  padding: 20px;
  border: 1px solid #dbe5ef;
  border-radius: 16px;
  background: #fff;
}
.pago-resumen dt { margin-top: 14px; color: #64748b; font-weight: 400; }
.pago-resumen dd { margin: 3px 0 0; color: #0b4f8a; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
  .pago-flujo { grid-template-columns: 1fr; }
  .pago-flujo > div { padding: 10px 14px; }
}
