/* ==========================================================
   KUDI COMPASS — Modern Fintech Stylesheet
   Typography: Plus Jakarta Sans
   Theme: Deep Forest Green & Nigerian Gold Accents
   ========================================================== */

:root {
  /* Brand Palette */
  --primary-950: #041f16;
  --primary-900: #0a3d2e;
  --primary-800: #0e4e3b;
  --primary-700: #14634c;
  --primary-600: #1b7a5f;
  --primary-50:  #eef7f4;
  --primary-100: #d6ede4;

  --accent-emerald: #10b981;
  --accent-emerald-light: #d1fae5;
  --accent-gold: #f59e0b;
  --accent-gold-dark: #b45309;
  --accent-gold-light: #fef3c7;
  --accent-gold-soft: #fffbeb;

  /* Neutrals */
  --bg-page: #f5f8f6;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --border: #e2e8e5;
  --border-focus: #10b981;
  
  --text-main: #0f1c17;
  --text-body: #374740;
  --text-muted: #657770;
  --text-light: #8fa099;

  /* Status Colors */
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(10, 61, 46, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(10, 61, 46, 0.08), 0 2px 4px -2px rgba(10, 61, 46, 0.04);
  --shadow-lg: 0 16px 36px -6px rgba(10, 61, 46, 0.12), 0 6px 12px -4px rgba(10, 61, 46, 0.06);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
  
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Ambient Background Glow */
.bg-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  max-width: 900px;
  height: 380px;
  background: radial-gradient(circle at 50% 10%, rgba(16, 185, 129, 0.12) 0%, rgba(10, 61, 46, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* Tabular figures for financial numbers */
input, strong, td, .hero-value, .stat-value {
  font-variant-numeric: tabular-nums;
}

/* ----- HEADER ----- */
header {
  position: relative;
  z-index: 1;
  background: linear-gradient(165deg, var(--primary-950) 0%, var(--primary-900) 65%, var(--primary-800) 100%);
  color: #ffffff;
  padding: 32px 20px 72px;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 20px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #d97706 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1503;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.16);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

h1 {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
  color: #ffffff;
}

.sub {
  font-size: 0.98rem;
  color: #c4ded5;
  font-weight: 400;
  max-width: 480px;
  margin: 0 auto;
}

/* ----- MAIN CONTAINER ----- */
main {
  position: relative;
  z-index: 2;
  max-width: 640px;
  width: 100%;
  margin: -48px auto 0;
  padding: 0 16px;
  flex: 1;
}

/* ----- TAB NAVIGATION (Segmented Control) ----- */
.tab-nav-wrapper {
  margin-bottom: 16px;
}

.tab-list {
  background: #ffffff;
  padding: 6px;
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(10, 61, 46, 0.08);
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  user-select: none;
}

.tab-btn:hover:not(.active) {
  background: var(--surface-alt);
  color: var(--text-main);
}

.tab-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

.tab-btn.active {
  background: var(--primary-900);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(10, 61, 46, 0.22);
}

.tab-icon {
  flex-shrink: 0;
  color: currentColor;
}

.tab-btn.active .tab-icon {
  color: var(--accent-emerald);
}


/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.24s ease-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- CARDS ----- */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.card-header {
  margin-bottom: 20px;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-900);
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}


/* ----- FORM FIELDS & INPUTS ----- */
.field {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 7px;
}

.label-with-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feature-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.two-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Input Affixes & Containers */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  overflow: hidden;
}

.input-wrapper:hover {
  border-color: #cbd5e1;
}

.input-wrapper:focus-within {
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.input-affix {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 12px;
  user-select: none;
}

.input-affix.prefix {
  padding-right: 0;
  color: var(--primary-800);
}

.input-affix.suffix {
  padding-left: 0;
  color: var(--text-muted);
  font-weight: 600;
}

input {
  width: 100%;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 16px; /* Prevents auto-zoom on iOS */
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border: none;
  outline: none;
}

input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

/* Hide number spin arrows for cleaner look */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ----- SELECT INPUT ----- */
.select-wrapper {
  position: relative;
}

select {
  width: 100%;
  padding: 13px 40px 13px 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ----- ACCORDION (Fees) ----- */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  margin: 20px 0;
  overflow: hidden;
  transition: var(--transition);
}

.accordion[open] {
  border-color: rgba(245, 158, 11, 0.35);
  background: #ffffff;
}

.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-body);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-900);
}

.accordion-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.accordion-body {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfb;
}

.accordion-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ----- ACTION BUTTONS ----- */
.action-buttons {
  margin-top: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-700) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(10, 61, 46, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(10, 61, 46, 0.32);
}

.btn-primary:active {
  transform: translateY(0);
}

.error {
  color: var(--danger-text);
  background: var(--danger-bg);
  border-left: 3px solid #dc2626;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  margin: 14px 0 0;
  display: none;
}

.error:not(:empty) {
  display: block;
}

/* ----- RESULTS SECTION ----- */
.results {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.3s ease-out;
}

.results[hidden] {
  display: none;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.results-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-900);
}

.results-badge {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
}

.results-badge.success {
  background: var(--accent-emerald-light);
  color: #065f46;
  border-color: #a7f3d0;
}

/* Hero Card */
.hero-card {
  background: linear-gradient(145deg, var(--primary-900) 0%, #0d4635 100%);
  color: #ffffff;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 24px -4px rgba(10, 61, 46, 0.3);
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.hero-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #a7f3d0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.hero-badge.gold {
  background: rgba(245, 158, 11, 0.22);
  color: var(--accent-gold);
}

.hero-value {
  display: block;
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--accent-gold);
  line-height: 1.15;
  margin-bottom: 6px;
}

.hero-subtext {
  font-size: 0.84rem;
  color: #c4ded5;
}

/* Key Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-value.accent {
  color: #b45309;
}

.stat-value.warning {
  color: #b91c1c;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* Fee Breakdown Box */
.fee-box {
  background: var(--accent-gold-soft);
  border: 1px solid var(--accent-gold-light);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-top: 16px;
}

.fee-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-gold-dark);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.fee-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-body);
}

.fee-row.highlight {
  font-weight: 700;
  color: var(--primary-900);
  background: rgba(245, 158, 11, 0.12);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

/* Pocket Check Card */
.pocket-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 16px;
}

.pocket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pocket-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-900);
}

.status-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.pocket-msg {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.45;
  margin-bottom: 12px;
}

.progress-track {
  height: 10px;
  background: #e2e8e5;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
}

.pocket-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Pocket Check Variations */
.pocket-card.good {
  border-left: 4px solid var(--accent-emerald);
  background: #f4fbf7;
}
.pocket-card.good .progress-bar {
  background: var(--accent-emerald);
}
.pocket-card.good .status-pill {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.pocket-card.tight {
  border-left: 4px solid var(--accent-gold);
  background: var(--accent-gold-soft);
}
.pocket-card.tight .progress-bar {
  background: var(--accent-gold);
}
.pocket-card.tight .status-pill {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.pocket-card.risky {
  border-left: 4px solid #dc2626;
  background: #fff5f5;
}
.pocket-card.risky .progress-bar {
  background: #dc2626;
}
.pocket-card.risky .status-pill {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

/* ----- SCHEDULE TABLE ----- */
.schedule-section {
  margin-top: 26px;
}

.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.schedule-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-900);
}

.schedule-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: 360px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: right;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f3;
}

th {
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid #edf2ef;
  color: var(--text-body);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) {
  background: #fafcfb;
}

tr:hover {
  background: #f0f7f3;
}

th:first-child, td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--primary-900);
}

/* Custom Scrollbar for Schedule */
.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.table-wrap::-webkit-scrollbar-track {
  background: #f1f5f3;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-pill);
}


/* Savings Tip */
.savings-tip {
  margin-top: 18px;
  padding: 14px 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  color: #0369a1;
}

.tip-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ----- FOOTER ----- */
footer {
  text-align: center;
  padding: 30px 16px 40px;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: #ffffff;
  margin-top: auto;
}

.footer-inner {
  max-width: 580px;
  margin: 0 auto;
}

.footer-sub {
  margin-top: 6px;
  color: var(--text-light);
  font-size: 0.78rem;
}


@media (max-width: 480px) {
  header {
    padding: 24px 16px 64px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .sub {
    font-size: 0.88rem;
  }

  main {
    margin-top: -42px;
    padding: 0 12px;
  }

  .card {
    padding: 20px 16px;
  }

  .two-inputs {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-value {
    font-size: 1.9rem;
  }

  .tab-btn {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
}
