:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #edf5f2;
  --text: #17201b;
  --muted: #62706a;
  --line: #dce5df;
  --accent: #0f766e;
  --accent-dark: #0a5f59;
  --accent-soft: #dff2ee;
  --warm: #b95035;
  --shadow: 0 18px 55px rgba(25, 39, 33, 0.08);
  --radius: 8px;
  --max: 980px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.32);
  outline-offset: 3px;
}

.site-header {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 18px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.brand::before {
  width: 14px;
  height: 14px;
  margin-right: 10px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  content: "";
}

.page {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 10px 0 44px;
}

.hero {
  padding: 18px 0 16px;
}

.hero--home {
  padding-top: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: 2.45rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.45rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.link-section,
.calculator-card,
.content-section,
.faq-section {
  margin-top: 20px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.tool-card {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.tool-card:hover {
  border-color: rgba(15, 118, 110, 0.45);
  transform: translateY(-2px);
}

.tool-card__label {
  align-self: end;
  font-size: 1.15rem;
  font-weight: 850;
}

.tool-card__text {
  color: var(--muted);
}

.calculator-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator-head {
  margin-bottom: 16px;
}

.calculator-head h2 {
  margin-bottom: 4px;
}

.calculator-head p {
  margin-bottom: 0;
  color: var(--muted);
}

form {
  display: grid;
  gap: 16px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mode-switch label {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.mode-switch input {
  width: 20px;
  height: 20px;
  margin: 0 10px 0 4px;
  accent-color: var(--accent);
}

.mode-switch span {
  font-weight: 740;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 52px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  color: var(--text);
}

input::placeholder {
  color: #9aa69f;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-row button,
.related-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  color: var(--text);
  font-weight: 760;
  text-decoration: none;
}

.preset-row button:hover,
.related-links a:hover {
  border-color: rgba(15, 118, 110, 0.5);
  background: var(--accent-soft);
}

.primary-button {
  min-height: 56px;
  padding: 14px 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-weight: 850;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.result {
  min-height: 76px;
  padding: 16px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
}

.result--empty {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 680;
}

.result--error {
  border-color: rgba(185, 80, 53, 0.35);
  background: #fff1ec;
  color: #7a2c1d;
  font-weight: 760;
}

.result__label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result__value {
  display: block;
  margin-bottom: 10px;
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.result__meta {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--muted);
}

.result__meta strong {
  color: var(--text);
}

.content-section,
.faq-section {
  padding: 20px 0 0;
}

.content-section p,
.faq-section p,
.plain-list {
  max-width: 740px;
  color: var(--muted);
}

.plain-list {
  margin: 0 0 18px;
  padding-left: 20px;
}

.plain-list li + li {
  margin-top: 8px;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

details {
  border-top: 1px solid var(--line);
}

details:last-child {
  border-bottom: 1px solid var(--line);
}

summary {
  min-height: 52px;
  padding: 15px 0;
  cursor: pointer;
  font-weight: 800;
}

details p {
  margin-bottom: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.site-footer {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 22px 0 36px;
  border-top: 1px solid var(--line);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.site-footer a {
  color: var(--muted);
}

@media (max-width: 420px) {
  .page,
  .site-header,
  .site-footer {
    width: min(100% - 22px, var(--max));
  }

  .calculator-card {
    padding: 14px;
  }

  .mini-grid,
  .mini-grid--two {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 720px) {
  .site-header {
    padding-top: 24px;
  }

  h1 {
    font-size: 4.45rem;
  }

  h2 {
    font-size: 2rem;
  }

  .result__value {
    font-size: 3.45rem;
  }

  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calculator-card {
    padding: 24px;
  }

  .mode-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .field-group {
    gap: 12px;
  }
}
