@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1c2129;
  --muted: #6b7380;
  --primary: #17a566; /* vivid emerald, still M-Pesa/WhatsApp-coded */
  --primary-dark: #0f8752;
  --danger: #c0392b;
  --radius: 14px;

  /* extra accent colors used to add colour/energy on the landing page */
  --accent-purple: #7c3aed;
  --accent-pink: #ec4899;
  --accent-orange: #f59e0b;
  --accent-blue: #3b82f6;

  --gradient-brand: linear-gradient(120deg, #17a566, #3b82f6 55%, #7c3aed);
  --gradient-cta: linear-gradient(120deg, #17a566, #0f8752);
  --shadow-sm: 0 2px 8px rgba(28, 33, 41, 0.06);
  --shadow-md: 0 10px 30px rgba(28, 33, 41, 0.09);
}

* { box-sizing: border-box; }

/* The [hidden] attribute's UA default of display:none loses to any author
   rule of equal specificity that sets its own `display` (e.g. .form-grid's
   display:grid) — so an element that's both `class="form-grid"` and
   `hidden` renders visible. Keep `hidden` authoritative everywhere. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
}
.badge.live { background: #e6f6ec; color: var(--primary-dark); }

main#app { max-width: 900px; margin: 24px auto; padding: 0 16px 60px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.business-header { display: flex; justify-content: space-between; align-items: center; }

h2 { margin: 0 0 4px; }
h3 { margin-top: 0; }
.muted { color: var(--muted); font-size: 0.92rem; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-actions { display: flex; gap: 8px; align-items: center; }
.mpesa-status-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 16px; flex-wrap: wrap; }

.import-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  background: #fafbfc;
}
.import-panel h4 { margin: 0 0 6px; font-size: 1rem; }

.sales-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #fafbfc;
  border: 1px solid var(--border);
}
.stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.02em; }
.stat-value { font-size: 1.4rem; font-weight: 800; }

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 8px 4px 0;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.trend-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}
.trend-bar-fill {
  width: 100%;
  max-width: 22px;
  background: var(--gradient-cta);
  border-radius: 4px 4px 0 0;
  min-height: 0;
}
.trend-bar-label { font-size: 0.68rem; color: var(--muted); }

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--gradient-cta); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: #eef2f6; color: var(--text); }
.btn-secondary:hover { background: #e2e7ed; }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

select, input, button {
  font-family: inherit;
}
select, input[type=text], input[type=number], input[type=email], input[type=password], input:not([type]) {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.9rem;
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { grid-column: span 2; display: flex; gap: 8px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }

.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef2f6;
  color: var(--muted);
  text-transform: capitalize;
}
.status-pill.paid, .status-pill.fulfilled, .status-pill.active { background: #e6f6ec; color: var(--primary-dark); }
.status-pill.cancelled, .status-pill.trial_expired, .status-pill.past_due { background: #fdecea; color: var(--danger); }
.badge.warn { background: #fdecea; color: var(--danger); }

.chat-setup {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chat-setup label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.chat-setup input { width: 180px; }

.chat-window {
  height: 380px;
  overflow-y: auto;
  background: #eceef1;
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.bubble {
  max-width: 75%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.bubble.customer { align-self: flex-end; background: #d9fdd3; border-bottom-right-radius: 3px; }
.bubble.assistant { align-self: flex-start; background: white; border-bottom-left-radius: 3px; }
.bubble.system { align-self: center; background: transparent; color: var(--muted); font-size: 0.8rem; }

.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }

.steps { padding-left: 20px; color: var(--text); font-size: 0.92rem; line-height: 1.7; }
code { background: #eef2f6; padding: 2px 6px; border-radius: 5px; font-size: 0.85em; }

a.brand { text-decoration: none; }

/* --- landing page --------------------------------------------------- */

.btn-lg { padding: 14px 28px; font-size: 1.02rem; border-radius: 12px; }

body.landing { overflow-x: hidden; }

.landing-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 8% 0%, rgba(23, 165, 102, 0.16), transparent 55%),
    radial-gradient(560px circle at 95% 12%, rgba(124, 58, 237, 0.14), transparent 55%),
    radial-gradient(500px circle at 50% 60%, rgba(59, 130, 246, 0.10), transparent 55%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(23,165,102,0.14), rgba(124,58,237,0.14));
  color: var(--primary-dark);
  margin-bottom: 20px;
}

.hero {
  max-width: 780px;
  margin: 76px auto 30px;
  padding: 0 20px;
  text-align: center;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 18px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { font-size: 1.15rem; color: var(--muted); margin-bottom: 30px; line-height: 1.55; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 16px; }

.hero-trust {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 30px auto 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.hero-trust span { display: inline-flex; align-items: center; gap: 6px; }

/* decorative chat mockup under the hero */
.hero-mock {
  max-width: 380px;
  margin: 46px auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: 16px;
  text-align: left;
  transform: rotate(-1.2deg);
}
.hero-mock .mock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
}
.hero-mock .mock-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gradient-brand);
  flex-shrink: 0;
}
.hero-mock .mbubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 8px;
}
.hero-mock .mbubble.in { background: #eef2f6; border-bottom-left-radius: 3px; }
.hero-mock .mbubble.out { background: #d9fdd3; border-bottom-right-radius: 3px; margin-left: auto; }

/* section shell */
.section { max-width: 1080px; margin: 0 auto; padding: 70px 20px 10px; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 44px; }
.section-head h2 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); font-size: 1.02rem; line-height: 1.55; }

/* pillars: what pesa ai is about */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.pillar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.pillar:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.pillar-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.pillar h3 { margin: 0 0 8px; font-size: 1.08rem; }
.pillar p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

.pillar-icon.c1 { background: rgba(23,165,102,0.14); }
.pillar-icon.c2 { background: rgba(59,130,246,0.14); }
.pillar-icon.c3 { background: rgba(245,158,11,0.16); }
.pillar-icon.c4 { background: rgba(124,58,237,0.14); }

/* how it works */
.steps-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  counter-reset: step;
}
.step { position: relative; padding-left: 6px; }
.step-num {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  margin-bottom: 14px;
}
.step h3 { margin: 0 0 6px; font-size: 1.02rem; }
.step p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* stats strip */
.stats-strip {
  max-width: 1080px;
  margin: 60px auto 0;
  padding: 26px 24px;
  border-radius: var(--radius);
  background: var(--gradient-brand);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  text-align: center;
  color: white;
}
.stats-strip .stat b { display: block; font-size: 1.5rem; font-weight: 800; }
.stats-strip .stat span { font-size: 0.82rem; opacity: 0.92; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.feature-card h3 { margin-bottom: 8px; font-size: 1.05rem; }

/* pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1080px;
  margin: 0 auto;
  align-items: stretch;
}
.pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}
.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 12px 32px rgba(16, 163, 74, 0.16);
  transform: translateY(-6px);
}
.pricing-card-badge {
  display: inline-block;
  align-self: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.pricing-card .price { font-size: 2.2rem; font-weight: 800; margin: 6px 0 2px; }
.pricing-card .price span { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.pricing-list { list-style: none; padding: 0; margin: 20px 0 24px; text-align: left; flex-grow: 1; }
.pricing-list li { padding: 6px 0; font-size: 0.88rem; color: var(--text); display: flex; gap: 8px; align-items: flex-start; }

@media (max-width: 860px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; }
  .pricing-card.featured { transform: none; }
}

/* final CTA banner */
.cta-banner {
  max-width: 1080px;
  margin: 70px auto 0;
  padding: 46px 30px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(135deg, #17a566, #3b82f6 60%, #7c3aed);
  color: white;
}
.cta-banner h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 10px; }
.cta-banner p { opacity: 0.92; margin-bottom: 22px; }
.cta-banner .btn-primary { background: white; color: var(--primary-dark); box-shadow: none; }
.cta-banner .btn-primary:hover { background: #f3f4f6; }

.site-footer { text-align: center; padding: 40px 20px 56px; color: var(--muted); font-size: 0.88rem; }

@media (max-width: 640px) {
  .hero h1 { font-size: 2.1rem; }
  .section { padding: 50px 18px 10px; }
}

/* --- auth pages (signup / login / admin login) ----------------------- */

.auth-wrap {
  display: flex;
  justify-content: center;
  padding: 60px 20px;
}
.auth-card { width: 100%; max-width: 460px; }
.error-text { color: var(--danger); font-size: 0.88rem; margin-top: -6px; }
.consent-row { flex-direction: row !important; align-items: flex-start; gap: 8px !important; font-size: 0.85rem; color: var(--muted); }
.consent-row input { margin-top: 3px; flex-shrink: 0; }
.consent-row a { color: var(--primary-dark); }

/* --- billing tab ------------------------------------------------------ */

.billing-summary { margin-bottom: 14px; }
.billing-summary p { margin: 4px 0; }
.small { font-size: 0.8rem; }

/* --- plan picker (signup form + billing tab) --------------------------- */

.plan-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}
.plan-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.plan-option:has(input:checked) {
  border-color: var(--primary);
  background: #f4f9f6;
}
.plan-option input { margin-top: 3px; flex-shrink: 0; width: auto; }
.plan-option-body { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--text); }
.plan-option-price { color: var(--primary-dark); font-weight: 600; font-size: 0.82rem; }
.plan-option-desc { color: var(--muted); font-size: 0.78rem; }
.plan-locked-note {
  background: #fff8e6;
  border: 1px solid #f0dca0;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #8a6d1a;
  margin: 10px 0 16px;
}
