/* NestSacco public enterprise shell — CSS Grid + utility system + mobile-first */
:root {
  --ns-primary: #0F766E;
  --ns-primary-dark: #115E59;
  --ns-secondary: #EA580C;
  --ns-accent: #2563EB;
  --ns-ink: #0B1220;
  --ns-muted: #64748B;
  --ns-line: #E2E8F0;
  --ns-card: #ffffff;
  --ns-bg: #F1F5F9;
  --ns-radius: 14px;
  --ns-shadow: 0 12px 40px rgba(15,23,42,.08);
  --ns-shadow-sm: 0 4px 16px rgba(15,23,42,.06);
  --ns-space: 1rem;
  --ns-header-h: 68px;
  --ns-safe-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.ns-public {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ns-ink);
  background: var(--ns-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; }
.ns-wrap {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

/* ——— Utility layer (Tailwind-inspired, no build step) ——— */
.ns-grid { display: grid; gap: 1rem; }
.ns-grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ns-grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ns-grid-4 { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ns-grid-auto {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.ns-grid-auto-sm {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
}
.ns-flex { display: flex; }
.ns-flex-wrap { flex-wrap: wrap; }
.ns-items-center { align-items: center; }
.ns-justify-between { justify-content: space-between; }
.ns-gap-1 { gap: .35rem; }
.ns-gap-2 { gap: .65rem; }
.ns-gap-3 { gap: 1rem; }
.ns-gap-4 { gap: 1.5rem; }
.ns-w-full { width: 100%; }
.ns-text-center { text-align: center; }
.ns-text-muted { color: var(--ns-muted); }
.ns-font-bold { font-weight: 800; }
.ns-hidden { display: none !important; }
.ns-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Top strip */
.ns-topstrip {
  background: var(--ns-ink);
  color: #94A3B8;
  font-size: .75rem;
  font-weight: 600;
  padding: .4rem 0;
}
.ns-topstrip .ns-wrap {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}
.ns-topstrip a { color: #E2E8F0; font-weight: 700; }
.ns-topstrip a:hover { color: #5EEAD4; }

/* Header — CSS grid for stable mobile stacking */
.ns-header {
  background: #fff;
  border-bottom: 1px solid var(--ns-line);
  position: sticky;
  top: 0;
  z-index: 80;
  box-shadow: var(--ns-shadow-sm);
}
.ns-header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand nav cta";
  align-items: center;
  gap: .75rem 1rem;
  min-height: var(--ns-header-h);
  padding-block: .35rem;
}
.ns-brand { grid-area: brand; display: flex; align-items: center; gap: .65rem; font-weight: 900; letter-spacing: -.02em; min-width: 0; }
.ns-brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--ns-primary), var(--ns-primary-dark));
  color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 900;
  border: 2px solid var(--ns-ink); box-shadow: 0 3px 0 var(--ns-ink);
  overflow: hidden;
}
.ns-brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.ns-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ns-brand-text strong { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.ns-brand-text span { font-size: .7rem; font-weight: 700; color: var(--ns-muted); text-transform: uppercase; letter-spacing: .04em; }
.ns-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  flex-wrap: wrap;
}
.ns-nav a {
  padding: .45rem .7rem;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 700;
  color: #334155;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.ns-nav a:hover { background: #F1F5F9; color: var(--ns-primary-dark); }
.ns-nav-cta {
  grid-area: cta;
  display: flex;
  gap: .45rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.ns-menu-toggle {
  display: none;
  border: 2px solid var(--ns-ink);
  background: #fff;
  border-radius: 10px;
  padding: .45rem .7rem;
  font-weight: 900;
  cursor: pointer;
  min-height: 40px;
  min-width: 44px;
}

/* Buttons */
.ns-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.05rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: .86rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
  min-height: 42px;
  text-align: center;
}
.ns-btn-primary {
  background: var(--ns-primary);
  color: #fff !important;
  border-color: var(--ns-ink);
  box-shadow: 0 3px 0 var(--ns-ink);
}
.ns-btn-primary:hover { background: var(--ns-primary-dark); transform: translateY(-1px); }
.ns-btn-ghost {
  background: #fff;
  color: var(--ns-ink) !important;
  border-color: var(--ns-line);
}
.ns-btn-ghost:hover { border-color: var(--ns-ink); }
.ns-btn-secondary {
  background: var(--ns-secondary);
  color: #fff !important;
  border-color: var(--ns-ink);
  box-shadow: 0 3px 0 var(--ns-ink);
}
.ns-btn-lg { padding: .72rem 1.35rem; font-size: .94rem; min-height: 48px; }
.ns-btn-block { width: 100%; }

/* Hero — asymmetric grid */
.ns-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ns-ink) 0%, #0F766E 55%, #0E7490 100%);
  color: #fff;
  padding: clamp(2rem, 5vw, 3.75rem) 0 clamp(2.5rem, 6vw, 4rem);
}
.ns-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: center;
}
.ns-hero h1 {
  font-size: clamp(1.65rem, 4.2vw, 2.75rem);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -.03em;
  margin: 0 0 .9rem;
}
.ns-hero p.lead {
  font-size: clamp(.95rem, 2vw, 1.05rem);
  opacity: .92;
  max-width: 36rem;
  margin: 0 0 1.35rem;
}
.ns-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-bottom: 1.5rem;
}
.ns-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}
.ns-stat {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  padding: .75rem .85rem;
  backdrop-filter: blur(6px);
}
.ns-stat strong { display: block; font-size: clamp(1.05rem, 2.5vw, 1.35rem); font-weight: 900; }
.ns-stat span {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .85;
}
.ns-hero-panel {
  background: rgba(255,255,255,.97);
  color: var(--ns-ink);
  border-radius: 18px;
  border: 2px solid var(--ns-ink);
  box-shadow: 0 8px 0 rgba(0,0,0,.22);
  padding: 1.15rem;
}
.ns-hero-panel h3 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 900; }
.ns-dashlet-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}
.ns-dashlet {
  background: #F8FAFC;
  border: 1.5px solid var(--ns-line);
  border-radius: 12px;
  padding: .7rem;
}
.ns-dashlet span {
  display: block;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ns-muted);
}
.ns-dashlet strong { font-size: .9rem; font-weight: 900; }
.ns-slider { position: relative; }
.ns-slide { display: none; animation: nsFade .45s ease; }
.ns-slide.on { display: block; }
.ns-slide-dots { display: flex; gap: .35rem; margin-top: .75rem; }
.ns-slide-dots button {
  width: 10px; height: 10px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.35); cursor: pointer; padding: 0;
}
.ns-slide-dots button.on { background: #fff; }
@keyframes nsFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Sections */
.ns-section { padding: clamp(2rem, 5vw, 3.25rem) 0; }
.ns-section-h {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}
.ns-section-h h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 900;
  letter-spacing: -.02em;
}
.ns-section-h p { margin: 0; color: var(--ns-muted); font-weight: 600; max-width: 28rem; }
.ns-kicker {
  display: inline-block;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ns-primary);
  margin-bottom: .3rem;
}

/* Cards — auto-fit grid (CSS Grid responsive without breakpoint hell) */
.ns-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.ns-card {
  background: var(--ns-card);
  border: 2px solid var(--ns-line);
  border-radius: var(--ns-radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--ns-shadow-sm);
  transition: .18s ease;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
}
.ns-card:hover {
  border-color: var(--ns-ink);
  transform: translateY(-3px);
  box-shadow: var(--ns-shadow);
}
.ns-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: #CCFBF1; color: var(--ns-primary-dark);
  font-weight: 900; font-size: 1.05rem;
  border: 1.5px solid #99F6E4;
}
.ns-card h3 { margin: 0; font-size: 1.02rem; font-weight: 900; }
.ns-card p { margin: 0; color: var(--ns-muted); font-size: .88rem; flex: 1; }
.ns-card a.more { font-weight: 800; font-size: .84rem; color: var(--ns-primary-dark); }

.ns-band { background: #fff; border-block: 1px solid var(--ns-line); }
.ns-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: center;
}
.ns-cols-4 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.ns-check { list-style: none; padding: 0; margin: 1rem 0 0; }
.ns-check li {
  position: relative;
  padding: .4rem 0 .4rem 1.55rem;
  font-weight: 600;
  font-size: .9rem;
}
.ns-check li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--ns-primary);
  font-weight: 900;
}

/* CTA */
.ns-cta {
  background: linear-gradient(90deg, var(--ns-primary-dark), var(--ns-primary));
  color: #fff;
  padding: clamp(1.75rem, 4vw, 2.5rem) 0;
  border-block: 2px solid var(--ns-ink);
}
.ns-cta .ns-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}
.ns-cta h2 { margin: 0 0 .3rem; font-size: clamp(1.2rem, 3vw, 1.45rem); font-weight: 900; }
.ns-cta p { margin: 0; opacity: .92; }

/* Footer */
.ns-footer {
  background: var(--ns-ink);
  color: #94A3B8;
  padding: 2.5rem 0 calc(1.15rem + var(--ns-safe-bottom));
}
.ns-footer-grid {
  display: grid;
  gap: 1.35rem;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  margin-bottom: 1.75rem;
}
.ns-footer h4 {
  color: #F8FAFC;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 .65rem;
}
.ns-footer a {
  display: block;
  padding: .3rem 0;
  font-weight: 600;
  font-size: .88rem;
  color: #CBD5E1;
  min-height: 36px;
}
.ns-footer a:hover { color: #5EEAD4; }
.ns-footer-brand { font-weight: 900; color: #F8FAFC; font-size: 1.05rem; margin-bottom: .45rem; }
.ns-footer-bottom {
  border-top: 1px solid #1E293B;
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .78rem;
  font-weight: 600;
}

/* Auth */
.ns-auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ns-bg);
}
.ns-auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem calc(2.5rem + var(--ns-safe-bottom));
}
.ns-auth-card {
  width: min(440px, 100%);
  background: #fff;
  border: 2px solid var(--ns-ink);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--ns-ink);
  overflow: hidden;
}
.ns-auth-card.wide { width: min(920px, 100%); }
.ns-auth-head {
  background: linear-gradient(145deg, var(--ns-primary-dark), var(--ns-primary));
  color: #fff;
  padding: 1.25rem 1.25rem 1.1rem;
  border-bottom: 2px solid var(--ns-ink);
}
.ns-auth-head h1 { margin: 0; font-size: clamp(1.15rem, 3vw, 1.35rem); font-weight: 900; }
.ns-auth-head p { margin: .35rem 0 0; opacity: .9; font-size: .88rem; }
.ns-auth-body-inner { padding: 1.2rem 1.25rem 1.35rem; }
.ns-field { margin-bottom: .8rem; }
.ns-field label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #475569;
  margin-bottom: .28rem;
}
.ns-field input, .ns-field select, .ns-field textarea {
  width: 100%;
  padding: .7rem .85rem;
  border-radius: 10px;
  border: 1.5px solid #CBD5E1;
  font-size: 16px; /* prevents iOS zoom */
  font-weight: 600;
  background: #fff;
  color: var(--ns-ink);
  min-height: 46px;
}
.ns-field input:focus, .ns-field select:focus {
  outline: none;
  border-color: var(--ns-primary);
  box-shadow: 0 0 0 3px rgba(15,118,110,.15);
}
.ns-field-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: .55rem;
  align-items: end;
}
.ns-field-row .ns-field { margin: 0; }
.ns-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .3rem;
  margin-bottom: 1rem;
  background: #F1F5F9;
  padding: .3rem;
  border-radius: 12px;
}
.ns-tabs button {
  border: 0;
  background: transparent;
  padding: .55rem;
  border-radius: 10px;
  font-weight: 800;
  font-size: .84rem;
  cursor: pointer;
  color: #64748B;
  min-height: 42px;
}
.ns-tabs button.on {
  background: #fff;
  color: var(--ns-primary-dark);
  box-shadow: var(--ns-shadow-sm);
}
.ns-alert {
  padding: .7rem .85rem;
  border-radius: 10px;
  font-size: .86rem;
  font-weight: 600;
  margin-bottom: .8rem;
}
.ns-alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.ns-alert-ok { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.ns-alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.ns-auth-links {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-size: .86rem;
  font-weight: 700;
}
.ns-auth-links a { color: var(--ns-primary-dark); min-height: 40px; display: inline-flex; align-items: center; }
.ns-security-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .45rem;
  align-items: center;
}
.ns-security-stamp {
  font-weight: 900;
  letter-spacing: .1em;
  font-size: 1rem;
  color: var(--ns-ink);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  background: #F1F5F9;
  padding: .45rem .65rem;
  border-radius: 8px;
  border: 1.5px dashed #94A3B8;
  white-space: nowrap;
}

/* ——— Responsive breakpoints ——— */
@media (max-width: 1100px) {
  .ns-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .ns-header-inner {
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "brand toggle cta"
      "nav nav nav";
  }
  .ns-menu-toggle { display: inline-flex; grid-area: toggle; }
  .ns-nav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: .35rem 0 .65rem;
    border-top: 1px solid var(--ns-line);
    margin-top: .15rem;
  }
  .ns-nav.open { display: flex; }
  .ns-nav a {
    width: 100%;
    border-radius: 10px;
    padding: .65rem .85rem;
  }
  .ns-hero-grid,
  .ns-cols-2 {
    grid-template-columns: 1fr;
  }
  .ns-hero-panel { order: 2; }
  .ns-brand-text strong { max-width: 36vw; }
}

@media (max-width: 640px) {
  .ns-wrap { width: calc(100% - 1.25rem); }
  .ns-topstrip { font-size: .7rem; }
  .ns-topstrip .ns-wrap { justify-content: center; text-align: center; }
  .ns-header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand toggle"
      "cta cta"
      "nav nav";
  }
  .ns-nav-cta {
    width: 100%;
    justify-content: stretch;
  }
  .ns-nav-cta .ns-btn { flex: 1; }
  .ns-hero-stats {
    grid-template-columns: 1fr;
  }
  .ns-dashlet-row {
    grid-template-columns: 1fr;
  }
  .ns-footer-grid {
    grid-template-columns: 1fr;
  }
  .ns-section-h {
    flex-direction: column;
    align-items: flex-start;
  }
  .ns-cta .ns-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .ns-cta .ns-btn { width: 100%; }
  .ns-security-row {
    grid-template-columns: 1fr;
  }
  .ns-field-row {
    grid-template-columns: 1fr;
  }
  .ns-auth-card {
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--ns-ink);
  }
  .ns-card:hover { transform: none; }
}

@media (max-width: 380px) {
  .ns-brand-text span { display: none; }
  .ns-btn { font-size: .8rem; padding: .5rem .85rem; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* East Africa phone row */
.ea-phone-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: .5rem !important;
  width: 100%;
}
.ea-dial-select {
  flex: 0 0 7.25rem !important;
  width: 7.25rem !important;
  max-width: 8rem !important;
}
.ea-phone-input {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: auto !important;
}
.ea-dial-select {
  font-weight: 800 !important;
  font-size: .9rem !important;
  padding: .55rem .4rem !important;
  border-radius: 10px !important;
  border: 1.5px solid #CBD5E1 !important;
  background: #F8FAFC !important;
  min-height: 46px;
}
.ea-phone-input {
  min-height: 46px;
  font-weight: 600;
  font-size: 16px !important;
  border-radius: 10px !important;
  border: 1.5px solid #CBD5E1 !important;
  padding: .55rem .75rem !important;
}
.ea-country-select {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .5rem;
  margin-bottom: .75rem;
}
.ea-country-chip {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .7rem;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  font-size: .88rem;
}
.ea-country-chip input { accent-color: #0F766E; }
.ea-country-chip.on {
  border-color: #0F766E;
  background: #F0FDFA;
  box-shadow: 0 2px 0 #0F766E;
}
.ea-flag { font-size: 1.25rem; line-height: 1; }

.ns-pw-wrap { position: relative !important; display: block; width: 100%; }
.ns-pw-wrap input { width: 100% !important; padding-right: 3.75rem !important; box-sizing: border-box; }
.ns-pw-toggle {
  position: absolute !important; right: .35rem !important; top: 50% !important;
  transform: translateY(-50%) !important; height: 32px; border: 0; background: transparent;
  color: #64748B; font-weight: 800; font-size: .75rem; cursor: pointer; z-index: 2;
}

.ea-phone-flag { flex:0 0 auto; display:inline-flex; align-items:center; width:28px; }
.ea-phone-flag img, .ns-flag { width:22px; height:16px; object-fit:cover; border-radius:2px; }
.ea-country-chip .ea-flag img { width:20px; height:15px; border-radius:2px; }
