/* ── SaaS App Bar ── */
.default-header:has(.saas-app-bar) {
  /* Provide just enough top padding so the nav bar isn't cut off */
  padding-top: calc(var(--section-padding) * 0.5) !important; 
  padding-bottom: 0 !important;
}

.saas-app-bar {
  padding: 0 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0; 
}

.saas-app-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.saas-app-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.saas-app-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.saas-app-title {
  font-family: 'Michael Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
  letter-spacing: -0.02em;
}

.saas-app-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  font-weight: 500;
}

@media (max-width: 768px) {
  .saas-app-bar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ── Portfolio-aligned token overrides ── */
.calculator-section {
  background-color: var(--bg);
  color: var(--text);
  padding-top: 0 !important; /* Topbar sits flush at the very top of the section */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --border: rgba(28, 29, 32, 0.175);
  --text: #1C1D20;
  --text-secondary: #6b7280;
  --accent: #455CE9;
  --accent-light: #eef2ff;
  --input-bg: #FFFFFF;
  --radius: 0.6rem;
  --radius-sm: 0.4rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --s1-color: #455CE9;
  --s2-color: #7c3aed;
}

/* Dark mode overrides */
.calculator-section[data-theme="dark"] {
  --bg: #1C1D20;
  --surface: #1f2937;
  --border: rgba(255, 255, 255, 0.2);
  --text: #FFFFFF;
  --text-secondary: #9ca3af;
  --accent: #455CE9;
  --input-bg: #111827;
}

/* Typography swap */
.calculator-section,
.calculator-section *,
.calculator-section input,
.calculator-section select,
.calculator-section button {
  font-family: 'Michael Sans', sans-serif !important;
}

.calculator-section .panel-title,
.calculator-section .bottom-line-title,
.calculator-section .scenario-label {
  font-weight: 800;
}

/* Section toggle tabs */
.calc-section-toggle {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 1.5rem 0 2rem;
}
.calc-section-toggle .section-nav-btn {
  font-family: 'Michael Sans', sans-serif;
  font-weight: 450;
  font-size: 1em;
  padding: 0.8em 2em;
  border: 1px solid var(--border);
  border-radius: 2.125em;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.7, 0, 0.3, 1);
}
.calc-section-toggle .section-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.calc-section-toggle .section-nav-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

/* Hide original app bar */
.app-bar { display: none !important; }

/* Locomotive scroll fix for desktop sticky */
@media (min-width: 1025px) {
  .calculator-section .app-container,
  .invest-section {
    display: grid;
    grid-template-columns: clamp(300px, 25vw, 400px) 1fr;
    gap: 2rem;
    align-items: start;
  }
  .calculator-section .inputs-panel,
  .invest-inputs-panel {
    position: relative;
    top: auto;
  }
}
main.touch .calculator-section .inputs-panel,
main.touch .invest-inputs-panel {
  position: sticky;
  top: 1rem;
}

.calculator-section .app-container {
  margin: 0 auto;
  max-width: 100em;
}

/* Theme Toggle utility */
.theme-toggle-utility {
  position: fixed;
  bottom: var(--gap-padding);
  right: var(--gap-padding);
  z-index: 50;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--color-dark);
  color: var(--color-white);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--animation-primary);
}

/* ── Email Capture Card (inline, end-of-results) ── */
.email-capture-card {
  background: #1C1D20;
  border-radius: 1rem;
  padding: 2.25rem 2.25rem 2rem;
  margin: 1.5rem 0 0.5rem;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
}
.email-capture-card::before {
  /* subtle accent glow so the card doesn't feel like a banner ad */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 0% 0%, rgba(69, 92, 233, 0.18), transparent 55%);
  pointer-events: none;
}
.email-capture-card > * { position: relative; }
.email-capture-card h4 {
  font-family: 'Michael Sans', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
  color: #FFFFFF;
}
.email-capture-card .email-sub {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

/* Honeypot — visually + assistive-tech hidden, but bots see it. */
.email-capture-card .hp-field {
  position: absolute !important;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.email-input-wrap {
  display: flex;
  gap: 0.65rem;
  margin: 0;
  align-items: stretch;
}
.email-input-wrap input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1.25rem;
  border-radius: 2.125rem;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: white;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.email-input-wrap input[type="email"]:focus {
  outline: none;
  border-color: rgba(69, 92, 233, 0.7);
  background: rgba(255,255,255,0.09);
}
.email-input-wrap input[type="email"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-email-submit {
  position: relative;
  padding: 0.85rem 1.6rem;
  min-width: 11rem;
  border-radius: 2.125rem;
  background: #455CE9;
  color: white;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, transform 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-email-submit:hover:not(:disabled) { background: #3a4ec7; }
.btn-email-submit:active:not(:disabled) { transform: translateY(1px); }
.btn-email-submit:disabled { cursor: not-allowed; }

.btn-email-submit .btn-spinner,
.btn-email-submit .btn-check { display: none; }

.btn-email-submit .btn-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: hcSpin 0.7s linear infinite;
}
@keyframes hcSpin { to { transform: rotate(360deg); } }

.email-fine-print {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  margin: 0.85rem 0 0;
}

/* ── State machine (data-state on .email-capture-card) ── */
.email-status-msg {
  display: none;
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.9rem;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.email-success-msg {
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  border: 1px solid rgba(74, 222, 128, 0.25);
}
.email-error-msg {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* SENDING — show spinner, hide label/check */
.email-capture-card[data-state="sending"] .btn-email-submit { background: #3a4ec7; }
.email-capture-card[data-state="sending"] .btn-email-submit .btn-label { opacity: 0.55; }
.email-capture-card[data-state="sending"] .btn-email-submit .btn-spinner {
  display: inline-block;
  margin-left: 0.55rem;
}

/* SUCCESS — green button, swap label/check, reveal success msg */
.email-capture-card[data-state="success"] .btn-email-submit {
  background: #16a34a;
}
.email-capture-card[data-state="success"] .btn-email-submit .btn-label { display: none; }
.email-capture-card[data-state="success"] .btn-email-submit .btn-check {
  display: inline-block;
  font-weight: 800;
  font-size: 1.1rem;
}
.email-capture-card[data-state="success"] #emailSuccessMsg { display: block; }
.email-capture-card[data-state="success"] .email-fine-print { display: none; }

/* ERROR — show error msg, keep form usable so user can retry */
.email-capture-card[data-state="error"] #emailErrorMsg { display: block; }
.email-capture-card[data-state="error"] .email-input-wrap input[type="email"] {
  border-color: rgba(239, 68, 68, 0.55);
}

@media (max-width: 540px) {
  .email-capture-card { padding: 1.75rem 1.5rem; }
  .email-input-wrap { flex-direction: column; gap: 0.55rem; }
  .btn-email-submit { width: 100%; min-width: 0; }
}

/* (.creator-plaque, .creator-identity, .profile-picture removed — moved to slim tool-byline in tool-shell.css) */

/* Scenario 2: two-column split for Down payment / Invest the Rest. */
.scenario-box.s2 .s2-split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 12px;
}
.scenario-box.s2 .s2-split-col {
  flex: 1 1 0;
  min-width: 0; /* allow the input to shrink instead of overflowing */
}
.scenario-box.s2 .s2-split-col--right { text-align: right; }
.scenario-box.s2 .s2-input-row {
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.scenario-box.s2 input#s2DownInput,
.scenario-box.s2 input#s2InvestInput {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* Mobile: stack the two columns so labels & inputs have full width. */
@media (max-width: 540px) {
  .scenario-box.s2 .s2-split { flex-direction: column; }
  .scenario-box.s2 .s2-split-col,
  .scenario-box.s2 .s2-split-col--right { text-align: left; }
  .scenario-box.s2 .s2-split-col--right .s2-input-row { justify-content: flex-start !important; }
}
