/* style.css – component styles, animations, layout
   NGO Project Performance Dashboard
   CSS variables → themes.css | Responsive breakpoints → responsive.css
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Reset + Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
  line-height: 1.5;
}

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--green-dark);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo {
  font-size: 64px;
  animation: pulse 1.5s infinite;
  display: block;
  margin-bottom: 4px;
}

.loading-title {
  font-size: 24px;
  font-weight: 700;
  margin: 16px 0 8px;
  letter-spacing: -0.5px;
}

.loading-subtitle {
  font-size: 14px;
  opacity: 0.75;
  margin-bottom: 24px;
}

.loading-bar {
  width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-progress {
  height: 100%;
  background: var(--gold-accent);
  border-radius: 2px;
  animation: load-anim 1.5s ease-in-out forwards;
}

@keyframes load-anim {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes skeleton-wave {
  0%   { background-position: 100%; }
  100% { background-position: 0%; }
}

/* ── Header ── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition-slow);
  flex-wrap: wrap;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
}

.logo-icon {
  font-size: 28px;
  line-height: 1;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-org {
  font-weight: 700;
  font-size: 14px;
  color: var(--green-primary);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.header-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-item {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-app);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-clock {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono, 'Courier New', monospace);
  color: var(--green-primary);
  letter-spacing: 1px;
}

.header-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--btn-radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--green-primary);
  color: white;
  border: 1.5px solid var(--green-primary);
}

.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-app);
  border-color: var(--green-primary);
  color: var(--green-primary);
}

.btn-danger {
  background: var(--red-alert);
  color: white;
  border: 1.5px solid var(--red-alert);
}

.btn-danger:hover {
  background: #b71c1c;
  border-color: #b71c1c;
}

.btn-gold {
  background: var(--gold-accent);
  color: #1a1a2e;
  border: 1.5px solid var(--gold-accent);
  font-weight: 700;
}

.btn-gold:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  opacity: 0.7;
  border-radius: 6px;
  transition: opacity var(--transition), background var(--transition);
  line-height: 1;
}

.btn-icon:hover {
  opacity: 1;
  background: var(--bg-app);
}

/* ── Filter Bar ── */
.filter-bar {
  background: var(--bg-filter);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}

.filter-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.filter-grid select,
.filter-select {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
  transition: border-color var(--transition);
  min-width: 110px;
}

.filter-grid select:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--green-primary);
}

#record-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  font-weight: 500;
}

/* ── Nav Tabs ── */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-nav::-webkit-scrollbar {
  height: 3px;
}

.tab-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--green-primary);
  background: var(--kpi-green-bg);
  border-radius: 6px 6px 0 0;
}

.tab-btn.active {
  color: var(--green-primary);
  border-bottom-color: var(--green-primary);
}

/* ── Tab Sections ── */
.tab-section {
  display: none;
  padding: 24px;
}

.tab-section.active {
  display: block;
}

/* ── Main Content ── */
#main-content {
  max-width: 1920px;
  margin: 0 auto;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  padding: 20px;
  margin-bottom: 20px;
  transition: box-shadow var(--transition);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-header h3,
.card-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-header .card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Panel (lighter variant) */
.panel {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--kpi-green-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── KPI Primary Grid (6 cards) ── */
.kpi-primary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--green-primary);
  transition: all var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 56px;
  height: 56px;
  border-radius: 0 0 0 56px;
  opacity: 0.06;
  background: currentColor;
  pointer-events: none;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.kpi-card.kpi-green  { border-left-color: var(--green-primary); }
.kpi-card.kpi-yellow { border-left-color: var(--gold-accent); }
.kpi-card.kpi-red    { border-left-color: var(--red-alert); }
.kpi-card.kpi-orange { border-left-color: var(--orange-warn); }
.kpi-card.kpi-blue   { border-left-color: var(--ngo-blue); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-icon {
  font-size: 20px;
  line-height: 1;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.kpi-semaphore {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kpi-semaphore.green  { background: var(--kpi-green-text); }
.kpi-semaphore.yellow { background: var(--kpi-yellow-text); }
.kpi-semaphore.red    { background: var(--kpi-red-text); }
.kpi-semaphore.orange { background: var(--orange-warn); }

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.kpi-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  margin: 4px 0;
}

.kpi-delta.positive { color: var(--kpi-green-text); }
.kpi-delta.negative { color: var(--kpi-red-text); }
.kpi-delta.neutral  { color: var(--text-muted); }

.kpi-breakdown {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-sparkline {
  width: 100%;
  height: 40px;
  margin-top: 8px;
  opacity: 0.8;
  display: block;
}

/* ── KPI Secondary Grid (18 mini-cards) ── */
.kpi-secondary-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.kpi-mini-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--green-light);
  transition: all var(--transition);
}

.kpi-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-mini-card.kpi-green  { border-top-color: var(--kpi-green-text); }
.kpi-mini-card.kpi-yellow { border-top-color: var(--kpi-yellow-text); }
.kpi-mini-card.kpi-red    { border-top-color: var(--kpi-red-text); }
.kpi-mini-card.kpi-orange { border-top-color: var(--orange-warn); }

.kpi-mini-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  line-height: 1.3;
}

.kpi-mini-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-mini-card.kpi-green  .kpi-mini-value { color: var(--kpi-green-text); }
.kpi-mini-card.kpi-yellow .kpi-mini-value { color: var(--kpi-yellow-text); }
.kpi-mini-card.kpi-red    .kpi-mini-value { color: var(--kpi-red-text); }

/* ── Executive Summary ── */
#exec-summary-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}

.summary-score-ring {
  text-align: center;
  flex-shrink: 0;
}

.summary-score {
  font-size: 52px;
  font-weight: 900;
  color: var(--green-primary);
  line-height: 1;
  letter-spacing: -2px;
}

.summary-class {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
}

.badge-green  { background: var(--kpi-green-bg);  color: var(--kpi-green-text); }
.badge-yellow { background: var(--kpi-yellow-bg); color: var(--kpi-yellow-text); }
.badge-red    { background: var(--kpi-red-bg);    color: var(--kpi-red-text); }
.badge-blue   { background: var(--status-info-bg); color: var(--ngo-blue); }
.badge-orange { background: rgba(230,81,0,.1);    color: var(--orange-warn); }

.summary-dims {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dim-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.dim-row .dim-name {
  font-weight: 600;
  color: var(--text-primary);
}

.dim-row .dim-pct {
  font-weight: 700;
  text-align: right;
  color: var(--text-primary);
}

.progress-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--green-primary);
  border-radius: 4px;
  transition: width 0.8s ease;
}

.progress-bar-fill.fill-yellow { background: var(--gold-accent); }
.progress-bar-fill.fill-red    { background: var(--red-alert); }
.progress-bar-fill.fill-orange { background: var(--orange-warn); }

/* ── Charts Grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.charts-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.charts-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-card .chart-container {
  position: relative;
  height: 280px;
}

.chart-card canvas {
  max-height: 280px;
}

.chart-canvas-wrap {
  position: relative;
  height: 280px;
}

.chart-canvas-wrap.tall {
  height: 340px;
}

.gauge-label {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--green-primary);
  margin-top: -160px;
  position: relative;
  z-index: 1;
}

/* ── Map Styles ── */
.map-card .map-container {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
}

.province-path {
  fill: rgba(46, 125, 50, 0.15);
  stroke: white;
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.3s;
}

.province-path:hover {
  fill: rgba(249, 168, 37, 0.6) !important;
}

.province-label {
  font-size: 9px;
  fill: #333;
  pointer-events: none;
  text-anchor: middle;
  font-weight: 600;
}

.map-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  z-index: 999;
  pointer-events: none;
  min-width: 180px;
  transition: opacity 0.15s;
}

.map-tooltip strong {
  display: block;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.map-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-color {
  width: 24px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.exec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.exec-table th {
  padding: 10px 12px;
  background: var(--green-primary);
  color: white;
  font-weight: 700;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.exec-table th:hover {
  background: var(--green-dark);
}

.exec-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.exec-table tr:hover td {
  background: var(--bg-app);
}

.exec-table tr.row-danger td {
  background: rgba(198, 40, 40, 0.04) !important;
}

.exec-table tr.row-warning td {
  background: rgba(249, 168, 37, 0.06) !important;
}

.table-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.table-controls input[type=search],
.table-search {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  font-size: 12px;
  font-family: var(--font-family);
  background: var(--bg-card);
  color: var(--text-primary);
  min-width: 200px;
  transition: border-color var(--transition);
}

.table-controls input[type=search]:focus,
.table-search:focus {
  outline: none;
  border-color: var(--green-primary);
}

.table-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 0 0;
  font-size: 13px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
  background: var(--green-primary);
  color: white;
  border-color: var(--green-primary);
}

.page-btn.active {
  background: var(--green-primary);
  color: white;
  border-color: var(--green-primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.table-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
}

/* Status badge inside table */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.success { background: var(--kpi-green-bg); color: var(--kpi-green-text); }
.status-badge.warning { background: var(--kpi-yellow-bg); color: var(--kpi-yellow-text); }
.status-badge.danger  { background: var(--kpi-red-bg); color: var(--kpi-red-text); }
.status-badge.info    { background: var(--status-info-bg); color: var(--ngo-blue); }

/* ── Alerts Bar ── */
.alerts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 16px;
}

.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

.alert-badge.critical {
  background: var(--status-danger-bg, var(--kpi-red-bg));
  color: var(--status-danger-text, var(--kpi-red-text));
}

.alert-badge.warning {
  background: var(--status-warning-bg, var(--kpi-yellow-bg));
  color: var(--status-warning-text, var(--kpi-yellow-text));
}

.alert-badge.info {
  background: var(--status-info-bg);
  color: var(--ngo-blue);
}

.alert-badge.success {
  background: var(--kpi-green-bg);
  color: var(--kpi-green-text);
}

/* ── Insights Grid ── */
.insights-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.insight-card {
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 4px solid;
  animation: fadeInUp 0.4s ease both;
}

.insight-card.green {
  background: var(--kpi-green-bg);
  border-left-color: var(--kpi-green-text);
}

.insight-card.yellow {
  background: var(--kpi-yellow-bg);
  border-left-color: var(--kpi-yellow-text);
}

.insight-card.red {
  background: var(--kpi-red-bg);
  border-left-color: var(--kpi-red-text);
}

.insight-card.blue {
  background: var(--status-info-bg);
  border-left-color: var(--ngo-blue);
}

.insight-card.orange {
  background: rgba(230, 81, 0, 0.08);
  border-left-color: var(--orange-warn);
}

.insight-icon {
  font-size: 18px;
  margin-bottom: 6px;
  display: block;
}

.insight-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.insight-msg {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Recommendations ── */
.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-app);
  border-left: 4px solid;
  align-items: flex-start;
}

.rec-card.high   { border-left-color: var(--red-alert); }
.rec-card.medium { border-left-color: var(--gold-accent); }
.rec-card.low    { border-left-color: var(--green-primary); }

.rec-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.rec-body {
  flex: 1;
}

.rec-priority {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.rec-card.high   .rec-priority { color: var(--kpi-red-text); }
.rec-card.medium .rec-priority { color: var(--kpi-yellow-text); }
.rec-card.low    .rec-priority { color: var(--kpi-green-text); }

.rec-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal, rgba(0, 0, 0, 0.5));
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  width: min(560px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}

.modal-close:hover {
  color: var(--red-alert);
  background: var(--kpi-red-bg);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  font-size: 13px;
  font-family: var(--font-family);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--green-primary);
}

.goals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--bg-card);
}

/* ── Comments ── */
#manager-comments {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg-card);
  color: var(--text-primary);
  resize: vertical;
  min-height: 200px;
  transition: border-color var(--transition);
}

#manager-comments:focus {
  outline: none;
  border-color: var(--green-primary);
}

.comments-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  color: white;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 240px;
  max-width: 340px;
  pointer-events: auto;
  border-left: 4px solid rgba(255, 255, 255, 0.4);
}

.toast.success { background: var(--green-primary); }
.toast.error   { background: var(--red-alert); }
.toast.info    { background: var(--ngo-blue, #1565c0); }
.toast.warning {
  background: var(--gold-accent);
  color: #1a1a2e;
}

/* ── Presentation Mode ── */
body.presentation-mode .dashboard-header .header-right { display: none; }
body.presentation-mode .filter-bar                     { display: none; }
body.presentation-mode .tab-nav                        { display: none; }
body.presentation-mode .kpi-value                      { font-size: 32px; }
body.presentation-mode .kpi-primary-grid               { grid-template-columns: repeat(3, 1fr); }
body.presentation-mode .kpi-secondary-grid             { grid-template-columns: repeat(6, 1fr); }
body.presentation-mode .tab-section.active             { padding: 16px; }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-app) 50%, var(--border) 75%);
  background-size: 400% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: 6px;
  color: transparent !important;
}

.skeleton * { visibility: hidden; }

/* ── No Data Message ── */
.no-data-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.no-data-msg .no-data-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* ── Notification Bell ── */
.notif-wrap {
  position: relative;
}

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red-alert);
  color: white;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  min-width: 16px;
  text-align: center;
  line-height: 16px;
  height: 16px;
}

/* ── Import / Audit History ── */
.history-item,
.audit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-app);
  margin-bottom: 6px;
  font-size: 12px;
  gap: 8px;
}

.history-file,
.audit-action {
  font-weight: 600;
  color: var(--text-primary);
}

.history-meta,
.audit-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Donor Tracking ── */
.donor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.donor-card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--green-primary);
  transition: all var(--transition);
}

.donor-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.donor-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.donor-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.donor-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--green-primary);
}

/* ── Beneficiary Stats ── */
.beneficiary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.beneficiary-stat:last-child {
  border-bottom: none;
}

.beneficiary-stat .stat-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.beneficiary-stat .stat-value {
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Timeline / Milestones ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  position: relative;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green-primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--green-primary);
  flex-shrink: 0;
  margin-top: 3px;
  z-index: 1;
  margin-left: 12px;
}

.timeline-dot.done    { background: var(--kpi-green-text); }
.timeline-dot.pending { background: var(--kpi-yellow-text); }
.timeline-dot.late    { background: var(--kpi-red-text); }

.timeline-body {
  flex: 1;
}

.timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Risk Matrix ── */
.risk-matrix {
  display: grid;
  gap: 6px;
}

.risk-row {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-app);
}

.risk-level {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  min-width: 48px;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
}

.risk-level.high   { background: var(--kpi-red-bg);    color: var(--kpi-red-text); }
.risk-level.medium { background: var(--kpi-yellow-bg); color: var(--kpi-yellow-text); }
.risk-level.low    { background: var(--kpi-green-bg);  color: var(--kpi-green-text); }

.risk-desc {
  flex: 1;
  color: var(--text-primary);
}

/* ── Geo / Location Badges ── */
.location-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 52px;
  display: block;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ── Utility Classes ── */
.hidden    { display: none !important; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-green  { color: var(--green-primary); }
.text-gold   { color: var(--gold-accent); }
.text-red    { color: var(--red-alert); }
.text-blue   { color: var(--ngo-blue); }
.text-orange { color: var(--orange-warn); }
.font-bold   { font-weight: 700; }
.font-800    { font-weight: 800; }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4   { gap: 4px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.mt-20   { margin-top: 20px; }
.mb-8    { margin-bottom: 8px; }
.mb-16   { margin-bottom: 16px; }
.mb-20   { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.w-full  { width: 100%; }
.section-gap { margin-bottom: 20px; }
.no-data { color: var(--text-muted); font-size: 13px; padding: 12px 0; }
