.tools-page {
  padding-bottom: 4rem;
}

.tools-hero {
  padding: 7.5rem 0 2.25rem;
}

.tools-hero-calculator {
  padding-bottom: 1.25rem;
}

.tools-eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 0.8rem;
}

.tools-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  margin-bottom: 0.85rem;
}

.tools-subtitle {
  color: var(--text-muted);
  max-width: 700px;
}

.tools-listing {
  padding: 1.5rem 0 2rem;
}

.tool-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.tool-card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.tool-card p {
  color: var(--text-muted);
}

.tool-card-tag {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.tool-button {
  display: inline-flex;
  margin-top: 1rem;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #f0c659 100%);
  padding: 0.58rem 0.95rem;
  border-radius: 999px;
  font-weight: 600;
}

.tool-card.is-upcoming {
  opacity: 0.86;
}

.calculator-section {
  padding: 1.25rem 0 0;
}

.calculator-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
}

.calculator-form-card,
.calculator-result-card,
.comparison-card,
.amortization-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.calculator-form-card,
.calculator-result-card {
  padding: 1.1rem;
}

.tool-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.tool-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-strong);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.tool-chip.is-active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.tool-form-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.tool-field label {
  font-size: 0.86rem;
  font-weight: 600;
}

.tool-field input,
.tool-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.94rem;
}

.tool-field input[readonly] {
  background: #f8fafc;
  color: #475569;
  cursor: not-allowed;
}

.tool-input-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.tool-advanced-toggle {
  margin-top: 0.9rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.tool-checkbox-row {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.tool-checkbox-row input[type="checkbox"] {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.tool-note {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.tool-note.tool-note-warning {
  color: #b45309;
  font-weight: 600;
}

.tool-input-preview {
  margin-top: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.88rem;
}

.tool-input-preview span {
  color: var(--text-muted);
}

.calculator-result-card h2 {
  margin-bottom: 0.45rem;
  font-size: 1.2rem;
}

.result-payment {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.04;
  font-weight: 700;
}

.result-frequency {
  color: var(--text-muted);
  margin-bottom: 0.95rem;
}

.result-breakdown {
  display: grid;
  gap: 0.35rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.result-row:last-child {
  border-bottom: 0;
}

.insurance-estimate {
  margin-top: 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding-top: 0.75rem;
}

.insurance-estimate h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.comparison-card,
.amortization-card {
  margin-top: 1rem;
  padding: 1rem;
}

.comparison-card h2,
.amortization-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.tool-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.amortization-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.amortization-header span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.amortization-table-wrap {
  margin-top: 0.55rem;
  max-height: 360px;
  overflow: auto;
}

.amortization-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.amortization-table-wrap th,
.amortization-table-wrap td {
  text-align: left;
  padding: 0.46rem 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.84rem;
}

[data-chart-svg] {
  width: 100%;
  min-height: 260px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

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

@media (max-width: 720px) {
  .tool-form-grid {
    grid-template-columns: 1fr;
  }

  .tool-input-split {
    grid-template-columns: 1fr;
  }
}
