/* =========================================================================
   tools/home-loan/style.css — Home loan calculator
   Theme: Palette E — sage dark (#3F4F44)
   Mood: stable, trustworthy, มั่นคง grounded — เหมือน private bank
   Layout: Hero + 2-col (form ↔ Big Number Card) + slider-heavy + bank chips
   ========================================================================= */

/* === Theme override (Palette E — --e-sage-dark) === */
body {
  --blue:         #3F4F44;   /* primary — sage dark forest */
  --blue-dark:    #2D3B32;   /* hover / pressed */
  --primary-bg:   #ECF1EE;   /* callout bg อ่อนมาก */
  --primary-mid:  #D5E0D9;   /* card lift bg */
  --primary-tint: rgba(63, 79, 68, 0.12);
  --primary-text: #1F2823;   /* badge / strong text */
  --accent-light: #95A99D;   /* border highlight */
  --accent-warm:  #A27B5C;   /* contrast accent (Palette E camel) */

  /* === Hero background image (Pexels — modern home) === */
  --hero-bg: url('https://images.pexels.com/photos/280229/pexels-photo-280229.jpeg?auto=compress&cs=tinysrgb&w=1600');
}

/* === Container — edge-to-edge 1400 === */
body .container {
  max-width: 1400px;
  padding: 0;
}
body .site-header-inner {
  max-width: 1400px;
  padding: 0.85rem 1.5rem;
}

/* === Back link === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin: 1.25rem 0 0 1.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-pill);
  transition: color 0.15s;
}
.back-link:hover { color: var(--blue); }

/* ============================================================
   Hero / Banner — modern signal with bg image + pill badges
   ============================================================ */
.hero-banner {
  max-width: 1400px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}
.hero-inner {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 2.5rem 2.75rem;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 220px;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center right 25%;
  background-repeat: no-repeat;
}
/* Layer 2: gradient overlay — sage tint */
.hero-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(236, 241, 238, 0.96) 0%,
    rgba(213, 224, 217, 0.88) 35%,
    rgba(213, 224, 217, 0.50) 62%,
    rgba(63, 79, 68, 0.20) 100%
  );
  z-index: 0;
}
/* Layer 3: subtle highlight */
.hero-inner::after {
  content: "";
  position: absolute;
  bottom: -40%;
  right: -5%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, transparent 65%);
  pointer-events: none;
  z-index: 1;
}
.hero-inner > * { position: relative; z-index: 2; }

/* Dotted geometric decoration — modern signal */
.hero-decoration {
  position: absolute;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--accent-light) 1px, transparent 1.5px);
  background-size: 14px 14px;
  opacity: 0.6;
  z-index: 1;
  bottom: -10px;
  left: 24%;
  width: 180px;
  height: 80px;
  -webkit-mask-image: linear-gradient(to right, black, transparent);
  mask-image: linear-gradient(to right, black, transparent);
}

.hero-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  background: #fff;
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(63, 79, 68, 0.30);
}
.hero-body { flex: 1; min-width: 0; }
.hero-title {
  font-size: clamp(1.85rem, 4.5vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--primary-text);
  margin: 0 0 0.5rem;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.hero-tagline {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0 0 1.25rem;
}
.hero-tagline strong { color: var(--primary-text); font-weight: 700; }

/* Pill-shape stats badges — modern signal */
.hero-stats {
  display: flex;
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.hero-stats li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  line-height: 1.2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.15s, border-color 0.15s;
}
.hero-stats li:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
}
.hero-stat-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-text);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.hero-stat-lbl {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
}

@media (max-width: 768px) {
  .hero-banner { padding: 0 1rem; }
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.75rem 1.5rem;
    gap: 1.25rem;
    min-height: 0;
    background-position: center top;
  }
  .hero-inner::before {
    background: linear-gradient(
      170deg,
      rgba(236, 241, 238, 0.94) 0%,
      rgba(213, 224, 217, 0.86) 60%,
      rgba(63, 79, 68, 0.18) 100%
    );
  }
  .hero-icon { width: 64px; height: 64px; border-radius: 16px; }
  .hero-icon svg { width: 36px; height: 36px; }
  .hero-stats { gap: 0.4rem; }
}

/* ============ Layout — 2 columns ============ */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: stretch;
  margin-top: 1.25rem;
  /* background: #FAFBFC; */
}
.calc-form {
  padding: 2rem 2rem 3rem;
  min-width: 0;
}
.calc-result {
  padding: 2rem 2rem 3rem;
  min-width: 0;
}

.form-card,
.result-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 1.75rem 1.85rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 6px 18px rgba(15,23,42,0.04);
}

@media (max-width: 768px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-form,
  .calc-result { padding: 1.25rem 1rem 1.5rem; }
  .calc-form { padding-bottom: 0.5rem; }
}
@media (max-width: 480px) {
  .form-card,
  .result-card { padding: 1.25rem 1.1rem; border-radius: 12px; }
}

/* ============ Form ============ */
.page-title {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Field — underline */
.field { margin-bottom: 2rem; }
.field-label {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.7rem;
  letter-spacing: -0.01em;
}
.field-input {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.45rem;
  transition: border-color 0.15s;
}
.field-input:focus-within { border-color: var(--blue); }
.field-input.field-input-error { border-bottom-color: #EF4444; }
.field-prefix {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
}
.field-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.6rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  padding: 0;
  width: 100%;
  letter-spacing: -0.01em;
  -moz-appearance: textfield;
}
.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-input input::placeholder { color: #CBD5E1; font-weight: 400; }

.error-msg {
  color: #DC2626;
  font-size: 0.85rem;
  margin-top: 0.55rem;
  font-weight: 500;
  display: none;
}
.error-msg.show { display: block; }

/* Segmented control */
.seg-control {
  display: flex;
  background: #F1F5F9;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg-control input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-control label {
  flex: 1;
  text-align: center;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  user-select: none;
  margin: 0;
}
.seg-control label:hover { color: var(--text-soft); }
.seg-control input:checked + label {
  background: #fff;
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

/* Primary button */
.btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(63, 79, 68, 0.32);
}
.btn:hover {
  background: var(--blue-dark);
  box-shadow: 0 6px 22px rgba(63, 79, 68, 0.42);
  transform: translateY(-1px);
}

/* ============ Result ============ */
.result-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--muted);
}
.result-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.55;
}
.result-empty p { font-size: 0.95rem; }

.result-content { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Range slider — modern signal === */
.field-slider { margin-top: 0.85rem; }
.field-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--primary-bg);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.field-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--blue) var(--slider-fill, 50%), #E2E8F0 var(--slider-fill, 50%));
}
.field-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #E2E8F0;
}
.field-slider input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--blue);
}
.field-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--blue);
  border-radius: 50%;
  cursor: grab;
  margin-top: -8px;
  box-shadow: 0 2px 8px rgba(63, 79, 68, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.field-slider input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: #fff;
  border: 3px solid var(--blue);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(63, 79, 68, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.field-slider input[type="range"]:hover::-webkit-slider-thumb,
.field-slider input[type="range"]:focus::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 0 6px var(--primary-tint), 0 2px 8px rgba(63, 79, 68, 0.45);
}
.field-slider input[type="range"]:hover::-moz-range-thumb,
.field-slider input[type="range"]:focus::-moz-range-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 0 6px var(--primary-tint), 0 2px 8px rgba(63, 79, 68, 0.45);
}
.field-slider-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* === Summary cards — Big Number style (BoA mortgage style) === */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.summary-card {
  padding: 2rem 1.5rem;
  border-radius: 16px;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}
.summary-card-pay {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,0.5) 0%, transparent 60%),
    linear-gradient(140deg, var(--primary-bg) 0%, var(--primary-mid) 100%);
  border-color: var(--accent-light);
  text-align: center;
}
.summary-card-pay::before {
  content: "";
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 140px;
  height: 80px;
  background-image: radial-gradient(circle, var(--accent-light) 1px, transparent 1.5px);
  background-size: 12px 12px;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at right bottom, black 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at right bottom, black 30%, transparent 75%);
}
.summary-card-vat { display: none; }   /* รวมเข้า big number card */

.summary-card-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-text);
  margin-bottom: 0.35rem;
  letter-spacing: 0;
  opacity: 0.8;
}
.summary-card-value {
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 0.55rem;
  font-variant-numeric: tabular-nums;
  color: var(--primary-text);
}
.summary-card-note {
  font-size: 0.85rem;
  color: var(--primary-text);
  opacity: 0.7;
  font-weight: 500;
}

/* === Mini-stats row — BoA "Rate / APR / Points" style === */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--accent-light);
}
.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
}
.mini-stat-label {
  font-size: 0.72rem;
  color: var(--text-soft);
  font-weight: 500;
}
.mini-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-text);
  font-variant-numeric: tabular-nums;
}
.mini-stat-value.warm { color: var(--accent-warm); }
@media (max-width: 480px) {
  .mini-stats { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .mini-stat:last-child { grid-column: 1 / -1; padding-top: 0.5rem; border-top: 1px dashed var(--accent-light); }
}

/* Breakdown */
.breakdown {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.break-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.break-row + .break-row { border-top: 1px dashed #E2E8F0; }
.break-label {
  color: var(--text-soft);
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.break-formula {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}
.break-value {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
}
.break-add { color: var(--text-soft); font-weight: 500; }

.break-row-final {
  margin-top: 0.5rem;
  padding-top: 1.1rem !important;
  border-top: 2px solid var(--text) !important;
}
.break-row-final .break-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.break-final {
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rate-badge {
  background: var(--primary-tint);
  color: var(--blue);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* === Result actions (copy + download image) === */
.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: #fff;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.action-btn:hover {
  background: var(--primary-bg);
  color: var(--blue);
  border-color: var(--accent-light);
}
.action-btn.is-success {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.action-btn svg { stroke: currentColor; }

@media (max-width: 480px) {
  .result-actions { flex-direction: column; }
  .action-btn { width: 100%; justify-content: center; }
}

/* === Bank chip grid (ตัวเลือกธนาคาร) === */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 0.55rem;
  margin-top: 0.2rem;
}
.bank-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  font-family: inherit;
  color: inherit;
  min-width: 0;
}
.bank-chip:hover {
  border-color: var(--accent-light);
  background: var(--primary-bg);
}
.bank-chip.is-active {
  border-color: var(--blue);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.bank-chip-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  /* Default: neutral — สีโผล่เฉพาะตอน active */
  background: #F1F5F9;
  color: var(--text-soft, #475569);
  transition: all 0.15s ease;
}
.bank-chip.is-active .bank-chip-icon {
  background: var(--blue);
  color: #fff;
}
.bank-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.bank-chip-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-strong, #1a1a1a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bank-chip-mrr {
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.bank-chip.is-active .bank-chip-mrr {
  color: var(--blue);
  font-weight: 600;
}

/* === "ระบุเอง" chip — dashed border === */
.bank-chip-icon-custom {
  background: #fff !important;
  color: var(--muted) !important;
  border: 1.5px dashed var(--accent-light);
}
.bank-chip.is-active .bank-chip-icon-custom {
  color: #fff !important;
  border-color: var(--blue);
  background: var(--blue) !important;
}

@media (max-width: 480px) {
  .bank-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.45rem;
  }
  .bank-chip {
    padding: 0.45rem 0.55rem;
  }
  .bank-chip-icon {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }
  .bank-chip-name { font-size: 0.78rem; }
  .bank-chip-mrr  { font-size: 0.66rem; }
}

/* === Visualization bar (เงินต้น vs ดอกเบี้ย) === */
.bar {
  height: 10px;
  border-radius: 999px;
  background: #F1F5F9;
  display: flex;
  overflow: hidden;
  margin-top: 1.25rem;
}
.bar-fill {
  height: 100%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-principal { background: var(--blue); }
.bar-interest  { background: var(--accent-warm); }   /* camel — palette E warm contrast */

.bar-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.bar-legend > span:last-child .dot { margin-right: 0; margin-left: 0.4rem; }
.dot-principal { background: var(--blue); }
.dot-interest  { background: var(--accent-warm); }

/* === Tiered interest breakdown === */
.tiered-breakdown {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.88rem;
}
.tiered-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  color: var(--text-soft);
}
.tiered-row .mono { font-weight: 600; color: var(--text); }

/* === Hint text === */
.hint-text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

/* =========================================================================
   Rates table — Modern fintech style
   - Equal-width columns (table-layout: fixed)
   - Round avatar icon · MRR column emphasized · best-rate badge
   - Full-width 1400px ตรงกับ calc-layout ด้านบน
   ========================================================================= */
.rates-section {
  max-width: 1400px;          /* <-- ขยายให้เท่า container หลัก */
  margin: 4rem auto 0;
  padding: 0 2rem;
}

/* === Section header — centered + icon === */
.rates-head {
  text-align: center;
  margin-bottom: 1.75rem;
}
.rates-head-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--primary-text);
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-light);
}
.rates-title {
  font-size: clamp(1.35rem, 2.8vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.rates-sub {
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0;
}
.rates-sub strong { color: var(--primary-text); font-weight: 700; }

/* === Table wrap — soft card === */
.rates-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.03), 0 12px 32px rgba(15,23,42,0.05);
}
.rates-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;   /* <-- key: equal width columns */
}

/* === Equal column widths === */
.rates-table th.rates-th-bank,
.rates-table td.rates-bank   { width: 40%; }
.rates-table th.rates-th-rate,
.rates-table td.rates-cell   { width: 20%; }   /* 3 cols × 20% = 60% */

/* === Header — modern fintech style === */
.rates-table thead th {
  background: linear-gradient(180deg, #FAFBFC 0%, #F1F5F9 100%);
  text-align: center;
  padding: 1.1rem 1rem;
  border-bottom: 1.5px solid var(--accent-light);
  vertical-align: middle;
  position: relative;
}
.rates-table thead th.rates-th-bank {
  text-align: left;
  padding-left: 1.5rem;
}
.rates-table thead th.rates-th-mrr {
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--primary-mid) 100%);
}
.rates-table thead th.rates-th-mrr::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--blue);
}
.rates-th-star {
  display: inline-block;
  color: var(--blue);
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.rates-th-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-text);
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-transform: none;
}
.rates-th-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.3;
}
.rates-table thead th.rates-th-mrr .rates-th-desc {
  color: var(--primary-text);
  font-weight: 600;
}

/* === Body row === */
.rates-table tbody td {
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--border);   /* เข้มขึ้นจาก border-soft */
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.rates-table tbody tr:last-child td { border-bottom: none; }
.rates-table tbody tr {
  transition: background 0.15s, transform 0.15s;
}
.rates-table tbody tr:hover {
  background: var(--primary-bg);
}

/* === Bank cell — round avatar + 2-line info ===
   หมายเหตุ: ห้ามใส่ display: flex ที่ <td> โดยตรง
   เพราะจะทำให้ td ไม่เป็น table-cell และ border-bottom จะหาย
   ใช้ wrapper .rates-bank-inner แทน */
.rates-bank {
  text-align: left !important;
  padding-left: 1.5rem !important;
  vertical-align: middle;
}
.rates-bank-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.rates-bank-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;            /* <-- round avatar (modern) */
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  background: var(--primary-bg);
  color: var(--primary-text);
  border: 2px solid var(--accent-light);
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.rates-table tbody tr:hover .rates-bank-icon {
  background: var(--primary-mid);
  border-color: var(--blue);
  transform: scale(1.05);
}
.rates-bank-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.rates-bank-name {
  font-weight: 600;
  color: var(--text);
  font-size: 1.02rem;
  /* แสดงชื่อเต็ม — ห้ามตัดด้วย ellipsis */
  white-space: normal;
  overflow: visible;
  line-height: 1.3;
}
.rates-bank-short {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* === Rate cell — chip-like centered === */
.rates-cell {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.rates-num {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.rates-pct {
  font-size: 0.7em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
  letter-spacing: 0;
}

/* === MRR column — emphasized chip === */
.rates-table tbody td.rates-mrr {
  background: var(--primary-bg);
  position: relative;
}
.rates-table tbody td.rates-mrr .rates-num {
  color: var(--blue);
  font-size: 1.32rem;
}
.rates-table tbody td.rates-mrr .rates-pct {
  color: var(--primary-text);
  font-weight: 600;
}
.rates-table tbody tr:hover td.rates-mrr {
  background: var(--primary-mid);
}

/* === Best-rate row — subtle highlight + tag === */
.rates-row-best td.rates-bank {
  position: relative;
}
.rates-row-best td.rates-bank::before {
  content: "";
  position: absolute;
  left: 0; top: 12%;
  bottom: 12%;
  width: 3px;
  background: var(--accent-warm);
  border-radius: 0 3px 3px 0;
}
.rates-best-tag {
  display: inline-flex;
  align-items: center;
  background: var(--accent-warm);
  color: #fff;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* === Legend === */
.rates-legend {
  margin-top: 1.25rem;
  padding: 1.1rem 1.35rem;
  background: #F8FAFC;
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.rates-legend strong { color: var(--blue); font-weight: 700; }
.rates-legend em { color: var(--text); font-style: normal; font-weight: 500; }

.rates-source {
  margin-top: 0.95rem;
  text-align: right;
  font-size: 0.88rem;
  color: var(--muted);
}
.rates-source a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-light);
}
.rates-source a:hover { border-bottom-color: var(--blue); }

/* === Mobile — table → card stack (เหมือนเดิม + polish) === */
@media (max-width: 640px) {
  .rates-section { padding: 0 1rem; margin-top: 3rem; }

  .rates-table-wrap {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }
  .rates-table thead { display: none; }
  .rates-table,
  .rates-table tbody,
  .rates-table tr,
  .rates-table td {
    display: block;
    width: 100%;
  }
  .rates-table tbody tr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 0.7rem;
    padding: 0.85rem 1rem 0.95rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .rates-table tbody tr:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(15,23,42,0.06);
  }
  .rates-table tbody tr.rates-row-best {
    border-color: var(--accent-warm);
    box-shadow: 0 0 0 1px var(--accent-warm), 0 1px 3px rgba(15,23,42,0.04);
  }
  .rates-table tbody td {
    padding: 0.55rem 0;
    border: none;
    text-align: right;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.05rem;
  }
  .rates-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.92rem;
    text-align: left;
    flex-shrink: 0;
  }
  .rates-table tbody td.rates-bank {
    padding: 0.35rem 0 0.75rem;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 0.45rem;
    padding-left: 0 !important;
  }
  .rates-table tbody td.rates-bank::before { display: none; }
  .rates-row-best td.rates-bank::before { display: none; }
  .rates-table tbody td.rates-mrr {
    background: transparent;
    margin-top: 0.2rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--border-soft);
  }
  .rates-table tbody td.rates-mrr::before {
    color: var(--blue);
    font-weight: 600;
  }
}

/* === Capture credit (โผล่ในรูปที่ download) === */
.capture-credit {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.capture-credit strong {
  color: var(--blue);
  font-weight: 700;
}

/* === Quick presets (ปุ่มลัด ระยะเวลา) === */
.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.quick-presets button {
  padding: 0.4rem 0.85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.quick-presets button:hover {
  border-color: var(--accent-light);
  color: var(--blue);
}
.quick-presets button.is-active {
  background: var(--primary-bg);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

/* Summary callout */
.summary-callout {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--primary-mid) 100%);
  border: 1px solid var(--accent-light);
  border-radius: 14px;
}
.summary-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1.4;
}
.summary-text {
  color: var(--primary-text);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
}
.summary-text strong {
  font-weight: 700;
  color: var(--primary-text);
  white-space: nowrap;
}

/* Hint text under field-label */
.hint-text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

/* === Copy button === */
.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: #fff;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover {
  background: var(--primary-bg);
  color: var(--blue);
  border-color: var(--accent-light);
}
.copy-btn.copied {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.copy-btn svg { stroke: currentColor; }

/* === CTA card — แนะนำ WHT calculator === */
.cta-cert {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  max-width: 1400px;
  margin: 2rem auto 0;
  padding: 1.25rem 1.4rem;
  background: linear-gradient(135deg, #E8F8F1 0%, #C9F0DD 100%);
  border: 1.5px solid var(--accent-light);
  border-radius: 16px;
  text-decoration: none;
  color: var(--primary-text);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cta-cert:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 10px 28px rgba(34, 196, 133, 0.20);
}
.cta-cert::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, transparent 65%);
  pointer-events: none;
}
.cta-cert-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #fff;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(34, 196, 133, 0.25);
  position: relative;
  z-index: 1;
}
.cta-cert-icon svg { stroke: currentColor; }
.cta-cert-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.cta-cert-tag {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.cta-cert-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.cta-cert-subtitle {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.55;
}
.cta-cert-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--blue);
  color: #fff;
  padding: 0.78rem 1.25rem;
  border-radius: 11px;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(34, 196, 133, 0.32);
  transition: background 0.15s, box-shadow 0.15s;
  position: relative;
  z-index: 1;
}
.cta-cert:hover .cta-cert-btn {
  background: var(--blue-dark);
  box-shadow: 0 6px 18px rgba(34, 196, 133, 0.42);
}
.cta-cert-btn svg { stroke: currentColor; transition: transform 0.18s; }
.cta-cert:hover .cta-cert-btn svg { transform: translateX(2px); }

@media (max-width: 540px) {
  .cta-cert {
    flex-direction: column;
    text-align: center;
    align-items: stretch;
    padding: 1.4rem 1.1rem;
    margin: 1.5rem 1rem 0;
  }
  .cta-cert-icon { margin: 0 auto; }
  .cta-cert-tag, .cta-cert-btn { align-self: center; justify-content: center; }
  .cta-cert-btn { width: 100%; }
}

/* ============ Info + FAQ — 2 columns ============ */
.info-grid {
  max-width: 1400px;
  margin: 4rem auto 5rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 0 1rem;
    margin: 3rem auto 4rem;
  }
}
.info-accordion { margin: 0; padding: 0; max-width: none; }
.info-accordion-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.info-accordion-faq .faq-grid { display: block; }

/* Accordion — Google FAQ flat */
.info-acc {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  margin: 0;
  padding: 0;
}
.info-acc:first-of-type { border-top: 1px solid var(--border-soft); }

.info-acc summary {
  padding: 1.25rem 0.25rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  user-select: none;
  transition: color 0.15s;
}
.info-acc summary::-webkit-details-marker { display: none; }
.info-acc summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-bottom: 4px;
  transition: transform 0.25s, border-color 0.15s;
  flex-shrink: 0;
  opacity: 0.7;
}
.info-acc[open] summary::after {
  transform: rotate(225deg);
  margin-bottom: -4px;
  border-color: var(--blue);
  opacity: 1;
}
.info-acc summary:hover { color: var(--text); }
.info-acc[open] summary { font-weight: 500; color: var(--text); }
.info-acc-body {
  padding: 0 0.25rem 1.4rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.85;
}
.info-acc-body p { margin-bottom: 0.8rem; }
.info-acc-body p:last-child { margin-bottom: 0; }
.info-acc-body strong { color: var(--text); font-weight: 600; }
.info-acc-body em { color: var(--text); font-style: normal; font-weight: 500; }

.rate-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 0.5rem;
}
.rate-list li {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: #F8FAFC;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-soft);
}
.rate-pct {
  flex-shrink: 0;
  min-width: 2.75rem;
  text-align: center;
  background: var(--primary-tint);
  color: var(--blue);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.formula {
  background: #F8FAFC;
  border-radius: 10px;
  padding: 0.95rem 1.15rem;
}
.formula-row {
  padding: 0.45rem 0;
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.7;
}
.formula-row + .formula-row { border-top: 1px dashed var(--border); }

/* ============ Responsive ============ */
@media (max-width: 880px) {
  body .container    { padding: 1rem 1rem 3rem; }
  .calc-layout       { gap: 2rem; }
  .field-input input { font-size: 1.4rem; }
  .field-prefix      { font-size: 1.3rem; }
}
@media (max-width: 480px) {
  .seg-control label { padding: 0.6rem 0.35rem; font-size: 0.8rem; }
  .field             { margin-bottom: 1.5rem; }
  .info-grid         { padding: 0 1rem; }
  .info-acc summary  { padding: 1.1rem 0.25rem; font-size: 0.95rem; }
}
