/* =====================================================
   GLOBAL DARK THEME
===================================================== */

body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at 20% 0%, #1e293b 0%, #0f172a 60%);
  padding: 40px 24px;
  color: #e5e7eb;
  line-height: 1.6;
}

h1, h2, h3 {
  margin-top: 0;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.hero {
  text-align: center;
  margin-bottom: 60px;
}

.hero-title {
  font-size: 38px;
  background: linear-gradient(90deg,#ffffff,#a5b4fc);

  -webkit-background-clip: text;
  background-clip: text;

  -webkit-text-fill-color: transparent;
}

.hero-points ul {
  list-style: none;
  padding: 0;
}

.hero-points li {
  margin: 6px 0;
  color: #cbd5e1;
}

.hero-explainer p {
  color: #94a3b8;
}

/* =====================================================
   CARDS
===================================================== */

.container {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  background: linear-gradient(145deg,#111827,#0f172a);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  padding: 30px;
  width: 380px;
  transition: all 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
}

label {
  font-size: 14px;
  color: #94a3b8;
}

input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0b1220;
  color: white;
}

input:focus {
  outline: none;
  border-color: #6366f1;
}

.standard-payments {
  margin: 12px 0 24px 0;
  font-size: 14px;
  opacity: 0.85;
}

/* =====================================================
   HELPERS
===================================================== */

.helper-text {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
}

.error-message {
  font-size: 12px;
  color: #f87171;
  margin-bottom: 10px;
}

/* =====================================================
   CASCADE OPTIONS
===================================================== */

.cascade-options {
  background: linear-gradient(145deg,#111827,#0f172a);
  padding: 30px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  max-width: 900px;
  margin: 40px auto;
}

.cascade-options h3 {
  margin-bottom: 16px;
}

.cascade-options label {
  margin-right: 30px;
  color: #e5e7eb;
}

/* =====================================================
   BUTTON
===================================================== */

button {
  display: block;
  margin: 40px auto;
  background: linear-gradient(135deg,#6366f1,#8b5cf6);
  color: white;
  padding: 14px 30px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 20px 50px rgba(99,102,241,0.4);
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-3px);
}

button:disabled {
  opacity: 0.4;
}

/* =====================================================
   STRATEGY SUMMARY
===================================================== */

.strategy-summary {
  background: linear-gradient(145deg,#111827,#0f172a);
  border-radius: 24px;
  padding: 40px;
  margin-top: 60px;
  border: 1px solid rgba(255,255,255,0.06);
}

/* =====================================================
   STRATEGY TABLE
===================================================== */

.strategy-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  border-radius: 16px;
  overflow: hidden;
}

.strategy-table th {
  background: #1e293b;
  padding: 14px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: #cbd5e1;
}

.strategy-table td {
  padding: 14px 18px;
  font-size: 14px;
  color: #e5e7eb;
}

.strategy-table tbody tr:nth-child(even) {
  background: #0f172a;
}

/* Highlight row (winner) */
.row-highlight {
  background: linear-gradient(
    90deg,
    rgba(124,58,237,0.25),
    rgba(124,58,237,0.15)
  ) !important;
  font-weight: 600;
}

/* =====================================================
   IMPACT SUMMARY BOX (Compact + Animated)
===================================================== */

.impact-summary {
  max-width: 640px;
  margin: 0 auto 18px auto;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  animation: fadeInImpact 0.35s ease-out;
}

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

.impact-positive {
  background: linear-gradient(135deg,#4338ca,#7c3aed);
  color: #ffffff;
}

.impact-negative {
  background: linear-gradient(135deg,#7f1d1d,#b91c1c);
  color: #ffffff;
}

.impact-neutral {
  background: linear-gradient(135deg,#1e293b,#334155);
  color: #e5e7eb;
}
/* =====================================================
   CHART
===================================================== */

.chart-card {
  margin-top: 50px;
  margin-bottom: 60px;   /* create hard separation */
  background: linear-gradient(145deg,#111827,#0f172a);
  border-radius: 24px;
  padding: 40px;
  border: 1px solid rgba(255,255,255,0.06);
}

.chart-card canvas {
  width: 100% !important;
  height: 380px !important;
}

/* =====================================================
   LEGEND
===================================================== */

.manual-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
}

.legend-item {
  cursor: pointer;
  opacity: 0.6;
}

.legend-item.active {
  opacity: 1;
  font-weight: 600;
}

.legend-line {
  display: inline-block;
  width: 20px;
  height: 3px;
  margin-right: 6px;
}

/* Keep legend colours intact */
.m1-sep { background: rgba(46,109,246,0.35); }
.m1-cas { background: rgba(46,109,246,1); }
.m2-sep { background: rgba(120,90,255,0.35); }
.m2-cas { background: rgba(120,90,255,1); }
.total-sep {background: rgba(203,213,225,0.6);}
.total-cas {background: #ffffff;}

/* =====================================================
   YEARLY TABLE
===================================================== */

.milestone-card {
  margin-top: 40px;
  background: linear-gradient(145deg,#111827,#0f172a);
  border-radius: 24px;
  padding: 30px;
  border: 1px solid rgba(255,255,255,0.06);
}

.milestone-table {
  min-width: 900px;   /* forces proper horizontal scroll */
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.milestone-table th,
.milestone-table td {
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

.milestone-table th:first-child,
.milestone-table td:first-child {
  text-align: left;
}


.milestone-card .table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
  border-radius: 12px;
}

.milestone-card th {
  background: #1e293b;
  padding: 12px;
}

.milestone-card td {
  padding: 12px;
}

.milestone-card tbody tr:nth-child(odd) {
  background: rgba(255,255,255,0.02);
}

.milestone-card tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.25);
}

.site-footer {
  text-align: center;
  margin-top: 80px;
  color: #64748b;
}

.manual-legend {
  margin-bottom: 30px;
}

.milestone-card {
  margin-top: 50px;
}


/* Year column centered */
.milestone-card th:first-child,
.milestone-card td:first-child {
  text-align: center;
}

/* All other columns right-aligned (numbers) */
.milestone-card th:not(:first-child),
.milestone-card td:not(:first-child) {
  text-align: right;
}





/* =====================================================
   FOOTER
===================================================== */

.site-footer {
  margin-top: 100px;
  padding: 60px 20px 80px;
  text-align: center;
  color: #94a3b8;
}

.footer-toggle {
  max-width: 700px;
  margin: 0 auto;
}

.footer-toggle summary {
  cursor: pointer;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.footer-section {
  margin-top: 30px;
}

.footer-section strong {
  display: block;
  margin-bottom: 12px;
  color: #e5e7eb;
}

.footer-section p {
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 500px;
}

.footer-section ul li {
  margin: 6px 0;
  color: #94a3b8;
}

.footer-section ul li::before {
  content: "• ";
  color: #6366f1;
}


.share-actions {
  margin-top: 30px;
  text-align: center;
}

.share-actions button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: none;
}

.share-actions button:hover {
  background: rgba(255,255,255,0.05);
}


/* =====================================================
   MOBILE OPTIMISATION
===================================================== */

/* =====================================================
   MOBILE OPTIMISATION
===================================================== */

@media (max-width: 768px) {

  body {
    padding: 24px 14px;
  }

  .card {
    width: 100%;
  }

  .chart-card {
    padding: 20px;
  }

  .chart-card canvas {
    height: 260px !important;
  }

  /* === FIXED LEGEND FOR MOBILE === */

  .manual-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-top: 16px;
  }

  .legend-item {
    font-size: 13px;
  }

  .strategy-summary {
    padding: 20px;
  }

  .strategy-table th,
  .strategy-table td {
    font-size: 13px;
    padding: 10px 8px;
  }

  .milestone-card {
    padding: 20px;
  }

}

@media (max-width: 768px) {

  .strategy-table th:nth-child(1),
  .strategy-table td:nth-child(1) {
    width: 40%;
  }

  .strategy-table th:nth-child(2),
  .strategy-table td:nth-child(2) {
    width: 30%;
  }

  .strategy-table th:nth-child(3),
  .strategy-table td:nth-child(3) {
    width: 30%;
  }

}