/* ============================================================
   Kenya Hustler Fund Intelligence Platform — Design System
   ============================================================ */

/* Local Inter font — offline capable */
@font-face { font-family:'Inter'; font-weight:300; font-style:normal; font-display:swap; src:url('../vendor/fonts/inter-300.ttf') format('truetype'); }
@font-face { font-family:'Inter'; font-weight:400; font-style:normal; font-display:swap; src:url('../vendor/fonts/inter-400.ttf') format('truetype'); }
@font-face { font-family:'Inter'; font-weight:500; font-style:normal; font-display:swap; src:url('../vendor/fonts/inter-500.ttf') format('truetype'); }
@font-face { font-family:'Inter'; font-weight:600; font-style:normal; font-display:swap; src:url('../vendor/fonts/inter-600.ttf') format('truetype'); }
@font-face { font-family:'Inter'; font-weight:700; font-style:normal; font-display:swap; src:url('../vendor/fonts/inter-700.ttf') format('truetype'); }

/* ── CSS Variables ── */
:root {
  --primary:      #1B4F72;
  --primary-dark: #154360;
  --primary-light:#2E86C1;
  --gov-green:    #006600;
  --gov-red:      #BB0000;
  --bg:           #F0F2F5;
  --surface:      #FFFFFF;
  --surface-2:    #F8F9FA;
  --border:       #E2E8F0;
  --border-2:     #CBD5E0;
  --text-1:       #1A202C;
  --text-2:       #4A5568;
  --text-3:       #718096;
  --text-inv:     #FFFFFF;
  --success:      #27AE60;
  --success-bg:   #EBF5EB;
  --warning:      #E67E22;
  --warning-bg:   #FEF3E2;
  --danger:       #C0392B;
  --danger-bg:    #FDEDEC;
  --info:         #2471A3;
  --info-bg:      #EAF4FB;
  --sidebar-bg:   #0F1C2E;
  --sidebar-hover:#1B2A3B;
  --sidebar-active:#1B4F72;
  --sidebar-text: #A0AEC0;
  --sidebar-text-active: #FFFFFF;
  --radius:       6px;
  --radius-lg:    10px;
  --shadow:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:    0 10px 30px rgba(0,0,0,0.12);
  --transition:   0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }

/* ── Layout ── */
.layout { display: flex; width: 100%; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-emblem {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gov-green), #008800);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  margin-top: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--sidebar-text);
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.sidebar-section {
  padding: 16px 0 4px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  padding: 0 16px 6px;
  opacity: 0.6;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 450;
  color: var(--sidebar-text);
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #FFFFFF;
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--gov-green);
  font-weight: 600;
}

.nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: var(--sidebar-text);
  opacity: 0.6;
}

/* ── Main Content ── */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}

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

.header-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.badge-date {
  background: var(--info-bg);
  color: var(--info);
}

.badge-live {
  background: var(--success-bg);
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 5px;
}

.content {
  padding: 24px 28px;
  flex: 1;
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.kpi-card.green::before { background: var(--gov-green); }
.kpi-card.blue::before { background: var(--primary); }
.kpi-card.orange::before { background: var(--warning); }
.kpi-card.red::before { background: var(--danger); }
.kpi-card.teal::before { background: #16A085; }
.kpi-card.purple::before { background: #7D3C98; }

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.trend-up { background: var(--success-bg); color: var(--success); }
.trend-down { background: var(--danger-bg); color: var(--danger); }
.trend-neutral { background: var(--info-bg); color: var(--info); }

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  font-weight: 450;
}

.kpi-insight {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 7px;
}

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

.card-body { padding: 20px; }
.card-body-sm { padding: 14px 20px; }

.card-footer {
  padding: 10px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}

/* ── Section Spacing ── */
.section { margin-bottom: 24px; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Data Tables ── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #F7F9FC; }
.data-table tbody tr { transition: background var(--transition); }

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-active    { background: var(--success-bg); color: var(--success); }
.badge-pending   { background: var(--info-bg);    color: var(--info); }
.badge-defaulted { background: var(--danger-bg);  color: var(--danger); }
.badge-closed    { background: #EEE;              color: var(--text-3); }
.badge-warning   { background: var(--warning-bg); color: var(--warning); }
.badge-flagged   { background: var(--danger-bg);  color: var(--danger); }
.badge-matched   { background: var(--success-bg); color: var(--success); }
.badge-mismatch  { background: var(--warning-bg); color: var(--warning); }
.badge-exception { background: var(--danger-bg);  color: var(--danger); }

.badge-tier-a { background: #EBF5EB; color: #1E8449; }
.badge-tier-b { background: #EAF4FB; color: #1A5276; }
.badge-tier-c { background: #FEF3E2; color: #D35400; }
.badge-tier-d { background: #FDEDEC; color: #922B21; }

/* ── Alerts Panel ── */
.alerts-list { display: flex; flex-direction: column; gap: 8px; }

.alert-item {
  padding: 10px 14px;
  border-radius: var(--radius);
  border-left: 3px solid;
  background: var(--surface-2);
  font-size: 12px;
}

.alert-item.critical  { border-color: var(--danger);  background: var(--danger-bg); }
.alert-item.high      { border-color: var(--warning); background: var(--warning-bg); }
.alert-item.medium    { border-color: var(--info);    background: var(--info-bg); }
.alert-item.low       { border-color: var(--success); background: var(--success-bg); }

.alert-title { font-weight: 600; color: var(--text-1); margin-bottom: 2px; }
.alert-desc  { color: var(--text-2); line-height: 1.4; font-size: 11.5px; }
.alert-meta  { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }

/* ── Insight Panel ── */
.insights-list { display: flex; flex-direction: column; gap: 8px; }

.insight-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 12px;
  border-left: 3px solid var(--primary-light);
  align-items: flex-start;
}

.insight-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.insight-text { color: var(--text-2); line-height: 1.45; }
.insight-text strong { color: var(--text-1); }

/* ── Activity Feed ── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 340px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  animation: fade-in 0.3s ease;
}

.activity-item:last-child { border-bottom: none; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.dot-green  { background: var(--success); }
.dot-red    { background: var(--danger); }
.dot-orange { background: var(--warning); }
.dot-blue   { background: var(--info); }

.activity-time {
  font-size: 10.5px;
  color: var(--text-3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 56px;
}

.activity-text { color: var(--text-2); line-height: 1.4; }
.activity-text strong { color: var(--text-1); font-weight: 600; }

/* ── Live Counters ── */
.counter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.counter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.counter-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

.counter-value.flash { color: var(--gov-green); }

.counter-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
  font-weight: 500;
}

.counter-delta {
  font-size: 11px;
  color: var(--success);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Impact Metrics ── */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.impact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.impact-label { font-size: 11px; color: var(--text-3); font-weight: 500; }
.impact-value { font-size: 20px; font-weight: 700; color: var(--text-1); }
.impact-sub { font-size: 11px; color: var(--text-3); }

/* ── Lending Flow ── */
.flow-wrapper {
  overflow-x: auto;
  padding: 10px 0;
}

.flow-diagram {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 900px;
  padding: 20px 10px;
}

.flow-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.flow-node {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  min-width: 90px;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.flow-node:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.flow-node.active  { border-color: var(--success);  background: var(--success-bg); }
.flow-node.pending { border-color: var(--info);     background: var(--info-bg); }
.flow-node.done    { border-color: var(--gov-green); background: #EBF5EB; }
.flow-node.error   { border-color: var(--danger);   background: var(--danger-bg); }

.flow-node-icon { font-size: 20px; }
.flow-node-label { font-size: 10.5px; font-weight: 600; color: var(--text-2); text-align: center; line-height: 1.3; }
.flow-node-count { font-size: 13px; font-weight: 700; color: var(--primary); }
.flow-node-time  { font-size: 10px; color: var(--text-3); }

.flow-arrow {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--border-2);
  margin: 0 -2px;
  position: relative;
  z-index: 0;
}

/* ── Credit Score Gauge ── */
.credit-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.credit-gauge svg { overflow: visible; }

.credit-score-label {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

/* ── Search Bar ── */
.search-bar {
  position: relative;
  flex: 1;
}

.search-bar input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color var(--transition);
  outline: none;
}

.search-bar input:focus {
  border-color: var(--primary);
}

.search-bar .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-3);
  pointer-events: none;
}

/* ── Filter Chips ── */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #FFF; border-color: var(--primary); }

/* ── Reconciliation ── */
.recon-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.recon-pane {
  background: var(--surface);
  padding: 16px;
}

.recon-pane-header {
  font-size: 12px;
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-rate-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
}

.match-stat {
  text-align: center;
}

.match-stat .value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.match-stat .label {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

/* ── Risk / Progress Bars ── */
.risk-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.risk-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.fill-success { background: var(--success); }
.fill-warning { background: var(--warning); }
.fill-danger  { background: var(--danger); }
.fill-info    { background: var(--info); }

/* ── Pipeline Funnel ── */
.pipeline {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 24px;
}

.pipeline-stage {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  position: relative;
}

.pipeline-stage::after {
  content: '›';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-3);
  z-index: 1;
}

.pipeline-stage:last-child::after { display: none; }

.pipeline-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.pipeline-label {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

.pipeline-conv {
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

/* ── Escalation Steps ── */
.escalation-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.esc-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.esc-step:last-child { border-bottom: none; }

.esc-number {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.esc-info { flex: 1; }
.esc-stage { font-weight: 600; color: var(--text-1); }
.esc-desc  { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.esc-count { font-size: 13px; font-weight: 700; color: var(--text-1); }

/* ── Gauge Donut (match rate) ── */
.gauge-container { position: relative; width: 140px; height: 140px; margin: 0 auto; }

/* ── Borrower Profile ── */
.profile-expand {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
  animation: fade-in 0.2s ease;
}

.profile-grid {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.profile-score-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.repay-bar-section { display: flex; flex-direction: column; gap: 8px; }
.repay-row { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-2); }

/* ── Report Cards ── */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--transition);
}

.report-card:hover { box-shadow: var(--shadow-md); }

.report-icon { font-size: 28px; }
.report-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.report-desc { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.report-meta { font-size: 11px; color: var(--text-3); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #FFF;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text-2);
}

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

.btn-success { background: var(--success); color: #FFF; }
.btn-success:hover { background: #1E8449; }

.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-danger { background: var(--danger); color: #FFF; }
.btn-danger:hover { background: #922B21; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-1);
  color: #FFF;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.25s ease, fade-out 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

@keyframes slide-in {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fade-out {
  to { opacity: 0; transform: translateX(10px); }
}

/* ── Presenter Panel (Secret) ── */
.presenter-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
}

.presenter-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(27, 79, 114, 0.25);
  color: rgba(255,255,255,0.6);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s;
  border: none;
}

.presenter-btn:hover {
  background: rgba(27, 79, 114, 0.75);
  color: #FFF;
  transform: scale(1.1);
}

.presenter-panel {
  position: absolute;
  bottom: 42px;
  right: 0;
  background: #0F1C2E;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  width: 220px;
  box-shadow: var(--shadow-lg);
  display: none;
}

.presenter-panel.open { display: block; animation: fade-in 0.2s ease; }

.presenter-panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 10px;
}

.sim-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.sim-btn {
  padding: 7px 6px;
  border-radius: var(--radius);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-align: center;
}

.sim-btn-start  { background: var(--success);  color: #FFF; }
.sim-btn-pause  { background: var(--warning);  color: #FFF; }
.sim-btn-reset  { background: #555;            color: #FFF; }
.sim-btn-high   { background: var(--gov-red);  color: #FFF; }

.sim-btn:hover { filter: brightness(1.15); }
.sim-btn:disabled { opacity: 0.45; cursor: default; }

.sim-clock {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-variant-numeric: tabular-nums;
}

/* ── Stat Row ── */
.stat-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat-item { display: flex; flex-direction: column; gap: 1px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text-1); }
.stat-label { font-size: 11px; color: var(--text-3); }

/* ── Chart Containers ── */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-width: 100%; }

/* ── Kenya Map ── */
.map-container {
  position: relative;
  background: #EAF2FF;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 300px;
}

.kenya-map {
  width: 100%;
  height: 100%;
}

.map-region {
  cursor: pointer;
  transition: opacity 0.15s;
}

.map-region:hover { opacity: 0.8; }

.map-tooltip {
  position: absolute;
  background: var(--text-1);
  color: #FFF;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 11.5px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  display: none;
}

.map-tooltip strong { display: block; font-size: 12.5px; margin-bottom: 2px; }

.map-legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(255,255,255,0.9);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 10.5px;
  color: var(--text-2);
}

.legend-item { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; }

/* ── Gantt Timeline ── */
.gantt-wrap { overflow-x: auto; }
.gantt-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 11.5px; }
.gantt-label { width: 120px; flex-shrink: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { flex: 1; height: 18px; background: var(--border); border-radius: 3px; position: relative; min-width: 300px; }
.gantt-bar { position: absolute; height: 100%; border-radius: 3px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Utility ── */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-muted   { color: var(--text-3)  !important; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: 'Courier New', monospace; font-size: 11.5px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, #0A1628 0%, #1B4F72 55%, #0a3d0a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}

/* Kenya flag accent bars on the right edge */
.login-flag-bar {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  display: flex;
  z-index: 0;
}
.login-flag-bar .fb-green { width: 14px; background: #006600; }
.login-flag-bar .fb-red   { width: 6px;  background: #BB0000; }
.login-flag-bar .fb-black { width: 10px; background: #1A1A1A; }

.login-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 20px;
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  padding: 36px 40px;
  width: 100%;
  box-sizing: border-box;
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-emblem { font-size: 42px; line-height: 1; margin-bottom: 8px; }
.login-brand-name { font-size: 22px; font-weight: 700; color: var(--text-1); }
.login-brand-sub  { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.login-gov-badge  {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px; padding: 4px 12px;
  background: var(--success-bg); color: var(--gov-green);
  border-radius: 20px; font-size: 11px; font-weight: 500;
}

.login-step-title {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  text-align: center; margin-bottom: 20px;
}

.login-field { margin-bottom: 14px; }
.login-field label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 5px;
}
.login-field input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; font-family: 'Inter', sans-serif;
  color: var(--text-1); box-sizing: border-box;
  transition: border-color 0.15s;
}
.login-field input:focus {
  outline: none; border-color: var(--gov-green);
  box-shadow: 0 0 0 3px rgba(0,102,0,0.1);
}

.login-btn {
  width: 100%; padding: 12px;
  background: var(--gov-green); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer; margin-top: 6px;
  transition: background 0.15s, opacity 0.15s;
}
.login-btn:hover   { background: #004d00; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-msg-error {
  padding: 8px 12px; background: var(--danger-bg);
  color: var(--danger); border-radius: var(--radius);
  font-size: 12px; margin-bottom: 10px;
}

.login-demo-hint {
  text-align: center; font-size: 11px;
  color: var(--text-3); margin-top: 12px;
}
.login-demo-hint code {
  background: var(--surface-2); color: var(--text-1);
  padding: 1px 5px; border-radius: 3px;
  font-family: 'Courier New', monospace; font-size: 11.5px;
}

/* OTP step */
.otp-header { text-align: center; margin-bottom: 22px; }
.otp-icon   { font-size: 34px; margin-bottom: 6px; }
.otp-desc   { font-size: 13px; color: var(--text-2); line-height: 1.55; }

.otp-row {
  display: flex; gap: 10px;
  justify-content: center; margin-bottom: 16px;
}
.otp-box {
  width: 46px; height: 52px;
  text-align: center; font-size: 22px; font-weight: 700;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-family: 'Courier New', monospace; color: var(--text-1);
  transition: border-color 0.15s;
}
.otp-box:focus { outline: none; border-color: var(--gov-green); box-shadow: 0 0 0 3px rgba(0,102,0,0.1); }
.otp-box.otp-shake {
  border-color: var(--danger); background: var(--danger-bg);
  animation: otpShake 0.35s ease;
}
@keyframes otpShake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}

.login-footer-note {
  font-size: 11px; color: rgba(255,255,255,0.45);
  text-align: center;
}

/* ══════════════════════════════════════════
   SIDEBAR USER + LOGOUT
══════════════════════════════════════════ */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 9px;
}
.sidebar-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 12px; font-weight: 600;
  color: var(--sidebar-text-active);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px; color: var(--sidebar-text); opacity: 0.65;
}
.sidebar-logout-btn {
  width: 100%; padding: 6px 10px;
  background: rgba(187,0,0,0.14); color: #FF9999;
  border: 1px solid rgba(187,0,0,0.22);
  border-radius: var(--radius);
  font-size: 11px; font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer; text-align: left;
  transition: background 0.15s;
}
.sidebar-logout-btn:hover { background: rgba(187,0,0,0.28); color: #FFBBBB; }
