:root {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #253831;
  background: #f6f8f6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

button, input, select { font: inherit; }

button { cursor: pointer; }

[hidden] { display: none !important; }

.page-shell { max-width: 1240px; margin: 0 auto; padding: 46px 30px 28px; }

.page-header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 24px; margin: 0 0 34px; }
.header-copy, .header-ad { min-width: 0; }
.header-ad .adsbygoogle { min-height: 90px; }
.eyebrow { color: #678579; font-size: 11px; font-weight: 750; letter-spacing: .24em; }
.page-header h1 { margin: 11px 0 8px; color: #193f34; font-size: clamp(30px, 3vw, 42px); letter-spacing: -.045em; line-height: 1.2; }
.header-copy p { margin: 0; color: #75857d; font-size: 14px; }

.top-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(360px, .78fr); align-items: start; gap: 22px; }
.card { border: 1px solid #e5ebe6; border-radius: 17px; background: #fff; box-shadow: 0 12px 36px rgba(28, 62, 48, .035); }
.form-card, .result-card { padding: 29px 30px 31px; }
.section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 28px; }
.section-number { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 9px; color: #30735c; background: #eaf4ee; font-size: 12px; font-weight: 750; }
.section-heading h2 { margin: 1px 0 4px; color: #244436; font-size: 19px; font-weight: 750; line-height: 1.3; }
.section-heading p { margin: 0; color: #97a59c; font-size: 12px; }
.required-mark { color: #d77a5e; }

.field-grid, .start-date-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; row-gap: 21px; }
.field { min-width: 0; }
.field label, .field legend { display: block; margin: 0 0 9px; color: #42594c; font-size: 13px; font-weight: 650; }
.method-field { margin: 0; padding: 0; border: 0; }
.method-field legend { padding: 0; }
.muted-label { color: #9aa89e; font-weight: 400; }
.field input, .field select { width: 100%; height: 45px; padding: 0 13px; border: 1px solid #dce5de; border-radius: 8px; color: #274437; background: #fff; outline: none; transition: border-color .18s, box-shadow .18s; }
.field input::placeholder { color: #adbbb0; }
.field input:focus, .field select:focus { border-color: #4f9a73; box-shadow: 0 0 0 3px #e2f1e6; }
.field input:disabled { color: #9ca9a0; background: #f6f8f6; cursor: not-allowed; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 41px; }
.input-suffix { position: absolute; top: 50%; right: 15px; color: #93a69a; font-size: 13px; transform: translateY(-50%); pointer-events: none; }
.joined-input { display: grid; grid-template-columns: minmax(0, 1fr) 68px; }
.joined-input input { border-radius: 8px 0 0 8px; }
.joined-input select { border-left: 0; border-radius: 0 8px 8px 0; background: #f7faf8; padding: 0 9px; }
.field-help { display: block; margin-top: 7px; color: #9daa9f; font-size: 11px; line-height: 1.5; }
.choice-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice { margin: 0 !important; position: relative; cursor: pointer; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice span { display: grid; place-items: center; height: 45px; border: 1px solid #dce5de; border-radius: 8px; background: #fff; color: #667c6d; font-size: 13px; font-weight: 600; transition: border-color .18s, background .18s; }
.choice input:checked + span { border-color: #3b8464; color: #247151; background: #eff7f1; }
.choice input:focus-visible + span { outline: 3px solid #b7ddc5; outline-offset: 2px; }
.form-divider { height: 1px; margin: 26px 0; background: #edf1ed; }
.optional-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 17px; }
.optional-heading h3 { margin: 0 0 5px; color: #344d3f; font-size: 15px; }
.optional-heading p { margin: 0; color: #9aa99f; font-size: 12px; line-height: 1.5; }
.optional-tag { margin-left: 5px; color: #9aaa9f; font-size: 11px; font-weight: 450; }
.text-button { flex: 0 0 auto; padding: 4px 0; border: 0; background: none; color: #267552; font-size: 12px; font-weight: 700; }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.text-button:disabled { color: #b6c4b9; cursor: not-allowed; }
.prepayment-hint { margin: -6px 0 0; }
.prepayment-list { display: grid; gap: 11px; }
.prepayment-item { padding: 15px; border: 1px solid #e2ebe3; border-radius: 10px; background: #fafcfb; }
.prepayment-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.prepayment-item-head strong { color: #43604f; font-size: 12px; }
.remove-button { padding: 2px 0; border: 0; background: none; color: #a56c60; font-size: 12px; }
.remove-button:hover { text-decoration: underline; }
.prepayment-fields, .rate-change-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.prepayment-fields .field:last-child { grid-column: 1 / -1; }
.prepayment-fields .field label, .rate-change-fields .field label { font-size: 12px; }
.prepayment-fields .field input, .prepayment-fields .field select, .rate-change-fields .field input { height: 41px; font-size: 13px; }
.form-error { margin-top: 22px; padding: 11px 13px; border: 1px solid #f0d5c8; border-radius: 8px; color: #a3503c; background: #fff6f2; font-size: 12px; line-height: 1.5; }
.calculate-button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 49px; margin-top: 24px; padding: 0 18px; border: 0; border-radius: 9px; color: white; background: #277653; font-size: 14px; font-weight: 700; transition: background .18s, transform .18s; }
.calculate-button:hover { background: #1d6244; transform: translateY(-1px); }
.calculate-button:focus-visible, .text-button:focus-visible, .remove-button:focus-visible { outline: 3px solid #b7ddc5; outline-offset: 3px; }
.calculate-button span { font-size: 21px; line-height: 1; }

.result-card { min-height: 508px; }
.empty-state { display: flex; align-items: center; flex-direction: column; justify-content: center; min-height: 365px; text-align: center; }
.empty-visual { display: flex; align-items: end; gap: 7px; height: 86px; margin-bottom: 18px; padding: 16px 17px; border: 1px solid #e6eee7; border-radius: 16px; background: #f5faf6; }
.empty-visual span { width: 16px; border-radius: 4px 4px 0 0; background: #bad9c3; }
.empty-visual span:nth-child(1) { height: 23px; }
.empty-visual span:nth-child(2) { height: 36px; }
.empty-visual span:nth-child(3) { height: 29px; }
.empty-visual span:nth-child(4) { height: 48px; background: #68ae82; }
.empty-state h3 { margin: 0 0 8px; color: #42604d; font-size: 15px; }
.empty-state p { margin: 0; color: #a0afa4; font-size: 12px; }
.primary-result { padding: 20px 20px 18px; border-radius: 11px; background: #eff7f1; }
.primary-result span { display: block; color: #617b68; font-size: 12px; }
.primary-result strong { display: block; margin: 7px 0 4px; color: #1f714e; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.primary-result small { color: #90a697; font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-top: 12px; }
.stat { min-width: 0; padding: 18px 0; border-bottom: 1px solid #edf1ed; }
.stat span, .savings-block span { display: block; margin-bottom: 6px; color: #96a59a; font-size: 11px; }
.stat strong { color: #3a5041; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.savings-block { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 18px; padding: 16px; border: 1px solid #dbeee0; border-radius: 9px; background: #f7fbf7; }
.savings-block strong { color: #287b54; font-size: 15px; font-variant-numeric: tabular-nums; }
.notice { margin-top: 16px; padding: 11px 12px; border-radius: 7px; color: #916d2f; background: #fff8e9; font-size: 12px; line-height: 1.5; }
.result-note { margin: 19px 0 0; color: #9aaa9f; font-size: 11px; line-height: 1.7; }

.schedule-card { margin-top: 22px; padding: 29px 30px 16px; }
.schedule-heading { margin-bottom: 19px; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 850px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th { padding: 12px 14px; border-bottom: 1px solid #e6ece6; color: #8fa397; background: #f8faf8; font-weight: 650; text-align: left; white-space: nowrap; }
th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }
td { padding: 14px; border-bottom: 1px solid #eef2ef; color: #53695a; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbf9; }
tbody tr.has-prepayment { background: #f7fbf7; }
tbody tr.has-prepayment:hover { background: #f0f8f1; }
tbody tr.has-rate-change { box-shadow: inset 3px 0 #68ae82; }
.numeric { text-align: right; }
.rate-cell { color: #47745c; }
.rate-change-cell { color: #1e7951; font-weight: 750; }
.rate-change-meta { display: block; margin-top: 3px; color: #8caa96; font-size: 10px; font-weight: 450; }
.prepayment-cell { color: #2b8256; font-weight: 750; }
.prepayment-meta { display: block; margin-top: 3px; color: #8caa96; font-size: 10px; font-weight: 450; }
.ad-section { width: 100%; min-width: 0; margin-top: 28px; }
.ad-label { margin: 0 0 10px; color: #75857d; font-size: 11px; text-align: center; }
footer { margin-top: 24px; color: #a2aea5; font-size: 11px; text-align: center; }

@media (max-width: 900px) {
  .page-header { grid-template-columns: 1fr; }
  .top-grid { grid-template-columns: 1fr; }
  .result-card { min-height: 0; }
  .empty-state { min-height: 220px; }
}

@media (max-width: 560px) {
  .page-shell { padding: 27px 15px 22px; }
  .page-header { margin-bottom: 25px; }
  .form-card, .result-card { padding: 22px 18px; }
  .field-grid, .start-date-grid { grid-template-columns: 1fr; gap: 18px; }
  .prepayment-fields, .rate-change-fields { grid-template-columns: 1fr; }
  .prepayment-fields .field:last-child { grid-column: auto; }
  .schedule-card { padding: 22px 18px 10px; }
  .stat-grid { gap: 0 12px; }
  .stat strong { font-size: 14px; }
}
