/* 版面骨架（沿用你網站的 fixed header，高度 80px） */
.loan-page { padding-top: 80px; background: #f6f7f9; min-height: 100vh; }
.loan-hero {
  background: #485652;
  color: #fff;
  padding: 42px 20px;
  text-align: center;
}
.loan-hero h2 { font-size: 36px; line-height: 1.2; margin-bottom: 6px; }

.loan-card {
  max-width: 980px;
  margin: 22px auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(9, 30, 66, .12);
  padding: 22px;
}

.loan-form { display: grid; gap: 16px; }
.field { display: grid; gap: 8px; }
.field.two { grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { font-weight: 600; color: #223; }
.field input[type="number"] {
  appearance: textfield;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d7dbe0;
  border-radius: 10px;
  font-size: 16px;
  background: #fbfcfe;
}
.field input:focus {
  outline: none; border-color: #7daaa0; box-shadow: 0 0 0 3px rgba(125,170,160,.2);
}
.hint { font-weight: 400; color: #6b7280; margin-left: 6px; }

.radios { display: flex; gap: 18px; align-items: center; margin-top: 6px; }
.radios input { transform: translateY(1px); }

.actions { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 16px; border-radius: 10px; border: 1px solid #cbd5e1;
  background: #fff; color: #111827; cursor: pointer; font-weight: 600;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #0f766e; border-color: #0f766e; color: #fff; }
.btn.primary:hover { filter: brightness(0.95); }

.sep { border: none; border-top: 1px solid #e5e7eb; margin: 16px 0; }

.result .kpi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 14px; margin-bottom: 10px;
}
.result .kpi > div { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; }
.result .kpi .k { font-size: 12px; color: #6b7280; }
.result .kpi .v { font-size: 18px; font-weight: 700; margin-top: 4px; }
.result .kpi.total .v { font-size: 20px; }
.result .emph { color: #0f766e; }

.sched summary { cursor: pointer; margin: 8px 0 12px; font-weight: 700; }
.sched table { width: 100%; border-collapse: collapse; }
.sched thead th { text-align: left; font-size: 13px; color: #6b7280; border-bottom: 1px solid #e5e7eb; padding: 8px 6px; }
.sched tbody td { padding: 10px 6px; border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; }
.muted { color: #6b7280; font-size: 13px; margin-top: 6px; }

.error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 8px; }

/* 手機優化 */
@media (max-width: 768px) {
  .loan-hero h2 { font-size: 28px; }
  .field.two { grid-template-columns: 1fr; }
}

@media (max-width: 640px){
  #yearsSeg{ order:1; flex:1 1 100%; min-width:0; margin-bottom:8px; overflow:hidden; }
  #yearsSeg button{ white-space:nowrap; min-height:44px; min-width:0; }
  #years{ order:2; flex:0 1 160px; width:auto; }
  #years + .unit{ order:3; }
  .row{ gap:10px; }
}

/* ……前略：保持你的既有內容不變 …… */

/* 手機優化補強：貸款年限列 */
@media (max-width: 768px){
  .row-years{ display:flex; flex-wrap:wrap; gap:10px; }
  .row-years #yearsSeg{
    order:1;
    flex:0 0 100% !important;
    width:100% !important;
    margin-bottom:8px;
    overflow:visible !important;
  }
  .row-years #yearsSeg button{
    flex:1 1 0;
    white-space:nowrap;
    min-height:44px;
    min-width:0;
  }
  .row-years #years{
    order:2;
    flex:0 1 160px !important;
    width:auto !important;
  }
  .row-years #years + .unit{
    order:3;
    align-self:center;
  }
}
