*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 7px;
  padding: 3px 7px;
  letter-spacing: -0.02em;
  line-height: 1.4;
}
.logo span { color: #2563eb; }
nav a {
  margin-left: 1.5rem;
  color: #475569;
  font-size: 0.9rem;
}
nav a:hover { color: #2563eb; text-decoration: none; }

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  nav { display: none; }
}

/* Ad slots */
.ad-slot { display: block; }
.ad-slot-banner { width: 100%; margin-bottom: 0; }
.ad-slot-sidebar { width: 100%; margin-bottom: 0; }
.ad-slot-bottom { width: 100%; margin-top: 0; }

/* Card */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

/* Tool form */
.tool-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.tool-subtitle {
  color: #64748b;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: #374151;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn:hover { background: #1d4ed8; }

/* Result box */
.result-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  display: none;
}
.result-box.show { display: block; }
.result-main {
  font-size: 2rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 0.25rem;
}
.result-label { font-size: 0.85rem; color: #64748b; }
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 500px) { .result-grid { grid-template-columns: 1fr 1fr; } }
.result-item { }
.result-item .val { font-weight: 700; font-size: 1.1rem; color: #1e293b; }
.result-item .lbl { font-size: 0.78rem; color: #64748b; }

/* Amortization table */
.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { background: #f1f5f9; padding: 0.6rem 0.8rem; text-align: left; font-weight: 600; color: #475569; }
td { padding: 0.55rem 0.8rem; border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #f8fafc; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  padding: 4rem 1.5rem;
  text-align: center;
}
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 560px; margin: 0 auto; }
@media (max-width: 600px) { .hero h1 { font-size: 1.8rem; } }

/* Tool grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.tool-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.tool-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card .icon { font-size: 2rem; margin-bottom: 0.75rem; }
.tool-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.35rem; }
.tool-card p { font-size: 0.85rem; color: #64748b; }
.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

/* Prose */
.prose h2 { font-size: 1.3rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }
.prose p { color: #475569; margin-bottom: 1rem; }
.prose ul { padding-left: 1.5rem; color: #475569; margin-bottom: 1rem; }
.prose ul li { margin-bottom: 0.4rem; }

/* Footer */
footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-brand .logo { color: #fff; }
.footer-brand .logo-mark { background: #fff; color: #2563eb; }
.footer-brand p { font-size: 0.85rem; margin-top: 0.5rem; max-width: 260px; }
.footer-links h4 { color: #fff; font-size: 0.85rem; margin-bottom: 0.75rem; }
.footer-links a { display: block; color: #94a3b8; font-size: 0.85rem; margin-bottom: 0.4rem; }
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid #334155;
  font-size: 0.8rem;
  text-align: center;
}

/* Page header */
.page-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 2rem 1.5rem;
}
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: #64748b; margin-top: 0.35rem; }
