/* =========================================================
   FINFORFAM — YOUR PLAN V2 (CLEAN, STABLE, MOBILE-SAFE)
   ========================================================= */

/* ---------------------------------------------------------
   Columns (override global .card behavior safely)
--------------------------------------------------------- */

/* Sticky results on desktop only */
@media (min-width: 901px) {
  .budget-results {
    position: sticky;
    top: 6.5rem;
  }
}

/* ---------------------------------------------------------
   Form sections
--------------------------------------------------------- */

.budget-form h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Input groups */
.budget-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

@media (max-width: 700px) {
  .budget-group {
    grid-template-columns: 1fr;
  }
}

.budget-group label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.budget-group input {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
  outline: none;
}

.budget-group input:focus {
  border-color: var(--color-seafoam);
  box-shadow: 0 0 0 2px rgba(131,197,190,0.45);
  background: #f8fcfd;
}

/* ---------------------------------------------------------
   Optional details (RESP / cash / debt)
--------------------------------------------------------- */

.plan-optional {
  margin-top: 1.25rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(131,197,190,0.08);
}

.plan-optional summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-deep-teal);
}

/* ---------------------------------------------------------
   Snapshot cards
--------------------------------------------------------- */

.plan-snapshot-cards {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.plan-snapshot-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(15,23,42,0.05);
  box-shadow: var(--shadow-soft);
}

.plan-snapshot-card--primary {
  background: linear-gradient(
    180deg,
    rgba(0,109,119,0.12),
    rgba(255,255,255,0.95)
  );
}

.plan-snapshot-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.plan-snapshot-value {
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.plan-snapshot-meta {
  font-size: 0.75rem;
  margin-top: 0.4rem;
  color: var(--color-text-muted);
}

.plan-scenario {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.35rem;
  background: #f3f6f6;
  border-radius: 999px;
}

/* Scenario pill — unified */
.scenario-pill {
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: #223;
  transition: all 0.18s ease;
}

/* Active state — both class names */
.scenario-pill.active,
.scenario-pill.is-active {
  background: linear-gradient(
    135deg,
    var(--color-deep-teal),
    var(--color-seafoam)
  );
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0, 109, 119, 0.35);
}


.scenario-pill:hover {
  background: rgba(0, 109, 119, 0.08);
}

.scenario-pill.active {
  background: #006d77;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 109, 119, 0.25);
}

.plan-scenario {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem;
  background: #f3f6f6;
  border-radius: 999px;
  max-width: 100%;
}

.plan-scenario .scenario-pill {
  white-space: nowrap;
  flex: 0 0 auto;
  min-width: 5.5rem;
  text-align: center;
}

@media (max-width: 420px) {
  .plan-scenario {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .plan-scenario .scenario-pill {
    min-width: 4.75rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 420px) {
  .plan-scenario {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .plan-scenario .scenario-pill {
    min-width: 4.75rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
  }
}
.plan-assumptions {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding-top: 2.0rem;
  margin-left: 0.5rem;
}

.slider {
  width: 36px;
  height: 20px;
  background: #d6dddd;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
}

.slider::after {
  content: "";
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.plan-helper-text {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.75rem;
  color: #6b7c7c;
  max-width: 55ch;
}

.flag-item {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #f4f7f7;
  color: #1f2d2d;
}

/* GOOD */
.flag-item[data-tone="good"] {
  background: rgba(0, 109, 119, 0.08);
  border-left: 4px solid #006d77;
}

/* CAUTION */
.flag-item[data-tone="caution"] {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid #f59e0b;
}

/* RISK */
.flag-item[data-tone="risk"] {
  background: rgba(220, 38, 38, 0.08);
  border-left: 4px solid #dc2626;
}

/* NEUTRAL */
.flag-item[data-tone="neutral"] {
  background: #f4f7f7;
  border-left: 4px solid #cbd5d5;
}

#v2Flags {
  display: grid;
  gap: 0.6rem;
}

.plan-snapshot-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;

  margin: 1.25rem 0 1.5rem;
  padding: 0.9rem 1.1rem;

  background: linear-gradient(
    135deg,
    rgba(0, 109, 119, 0.08),
    rgba(0, 109, 119, 0.03)
  );
  border-radius: 14px;
}

.plan-snapshot-text p {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.plan-snapshot-cta .btn {
  white-space: nowrap;
}

.plan-snapshot-cta {
  display: none;
}

/* ---------------------------------------------------------
   Balance bar
--------------------------------------------------------- */

.balance-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.balance-bar-track {
  display: flex;
  height: 10px;
  background: #e9eeee;
  border-radius: 999px;
  overflow: hidden;
}

/* Assets */
#segCash {
  background: #9fd3c7; /* light teal */
}

#segInvest {
  background: #006d77; /* brand teal */
}

#segHome {
  background: #cfd8d8; /* neutral */
}

/* Debts */
.balance-bar-seg.debt#segMortgage {
  background: #f59e0b; /* amber */
}

.balance-bar-seg.debt#segOtherDebt {
  background: #f97316; /* soft red */
}

.balance-bar-col.debts .balance-bar-track {
  opacity: 0.9;
}

@media (max-width: 900px) {
  .balance-bar {
    grid-template-columns: 1fr;
  }
}

.balance-bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15,23,42,0.08);
}

/* ---------------------------------------------------------
   Actions
--------------------------------------------------------- */

.budget-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .budget-actions {
    flex-direction: column;
  }

  .budget-actions button {
    width: 100%;
  }
}

/* ---------------------------------------------------------
   Notes
--------------------------------------------------------- */

.plan-footnote {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* CRITICAL: allow grid children to shrink */
.budget-layout > *,
.dashv3-main-grid > *,
.dashv3-hero-grid > *,
.dashv3-lab-grid > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .budget-layout {
    grid-template-columns: 1fr;
  }
}
