:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #14213d;
  --muted: #5c677d;
  --primary: #0f4c81;
  --primary-hover: #09355c;
  --accent: #0d9488;
  --border: #e2e8f0;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-container {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary);
}

nav {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero {
  text-align: center;
  max-width: 740px;
  margin: 0 auto 24px;
}

.hero h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.35rem);
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero p {
  color: var(--muted);
  font-size: 1rem;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.ad-slot {
  background: #eef2f6;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 24px 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.card h2 {
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.card p + p {
  margin-top: 10px;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.help {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.98rem;
  color: var(--text);
  background: #fff;
}

input[type="number"]:focus,
select:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.total-box {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}

.total-label {
  font-size: 0.85rem;
  color: #0f766e;
  font-weight: 600;
}

.total-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin: 2px 0;
}

.net-estimate {
  font-size: 0.9rem;
  color: var(--text);
}

.breakdown {
  list-style: none;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
  gap: 12px;
}

.breakdown li span:last-child {
  font-weight: 600;
  text-align: right;
}

.info-section {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

footer .links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: #eef2f6;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.modal-content p {
  margin-bottom: 12px;
  font-size: 0.94rem;
  color: var(--text);
}

@media (max-width: 820px) {
  .calc-grid,
  .form-row {
    grid-template-columns: 1fr;
  }
  nav {
    gap: 12px;
    font-size: 0.85rem;
  }
}
  
input[type="date"] { width:100%; padding:10px 12px; border:1px solid #cbd5e1; border-radius:8px; font:inherit; color:var(--text); background:#fff; min-width:0; }
.form-group, .calc-grid > * { min-width:0; }
.prose { max-width:760px; margin:0 auto; }
.prose h1 { line-height:1.2; margin-bottom:12px; font-size:clamp(1.6rem,4vw,2.1rem); }
.prose h2 { font-size:1.25rem; margin:28px 0 10px; }
.prose p, .prose ul, .prose ol { margin-bottom:12px; }
.prose ul, .prose ol, .card ul { padding-left:22px; }
.card ul.breakdown { padding-left:0; }
.table-wrap { overflow-x:auto; margin-bottom:14px; }
table { border-collapse:collapse; width:100%; font-size:.92rem; background:#fff; }
th,td { border:1px solid var(--border); padding:8px 10px; text-align:left; }
.updated { color:var(--muted); font-size:.85rem; }
.pending { background:#fef08a; padding:0 4px; }
.warn { color:#b45309; font-size:.88rem; margin-top:10px; }
details { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; margin-bottom:10px; }
summary { font-weight:600; cursor:pointer; }
details p { margin-top:8px; }
.block { margin-top:40px; }
.block > h2 { margin-bottom:14px; }
nav { flex-wrap:wrap; }
@media (max-width:520px) { header { position:static; padding:12px 16px; } .nav-container { flex-direction:column; gap:6px; } }
