/* ========================================================================
   DEPLOY PATH: /css/sidebar-polish.css
   Tepuy Solutions — Retirement Calculator sidebar polish
   Version: 2026-03-31 (refactored)
   
   Load AFTER tepuy.css.
   Token overrides are scoped to .calc-aside — they do NOT bleed globally.
   ======================================================================== */

/* ══════════════════════════════════════════════════════════════════════════
   0.  DESIGN TOKENS (local overrides only)
   ══════════════════════════════════════════════════════════════════════════ */
.calc-aside {

  /* Sidebar surface — slightly cooler off-white so cards pop */
  --sb-bg:          #f4f8f6;
  --sb-border:      #dce8e1;

  /* Card header — institutional, not emoji-green */
  --cardH-bg:       #1a5236;
  --cardH-bg-open:  #21673f;
  --cardH-text:     #ffffff;

  /* Inputs */
  --inp-bg:         #ffffff;
  --inp-border:     #c8ddd3;
  --inp-focus:      #1a6b4a;

  /* Tooltip */
  --tip-bg:         #0f2b1e;
  --tip-fg:         #f0fdf4;
  --tip-radius:     6px;
  --tip-shadow:     0 4px 16px rgba(0,0,0,0.22);
}


/* ══════════════════════════════════════════════════════════════════════════
   1.  SIDEBAR PANEL — clean container
   ══════════════════════════════════════════════════════════════════════════ */
body.calc .calc-aside .sidebar-panel,
body.calc .calc-aside {
  background: var(--sb-bg) !important;
}

body.calc .calc-aside .sidebar-scroll {
  background: transparent !important;
  padding-right: 4px !important;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #c8ddd3 transparent;
}

body.calc .calc-aside .sidebar-scroll::-webkit-scrollbar { width: 5px; }
body.calc .calc-aside .sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
body.calc .calc-aside .sidebar-scroll::-webkit-scrollbar-thumb {
  background: #c8ddd3;
  border-radius: 4px;
}


/* ══════════════════════════════════════════════════════════════════════════
   2.  MODE TOGGLE BAR — refined pill switcher
   ══════════════════════════════════════════════════════════════════════════ */
body.calc .calc-aside .mode-toggle-bar,
aside .mode-toggle-bar {
  padding: 0.7rem 0.9rem 0.65rem !important;
  background: transparent !important;
  border-bottom: 1px solid var(--sb-border) !important;
  margin-bottom: 0.55rem !important;
  gap: 0 !important;
}

body.calc .calc-aside .mode-btn,
aside .mode-btn {
  font-size: 0.765rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  padding: 0.28rem 0.85rem !important;
  color: #5a7a6c !important;
  background: transparent !important;
  border: 1px solid #c8ddd3 !important;
  transition: color 0.14s, background 0.14s !important;
}

body.calc .calc-aside .mode-btn:first-of-type,
aside .mode-btn:first-of-type { border-radius: 5px 0 0 5px !important; }

body.calc .calc-aside .mode-btn:last-of-type,
aside .mode-btn:last-of-type  {
  border-radius: 0 5px 5px 0 !important;
  border-left: none !important;
}

body.calc .calc-aside .mode-btn--active,
aside .mode-btn--active {
  color: #fff !important;
  background: #1a5236 !important;
  border-color: #1a5236 !important;
  letter-spacing: 0.04em !important;
}

body.calc .calc-aside .mode-hint,
aside .mode-hint {
  font-size: 0.68rem !important;
  color: #9aada6 !important;
  letter-spacing: 0.02em !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   3.  ADVANCED MODE — Sidebar title/sub text
   ══════════════════════════════════════════════════════════════════════════ */
#advModePanel .sidebar-title {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  color: #1a5236 !important;
  border-bottom: none !important;
  padding: 0.35rem 0.9rem 0 !important;
  margin: 0 0 0.1rem !important;
}

#advModePanel .sidebar-sub {
  font-size: 0.72rem !important;
  color: #9aada6 !important;
  padding: 0 0.9rem !important;
  margin: 0 0 0.5rem !important;
  line-height: 1.4 !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   4.  ACCORDION CARDS — all start CLOSED in Advanced mode
       The JS wireCollapsibles() and the inline aria-expanded="true" on each
       card-header need to be overridden via CSS so that on page load
       every card content is visually collapsed until clicked.
       We force the closed state here; JS will still toggle correctly.
   ══════════════════════════════════════════════════════════════════════════ */

/* Override: in advanced panel, card-content always starts hidden even if
   it has the .open class or inline styles from the HTML source. */
#advModePanel .card-content {
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: block !important;
  transition: max-height 0.3s ease, opacity 0.22s ease, padding 0.3s ease !important;
}

/* Only show the content once .open is added AND aria-expanded is true on the header */
#advModePanel .card-content.open {
  max-height: 3600px !important;
  overflow: visible !important;
  opacity: 1 !important;
  padding: 0.65rem 0.9rem 0.85rem !important;
}

/* Ensure headers that have aria-expanded="true" in HTML start with open icon */
/* We can't change the HTML, so we let CSS reflect the actual .open class instead */


/* ══════════════════════════════════════════════════════════════════════════
   5.  CARD HEADERS — institutional, no emojis, clean chevron
   ══════════════════════════════════════════════════════════════════════════ */

/* Hide all .ico spans inside advanced panel card headers */
#advModePanel .card-header .ico {
  display: none !important;
}

/* Main card header — refined look */
#advModePanel .card-header,
aside #advModePanel .card-header {
  padding: 0 2.4rem 0 0.9rem !important;
  height: 40px !important;
  font-size: 0.775rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--cardH-text) !important;
  background: var(--cardH-bg) !important;
  border-radius: 7px 7px 0 0 !important;
  border-bottom: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 0 !important;
  cursor: pointer !important;
  user-select: none !important;
  position: relative !important;
  transition: background 0.14s !important;
}

#advModePanel .card-header:hover {
  background: var(--cardH-bg-open) !important;
}

/* h4 inside header */
#advModePanel .card-header h4 {
  font: inherit !important;
  color: inherit !important;
  margin: 0 !important;
  line-height: 1 !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  letter-spacing: inherit !important;
  text-transform: inherit !important;
}

/* Chevron indicator — SVG-drawn arrow, no emoji, no +/- */
#advModePanel .card-header::after {
  content: '' !important;
  position: absolute !important;
  right: 11px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,0.18) !important;
  border: none !important;
  /* Down chevron via clip-path or border trick */
  box-shadow: none !important;
  font-size: 0 !important; /* hide any text content */
  /* Draw a down-pointing chevron using border trick */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23ffffff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-size: 12px 12px !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  transition: transform 0.22s ease !important;
}

/* When card is expanded, rotate chevron to point up */
#advModePanel .card-header[aria-expanded="true"]::after {
  content: '' !important;
  transform: translateY(-50%) rotate(180deg) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23ffffff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-size: 12px 12px !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  right: 11px !important;
  top: 50% !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
}

/* Card wrapper */
#advModePanel .card,
aside #advModePanel .card {
  border: 1px solid var(--sb-border) !important;
  border-radius: 8px !important;
  margin-bottom: 0.4rem !important;
  overflow: hidden !important;
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
  transition: box-shadow 0.15s !important;
}

#advModePanel .card:hover {
  box-shadow: 0 2px 8px rgba(26, 82, 54, 0.08) !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   6.  FORM ROW — tighter, more legible
   ══════════════════════════════════════════════════════════════════════════ */
#advModePanel .form-row {
  margin-bottom: 0.5rem !important;
}

#advModePanel .form-row:last-child {
  margin-bottom: 0.1rem !important;
}

#advModePanel .form-row label {
  font-size: 0.785rem !important;
  font-weight: 500 !important;
  color: #3d5248 !important;
  margin-bottom: 3px !important;
  display: block !important;
  line-height: 1.35 !important;
}

/* checkbox/radio labels — inline, not block */
#advModePanel .form-row label:has(input[type="checkbox"]),
#advModePanel .form-row label:has(input[type="radio"]) {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.4rem !important;
  flex-wrap: wrap !important;
  font-size: 0.785rem !important;
}

/* Inputs */
#advModePanel .form-row input[type="text"],
#advModePanel .form-row input[type="number"],
#advModePanel .form-row select,
#advModePanel .form-row textarea {
  width: 100% !important;
  padding: 0.3rem 0.55rem !important;
  font-size: 0.845rem !important;
  border-radius: 5px !important;
  border: 1px solid var(--inp-border) !important;
  background: var(--inp-bg) !important;
  color: #0f1c16 !important;
  font-family: inherit !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
  box-sizing: border-box !important;
}

#advModePanel .form-row input[type="text"]:focus,
#advModePanel .form-row input[type="number"]:focus,
#advModePanel .form-row select:focus {
  outline: none !important;
  border-color: var(--inp-focus) !important;
  box-shadow: 0 0 0 3px rgba(26, 107, 74, 0.12) !important;
  background: #ffffff !important;
}

/* Toggles / checkboxes */
#advModePanel input[type="checkbox"].toggle,
#advModePanel .form-row input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0 !important;
  margin-top: 1px !important;
  accent-color: #1a5236 !important;
  cursor: pointer !important;
}

/* Hint text */
#advModePanel .card-content > .muted,
#advModePanel .hint,
#advModePanel p.hint {
  font-size: 0.72rem !important;
  color: #9aada6 !important;
  line-height: 1.45 !important;
  margin: -0.15rem 0 0.6rem !important;
}

#advModePanel .tiny.muted,
#advModePanel p.tiny.muted {
  font-size: 0.68rem !important;
  color: #b0bfba !important;
  line-height: 1.4 !important;
  margin: 0.25rem 0 0.1rem !important;
}

/* Grid helpers */
#advModePanel .grid-2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.5rem !important;
}

#advModePanel .grid-3 {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
  gap: 0.5rem !important;
}

@media (max-width: 440px) {
  #advModePanel .grid-2,
  #advModePanel .grid-3 {
    grid-template-columns: 1fr !important;
  }
}

/* nested-fields divider */
#advModePanel .nested-fields {
  border-top: 1px solid #e8f0eb !important;
  padding: 0.45rem 0 0.1rem !important;
  margin-top: 0.45rem !important;
}

/* form-section-label (used in Household card) */
#advModePanel .form-section-label {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.09em !important;
  color: #7aaa90 !important;
  border-bottom: 1px solid #ddf0e8 !important;
  padding-bottom: 0.2rem !important;
  margin: 0.8rem 0 0.4rem !important;
}

/* muted inline spans */
#advModePanel span.muted {
  font-size: 0.68rem !important;
  color: #b0bfba !important;
  font-weight: 400 !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   7.  TOOLTIP  (.i element) — fixed positioning, proper bubble
       JS must set --tip-x / --tip-y on mouseenter (already done in tepuy).
       We polish the visual here and ensure it never clips inside sidebar.
   ══════════════════════════════════════════════════════════════════════════ */

/* The info badge itself */
.i {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 14px !important;
  height: 14px !important;
  border-radius: 50% !important;
  background: #d4e8de !important;
  color: #1a5236 !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  font-style: normal !important;
  line-height: 1 !important;
  cursor: default !important;
  vertical-align: middle !important;
  margin-left: 0.25rem !important;
  flex-shrink: 0 !important;
  position: relative !important;
  /* Ensure the pseudo-element can escape */
  overflow: visible !important;
}

.i:hover {
  background: #1a5236 !important;
  color: #ffffff !important;
}

/* Tooltip bubble */
.i::after {
  content: attr(data-tip) !important;
  display: block !important;
  position: fixed !important;
  left: var(--tip-x, 50%) !important;
  top: var(--tip-y, auto) !important;
  bottom: auto !important;
  transform: none !important;
  min-width: 200px !important;
  max-width: 270px !important;
  width: max-content !important;
  padding: 0.55rem 0.75rem !important;
  background: var(--tip-bg, #0f2b1e) !important;
  color: var(--tip-fg, #f0fdf4) !important;
  font-size: 0.72rem !important;
  font-weight: 400 !important;
  font-style: normal !important;
  line-height: 1.5 !important;
  border-radius: var(--tip-radius, 6px) !important;
  box-shadow: var(--tip-shadow, 0 4px 16px rgba(0,0,0,0.22)) !important;
  pointer-events: none !important;
  z-index: 99999 !important;
  white-space: normal !important;
  word-break: normal !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.15s ease, visibility 0.15s ease !important;
  letter-spacing: 0.01em !important;
}

/* Arrow */
.i::before {
  content: '' !important;
  display: block !important;
  position: fixed !important;
  left: var(--tip-arrow-x, 50%) !important;
  top: var(--tip-arrow-y, auto) !important;
  bottom: auto !important;
  transform: rotate(45deg) !important;
  width: 7px !important;
  height: 7px !important;
  background: var(--tip-bg, #0f2b1e) !important;
  pointer-events: none !important;
  z-index: 99998 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.15s ease, visibility 0.15s ease !important;
}

/* Show on hover */
.i:hover::after,
.i:focus::after {
  opacity: 1 !important;
  visibility: visible !important;
}

.i:hover::before,
.i:focus::before {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Fallback for when JS hasn't positioned the tooltip yet — show above */
.i:not([style*="--tip-x"]):hover::after {
  position: absolute !important;
  bottom: calc(100% + 10px) !important;
  left: 50% !important;
  top: auto !important;
  transform: translateX(-50%) !important;
  max-width: 240px !important;
  min-width: 180px !important;
}
.i:not([style*="--tip-x"]):hover::before {
  position: absolute !important;
  bottom: calc(100% + 6px) !important;
  left: 50% !important;
  top: auto !important;
  transform: translateX(-50%) rotate(45deg) !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   8.  SIDEBAR FOOTER — Calculate button ONLY, Pro banner removed
   ══════════════════════════════════════════════════════════════════════════ */

/* Remove the Pro CTA banner entirely */
.sidebar-footer .pro-cta,
.sidebar-footer button.pro-cta,
.sidebar-footer #unlockPro {
  display: none !important;
}

/* Clean footer layout: just the button + tiny hint */
.sidebar-footer {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.35rem !important;
  padding: 0.6rem 0 0.5rem !important;
  flex-shrink: 0 !important;
  border-top: 1px solid var(--sb-border) !important;
  background: var(--sb-bg) !important;
}

/* Calculate button — refined */
.sidebar-footer #runBtn,
.sidebar-footer .btn.btn-primary {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 42px !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, #1a5236 0%, #247857 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(26, 82, 54, 0.22) !important;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
}

.sidebar-footer #runBtn:hover,
.sidebar-footer .btn.btn-primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(26, 82, 54, 0.3) !important;
  background: linear-gradient(135deg, #1d5c3c 0%, #2b8f62 100%) !important;
}

.sidebar-footer #runBtn:active,
.sidebar-footer .btn.btn-primary:active {
  transform: translateY(0) !important;
}

/* "Adjust inputs above" hint */
.sidebar-footer .tiny.muted {
  font-size: 0.68rem !important;
  color: #9aada6 !important;
  text-align: center !important;
  margin: 0 !important;
  line-height: 1.35 !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   9.  SIMPLE MODE — polished card & inputs (keep emojis, they're intentional)
   ══════════════════════════════════════════════════════════════════════════ */

/* Subtle card surface */
aside .simple-card,
body.calc .calc-aside .simple-card {
  background: #ffffff !important;
  border: 1px solid var(--sb-border) !important;
  border-radius: 10px !important;
  padding: 0.9rem 0.95rem 1rem !important;
  margin: 0 0 0.5rem !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;
}

/* Question label */
.simple-q-label {
  font-size: 0.785rem !important;
  font-weight: 600 !important;
  color: #1f3d2d !important;
  gap: 0.3rem !important;
}

/* Hint text */
.simple-q-hint {
  font-size: 0.7rem !important;
  color: #9aada6 !important;
  margin-left: 0 !important;
  margin-top: 1px !important;
  line-height: 1.35 !important;
}

/* Input field */
.simple-q-input {
  font-size: 0.92rem !important;
  padding: 0.42rem 0.6rem !important;
  border-radius: 6px !important;
  border: 1px solid var(--inp-border) !important;
  background: var(--inp-bg) !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}

.simple-q-input:focus {
  border-color: var(--inp-focus) !important;
  box-shadow: 0 0 0 3px rgba(26, 107, 74, 0.11) !important;
  outline: none !important;
}

/* Prefix/suffix decorators */
.simple-q-prefix,
.simple-q-suffix {
  background: #f0f6f3 !important;
  border-color: var(--inp-border) !important;
  color: #7aaa90 !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
}

/* Divider */
.simple-section-divider {
  background: #e8f0eb !important;
  margin: 0.45rem 0 0.85rem !important;
}

/* Run button */
.simple-run-btn,
aside .simple-card .simple-run-btn,
body.calc .calc-aside .simple-card .simple-run-btn {
  background: linear-gradient(135deg, #1a5236 0%, #247857 100%) !important;
  border-radius: 8px !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em !important;
  box-shadow: 0 2px 8px rgba(26, 82, 54, 0.2) !important;
  transition: transform 0.12s, box-shadow 0.12s !important;
  margin-top: 0.65rem !important;
}

.simple-run-btn:hover,
aside .simple-card .simple-run-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(26, 82, 54, 0.28) !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   10. SELECT DROPDOWNS — consistent styling
   ══════════════════════════════════════════════════════════════════════════ */
#advModePanel select {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239aada6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.6rem center !important;
  background-size: 8px 5px !important;
  padding-right: 1.8rem !important;
  cursor: pointer !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   11. MOBILE REFINEMENTS (≤ 768px)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar fills viewport width on mobile */
  body.calc .calc-aside .sidebar-panel {
    border-radius: 0 !important;
    padding: 0 0.75rem 0 !important;
  }

  /* Slightly more breathing room between cards */
  #advModePanel .card {
    margin-bottom: 0.35rem !important;
  }

  /* Tighter card header on mobile */
  #advModePanel .card-header {
    height: 38px !important;
    font-size: 0.72rem !important;
    padding: 0 2.2rem 0 0.8rem !important;
  }

  /* Open card content — slightly tighter padding */
  #advModePanel .card-content.open {
    padding: 0.55rem 0.8rem 0.75rem !important;
  }

  /* Footer */
  .sidebar-footer {
    padding: 0.5rem 0 0.4rem !important;
  }

  /* Simple card: full-width inputs on narrow screens */
  .simple-q-input-wrap {
    flex-wrap: nowrap !important;
  }
}

@media (max-width: 480px) {
  /* Stack prefix + input vertically on very small phones */
  .simple-q-input-wrap {
    flex-direction: row !important; /* keep inline; the suffix can wrap */
  }
}


/* ══════════════════════════════════════════════════════════════════════════
   12. DESKTOP REFINEMENTS (≥ 1025px)
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {

  body.calc .calc-aside .sidebar-panel {
    border-radius: 0 !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: 1px solid var(--sb-border) !important;
    padding: 0 !important;
  }

  /* Scroll area padding */
  body.calc .calc-aside .sidebar-scroll {
    padding: 0.5rem 0.6rem 0 !important;
  }

  /* Footer padding aligned with scroll area */
  .sidebar-footer {
    padding: 0.6rem 0.6rem 0.6rem !important;
  }
}


/* ══════════════════════════════════════════════════════════════════════════
   13. MISCELLANEOUS POLISH
   ══════════════════════════════════════════════════════════════════════════ */

/* Phase tags inside Household card — keep colours, just ensure sizing */
.phase-tag {
  font-size: 0.58rem !important;
  padding: 0.12rem 0.4rem !important;
  letter-spacing: 0.05em !important;
  border-radius: 3px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
}

/* "result-box" notices inside forms */
#advModePanel .result-box {
  font-size: 0.76rem !important;
  padding: 0.4rem 0.6rem !important;
  border-radius: 5px !important;
  line-height: 1.45 !important;
}

/* inline-number (spend-down age) */
#advModePanel .inline-number {
  width: 56px !important;
  text-align: center !important;
  padding: 0.25rem 0.3rem !important;
  font-size: 0.82rem !important;
  border-radius: 5px !important;
  border: 1px solid var(--inp-border) !important;
  margin-left: 0.35rem !important;
}

/* "Add purchase" dashed button */
#addBigTicketBtn {
  font-size: 0.76rem !important;
  color: #5a7a6c !important;
  border-color: #c8ddd3 !important;
  border-radius: 5px !important;
  padding: 0.3rem 0.6rem !important;
  transition: background 0.15s, border-color 0.15s !important;
}

#addBigTicketBtn:hover {
  background: #f0f7f4 !important;
  border-color: #3db07e !important;
  color: #1a5236 !important;
}

/* ASFA quick-fill buttons in both simple & advanced */
#asfaBtns,
#s_asfaBtns {
  display: flex !important;
  gap: 0.3rem !important;
  flex-wrap: wrap !important;
  margin-top: 0.45rem !important;
}

.s-asfa-btn,
#asfaBtns .btn-outline,
#asfaBtns .btn-small {
  font-size: 0.7rem !important;
  padding: 0.22rem 0.55rem !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

/* Pro banner in-card notices — keep but de-emphasise */
.pro-banner {
  border-radius: 7px !important;
  font-size: 0.78rem !important;
}

/* Warning/info boxes inherit nice sizing */
#advModePanel .result-box.warning {
  background: #fff9ed !important;
  border-left: 3px solid #f59e0b !important;
  color: #7a4f00 !important;
}

#advModePanel .result-box.info {
  background: #eff8ff !important;
  border-left: 3px solid #3b82f6 !important;
  color: #1e3a5f !important;
}

/* Scenario B nested fields */
#scenBFields.nested-fields {
  background: #fafcfb !important;
  border-radius: 0 0 6px 6px !important;
  padding: 0.5rem 0.6rem 0.4rem !important;
  border: none !important;
  border-top: 1px solid #e8f0eb !important;
  margin-top: 0.4rem !important;
}

/* TTR note inside AU panel */
#advModePanel .form-row strong {
  font-size: 0.785rem !important;
  color: #1f3d2d !important;
}

/* Carry-forward info box */
#carryForwardInfoBox {
  border-radius: 5px !important;
  font-size: 0.75rem !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   14. JS INIT HELPER — ensure cards start collapsed on DOMContentLoaded
       We add a brief no-transition state on page load so there is no
       flicker of content expanding then collapsing.
   ══════════════════════════════════════════════════════════════════════════ */

/* Applied by a small inline script (see bottom of this comment).
   This class suppresses transitions during initial collapse. */
#advModePanel.no-transitions .card-content,
#advModePanel.no-transitions .card-header {
  transition: none !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   SCENARIO SAVE / LOAD / SHARE — sidebar buttons
   ══════════════════════════════════════════════════════════════════════════ */
.ret-scenario-row {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.ret-scen-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  padding: 0.38rem 0.4rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #3d5248;
  background: #f4f8f6;
  border: 1px solid #c8ddd3;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}
.ret-scen-btn:hover { background: #e6f2ec; border-color: #3db07e; color: #1a5236; }
.ret-scen-btn:active { background: #d4eae0; }
.ret-scen-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ret-scen-btn--share {
  color: #1a5236;
  background: #edf7f2;
  border-color: #b3d9c4;
}
.ret-scen-btn--share:hover { background: #d4ede2; border-color: #1a6b4a; }

.ret-scen-hint {
  display: none;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0;
  text-align: center;
  line-height: 1.35;
}

/* ══════════════════════════════════════════════════════════════════════════
   LOAD DROPDOWN
   ══════════════════════════════════════════════════════════════════════════ */
.ret-load-dropdown {
  background: #ffffff;
  border: 1px solid #c8ddd3;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.13);
  overflow: hidden;
  margin: 0 0 0.5rem;
  z-index: 200;
  animation: rld-fadein 0.15s ease;
}
@keyframes rld-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rld-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #f4f8f6;
  border-bottom: 1px solid #e3ede8;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3d5248;
}
.rld-close {
  background: none; border: none; font-size: 0.8rem;
  color: #9aada6; cursor: pointer; padding: 0 0.1rem; line-height: 1;
}
.rld-close:hover { color: #1a5236; }
.rld-list {
  list-style: none; margin: 0; padding: 0.3rem 0;
  max-height: 220px; overflow-y: auto;
}
.rld-item {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.5rem; width: 100%; padding: 0.45rem 0.75rem;
  font-family: inherit; font-size: 0.8rem; color: #0f1c16;
  background: none; border: none; cursor: pointer; text-align: left;
  transition: background 0.1s;
}
.rld-item:hover { background: #f0f7f4; color: #1a5236; }
.rld-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rld-date { font-size: 0.64rem; color: #9aada6; flex-shrink: 0; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════════════
   SHARED SCENARIO BANNER
   ══════════════════════════════════════════════════════════════════════════ */
.ret-shared-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #14532d;
  line-height: 1.45;
  animation: ret-banner-in 0.3s ease;
}
.ret-shared-banner[hidden] { display: none !important; }
@keyframes ret-banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ret-shared-banner__close {
  margin-left: auto; flex-shrink: 0; background: none; border: none;
  font-size: 0.85rem; color: #4ade80; cursor: pointer;
  padding: 0.1rem 0.2rem; line-height: 1; border-radius: 3px;
}
.ret-shared-banner__close:hover { color: #15803d; background: rgba(21,128,61,0.08); }

/* ══════════════════════════════════════════════════════════════════════════
   SHARE RESULT BUTTON BAR
   ══════════════════════════════════════════════════════════════════════════ */
.ret-share-result-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0.5rem 0 0.75rem;
}
.ret-share-result-bar[hidden] { display: none !important; }

.ret-share-result-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a5236;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.ret-share-result-btn:hover {
  background: #dcfce7;
  border-color: #4ade80;
  box-shadow: 0 2px 8px rgba(26, 107, 74, 0.15);
}

/* ══════════════════════════════════════════════════════════════════════════
   SHARE CARD MODAL OVERLAY
   ══════════════════════════════════════════════════════════════════════════ */
.ret-sc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 99990;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.ret-sc-overlay.ret-sc-visible {
  display: flex;
}
.ret-sc-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════════════════════
   THE CARD (what html2canvas captures)
   ══════════════════════════════════════════════════════════════════════════ */
.ret-sc-card {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  /* Dark default */
  background: #0d1117;
  color: #e8f0eb;
  border: 1px solid #1e2a22;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.ret-sc-card.ret-sc-light {
  background: #ffffff;
  color: #0f1c16;
  border: 1px solid #e3ede8;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.ret-sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ret-sc-card.ret-sc-light .ret-sc-header { border-bottom-color: #e3ede8; }

.ret-sc-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.28rem 0.75rem;
  border-radius: 20px;
  background: rgba(26,107,74,0.25);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.3);
}
.ret-sc-badge.ret-sc-badge-good { background: rgba(26,107,74,0.25); color: #4ade80; border-color: rgba(74,222,128,0.3); }
.ret-sc-badge.ret-sc-badge-warn { background: rgba(251,191,36,0.15); color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.ret-sc-card.ret-sc-light .ret-sc-badge.ret-sc-badge-good { background: #dcfce7; color: #15803d; border-color: #86efac; }
.ret-sc-card.ret-sc-light .ret-sc-badge.ret-sc-badge-warn { background: #fef9c3; color: #a16207; border-color: #fde047; }

.ret-sc-brand {
  display: flex; flex-direction: column; align-items: flex-end;
  font-size: 0.72rem; font-weight: 700;
  color: rgba(255,255,255,0.45); line-height: 1.4;
}
.ret-sc-card.ret-sc-light .ret-sc-brand { color: #9aada6; }
.ret-sc-brand span { font-size: 0.62rem; font-weight: 400; opacity: 0.7; }

.ret-sc-headline {
  padding: 1rem 1.25rem 0.75rem;
  font-size: 1.1rem; font-weight: 600; line-height: 1.45;
  color: #e8f0eb;
}
.ret-sc-card.ret-sc-light .ret-sc-headline { color: #0f1c16; }
.ret-sc-headline strong { color: #4ade80; }
.ret-sc-card.ret-sc-light .ret-sc-headline strong { color: #15803d; }

.ret-sc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 1.25rem 0.75rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.ret-sc-card.ret-sc-light .ret-sc-stats { background: #e3ede8; border-color: #e3ede8; }

.ret-sc-stat {
  background: #131a1f;
  padding: 0.7rem 0.85rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.ret-sc-card.ret-sc-light .ret-sc-stat { background: #f7faf8; }

.ret-sc-stat-label {
  font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
}
.ret-sc-card.ret-sc-light .ret-sc-stat-label { color: #9aada6; }

.ret-sc-stat-value {
  font-size: 0.875rem; font-weight: 500; line-height: 1.4;
  color: #c8ddd3;
}
.ret-sc-card.ret-sc-light .ret-sc-stat-value { color: #3d5248; }

.ret-sc-stat-value.green { color: #4ade80; }
.ret-sc-stat-value.blue  { color: #60a5fa; }
.ret-sc-stat-value.warn  { color: #fbbf24; }
.ret-sc-stat-value.red   { color: #f87171; }
.ret-sc-card.ret-sc-light .ret-sc-stat-value.green { color: #15803d; }
.ret-sc-card.ret-sc-light .ret-sc-stat-value.blue  { color: #1d4ed8; }
.ret-sc-card.ret-sc-light .ret-sc-stat-value.warn  { color: #92400e; }
.ret-sc-card.ret-sc-light .ret-sc-stat-value.red   { color: #b91c1c; }

.ret-sc-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 0 1.25rem; }
.ret-sc-card.ret-sc-light .ret-sc-divider { background: #e3ede8; }

.ret-sc-assumptions {
  padding: 0.65rem 1.25rem;
  font-size: 0.72rem; color: rgba(255,255,255,0.45); line-height: 1.7;
}
.ret-sc-card.ret-sc-light .ret-sc-assumptions { color: #7a948a; }
.ret-sc-assumptions strong { color: rgba(255,255,255,0.75); font-weight: 600; }
.ret-sc-card.ret-sc-light .ret-sc-assumptions strong { color: #1f3d2d; }

.ret-sc-footer {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; padding: 0.65rem 1.25rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ret-sc-card.ret-sc-light .ret-sc-footer { border-top-color: #e3ede8; }

.ret-sc-disclaimer { font-size: 0.62rem; color: rgba(255,255,255,0.25); line-height: 1.5; margin: 0; }
.ret-sc-card.ret-sc-light .ret-sc-disclaimer { color: #b0bfba; }

.ret-sc-url { font-size: 0.62rem; font-weight: 600; color: rgba(255,255,255,0.2); white-space: nowrap; flex-shrink: 0; }
.ret-sc-card.ret-sc-light .ret-sc-url { color: #c8ddd3; }

/* ══════════════════════════════════════════════════════════════════════════
   MODAL ACTION BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */
.ret-sc-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  justify-content: center; width: 100%;
}
.ret-sc-action-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  border-radius: 8px; cursor: pointer; border: none;
  transition: background 0.14s, transform 0.1s; white-space: nowrap;
}
.ret-sc-action-btn:active { transform: translateY(1px); }

.ret-sc-action-primary { background: #1a5236; color: #ffffff; }
.ret-sc-action-primary:hover { background: #247857; }

.ret-sc-action-secondary {
  background: rgba(255,255,255,0.1); color: #e8f0eb;
  border: 1px solid rgba(255,255,255,0.15);
}
.ret-sc-action-secondary:hover { background: rgba(255,255,255,0.18); }

.ret-sc-action-close {
  background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.1);
}
.ret-sc-action-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

.ret-sc-hint { font-size: 0.72rem; color: rgba(255,255,255,0.3); text-align: center; margin: 0; }

@media (max-width: 500px) {
  .ret-sc-stats { grid-template-columns: 1fr; }
  .ret-sc-headline { font-size: 0.95rem; }
  .ret-sc-action-btn { padding: 0.5rem 0.75rem; font-size: 0.76rem; }
  .ret-scen-btn { font-size: 0.67rem; padding: 0.35rem 0.25rem; gap: 0.2rem; }
  .ret-scen-btn svg { display: none; }
}
