/* Hua Yin Finance standalone mortgage calculator */
.calculator-page {
  background: #f5f8fc;
}

.calculator-hero {
  padding: 92px 0 76px;
  background:
    radial-gradient(circle at top left, rgba(214, 173, 97, .20), transparent 34%),
    linear-gradient(135deg, #08172f 0%, #0d3b78 100%);
  color: #fff;
  text-align: center;
}

.calculator-hero .section-kicker {
  color: var(--hyf-gold);
}

.calculator-hero h1 {
  max-width: 860px;
  margin: 0 auto 18px;
  font-size: clamp(2.45rem, 5vw, 4.45rem);
  line-height: 1.04;
  letter-spacing: -.035em;
  color: #fff;
}

.calculator-hero .lead {
  max-width: 780px;
  margin: 0 auto;
  color: rgba(255, 255, 255, .86);
}

.calculator-main .section {
  padding-top: 72px;
  padding-bottom: 72px;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 28px;
  align-items: start;
}

.calculator-card,
.results-card,
.table-card {
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 22px 52px rgba(8, 23, 47, .10);
  border: 1px solid rgba(8, 23, 47, .06);
}

.calculator-card {
  padding: 34px;
}

.calculator-card-head {
  margin-bottom: 28px;
}

.calculator-card-head h2,
.breakdown-head h2 {
  margin: 0 0 8px;
  color: var(--hyf-ink);
}

.calculator-card-head p,
.calculator-note {
  margin: 0;
  color: #64748b;
  line-height: 1.6;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.calculator-grid label {
  display: grid;
  gap: 8px;
  color: var(--hyf-ink);
  font-weight: 800;
}

.calculator-grid input,
.calculator-grid select {
  width: 100%;
  height: 52px;
  border: 1px solid rgba(8, 23, 47, .16);
  border-radius: 16px;
  padding: 0 16px;
  font: inherit;
  color: var(--hyf-ink);
  background: #fff;
  outline: none;
  transition: border-color .22s ease, box-shadow .22s ease;
}

.calculator-grid input:focus,
.calculator-grid select:focus {
  border-color: var(--hyf-blue);
  box-shadow: 0 0 0 4px rgba(13, 59, 120, .12);
}

.input-prefix,
.input-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix > span,
.input-suffix > span {
  position: absolute;
  color: #64748b;
  font-weight: 800;
  pointer-events: none;
}

.input-prefix > span {
  left: 16px;
}

.input-prefix input {
  padding-left: 34px;
}

.input-suffix > span {
  right: 16px;
}

.input-suffix input {
  padding-right: 58px;
}

.calculator-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 0 18px;
}

.btn-secondary {
  background: #fff !important;
  color: var(--hyf-blue) !important;
  border: 1px solid rgba(13, 59, 120, .22) !important;
  box-shadow: 0 12px 28px rgba(8, 23, 47, .08) !important;
}

.results-card {
  padding: 28px;
  position: sticky;
  top: 22px;
}

.result-highlight {
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(135deg, #08172f 0%, #0d3b78 100%);
  color: #fff;
  margin-bottom: 18px;
}

.result-highlight span,
.result-stats span {
  display: block;
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .78;
  margin-bottom: 8px;
}

.result-highlight strong {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.result-stats {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.result-stats div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(8, 23, 47, .08);
}

.result-stats span {
  margin: 0;
  color: #64748b;
  opacity: 1;
}

.result-stats strong {
  color: var(--hyf-ink);
  text-align: right;
}

.breakdown-section {
  background: #fff;
}

.breakdown-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.breakdown-head .section-title,
.breakdown-head .lead {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  max-height: 620px;
  overflow: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.schedule-table th,
.schedule-table td {
  padding: 15px 18px;
  text-align: right;
  border-bottom: 1px solid rgba(8, 23, 47, .08);
  color: var(--hyf-ink);
}

.schedule-table th:first-child,
.schedule-table td:first-child,
.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) {
  text-align: left;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8fc;
  color: #536174;
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.schedule-table tbody tr:hover {
  background: #f8fafc;
}

.empty-row {
  text-align: center !important;
  color: #64748b !important;
  padding: 34px !important;
}

@media (max-width: 980px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .results-card {
    position: static;
  }
}

@media (max-width: 640px) {
  .calculator-hero {
    padding: 72px 0 58px;
  }

  .calculator-main .section {
    padding-top: 52px;
    padding-bottom: 52px;
  }

  .calculator-card,
  .results-card {
    padding: 22px;
    border-radius: 22px;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .breakdown-head {
    display: block;
  }

  .breakdown-actions {
    margin-top: 18px;
  }

  .calculator-actions .btn,
  .breakdown-actions .btn {
    width: 100%;
    text-align: center;
  }
}

/* ================================
   V9.0.7 Edge calculator layout patch
   Edge-specific fallback to avoid compressed form/result columns on Windows.
   ================================ */
@media (min-width: 981px) {
  html.is-edge .calculator-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: 1080px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    gap: 28px !important;
  }

  html.is-edge .calculator-card,
  html.is-edge .results-card,
  html.is-edge .table-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  html.is-edge .results-card {
    position: static !important;
    top: auto !important;
    display: grid !important;
    grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr) !important;
    gap: 22px !important;
    align-items: stretch !important;
  }

  html.is-edge .results-card > .section-kicker,
  html.is-edge .results-card > .calculator-note {
    grid-column: 1 / -1 !important;
  }

  html.is-edge .result-highlight {
    margin-bottom: 0 !important;
    min-height: 150px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  html.is-edge .result-stats {
    margin-bottom: 0 !important;
    align-self: stretch !important;
  }

  html.is-edge .calculator-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr)) !important;
  }
}

@media (min-width: 981px) and (max-width: 1120px) {
  html.is-edge .results-card {
    grid-template-columns: 1fr !important;
  }
  html.is-edge .calculator-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 640px) {
  html.is-edge .calculator-grid,
  html.is-edge .results-card {
    grid-template-columns: 1fr !important;
  }
}
