/* ── ZamPay Design System ─────────────────────────────────── */
:root {
  --green: #1B4332;
  --green-mid: #40916C;
  --green-light: #D8F3DC;
  --gold: #D4A017;
  --gold-light: #FFF8E1;
  --dark: #0D1B12;
  --gray-50: #F4F9F6;
  --gray-100: #E8F0EB;
  --gray-200: #C8D8CC;
  --gray-400: #8FA896;
  --gray-600: #4A5E52;
  --gray-800: #1E2E24;
  --white: #FFFFFF;
  --danger: #C0392B;
  --danger-light: #FDEDEC;
  --warning: #E67E22;
  --warning-light: #FEF5E7;
  --success: #27AE60;
  --success-light: #EAFAF1;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --transition: 0.18s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--dark);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── App shell ───────────────────────────────────────────── */
.zpay-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Nav ─────────────────────────────────────────────────── */
.zpay-nav {
  width: 220px;
  min-height: 100vh;
  background: var(--green);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}
.nav-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  display: block;
}
.nav-company {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-links {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}
.nav-link.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border-left-color: var(--gold);
}
.nav-icon { font-size: 16px; }
.nav-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.nav-user {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main content area ───────────────────────────────────── */
.zpay-main {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
  max-width: 1100px;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title { font-size: 24px; font-weight: 700; color: var(--dark); }
.page-subtitle { font-size: 14px; color: var(--gray-600); margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 16px;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--green); margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.12);
}
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--green-mid); }
.btn-secondary { background: var(--gray-100); color: var(--dark); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #A93226; }
.btn-ghost { background: transparent; color: rgba(255,255,255,0.8); border: 1px solid rgba(255,255,255,0.2); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-100);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gold { background: var(--gold-light); color: #8B6914; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-red { background: var(--danger-light); color: var(--danger); }

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-warning { background: var(--warning-light); color: #784212; border-left: 3px solid var(--warning); }
.alert-success { background: var(--success-light); color: #145A32; border-left: 3px solid var(--success); }
.alert-danger { background: var(--danger-light); color: #922B21; border-left: 3px solid var(--danger); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }
.empty-state-msg { font-size: 14px; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
}
.login-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  font-size: 32px;
  font-weight: 900;
  color: var(--green);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -1px;
}
.login-logo span { color: var(--gold); }
.login-tagline {
  text-align: center;
  font-size: 14px;
  color: var(--gray-400);
  margin-bottom: 28px;
}

/* ── Wizard steps ────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-radius: var(--radius);
  overflow: hidden;
}
.wizard-step {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-400);
  border-right: 1px solid var(--gray-200);
}
.wizard-step:last-child { border-right: none; }
.wizard-step.active { background: var(--green); color: var(--white); }
.wizard-step.done { background: var(--green-light); color: var(--green); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.22s ease; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Nav becomes top bar with hamburger */
  .zpay-nav {
    width: 100%;
    min-height: auto;
    position: fixed;
    top: 0; left: 0; right: 0;
    flex-direction: column;
    z-index: 200;
    height: auto;
  }
  .nav-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: none;
  }
  .nav-links {
    display: none;
    padding: 8px 0 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .nav-links.open { display: block; }
  .nav-link { padding: 12px 16px; font-size: 15px; }
  .nav-footer { display: none; }
  .nav-footer.open { display: block; }
  .zpay-main { margin-left: 0; padding: 72px 12px 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Hamburger button */
  .nav-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
  }
  .nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,0.8);
    border-radius: 2px;
    transition: all 0.2s;
  }
  .nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .nav-hamburger.open span:nth-child(2) { opacity: 0; }
  .nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
}
@media (min-width: 769px) {
  .nav-hamburger { display: none; }
}


/* ═══════════════════════════════════════════════════
   Compliance Health Score — Dashboard Widget
   ═══════════════════════════════════════════════════ */
.health-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  padding: 24px 28px;
}
@media (max-width: 600px) {
  .health-card { grid-template-columns: 1fr; justify-items: center; gap: 16px; }
}
.health-gauge-wrap {
  position: relative; width: 120px; height: 120px;
  flex-shrink: 0; cursor: pointer;
}
.health-gauge-wrap:hover .health-score-num { opacity: .8; }
.health-gauge-svg { transform: rotate(-90deg); }
.health-gauge-bg { fill: none; stroke: #E8F0EA; stroke-width: 10; }
.health-gauge-fill {
  fill: none; stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1), stroke .4s;
}
.health-score-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.health-score-num  { font-size: 30px; font-weight: 800; line-height: 1; color: var(--dark); }
.health-score-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-top: 2px; }
.health-right { min-width: 0; }
.health-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.health-title { font-size: 15px; font-weight: 700; color: var(--dark); }
.health-grade { font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 100px; text-transform: uppercase; letter-spacing: .04em; }
.grade-green { background: #D8F3DC; color: #166534; }
.grade-amber { background: #FEF9C3; color: #92400E; }
.grade-red   { background: #FEE2E2; color: #991B1B; }
.health-summary { font-size: 13px; color: var(--gray-500); margin-bottom: 14px; line-height: 1.5; }
.health-checks { display: flex; flex-direction: column; gap: 6px; }
.health-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.5; }
.health-check-icon { flex-shrink: 0; font-size: 13px; margin-top: 1px; }
.health-check-text { color: var(--gray-600); }
.health-check-text strong { color: var(--dark); font-weight: 600; }
.health-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--gray-100); }
.health-ask-leah {
  display: inline-flex; align-items: center; gap: 6px;
  background: #1B4332; color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: background .15s; font-family: inherit;
}
.health-ask-leah:hover { background: #0D2B1F; }
.health-ask-leah-lm { font-family: Georgia, serif; font-size: 11px; font-weight: 700; color: #C9A84C; }
.health-refresh { font-size: 12px; color: var(--gray-400); background: none; border: none; cursor: pointer; transition: color .15s; font-family: inherit; }
.health-refresh:hover { color: var(--gray-600); }
.health-loading { display: flex; align-items: center; gap: 12px; padding: 28px; color: var(--gray-400); font-size: 13px; }
.health-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #E8F0EA; border-top-color: #1B4332;
  animation: health-spin .7s linear infinite; flex-shrink: 0;
}
@keyframes health-spin { to { transform: rotate(360deg); } }


/* ═══════════════════════════════════════════════════
   Payroll Anomaly Detection Panel
   ═══════════════════════════════════════════════════ */
.anomaly-panel {
  border-radius: 12px; margin-bottom: 16px; overflow: hidden;
  border: 1.5px solid #F59E0B; background: #FFFBEB;
  animation: anomalySlide .3s ease;
}
@keyframes anomalySlide { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.anomaly-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: #FEF3C7; border-bottom: 1px solid #FDE68A;
}
.anomaly-header-left { display: flex; align-items: center; gap: 10px; }
.anomaly-icon { font-size: 18px; }
.anomaly-title { font-size: 14px; font-weight: 700; color: #92400E; }
.anomaly-count {
  background: #F59E0B; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 100px;
}
.anomaly-header-right { display: flex; align-items: center; gap: 8px; }
.anomaly-ask-leah {
  display: inline-flex; align-items: center; gap: 5px;
  background: #1B4332; color: #fff; border: none; border-radius: 7px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
.anomaly-ask-leah:hover { background: #0D2B1F; }
.anomaly-ask-leah-lm { font-family: Georgia,serif; font-size: 10px; font-weight:700; color:#C9A84C; }
.anomaly-dismiss {
  background: none; border: 1.5px solid #D97706; color: #92400E;
  border-radius: 7px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.anomaly-dismiss:hover { background: #FDE68A; }
.anomaly-items { padding: 12px 18px; display: flex; flex-direction: column; gap: 6px; }
.anomaly-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5;
}
.anomaly-item.critical { background: #FEF2F2; border-left: 3px solid #DC2626; }
.anomaly-item.warning  { background: #FFFBEB; border-left: 3px solid #F59E0B; }
.anomaly-item.info     { background: #EFF6FF; border-left: 3px solid #3B82F6; }
.anomaly-item-icon { flex-shrink: 0; font-size: 14px; margin-top: 1px; }
.anomaly-item-text { color: #374151; }
.anomaly-item-text strong { color: #111827; font-weight: 600; }
.anomaly-footer {
  padding: 10px 18px; border-top: 1px solid #FDE68A;
  font-size: 12px; color: #92400E; background: #FEF9C3;
  display: flex; align-items: center; gap: 6px;
}

/* ═══════════════════════════════════════════════════
   Regulatory Alert Banner
   ═══════════════════════════════════════════════════ */
.reg-alert {
  border-radius: 10px; padding: 14px 18px; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 12px;
  animation: regSlide .35s ease; border: 1.5px solid transparent;
}
@keyframes regSlide { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.reg-alert.info     { background: #EFF6FF; border-color: #BFDBFE; }
.reg-alert.warning  { background: #FFFBEB; border-color: #FDE68A; }
.reg-alert.critical { background: #FEF2F2; border-color: #FECACA; }
.reg-alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.reg-alert-body { flex: 1; min-width: 0; }
.reg-alert-title {
  font-size: 13.5px; font-weight: 700; margin-bottom: 3px;
}
.reg-alert.info     .reg-alert-title { color: #1E40AF; }
.reg-alert.warning  .reg-alert-title { color: #92400E; }
.reg-alert.critical .reg-alert-title { color: #991B1B; }
.reg-alert-msg { font-size: 12.5px; line-height: 1.55; }
.reg-alert.info     .reg-alert-msg { color: #1D4ED8; }
.reg-alert.warning  .reg-alert-msg { color: #B45309; }
.reg-alert.critical .reg-alert-msg { color: #B91C1C; }
.reg-alert-meta { font-size: 11px; margin-top: 4px; opacity: .7; }
.reg-alert-dismiss {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  font-size: 16px; color: inherit; opacity: .5; padding: 2px 4px;
  transition: opacity .15s; line-height: 1;
}
.reg-alert-dismiss:hover { opacity: 1; }