:root {
  --white: #ffffff;
  --bg: #f8fafc;
  --border: #e5e7eb;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-soft: #e8f0fe;
  --mpesa: #00a651;
  --mpesa-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --success: #10b981;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 12px 40px rgba(17, 24, 39, 0.08);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--white);
  color: var(--text);
  line-height: 1.5;
}

.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
}

/* Header — logo only */
.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 24px 28px;
  background: var(--white);
}

.logo-link {
  display: block;
  line-height: 0;
}

.logo-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: 12px;
}

.brand-logo {
  width: 128px;
  height: 128px;
  object-fit: contain;
}

@media (min-width: 400px) {
  .brand-logo {
    width: 140px;
    height: 140px;
  }
}

/* Hero — Service Expired */
.hero {
  text-align: center;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.hero-eyebrow {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--danger);
}

.hero-title {
  margin: 0 0 12px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

.hero-lead {
  margin: 0 auto;
  max-width: 340px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Main shell */
.shell {
  flex: 1;
  padding: 28px 20px 24px;
}

.steps-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 0 40px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}

.step-dot.active {
  background: var(--primary);
  transform: scale(1.2);
}

.step-dot.done {
  background: var(--success);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 48px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
}

.step-panel[hidden] {
  display: none !important;
}

.step-panel.active {
  display: block;
}

.panel-center {
  text-align: center;
  padding: 40px 24px;
}

.panel-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.field-note {
  margin: 16px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 12px;
}

/* Fields */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.field-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-wrap {
  position: relative;
}

.input-wrap input,
.field select {
  width: 100%;
  padding: 14px 16px 14px 48px;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select {
  padding-left: 16px;
}

.input-wrap input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-lg {
  padding: 16px 20px;
  font-size: 1.05rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-mpesa {
  background: var(--mpesa);
  color: var(--white);
}

.btn-mpesa:hover:not(:disabled) {
  background: #008f47;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0;
  margin-bottom: 16px;
  cursor: pointer;
  font-family: inherit;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

/* Account card */
.account-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.account-card .name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.account-card code {
  font-size: 0.85rem;
  background: var(--white);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.account-card .status-expired {
  color: var(--danger);
  font-weight: 600;
}

.account-card .status-soon {
  color: var(--warn);
  font-weight: 600;
}

/* Period options */
.period-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.period-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--white);
}

.period-option:hover {
  border-color: #cbd5e1;
}

.period-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.period-option input {
  display: none;
}

.period-option .period-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.period-option .period-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.period-option .amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.mpesa-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--mpesa);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* M-Pesa strip */
.mpesa-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--mpesa-soft);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.mpesa-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mpesa-strip strong {
  font-size: 1.35rem;
  color: var(--mpesa);
  letter-spacing: 0.02em;
}

/* Google Play promo */
.app-promo {
  margin-top: 28px;
}

.app-promo-inner {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.app-promo-label {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.app-promo-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.app-promo-text {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Official-style Google Play badge (black + multicolor icon) */
.play-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 20px 8px 12px;
  background: #000000;
  color: #ffffff;
  text-decoration: none;
  border: 1px solid #a6a6a6;
  border-radius: 6px;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.play-store-btn:hover {
  background: #1a1a1a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.play-store-btn:active {
  transform: scale(0.98);
}

.play-store-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.play-store-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: block;
}

.play-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1.15;
  padding-top: 1px;
}

.play-text-top {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  opacity: 0.95;
}

.play-text-bottom {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
}

/* Status screens */
.status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.status-icon svg {
  width: 36px;
  height: 36px;
}

.status-success {
  background: #d1fae5;
  color: var(--success);
}

.status-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.loader-ring {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.checklist {
  text-align: left;
  margin: 20px 0 28px;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.checklist li {
  margin-bottom: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

.form-error[hidden] {
  display: none;
}

/* Footer */
.site-footer {
  padding: 24px 24px 32px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.footer-link svg {
  width: 18px;
  height: 18px;
}

.footer-divider {
  color: var(--text-muted);
}

.footer-legal {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Spinner on button */
.btn-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.loading .btn-label {
  opacity: 0.7;
}

@media (min-width: 520px) {
  body {
    background: var(--bg);
  }

  .layout {
    max-width: 520px;
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100vh - 48px);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
  }

  .topbar {
    border-radius: 20px 20px 0 0;
  }

  .site-footer {
    border-radius: 0 0 20px 20px;
  }
}

@media (min-width: 768px) {
  .layout {
    max-width: 620px;
    margin-top: 40px;
    margin-bottom: 40px;
    min-height: calc(100vh - 80px);
  }

  .topbar {
    padding: 44px 40px 36px;
  }

  .shell {
    padding: 32px 36px 28px;
  }

  .hero {
    padding: 0 12px 32px;
    margin-bottom: 32px;
  }

  .hero-title {
    font-size: 2.125rem;
  }

  .hero-lead {
    max-width: 440px;
    font-size: 1rem;
  }

  .steps-bar {
    padding: 0 56px;
    margin-bottom: 32px;
  }

  .panel {
    padding: 28px 32px;
  }

  .panel-center {
    padding: 48px 40px;
  }

  .period-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 12px;
  }

  .period-option {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 118px;
  }

  .period-option .amount {
    margin-top: auto;
  }

  .app-promo-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 24px 28px;
  }

  .app-promo-copy {
    flex: 1;
    min-width: 0;
  }

  .app-promo-text {
    margin-bottom: 0;
  }

  .play-store-btn {
    flex-shrink: 0;
  }

  .site-footer {
    padding: 28px 36px 36px;
  }
}

@media (min-width: 1024px) {
  .layout {
    max-width: 680px;
    margin-top: 48px;
    margin-bottom: 48px;
  }

  .hero-title {
    font-size: 2.25rem;
  }

  .period-list {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
}
