/* ---------- tools hub + shared tool-page chrome ---------- */

.tool-hero { max-width: 680px; margin: 0 auto 40px; text-align: center; }
.tool-hero .eyebrow { margin-left: auto; margin-right: auto; }
.tool-hero h1 { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 14px; text-wrap: balance; }
.tool-hero p { font-size: 15.5px; line-height: 1.6; color: var(--muted); margin: 0; }

.tools-main { max-width: 1152px; margin: 0 auto; padding: 56px 24px 32px; }
.tool-page-main { max-width: 720px; margin: 0 auto; padding: 56px 24px 0; }

.tools-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 12px; }
.tool-card { display: block; padding: 28px; }
.tool-card .step-icon { margin-bottom: 18px; }
.tool-card h2 { font-size: 19px; font-weight: 700; margin: 0 0 8px; }
.tool-card p { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 0 0 18px; }
.tool-card-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.tool-card-cta svg { transition: transform 0.2s ease; }
.tool-card:hover .tool-card-cta svg { transform: translateX(3px); }

.tool-cta { max-width: 720px; margin: 48px auto 0; padding: 36px; text-align: center; }
.tool-cta h2 { font-size: 20px; font-weight: 700; margin: 0 0 10px; text-wrap: balance; }
.tool-cta p { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin: 0 auto 22px; max-width: 460px; }

.tool-info { max-width: 720px; margin: 56px auto 0; padding: 24px 24px 88px; }
.tool-info h2 { font-size: 20px; font-weight: 700; margin: 0 0 14px; }
.tool-info p { font-size: 14.5px; line-height: 1.7; color: var(--muted); margin: 0 0 14px; }
.tool-info p:last-child { margin-bottom: 0; }
.tool-info strong { color: var(--fg); }

/* ---------- calculator card ---------- */

.calc-card { padding: 28px; }
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 12px; }

.calc-field { margin-bottom: 20px; }
.calc-field:last-child { margin-bottom: 0; }
.calc-field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.calc-field > label,
.calc-field-head > label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.calc-field-head > label { margin-bottom: 0; }

.calc-row { display: flex; gap: 8px; }
.calc-row .calc-input { flex: 1; min-width: 0; }

.calc-input,
.calc-select {
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--tint-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease;
}
.calc-input:focus,
.calc-select:focus { border-color: rgba(143,217,174,0.5); }
.calc-input::placeholder { color: var(--muted-2); }
.calc-input--readonly { background: rgba(245,241,232,0.03); font-weight: 600; cursor: default; }
.calc-input--prefixed { padding-left: 22px; }

.calc-input-wrap { position: relative; flex: 1; min-width: 0; }
.calc-input-prefix,
.calc-input-suffix { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; font-size: 14px; color: var(--muted-2); pointer-events: none; }
.calc-input-prefix { left: 12px; }
.calc-input-suffix { right: 12px; }
.calc-input-wrap .calc-input--suffixed { padding-right: 26px; }

.calc-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 92px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238aa396' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.calc-select option { background: #1b3a2f; color: var(--fg); }

.calc-hint { font-size: 12.5px; color: var(--muted-2); margin: 8px 0 0; }
.calc-caption { font-size: 12.5px; line-height: 1.6; color: var(--muted-2); margin: 0; }
.calc-caption + .calc-caption { margin-top: 2px; }

.calc-swap-row { display: flex; justify-content: center; margin: -8px 0 12px; }
.calc-swap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.calc-swap:hover { background: var(--tint-2); color: var(--fg); }

.calc-toggle { display: inline-flex; gap: 2px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; flex-shrink: 0; }
.calc-toggle button {
  border: none;
  background: transparent;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
}
.calc-toggle button.active { background: var(--tint-2); color: var(--fg); }

.calc-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.calc-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.calc-pill:hover { background: var(--tint-2); color: var(--fg); }
.calc-pill.active { border-color: rgba(143,217,174,0.45); background: rgba(143,217,174,0.12); color: var(--fg); }

.calc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.calc-badge {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-2);
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.calc-badge:hover { border-color: rgba(143,217,174,0.4); background: rgba(143,217,174,0.1); color: var(--fg); }

/* ---------- installment result ---------- */

.calc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100%; min-height: 220px; text-align: center; padding: 24px; color: var(--muted-2); }
.calc-empty svg { color: var(--muted-3); }
.calc-empty p { font-size: 13.5px; line-height: 1.6; max-width: 220px; margin: 0; }

.calc-result-title { font-size: 13px; color: var(--muted-2); margin: 0 0 16px; }

.calc-verdict {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(143,217,174,0.28);
  background: rgba(143,217,174,0.1);
  margin-bottom: 20px;
}
.calc-verdict.is-tie { border-color: var(--border); background: var(--tint-1); }
.calc-verdict svg { flex-shrink: 0; margin-top: 2px; color: var(--good); }
.calc-verdict.is-tie svg { color: var(--muted); }
.calc-verdict-title { font-size: 15px; font-weight: 700; color: var(--good); margin: 0 0 4px; }
.calc-verdict.is-tie .calc-verdict-title { color: var(--fg); }
.calc-verdict-body { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0; }
.calc-verdict-pct { font-size: 12px; color: var(--muted-2); margin: 4px 0 0; }

.calc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.calc-stat-label { font-size: 12px; color: var(--muted-2); margin: 0 0 4px; }
.calc-stat-value { font-size: 17px; font-weight: 600; }

.calc-breakdown { display: flex; flex-direction: column; gap: 9px; }
.calc-breakdown-head { display: grid; grid-template-columns: 26px 1fr 1fr; gap: 8px; font-size: 11px; font-weight: 600; color: var(--muted-2); }
.calc-row-month { display: grid; grid-template-columns: 26px 1fr 1fr; align-items: center; gap: 8px; }
.calc-row-month-num { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted-2); }
.calc-bar-track { height: 5px; border-radius: 999px; background: var(--tint-2); overflow: hidden; margin-bottom: 3px; }
.calc-bar-fill { height: 100%; border-radius: 999px; background: var(--surface-3); }
.calc-bar-fill--good { background: var(--good); }
.calc-bar-fill--bad { background: var(--bad); }
.calc-row-month-value { font-size: 11px; color: var(--muted-2); }
.calc-row-month-value.is-bad { color: var(--bad); }

/* ---------- stacked-area chart (compound interest) ---------- */

.calc-chart { width: 100%; overflow: visible; }
.calc-chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; }
.calc-chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.calc-chart-legend-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .tool-hero h1 { font-size: 27px; }
  .calc-card { padding: 20px; }
  .calc-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
}
