/* ── Finmatics — Global Stylesheet ── */
:root {
  --navy:    #0D1B3E;
  --teal:    #0D9488;
  --teal-lt: #CCFBF1;
  --teal-dk: #0F766E;
  --gold:    #F59E0B;
  --gold-lt: #FEF3C7;
  --slate:   #475569;
  --slate-lt:#94A3B8;
  --off-wht: #F8FAFC;
  --white:   #FFFFFF;
  --border:  #E2E8F0;
  --red:     #DC2626;
  --green:   #16A34A;
  --radius:  10px;
  --radius-lg: 14px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--navy);
  background: var(--off-wht);
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { color: var(--slate); }
a  { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 1rem; }

/* ── NAV ── */
.nav {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}
.nav-logo-icon {
  width: 36px; height: 36px;
  background: var(--teal);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; font-weight: 800;
}
.nav-logo-text { color: #fff; font-weight: 700; font-size: 1rem; }
.nav-logo-text span { color: var(--teal); }
.nav-links {
  display: flex;
  gap: .25rem;
  list-style: none;
  flex-wrap: wrap;
}
.nav-links a {
  color: rgba(255,255,255,.8);
  font-size: .85rem;
  padding: .4rem .7rem;
  border-radius: 6px;
  transition: all .15s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,.1);
  text-decoration: none;
}
.nav-cta {
  background: var(--teal) !important;
  color: #fff !important;
  padding: .4rem .9rem !important;
  border-radius: 6px;
}
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 1.5rem;
  padding: .25rem;
}

/* ── HERO ── */
.hero {
  background: var(--navy);
  color: #fff;
  padding: 3.5rem 1rem 3rem;
  text-align: center;
}
.hero h1 { color: #fff; margin-bottom: .75rem; }
.hero p { color: rgba(255,255,255,.75); font-size: 1.05rem; max-width: 560px; margin: 0 auto 1.5rem; }
.hero-badge {
  display: inline-block;
  background: rgba(13,148,136,.2);
  border: 1px solid rgba(13,148,136,.4);
  color: var(--teal-lt);
  font-size: .8rem;
  font-weight: 600;
  padding: .25rem .85rem;
  border-radius: 999px;
  margin-bottom: 1rem;
  letter-spacing: .04em;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.hero-stat .val { font-size: 1.5rem; font-weight: 800; color: var(--teal-lt); }
.hero-stat .lbl { font-size: .78rem; color: rgba(255,255,255,.55); }

/* ── TOOL GRID (homepage) ── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all .18s;
  display: block;
  box-shadow: var(--shadow);
}
.tool-card:hover {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12), var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: .875rem;
}
.tool-card h3 { font-size: 1rem; margin-bottom: .3rem; color: var(--navy); }
.tool-card p  { font-size: .85rem; color: var(--slate); line-height: 1.5; }
.tool-card .tag {
  display: inline-block;
  margin-top: .625rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--teal-lt);
  color: var(--teal-dk);
}

/* ── CALCULATOR PAGE ── */
.page-header {
  background: var(--navy);
  padding: 2rem 1rem 1.75rem;
  color: #fff;
}
.page-header h1 { color: #fff; font-size: clamp(1.4rem, 3.5vw, 2rem); }
.page-header p  { color: rgba(255,255,255,.7); margin-top: .375rem; font-size: .95rem; }
.breadcrumb {
  font-size: .8rem;
  color: rgba(255,255,255,.5);
  margin-bottom: .625rem;
}
.breadcrumb a { color: rgba(255,255,255,.6); }
.breadcrumb span { color: var(--teal-lt); }

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}
@media (max-width: 720px) { .calc-layout { grid-template-columns: 1fr; } }

.calc-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calc-card-head {
  background: var(--navy);
  padding: 1rem 1.25rem;
  color: #fff;
}
.calc-card-head h3 { color: #fff; font-size: 1rem; }
.calc-card-head p  { color: rgba(255,255,255,.6); font-size: .8rem; margin-top: .2rem; }
.calc-body { padding: 1.25rem; }

/* ── FORM ELEMENTS ── */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .35rem;
}
.field .hint { font-size: .75rem; color: var(--slate-lt); margin-top: .2rem; }
.input-wrap { position: relative; }
.input-prefix, .input-suffix {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: .85rem;
  color: var(--slate);
  font-weight: 600;
  pointer-events: none;
}
.input-prefix { left: .75rem; }
.input-suffix { right: .75rem; }
input[type=number], input[type=text], select {
  width: 100%;
  padding: .6rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--navy);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
input[type=number].has-prefix { padding-left: 2rem; }
input[type=number].has-suffix { padding-right: 2.5rem; }
input:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}
input[type=range] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  background: var(--teal);
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--teal);
  cursor: pointer;
}
input[type=range]:focus { box-shadow: none; border: none; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.5rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--teal);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--teal-dk); text-decoration: none; color: #fff; }
.btn-secondary {
  background: transparent;
  color: var(--teal);
  border: 1.5px solid var(--teal);
}
.btn-secondary:hover { background: var(--teal-lt); text-decoration: none; }
.btn-ghost {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  font-size: .85rem;
  padding: .5rem 1rem;
}
.btn-ghost:hover { background: rgba(255,255,255,.2); text-decoration: none; color: #fff; }
.btn-sm { padding: .45rem 1rem; font-size: .85rem; }

/* ── RESULTS PANEL ── */
.results-panel {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: #fff;
  margin-top: 1rem;
}
.results-panel.hidden { display: none; }
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.result-row:last-child { border-bottom: none; }
.result-label { font-size: .82rem; color: rgba(255,255,255,.6); }
.result-value { font-size: 1rem; font-weight: 700; color: #fff; }
.result-value.highlight { font-size: 1.3rem; color: var(--teal-lt); }
.result-value.warn { color: #FCA5A5; }

/* ── AMORTIZATION TABLE ── */
.amort-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.amort-table th {
  background: var(--navy);
  color: rgba(255,255,255,.85);
  padding: .6rem .75rem;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
.amort-table th:first-child { text-align: left; }
.amort-table td {
  padding: .5rem .75rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  color: var(--slate);
}
.amort-table td:first-child { text-align: left; font-weight: 600; color: var(--navy); }
.amort-table tr:nth-child(even) td { background: var(--off-wht); }
.amort-table tr:hover td { background: var(--teal-lt); }

/* ── CHART ── */
.chart-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
}
.chart-title { font-size: .85rem; font-weight: 600; color: var(--navy); margin-bottom: .75rem; }
.chart-canvas { max-height: 260px; }

/* ── INFO BOXES ── */
.info-box {
  background: var(--gold-lt);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  font-size: .85rem;
  color: #78350F;
  line-height: 1.6;
  margin-top: 1rem;
}
.info-box strong { display: block; margin-bottom: .25rem; }
.tip-box {
  background: var(--teal-lt);
  border: 1px solid #99F6E4;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  font-size: .85rem;
  color: #065F46;
  margin-top: .75rem;
}

/* ── FAQ ── */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.faq-q {
  font-weight: 600;
  font-size: .95rem;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-q::after { content: '+'; font-size: 1.2rem; color: var(--teal); transition: transform .2s; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a {
  display: none;
  margin-top: .625rem;
  font-size: .88rem;
  color: var(--slate);
  line-height: 1.7;
}
.faq-item.open .faq-a { display: block; }

/* ── ADSENSE SLOTS ── */
.ad-slot {
  text-align: center;
  overflow: hidden;
  /* Don't show a white box — only take space when an ad actually renders */
  min-height: 0;
}
/* Only add height once AdSense injects the ins tag */
.ad-slot ins.adsbygoogle { display: block; }
.ad-slot-leaderboard { margin: 1rem 0; }
.ad-slot-rectangle   { margin: 1rem 0; }
.ad-slot-banner      { margin: .75rem 0; }

/* ── FOOTER ── */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  padding: 2.5rem 1rem 1.5rem;
  margin-top: 3rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto 2rem;
}
.footer-brand p { font-size: .85rem; line-height: 1.6; margin-top: .75rem; }
.footer h4 { color: #fff; font-size: .9rem; margin-bottom: .75rem; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: .4rem; }
.footer ul a { color: rgba(255,255,255,.5); font-size: .85rem; }
.footer ul a:hover { color: var(--teal-lt); text-decoration: none; }
.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .78rem;
}
.footer-bottom a { color: rgba(255,255,255,.4); }

/* ── SECTION TITLES ── */
.section-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .375rem; }
.section-sub   { color: var(--slate); font-size: .9rem; margin-bottom: 1.5rem; }
.section { padding: 2.5rem 0; }

/* ── UTILS ── */
.text-center { text-align: center; }
.text-teal   { color: var(--teal); }
.text-navy   { color: var(--navy); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; gap: .5rem; align-items: center; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 580px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── MOBILE ── */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--navy); padding: .5rem 1rem 1rem; gap: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .6rem .75rem; border-radius: 6px; }
  .nav-hamburger { display: block; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 2rem 1rem; }
  .hero-stats { gap: 1.25rem; }
}
@media (max-width: 400px) {
  .tool-grid { grid-template-columns: 1fr; }
}

/* ── PRINT ── */
@media print {
  .nav, .footer, .ad-slot, .btn { display: none !important; }
  .results-panel { border: 1px solid #ccc; }
}
