:root {
  --nav-green: #3d9b44;
  --nav-green-dark: #2d7a33;
  --nav-green-deep: #1e5a24;
  --nav-gold: #d4a017;
  --nav-brown: #6b4f2a;
  --nav-red: #ce1126;
  --nav-navy: #0a165e;
  --nav-ink: #14201a;
  --nav-muted: #5c6b62;
  --nav-line: #e3ebe4;
  --nav-surface: #f4f7f4;
  --nav-card: #ffffff;
  --nav-sidebar: #0f1f14;
  --nav-radius: 14px;
  --nav-shadow: 0 10px 30px rgba(15, 31, 20, 0.08);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--nav-ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(61, 155, 68, 0.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(212, 160, 23, 0.10), transparent 50%),
    var(--nav-surface);
  min-height: 100%;
}

a { color: var(--nav-green-dark); text-decoration: none; }
a:hover { color: var(--nav-green); }

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #122318 0%, var(--nav-sidebar) 100%);
  color: #fff;
  padding: 1.25rem 1rem 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 1rem;
}

.brand img {
  max-width: 100%;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  align-self: flex-start;
}

.brand-title {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
  font-weight: 700;
}

.brand-product {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-top: -0.35rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: rgba(255,255,255,0.82);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
  border-left: 3px solid transparent;
}

.nav-list a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.nav-list a.active {
  background: rgba(61, 155, 68, 0.18);
  color: #fff;
  border-left-color: var(--nav-green);
}

.nav-list .ico {
  width: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  opacity: 0.9;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.35rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-line);
  box-shadow: 0 4px 18px rgba(15, 31, 20, 0.04);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.topbar-title {
  min-width: 0;
}

.topbar-eyebrow {
  margin: 0 0 0.1rem;
  color: var(--nav-green-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-left h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-left p {
  margin: 0.15rem 0 0;
  color: var(--nav-muted);
  font-size: 0.85rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, rgba(61, 155, 68, 0.1), rgba(61, 155, 68, 0.16));
  color: var(--nav-green-deep);
  border: 1px solid rgba(61, 155, 68, 0.22);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-role i {
  font-size: 0.95rem;
  opacity: 0.85;
}

.user-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 0.82rem;
  line-height: 1.25;
  min-width: 0;
}

.user-chip strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}

.user-chip span {
  color: var(--nav-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}

.profile-menu { position: relative; }

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.28rem 0.45rem 0.28rem 0.28rem;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  list-style: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-trigger::-webkit-details-marker { display: none; }

.profile-trigger:hover,
.profile-trigger:focus-visible {
  background: rgba(61, 155, 68, 0.08);
  border-color: rgba(61, 155, 68, 0.15);
  outline: none;
}

.profile-menu[open] .profile-trigger {
  background: rgba(61, 155, 68, 0.1);
  border-color: rgba(61, 155, 68, 0.22);
  box-shadow: 0 4px 14px rgba(61, 155, 68, 0.12);
}

.profile-avatar-wrap {
  display: inline-flex;
  padding: 2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nav-green), var(--nav-gold));
  flex-shrink: 0;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--nav-green-dark), var(--nav-green-deep));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 2px solid #fff;
}

.profile-avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 0.9rem;
  border: none;
  flex-shrink: 0;
}

.profile-chevron {
  color: var(--nav-muted);
  font-size: 1.15rem;
  transition: transform 0.15s ease;
}

.profile-menu[open] .profile-chevron { transform: rotate(180deg); }

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  min-width: 250px;
  overflow: hidden;
  border: 1px solid var(--nav-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(18, 45, 24, 0.14);
  z-index: 50;
}

.profile-menu[open] .profile-dropdown { display: block; }

.profile-dropdown-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  border-bottom: 1px solid var(--nav-line);
  background: linear-gradient(180deg, #f8fbf8 0%, #fff 100%);
}

.profile-dropdown-head strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}

.profile-dropdown-head span {
  color: var(--nav-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.profile-logout {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  color: #a12d2d;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}

.profile-logout i { font-size: 1.1rem; }

.profile-logout:hover { background: #fff3f3; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--nav-green); color: #fff; }
.btn-primary:hover { background: var(--nav-green-dark); }
.btn-secondary { background: #e8eee9; color: var(--nav-ink); }
.btn-danger { background: var(--nav-red); color: #fff; }
.btn-ghost { background: transparent; color: var(--nav-muted); border: 1px solid var(--nav-line); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.record-count {
  color: var(--nav-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--nav-line);
}

.page-link {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--nav-line);
  border-radius: 8px;
  background: var(--nav-card);
  font-size: 0.85rem;
  font-weight: 700;
}

.page-link.disabled {
  color: var(--nav-muted);
  opacity: 0.5;
  pointer-events: none;
}

.page-status {
  color: var(--nav-muted);
  font-size: 0.85rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 2rem;
}

.detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-grid span {
  color: var(--nav-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.detail-grid strong {
  color: var(--nav-ink);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--nav-line);
}

.tab-button {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--nav-muted);
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab-button:hover,
.tab-button.active {
  color: var(--nav-green-dark);
}

.tab-button.active {
  border-bottom-color: var(--nav-green);
}

.tab-count {
  display: inline-flex;
  min-width: 1.4rem;
  justify-content: center;
  margin-left: 0.3rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: #e8eee9;
  font-size: 0.75rem;
}

[hidden] {
  display: none !important;
}

.print-heading {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }

  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .shell,
  .main {
    display: block;
    min-height: auto;
  }

  .content {
    padding: 0;
    max-width: none;
  }

  .print-heading {
    display: block;
    margin-bottom: 8mm;
  }

  .print-heading h1 {
    margin: 0 0 2mm;
    font-size: 20pt;
  }

  .print-heading p {
    margin: 0;
    color: #444;
    font-size: 11pt;
  }

  .card,
  .kpi {
    box-shadow: none;
    border-color: #bbb;
    break-inside: avoid;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4mm;
  }

  .kpi {
    padding: 4mm;
  }

  .kpi .value {
    font-size: 13pt;
  }

  .table-wrap {
    overflow: visible;
  }

  table.data {
    font-size: 9pt;
  }

  table.data th,
  table.data td {
    padding: 2.5mm;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

.content {
  padding: 1.35rem 1.5rem 2.5rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi {
  background: var(--nav-card);
  border: 1px solid var(--nav-line);
  border-radius: var(--nav-radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--nav-shadow);
}

.kpi .label {
  color: var(--nav-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi .value {
  margin-top: 0.35rem;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--nav-ink);
}

.kpi-grid.kpi-grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.kpi-grid.kpi-grid-compact .kpi {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
}

.kpi-grid.kpi-grid-compact .kpi .label {
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

.kpi-grid.kpi-grid-compact .kpi .value {
  margin-top: 0.2rem;
  font-size: 1.05rem;
  line-height: 1.2;
}

.kpi-grid.kpi-grid-compact .kpi-icon {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1rem;
}

.kpi-grid.kpi-grid-compact .kpi-sub {
  margin-top: 0.15rem;
  font-size: 0.72rem;
}

.card {
  background: var(--nav-card);
  border: 1px solid var(--nav-line);
  border-radius: var(--nav-radius);
  box-shadow: var(--nav-shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--nav-line);
}

.card-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.card-body { padding: 1.15rem; }

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--nav-line);
  text-align: left;
  vertical-align: middle;
}

table.data th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nav-muted);
  background: #f8fbf8;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-pending, .badge-partial { background: #fff4d6; color: #8a6200; }
.badge-approved { background: #e5f6e8; color: #1e6b2a; }
.badge-rejected { background: #fde8ea; color: #9b1c2a; }
.badge-sacco { background: #e8f0ff; color: #1e3a8a; }
.badge-fpo { background: #f3e8ff; color: #6b21a8; }
.badge-generated { background: #fff4d6; color: #8a6200; }
.badge-submitted { background: #e8f0ff; color: #1e3a8a; }
.badge-paid { background: #e5f6e8; color: #1e6b2a; }
.badge-mobilizer { background: #e8f0ff; color: #1e3a8a; }
.badge-agripreneur { background: #e7f6ef; color: #1a6b45; }

.mobilizers-role-tabs {
  padding: 0 1rem 0.75rem;
  border-bottom: 1px solid var(--nav-line);
}

.reports-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.reports-page-head-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.reports-page-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--nav-ink);
}
.reports-page-desc {
  margin: 0;
  max-width: 46rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--nav-muted);
}
.reports-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Report type tabs (Comprehensive + views) */
.reports-view-tabs {
  gap: 0.15rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.reports-view-tabs::-webkit-scrollbar { display: none; }
.reports-view-tabs .tab-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.reports-view-tabs .tab-button .bx {
  font-size: 1.05rem;
}

/* Compact, adaptive stat cards */
.kpi-grid.reports-kpis {
  grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.kpi-grid.kpi-grid-compact.reports-kpis .kpi {
  padding: 0.6rem 0.7rem;
}
.kpi-grid.kpi-grid-compact.reports-kpis .kpi-icon {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.kpi-grid.kpi-grid-compact.reports-kpis .kpi .value {
  font-size: 1rem;
}

.reports-card .card-head {
  align-items: flex-start;
}
.reports-card-head-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.reports-card-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--nav-muted);
}

.reports-table-note {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0 1rem 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  background: #f3f8f5;
  color: #3d5244;
  font-size: 0.84rem;
  line-height: 1.45;
}
.reports-table-note .bx {
  flex-shrink: 0;
  margin-top: 0.1rem;
  font-size: 1rem;
  color: var(--nav-green-dark);
}

.reports-table-wrap {
  overflow-x: auto;
}
.reports-data-table th.num,
.reports-data-table td.num {
  text-align: right;
  white-space: nowrap;
}
.reports-table-comprehensive th:first-child,
.reports-table-comprehensive td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 1px 0 0 var(--nav-line);
}
.reports-table-comprehensive thead th:first-child {
  z-index: 2;
}
.reports-data-table .reports-total-row td {
  border-top: 2px solid var(--nav-green-dark);
  background: #eef7ef;
  font-weight: 700;
}
.reports-table-comprehensive .reports-total-row td:first-child {
  background: #eef7ef;
}

.reports-metric-approved { color: #1e6b2a; font-weight: 600; }
.reports-metric-pending { color: #8a6200; font-weight: 600; }

.reports-util {
  display: inline-block;
  min-width: 3rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.reports-util-high { background: #e5f6e8; color: #1e6b2a; }
.reports-util-mid { background: #fff4d6; color: #8a6200; }
.reports-util-low { background: #fde8ea; color: #9b1c2a; }

.data tr.row-inactive td {
  opacity: 0.72;
}
.data tr.row-agripreneur td:first-child strong {
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full { grid-column: 1 / -1; }

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-control[readonly] {
  background: #f3f6f4;
  color: var(--nav-muted, #5a6b5e);
  cursor: default;
}
.required-mark { color: var(--nav-red); }

.file-upload {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  border: 2px dashed #b8c9bb;
  border-radius: 12px;
  background: #f7faf7;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-upload:hover,
.file-upload.has-file {
  border-color: var(--nav-green);
  background: #edf7ee;
}

.file-upload-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 10px;
  background: var(--nav-red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.file-upload-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
}

.file-upload-copy small {
  overflow: hidden;
  color: var(--nav-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.form-group label { font-size: 0.8rem; font-weight: 700; color: var(--nav-muted); }

.form-control,
select.form-control,
textarea.form-control {
  border: 1px solid var(--nav-line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  background: #fff;
}

.form-control:focus {
  outline: 2px solid rgba(61, 155, 68, 0.25);
  border-color: var(--nav-green);
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field .form-control {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nav-muted);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--nav-green-dark);
  background: rgba(61, 155, 68, 0.08);
  outline: none;
}

.password-toggle.is-visible {
  color: var(--nav-green-dark);
}

.check-list {
  display: grid;
  gap: 0.55rem;
  background: #f7faf7;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  padding: 0.9rem;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 1rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 600;
}
.alert-error { background: #fde8ea; color: #9b1c2a; }
.alert-success { background: #e5f6e8; color: #1e6b2a; }
.alert-warn { background: #fff4d6; color: #8a6200; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 14, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow: auto;
}
.modal.modal-lg {
  width: min(820px, 100%);
}
.modal.modal-sm {
  width: min(420px, calc(100% - 2rem));
}
.modal-record .modal-header,
.modal-record .modal-footer {
  padding: 0.85rem 1rem;
}
.modal-record .modal-body {
  padding: 0.85rem 1rem;
  max-height: min(70vh, 520px);
  overflow-y: auto;
}
.modal.modal-record-wide {
  width: min(1040px, calc(100% - 2rem));
  max-height: 94vh;
}
.modal-record-wide .modal-body {
  max-height: 78vh;
  padding: 1.15rem 1.35rem;
}
.modal-record-wide #cigMembersSection {
  padding: 1rem;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  background: #f8faf9;
}
.modal-record-wide .cig-member-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1fr) minmax(130px, 0.7fr);
  gap: 0.55rem;
  align-items: end;
  padding: 0.7rem;
  background: #fff;
  border: 1px solid var(--nav-line);
  border-radius: 10px;
}
.modal-record-wide .cig-member-row > strong {
  grid-column: 1 / -1;
}
@media (max-width: 700px) {
  .modal.modal-record-wide {
    width: min(100%, calc(100% - 0.75rem));
  }
  .modal-record-wide .modal-body {
    padding: 0.85rem;
  }
  .modal-record-wide .cig-member-row {
    grid-template-columns: 1fr;
  }
  .modal-record-wide .cig-member-row > strong {
    grid-column: auto;
  }
}
.modal-record .form-grid {
  grid-template-columns: 1fr;
  gap: 0.7rem;
}
.modal-record .form-group label {
  font-size: 0.76rem;
}
.modal-record .form-control,
.modal-record select.form-control,
.modal-record textarea.form-control {
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
}
.modal-record .form-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nav-muted);
  padding-top: 0.15rem;
}

.modal-grant .modal-header,
.modal-grant .modal-footer {
  padding: 0.75rem 1rem;
}
.modal-grant .modal-body {
  padding: 0.75rem 1rem 0.85rem;
}
.modal-grant .modal-header h3 {
  font-size: 0.98rem;
}
.grant-form-grid {
  gap: 0.65rem;
}
.grant-form-grid .form-group label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--nav-muted);
}
.grant-form-grid .form-control {
  padding: 0.48rem 0.62rem;
  font-size: 0.88rem;
}
.grant-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--nav-muted);
  margin-top: 0.15rem;
  margin-bottom: -0.15rem;
}
.grant-meta-line {
  min-height: 2.05rem;
  display: flex;
  align-items: center;
  padding: 0.48rem 0.62rem;
  border-radius: 10px;
  background: #f3f6f4;
  color: var(--nav-muted);
  font-size: 0.86rem;
}
.grant-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #f8faf9;
  border: 1px solid var(--nav-line);
}
.grant-preview-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--nav-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.grant-preview strong {
  font-size: 0.92rem;
  color: var(--nav-ink);
}
.modal-record .form-section-lead {
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
}
.modal-record .modal-header h3 {
  font-size: 0.98rem;
}
.modal-record .modal-subtitle {
  margin: 0.15rem 0 0;
  color: var(--nav-muted);
  font-size: 0.78rem;
}

.mob-detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  color: var(--nav-muted);
  font-size: 0.82rem;
}
.mob-detail-breadcrumb a {
  color: var(--nav-green-dark);
  font-weight: 700;
  text-decoration: none;
}
.mob-detail-breadcrumb a:hover { text-decoration: underline; }
.mob-detail-breadcrumb span[aria-current="page"] {
  color: var(--nav-ink);
  font-weight: 700;
}

.mob-detail-panel {
  margin-bottom: 0.85rem;
}
.mob-detail-panel-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 0.95rem 1.1rem;
}
.mob-detail-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.mob-detail-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, #edf7ee, #d8eadb);
  color: var(--nav-green-dark);
  font-size: 0.9rem;
  font-weight: 800;
}
.mob-detail-profile-body { min-width: 0; }
.mob-detail-profile-body h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}
.mob-detail-subline {
  margin: 0.25rem 0 0;
  color: var(--nav-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-detail-kpis {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
}
.mob-detail-kpi {
  min-width: 58px;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--nav-line);
  background: #f8fbf8;
  text-align: center;
}
.mob-detail-kpi strong {
  display: block;
  font-size: 1rem;
  line-height: 1;
  color: var(--nav-ink);
}
.mob-detail-kpi span {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nav-muted);
}
.mob-detail-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}
.mob-detail-action-note {
  max-width: 180px;
  color: var(--nav-muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: right;
}
.mob-detail-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  padding: 0.55rem 1.1rem 0.85rem;
  border-top: 1px solid var(--nav-line);
  background: #fafcfa;
  color: var(--nav-muted);
  font-size: 0.78rem;
}
.mob-detail-foot strong { color: var(--nav-ink); }

.mob-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1.1rem 0;
}
.mob-status-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  background: #fff;
  color: var(--nav-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mob-status-tab:hover {
  border-color: #b8c9bb;
  color: var(--nav-ink);
}
.mob-status-tab.active {
  border-color: var(--nav-green);
  background: #edf7ee;
  color: var(--nav-green-dark);
}
.grants-page-head,
.page-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.grants-page-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grants-filters,
.page-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: var(--nav-card);
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  box-shadow: var(--nav-shadow);
}

.grants-filters .form-group,
.page-filters .form-group {
  margin: 0;
  min-width: 0;
}

.grants-filters label,
.page-filters label {
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.grants-filters .form-control,
.page-filters .form-control {
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  border-radius: 8px;
  min-height: 2.1rem;
}

.grants-filters .grants-search,
.page-filters .page-filter-search,
.page-filters .grants-search,
.page-filters .users-search {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 260px;
}

.grants-filters .form-group:not(.grants-search),
.page-filters .form-group:not(.page-filter-search):not(.grants-search):not(.users-search) {
  flex: 0 1 130px;
  min-width: 110px;
}

.grants-filters .grants-clear-btn,
.page-filters .page-filter-clear {
  align-self: flex-end;
  margin-bottom: 1px;
}

.page-filters .filters-action-btn {
  align-self: flex-end;
  margin-bottom: 1px;
}

.users-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.users-page-head .record-count { margin: 0; }
.users-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.users-segment-tabs {
  margin-bottom: 0.85rem;
}

.users-status-tabs {
  padding-bottom: 0.75rem;
}
button.mob-status-tab {
  cursor: pointer;
  font-family: inherit;
}
.users-row-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
}
.users-actions-cell {
  width: 1%;
  white-space: nowrap;
  position: relative;
}

.row-action-menu {
  position: relative;
  display: inline-block;
}

.row-action-menu > summary {
  list-style: none;
}

.row-action-menu > summary::-webkit-details-marker {
  display: none;
}

.row-action-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  padding-inline: 0.55rem;
  white-space: nowrap;
}

.row-action-menu-trigger .bx {
  font-size: 1rem;
  transition: transform 0.15s ease;
}

.row-action-menu[open] .row-action-menu-trigger .bx-chevron-down {
  transform: rotate(180deg);
}

.row-action-menu-dropdown {
  display: none;
  min-width: 148px;
  padding: 0.35rem;
  border: 1px solid var(--nav-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(18, 45, 24, 0.12);
  z-index: 40;
}

.row-action-menu[open] .row-action-menu-dropdown {
  display: block;
}

.row-action-menu-dropdown.is-fixed {
  position: fixed;
}

.institution-profile-gate {
  z-index: 1000;
  background: rgba(10, 20, 14, 0.72);
  backdrop-filter: blur(3px);
}

.row-action-menu-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nav-ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.row-action-menu-item .bx {
  font-size: 1rem;
  color: var(--nav-muted);
}

.row-action-menu-item:hover,
.row-action-menu-item:focus-visible {
  background: #f3f8f4;
  outline: none;
}

.row-action-menu-item.is-danger {
  color: #b42318;
}

.row-action-menu-item.is-danger .bx {
  color: #b42318;
}

.row-action-menu-item.is-danger:hover,
.row-action-menu-item.is-danger:focus-visible {
  background: #fef3f2;
}
.mob-detail-table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem 0;
}
.mob-detail-table-head h2 {
  margin: 0;
  font-size: 0.95rem;
}
.mob-detail-table-head .record-count {
  font-size: 0.78rem;
}

.form-section-title {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
  color: var(--nav-ink);
}
.form-section-lead {
  margin: 0 0 0.65rem;
  color: var(--nav-muted);
  font-size: 0.84rem;
}
.cig-toggle {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.cig-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}
.cig-toggle label:has(input:checked) {
  border-color: var(--nav-green);
  background: #edf7ee;
  color: var(--nav-green-dark);
}
.cig-search-results {
  max-height: 120px;
  overflow-y: auto;
  margin-top: 0.35rem;
  border: 1px solid var(--nav-line);
  border-radius: 8px;
  background: #fff;
}
.cig-search-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-bottom: 1px solid var(--nav-line);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 0.82rem;
}
.cig-search-item:last-child { border-bottom: 0; }
.cig-search-item:hover { background: #f7faf7; }
.cig-selected-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #e5f6e8;
  color: #1e6b2a;
  font-size: 0.78rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .mob-detail-panel-inner {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .mob-detail-action {
    align-items: stretch;
  }
  .mob-detail-action-note {
    max-width: none;
    text-align: left;
  }
}
@media (max-width: 768px) {
  .mob-detail-kpis { justify-content: flex-start; }
}
.modal-header, .modal-footer {
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.modal-header { border-bottom: 1px solid var(--nav-line); }
.modal-footer { border-top: 1px solid var(--nav-line); justify-content: flex-end; }
.modal-body { padding: 1.15rem; }
.modal-header h3 { margin: 0; font-size: 1.05rem; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, rgba(15,31,20,0.92), rgba(30,90,36,0.85)),
    url("../img/logo.png") center/cover no-repeat;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.96);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 25px 70px rgba(0,0,0,0.35);
}

.login-card .logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.login-card .logo-wrap img {
  max-width: 320px;
  max-height: 105px;
  object-fit: contain;
  height: auto;
}
.login-card h1 {
  margin: 0.5rem 0 0.2rem;
  text-align: center;
  font-size: 1.35rem;
}
.login-card .sub {
  text-align: center;
  color: var(--nav-muted);
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.onboarding-page {
  padding: 1.25rem;
}

.onboarding-card {
  width: min(560px, 100%);
  background: rgba(255,255,255,0.97);
  border-radius: 18px;
  padding: 1.5rem 1.65rem 1.65rem;
  box-shadow: 0 25px 70px rgba(0,0,0,0.35);
}

.onboarding-card .logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.onboarding-card .logo-wrap img {
  max-width: 280px;
  max-height: 90px;
  object-fit: contain;
}

.onboarding-card h1 {
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
}

.onboarding-card .sub {
  text-align: center;
  color: var(--nav-muted);
  margin: 0.45rem 0 1rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.onboarding-form-grid {
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.onboarding-submit {
  width: 100%;
  margin-top: 0.85rem;
}

.onboarding-foot {
  margin-top: 1rem !important;
  margin-bottom: 0 !important;
}

@media (max-width: 640px) {
  .onboarding-form-grid { grid-template-columns: 1fr; }
}

.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--nav-muted);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: #fff;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  color: var(--nav-green-deep);
  font-size: 1.35rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: #f4f8f4;
  border-color: rgba(61, 155, 68, 0.25);
  outline: none;
  box-shadow: 0 2px 8px rgba(61, 155, 68, 0.1);
}

body.profile-menu-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 14, 0.25);
  z-index: 15;
  pointer-events: none;
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-chip strong,
  .user-chip span { max-width: 8rem; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    z-index: 50;
    transition: transform 0.2s ease;
    width: min(280px, 85vw);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }

  .topbar {
    padding: 0.65rem 0.85rem;
    gap: 0.65rem;
  }

  .topbar-left {
    gap: 0.65rem;
  }

  .topbar-left h1 {
    font-size: 1.02rem;
  }

  .topbar-eyebrow {
    font-size: 0.66rem;
  }

  .badge-role {
    display: none;
  }

  .user-chip,
  .profile-chevron {
    display: none;
  }

  .profile-trigger {
    padding: 0.2rem;
    border-radius: 50%;
    min-width: 48px;
    min-height: 48px;
    justify-content: center;
  }

  .profile-avatar-wrap {
    padding: 3px;
  }

  .profile-avatar {
    width: 42px;
    height: 42px;
    font-size: 0.85rem;
  }

  .profile-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    min-width: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(18, 45, 24, 0.18);
    z-index: 60;
  }

  .profile-menu[open] {
    position: relative;
    z-index: 65;
  }

  .profile-menu[open] .profile-dropdown {
    animation: nav-slide-up 0.22s ease;
  }
}

@keyframes nav-slide-up {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 420px) {
  .topbar-title {
    max-width: calc(100vw - 7.5rem);
  }
}

/* Skeleton loaders */
@keyframes nav-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #e8eee9 25%, #f4f7f4 50%, #e8eee9 75%);
  background-size: 200% 100%;
  animation: nav-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-label { height: 0.75rem; width: 60%; margin-bottom: 0.5rem; }
.skeleton-value { height: 1.5rem; width: 45%; }
.skeleton-cell { height: 0.85rem; width: 80%; }

.kpi-skeleton { min-height: 88px; }
.kpi-grid.is-loading { min-height: 100px; }

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: rgba(61, 155, 68, 0.12);
  color: var(--nav-green-dark);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.kpi-sub {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--nav-muted);
  font-weight: 600;
  white-space: pre-line;
  line-height: 1.55;
}

.kpi-success { border-color: #b8e0be; }
.kpi-success .kpi-icon { background: #e5f6e8; color: #1e6b2a; }
.kpi-warn { border-color: #f0d998; }
.kpi-warn .kpi-icon { background: #fff4d6; color: #8a6200; }
.kpi-danger { border-color: #f5c2c7; }
.kpi-danger .kpi-icon { background: #fde8ea; color: #9b1c2a; }
.kpi-neutral .kpi-icon { background: #eef2ef; color: var(--nav-muted); }

.card.table-loading { position: relative; }
.card.table-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.45);
  pointer-events: none;
  z-index: 2;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

table.data tbody tr:hover td {
  background: #f8fbf8;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--nav-muted);
}

.empty-state i {
  font-size: 2.5rem;
  color: #b8c9bb;
  margin-bottom: 0.75rem;
  display: block;
}

.empty-state p {
  margin: 0 0 1rem;
  font-weight: 600;
}

.filters .btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.nav-toast.swal2-popup {
  font-family: var(--font);
  border-radius: 12px;
  box-shadow: var(--nav-shadow);
}

.swal2-styled.swal2-confirm {
  background: var(--nav-green) !important;
}

.profile-menu-action,
.profile-logout {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}

.profile-menu-action {
  color: var(--nav-ink);
  border-bottom: 1px solid var(--nav-line);
}

.profile-menu-action:hover {
  background: #f3f8f3;
}

.profile-logout {
  color: #a12d2d;
}

.profile-menu-action i,
.profile-logout i {
  font-size: 1.1rem;
}
