:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ef;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --surface: #ffffff;
  --page: #f1f5f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(37, 99, 235, .09), transparent 28rem),
    radial-gradient(circle at 88% 85%, rgba(14, 165, 233, .08), transparent 26rem),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.calculator {
  width: min(1080px, 100%);
  padding: 38px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(203, 213, 225, .85);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.intro { margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.45rem); line-height: 1.1; letter-spacing: -.035em; }
.intro > p:last-child { max-width: 680px; margin: 12px 0 0; color: var(--muted); line-height: 1.55; }

.grid { display: grid; gap: 18px; margin-top: 22px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { min-width: 0; }
label { display: block; margin: 0 0 8px; color: #475569; font-size: .8rem; font-weight: 650; }

select, input, .value-shell {
  width: 100%;
  min-width: 0;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
}

select { padding: 0 46px 0 16px; cursor: pointer; }
input { height: 100%; padding: 0; border: 0; outline: 0; background: transparent; }
.input-shell {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input-shell:focus-within, select:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .13); outline: 0; }
.input-shell span { flex: 0 0 auto; color: var(--muted); font-size: .9rem; }
.currency { font-weight: 800; }

.value-shell { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; overflow: hidden; }
.value-shell output { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.value-shell span { flex: 0 0 auto; color: var(--muted); font-size: .84rem; font-weight: 600; }
.emphasized, .annual { color: var(--blue-dark); background: var(--blue-soft); border-color: #93b4fb; }
.annual { font-size: clamp(1.05rem, 2.3vw, 1.42rem); }

.note { margin: 26px 0 0; padding-top: 20px; border-top: 1px solid #e8edf4; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.note strong { color: #334155; }
.error { margin-top: 18px; padding: 12px 14px; border-radius: 10px; color: #991b1b; background: #fef2f2; font-size: .85rem; }

@media (max-width: 700px) {
  main { align-items: start; padding: 20px 14px; }
  .calculator { padding: 24px 18px; border-radius: 20px; }
  .intro { margin-bottom: 24px; }
  .two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .three-columns, .four-columns { grid-template-columns: 1fr; gap: 12px; }
  .grid { margin-top: 18px; }
  select, input, .value-shell, .input-shell { height: 54px; }
  .annual { font-size: 1.32rem; }
}

@media (min-width: 701px) and (max-width: 980px) {
  .four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .two-columns { grid-template-columns: 1fr; }
}

