:root {
  color-scheme: light;
  --white: #ffffff;
  --off-white: #f7f7f7;
  --fog: #f1f2f4;
  --mist: #e4e6ea;
  --charcoal: #111111;
  --slate: #2b2b2b;
  --muted: #6a6a6a;
  --red: #e53935;
  --red-dark: #c62828;
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 30px 60px rgba(15, 15, 15, 0.12);
  --border: 1px solid rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--slate);
  background: linear-gradient(180deg, #ffffff 0%, #f3f3f4 45%, #ededf0 100%);
  min-height: 100vh;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.glass {
  background: var(--glass);
  border: var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
  padding: 6px 24px;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: auto;
  height: 50px;
  max-width: 72px;
  object-fit: contain;
}

.logo-word {
  height: 42px;
  width: auto;
  object-fit: contain;
}


.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.nav a {
  text-decoration: none;
  color: var(--slate);
  font-weight: 600;
}

.btn {
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 10px 30px rgba(229, 57, 53, 0.3);
}

.btn-primary:hover {
  background: var(--red-dark);
}

.mobile-login {
  display: none;
  margin: 12px 0 0;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--slate);
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin: 48px 0 40px;
  align-items: center;
}

.hero-copy h1 {
  font-family: "DM Sans", sans-serif;
  font-size: clamp(32px, 4vw, 48px);
  color: var(--charcoal);
  margin-bottom: 14px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--muted);
  margin-bottom: 10px;
}

.lead {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.hero-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.hero-tags span {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.hero-card {
  padding: 26px;
}

.hero-card-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-card-amount {
  font-family: "DM Sans", sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 10px;
}

.hero-card-meta {
  color: var(--muted);
  margin-bottom: 18px;
}

.hero-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

.tabs {
  padding: 18px;
  margin-bottom: 32px;
}

.tab-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-button {
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--slate);
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.tab-button.active {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 10px 30px rgba(229, 57, 53, 0.25);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

.value {
  font-weight: 600;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
  margin-bottom: 30px;
}

.panel {
  padding: 26px;
}

.panel-title {
  font-family: "DM Sans", sans-serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--charcoal);
}

.panel-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--muted);
  margin: 16px 0 8px;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.field input,
.field select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 14px;
}

.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(229, 57, 53, 0.12);
  color: var(--red);
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-left: 6px;
  cursor: default;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  position: relative;
}

.help::after {
  content: attr(data-help);
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translate(-50%, -100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  max-width: 220px;
  width: max-content;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
  z-index: 20;
  white-space: normal;
}

.help:hover::after {
  opacity: 1;
}

.pdf-export {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 740px;
  background: #f4f4f4;
  padding: 24px;
  font-family: "Inter", sans-serif;
  color: #111111;
}

.pdf-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.pdf-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 3px solid #e53935;
  margin-bottom: 18px;
}

.pdf-logo {
  height: 44px;
  width: auto;
}

.pdf-title {
  font-family: "DM Sans", sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.pdf-section {
  margin-bottom: 16px;
}

.pdf-section h4 {
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6a6a6a;
  margin-bottom: 10px;
}

.pdf-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.pdf-row strong {
  font-weight: 700;
}

.field.split {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field.split label {
  min-width: 0;
}

.field.split input,
.field.split select {
  width: 100%;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.extra-fields {
  display: none;
  gap: 14px;
}

.extra-fields.active {
  display: grid;
}

.summary {
  display: grid;
  gap: 18px;
}

.summary-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.summary-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 12px;
}

.summary-amount {
  font-family: "DM Sans", sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--charcoal);
}

.updated {
  font-size: 12px;
  color: var(--muted);
  margin-top: -8px;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  font-size: 14px;
}

.summary-grid div {
  background: rgba(255, 255, 255, 0.75);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: grid;
  gap: 6px;
}

.summary-grid .total {
  grid-column: 1 / -1;
  background: rgba(229, 57, 53, 0.08);
  border: 1px solid rgba(229, 57, 53, 0.2);
}

.summary-grid.compact div {
  background: rgba(255, 255, 255, 0.55);
}

.donut-card {
  margin: 18px 0 10px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: center;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(
    #2e2e2e 0deg 220deg,
    #b91c1c 220deg 270deg,
    #7c7c7c 270deg 310deg,
    #c4c4c4 310deg 360deg
  );
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 32px;
  border-radius: 50%;
  background: var(--glass);
}

.donut-legend {
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.dot-pi { background: #2e2e2e; }
.dot-tax { background: #b91c1c; }
.dot-ins { background: #7c7c7c; }
.dot-other { background: #c4c4c4; }

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  text-align: left;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.amortization {
  margin-bottom: 30px;
}

.amortization-controls {
  margin: -6px 0 16px;
  display: flex;
  justify-content: flex-end;
}

.amortization-controls label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
}

.amortization-controls select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.7);
}

.lenders .muted {
  color: var(--muted);
  margin-bottom: 18px;
}

.guide-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding: 4px;
}

.guide-list {
  display: grid;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.guide-list strong {
  color: var(--slate);
  display: block;
  margin-bottom: 4px;
}

.lender-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.lender-card {
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: grid;
  gap: 10px;
  position: relative;
}

.footer {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.disclaimer {
  max-width: 620px;
  line-height: 1.4;
  text-align: right;
}

@media (max-width: 860px) {
  .topbar {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding: 12px 18px;
  }

  .nav {
    display: none;
  }

  .mobile-login {
    display: block;
    margin-top: 18px;
  }

  .brand {
    width: 100%;
    justify-content: center;
    transform: translateY(4px);
  }

  .logo-icon {
    height: 42px;
  }

  .logo-word {
    height: 30px;
  }

  .mobile-login .btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .donut-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}
