:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a2233;
  --muted: #5a6478;
  --border: #dde2ea;
  --accent: #0b6e4f;
  --accent-soft: #e3f2ec;
  --result-bg: #f0f7f4;
  --max-width: 52rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f;
    --surface: #1a2029;
    --text: #e8ecf3;
    --muted: #9aa5b8;
    --border: #2c3542;
    --accent: #4cc099;
    --accent-soft: #1d2f28;
    --result-bg: #1b2822;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

header.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

header.site a.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

header.site nav a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 0.9rem;
  font-size: 0.92rem;
}

header.site nav a:hover { color: var(--accent); }

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.5rem 0 0.25rem; }
h2 { font-size: 1.25rem; margin-top: 2rem; }
p.lede { color: var(--muted); margin-top: 0.25rem; }

a { color: var(--accent); }

.tool-card, .calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.calc { margin-top: 1.25rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.9rem 1.1rem;
}

label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }

input[type="number"], select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.results {
  margin-top: 1.25rem;
  background: var(--result-bg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.results h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }

.results table { width: 100%; border-collapse: collapse; }
.results td {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.results tr:last-child td { border-bottom: none; }
.results td.val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.results .big { font-size: 1.35rem; color: var(--accent); }

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

ul.tool-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
ul.tool-list a { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
ul.tool-list p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }

table.devices { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.devices th, table.devices td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
table.devices td.num, table.devices th.num { text-align: right; }
table.devices input[type="number"] { width: 4.5rem; padding: 0.3rem 0.4rem; }
.table-wrap { overflow-x: auto; }

details {
  margin: 0.6rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
}
details summary { cursor: pointer; font-weight: 600; }

footer.site {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
footer.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1rem;
}
footer.site a { color: var(--muted); }

@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
}

.stack-gap { margin-top: 0.4rem; }
.mb-1 { margin-bottom: 1rem; }

.promo {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}
.promo p { margin: 0; }
.promo .promo-tag {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}
