/* =====================================================================
   WealthFlow - public site, auth screens and dashboard shell
   Built on Bootstrap 5.3. Theme switches with data-bs-theme on <html>.
   Signature device: ledger rules (single rules between rows, a double rule
   under every total) used for the hero, features and pricing.
   ===================================================================== */

:root {
  --wf-deep: #0b2545;          /* navy: dark sections */
  --wf-deep-2: #12335c;
  --wf-teal: #0f766e;          /* primary action */
  --wf-teal-hover: #0b5f58;
  --wf-link: #0f766e;
  --wf-gold: #d4a017;          /* accent, used sparingly */
  --wf-gold-hover: #e0b032;
  --wf-paper: #f3f6f7;
  --wf-surface: #ffffff;
  --wf-ink: #10222f;
  --wf-muted: #566874;
  --wf-rule: #d3dde2;
  --wf-pos: #0f766e;
  --wf-neg: #b42318;
  --wf-radius: 10px;
  --wf-font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --wf-font-body: "Figtree", "Segoe UI", system-ui, sans-serif;

  --bs-body-font-family: var(--wf-font-body);
  --bs-body-color: var(--wf-ink);
  --bs-body-bg: var(--wf-paper);
  --bs-link-color: var(--wf-link);
  --bs-link-hover-color: var(--wf-teal-hover);
  --bs-border-color: var(--wf-rule);
}

[data-bs-theme="dark"] {
  --wf-deep: #07121d;
  --wf-deep-2: #0d2234;
  --wf-teal: #14958a;
  --wf-teal-hover: #1aaea1;
  --wf-link: #4fd1c5;
  --wf-paper: #0a1722;
  --wf-surface: #102232;
  --wf-ink: #e8eef2;
  --wf-muted: #9fb0bc;
  --wf-rule: #263d4f;
  --wf-pos: #4fd1c5;
  --wf-neg: #ff8a7a;
  --bs-body-bg: var(--wf-paper);
  --bs-body-color: var(--wf-ink);
  --bs-border-color: var(--wf-rule);
}

body { font-feature-settings: "tnum" 1; line-height: 1.6; }
h1, h2, h3, h4, .display-font { font-family: var(--wf-font-display); letter-spacing: -0.015em; line-height: 1.12; color: var(--wf-ink); }
.measure { max-width: 62ch; }
.text-muted-wf { color: var(--wf-muted); }
a { text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--wf-gold); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--wf-gold); color: #10222f; padding: 8px 14px; border-radius: 6px; z-index: 2000; }
.skip-link:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 8px; padding: 0.65rem 1.2rem; }
.btn-wf { background: var(--wf-teal); border-color: var(--wf-teal); color: #fff; }
.btn-wf:hover, .btn-wf:focus-visible { background: var(--wf-teal-hover); border-color: var(--wf-teal-hover); color: #fff; }
.btn-gold { background: var(--wf-gold); border-color: var(--wf-gold); color: #10222f; }
.btn-gold:hover, .btn-gold:focus-visible { background: var(--wf-gold-hover); border-color: var(--wf-gold-hover); color: #10222f; }
.btn-line { background: transparent; border: 1.5px solid currentColor; color: var(--wf-ink); }
.btn-line:hover { background: var(--wf-ink); color: var(--wf-paper); border-color: var(--wf-ink); }
.on-deep .btn-line { color: #fff; }
.on-deep .btn-line:hover { background: #fff; color: var(--wf-deep); border-color: #fff; }
.btn-lg { padding: 0.8rem 1.5rem; }

/* ---------- Header ---------- */
.site-header { background: var(--wf-surface); border-bottom: 1px solid var(--wf-rule); position: sticky; top: 0; z-index: 1030; }
.site-header .navbar { padding-block: 0.6rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--wf-font-display); font-weight: 800; font-size: 1.3rem; color: var(--wf-ink); text-decoration: none; letter-spacing: -0.02em; }
.brand:hover { color: var(--wf-ink); }
.brand svg { flex: none; }
.site-header .nav-link { color: var(--wf-ink); font-weight: 500; padding: 0.5rem 0.9rem; border-bottom: 2px solid transparent; }
.site-header .nav-link:hover { color: var(--wf-link); }
.site-header .nav-link.active { border-bottom-color: var(--wf-gold); }
.theme-toggle { background: none; border: 1px solid var(--wf-rule); width: 40px; height: 40px; border-radius: 8px; color: var(--wf-ink); display: inline-grid; place-items: center; }
.theme-toggle:hover { border-color: var(--wf-ink); }
.theme-toggle .when-dark { display: none; }
[data-bs-theme="dark"] .theme-toggle .when-dark { display: inline; }
[data-bs-theme="dark"] .theme-toggle .when-light { display: none; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section-tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section-rule { border-top: 1px solid var(--wf-rule); }
.on-deep { background: var(--wf-deep); color: #e8eef2; }
.on-deep h1, .on-deep h2, .on-deep h3 { color: #fff; }
.on-deep .text-muted-wf { color: #a9bccb; }
.h-section { font-size: clamp(1.75rem, 3.4vw, 2.5rem); font-weight: 700; }
.lead-wf { font-size: 1.15rem; color: var(--wf-muted); }
.on-deep .lead-wf { color: #b7c8d6; }

/* ---------- Hero ---------- */
.hero { background: var(--wf-paper); padding-block: clamp(2.5rem, 6vw, 5rem) clamp(3rem, 7vw, 5.5rem); border-bottom: 1px solid var(--wf-rule); }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 800; max-width: 12ch; }
.hero .lead-wf { max-width: 46ch; margin-top: 1.25rem; }
.hero-note { color: var(--wf-muted); font-size: 0.95rem; margin-top: 1rem; }

/* The ledger statement shown in the hero */
.ledger { background: var(--wf-surface); border: 1px solid var(--wf-rule); border-top: 5px solid var(--wf-deep); border-radius: 4px; padding: 1.25rem 1.5rem 1.5rem; max-width: 460px; margin-inline: auto; }
.ledger-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 0.75rem; border-bottom: 1px solid var(--wf-ink); }
.ledger-head h2 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.ledger-head small { color: var(--wf-muted); }
.ledger-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 0.75rem; padding: 0.8rem 0; border-bottom: 1px solid var(--wf-rule); }
.ledger-row .chip { width: 12px; height: 12px; border-radius: 3px; }
.ledger-row .name { font-weight: 600; }
.ledger-row .sub { display: block; font-size: 0.82rem; color: var(--wf-muted); font-weight: 400; }
.ledger-row .amt { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.ledger-total { display: flex; justify-content: space-between; align-items: baseline; padding: 0.9rem 0 0.35rem; margin-top: 0.25rem; border-top: 1px solid var(--wf-ink); }
.ledger-total .label { font-weight: 700; }
.ledger-total .amt { font-family: var(--wf-font-display); font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; position: relative; padding-bottom: 6px; }
.ledger-total .amt::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; border-top: 1px solid var(--wf-ink); border-bottom: 1px solid var(--wf-ink); transform-origin: left; }
.goal { margin-top: 1.1rem; }
.goal-top { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.35rem; }
.goal-bar { height: 8px; border-radius: 2px; background: var(--wf-rule); overflow: hidden; }
.goal-bar span { display: block; height: 100%; width: 72%; background: var(--wf-gold); }

/* The one orchestrated moment: ledger rows post in sequence, then the total rule draws. */
@media (prefers-reduced-motion: no-preference) {
  .ledger-row { opacity: 0; transform: translateY(6px); animation: post 0.45s ease-out forwards; }
  /* nth-of-type counts the header div too, so the three rows are divs 2, 3 and 4 */
  .ledger-row:nth-of-type(2) { animation-delay: 0.15s; }
  .ledger-row:nth-of-type(3) { animation-delay: 0.3s; }
  .ledger-row:nth-of-type(4) { animation-delay: 0.45s; }
  .ledger-total .amt::after { transform: scaleX(0); animation: rule 0.5s ease-out 0.85s forwards; }
  .goal-bar span { transform-origin: left; transform: scaleX(0); animation: rule 0.7s ease-out 1.1s forwards; }
}
@keyframes post { to { opacity: 1; transform: none; } }
@keyframes rule { to { transform: scaleX(1); } }

/* ---------- Facts strip ---------- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); }
.facts > div { padding: 1.25rem 1.5rem; border-left: 1px solid var(--wf-rule); }
.facts > div:first-child { border-left: 0; padding-left: 0; }
.facts strong { display: block; font-family: var(--wf-font-display); font-size: 1.1rem; }
.facts span { color: var(--wf-muted); }

/* ---------- Feature ledger (definition list) ---------- */
.feature-ledger { margin: 0; border-top: 1px solid var(--wf-ink); }
.feature-ledger .row-item { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 1.5rem; padding: 1.2rem 0; border-bottom: 1px solid var(--wf-rule); }
.feature-ledger dt { font-family: var(--wf-font-display); font-weight: 700; font-size: 1.15rem; }
.feature-ledger dd { margin: 0; color: var(--wf-muted); max-width: 60ch; }
.sticky-col { position: sticky; top: 100px; }

/* ---------- Steps (a true sequence, so numbered) ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; counter-reset: step; }
.steps li { list-style: none; counter-increment: step; border-top: 1px solid var(--wf-ink); padding-top: 1rem; }
.steps li::before { content: counter(step); display: block; font-family: var(--wf-font-display); font-size: 3rem; font-weight: 800; line-height: 1; color: var(--wf-gold); margin-bottom: 0.5rem; }
.steps h3 { font-size: 1.25rem; }
.steps p { color: var(--wf-muted); margin: 0; }

/* ---------- Pricing ---------- */
.billing-toggle { display: inline-flex; border: 1px solid var(--wf-ink); border-radius: 8px; padding: 3px; background: var(--wf-surface); }
.billing-toggle button { border: 0; background: none; padding: 0.45rem 1rem; border-radius: 6px; font-weight: 600; color: var(--wf-ink); }
.billing-toggle button.is-active { background: var(--wf-deep); color: #fff; }
.billing-toggle .save { font-size: 0.78rem; font-weight: 600; color: var(--wf-gold); margin-left: 0.35rem; }
.billing-toggle button:not(.is-active) .save { color: var(--wf-teal); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; align-items: stretch; }
.plan { background: var(--wf-surface); border: 1px solid var(--wf-rule); border-radius: var(--wf-radius); padding: 1.5rem; display: flex; flex-direction: column; }
.plan h3 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.plan-desc { color: var(--wf-muted); font-size: 0.95rem; min-height: 3.1em; }
.plan-price { margin: 0.75rem 0 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--wf-ink); display: flex; align-items: baseline; gap: 0.15rem; flex-wrap: wrap; }
.plan-price .cur { font-size: 1.3rem; font-weight: 600; }
.plan-price .amount { font-family: var(--wf-font-display); font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.plan-price .per { color: var(--wf-muted); margin-left: 0.2rem; }
.plan ul { list-style: none; padding: 0; margin: 0 0 1.5rem; flex: 1; }
.plan li { padding: 0.4rem 0; display: flex; gap: 0.6rem; align-items: baseline; }
.plan li i { color: var(--wf-pos); flex: none; }
.plan li.off { color: var(--wf-muted); }
.plan li.off i { color: var(--wf-muted); }
.plan-featured { background: var(--wf-deep); color: #e8eef2; border-color: var(--wf-deep); border-top: 5px solid var(--wf-gold); }
.plan-featured h3, .plan-featured .amount { color: #fff; }
.plan-featured .plan-desc, .plan-featured .per, .plan-featured li.off, .plan-featured li.off i { color: #a9bccb; }
.plan-featured .plan-price { border-bottom-color: #fff; }
.plan-featured li i { color: var(--wf-gold); }
.plan-flag { display: inline-block; font-size: 0.8rem; font-weight: 700; background: var(--wf-gold); color: #10222f; border-radius: 4px; padding: 0.1rem 0.5rem; margin-bottom: 0.5rem; align-self: flex-start; }

/* ---------- FAQ ---------- */
.faq .accordion-item { background: transparent; border: 0; border-top: 1px solid var(--wf-rule); }
.faq .accordion-item:last-child { border-bottom: 1px solid var(--wf-rule); }
.faq .accordion-button { background: transparent; color: var(--wf-ink); font-family: var(--wf-font-display); font-weight: 700; font-size: 1.1rem; padding: 1.1rem 0; box-shadow: none; }
.faq .accordion-button:not(.collapsed) { color: var(--wf-link); background: transparent; }
.faq .accordion-body { padding: 0 0 1.25rem; color: var(--wf-muted); max-width: 64ch; }

/* ---------- Testimonials (only rendered when real ones are configured) ---------- */
.quote-block { border-left: 4px solid var(--wf-gold); padding-left: 1.25rem; margin: 0; }
.quote-block p { font-family: var(--wf-font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.35; }
.quote-block footer { color: var(--wf-muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--wf-deep); color: #b7c8d6; padding-block: 3rem 2rem; }
.site-footer .brand { color: #fff; }
.site-footer h2 { font-size: 1rem; color: #fff; margin-bottom: 0.75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.4rem; }
.site-footer a { color: #b7c8d6; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-base { border-top: 1px solid rgba(255, 255, 255, 0.15); margin-top: 2rem; padding-top: 1.25rem; font-size: 0.9rem; }

/* ---------- Page header for inner pages ---------- */
.page-head { background: var(--wf-paper); border-bottom: 1px solid var(--wf-rule); padding-block: clamp(2.5rem, 5vw, 4rem); }
.page-head h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; }
.prose { max-width: 70ch; }
.prose h2 { font-size: 1.4rem; margin-top: 2rem; }
.prose p, .prose li { color: var(--wf-ink); }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; margin-bottom: 0.3rem; }
.form-control, .form-select { border-radius: 8px; padding: 0.65rem 0.85rem; border-color: var(--wf-rule); background-color: var(--wf-surface); color: var(--wf-ink); }
.form-control:focus, .form-select:focus { border-color: var(--wf-teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.25); }
.field-error { color: var(--wf-neg); font-size: 0.9rem; margin-top: 0.3rem; }
.field-hint { color: var(--wf-muted); font-size: 0.88rem; margin-top: 0.3rem; }
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 3rem; }
.pw-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 44px; border: 0; background: none; color: var(--wf-muted); border-radius: 8px; }
.pw-toggle:hover { color: var(--wf-ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { border-radius: 8px; }
button[disabled] .btn-label { opacity: 0.7; }

/* ---------- Auth screens ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; }
.auth-aside { background-color: var(--wf-deep); color: #e8eef2; padding: clamp(2rem, 4vw, 3.5rem); display: flex; flex-direction: column; justify-content: space-between;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 35px, rgba(255, 255, 255, 0.07) 35px, rgba(255, 255, 255, 0.07) 36px); }
.auth-aside .brand { color: #fff; }
.auth-aside h2 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 800; max-width: 14ch; }
.auth-points { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-points li { padding: 0.6rem 0; border-top: 1px solid rgba(255, 255, 255, 0.18); display: flex; gap: 0.7rem; }
.auth-points i { color: var(--wf-gold); }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem 1.25rem; background: var(--wf-paper); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.4rem; }
.auth-top { display: none; }

/* ---------- Dashboard shell (replaced by the dashboard module) ---------- */
.app-bar { background: var(--wf-deep); color: #fff; }
.app-bar .brand { color: #fff; }
.app-bar a, .app-bar .btn-link { color: #cfe0ec; text-decoration: none; }
.app-bar a:hover { color: #fff; }
.panel { background: var(--wf-surface); border: 1px solid var(--wf-rule); border-radius: var(--wf-radius); padding: 1.25rem 1.5rem; }
.panel h2 { font-size: 1.15rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sticky-col { position: static; }
  .feature-ledger .row-item { grid-template-columns: 1fr; gap: 0.3rem; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-top { display: block; margin-bottom: 1.5rem; }
  .facts { grid-template-columns: 1fr; }
  .facts > div { border-left: 0; border-top: 1px solid var(--wf-rule); padding-left: 0; }
  .facts > div:first-child { border-top: 0; }
}

/* Home page hero list */
.hero-points { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .45rem; }
.hero-points li { position: relative; padding-left: 1.6rem; }
.hero-points li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--wf-teal, #0f766e); font-weight: 700; }
