:root {
  --bg: #ffffff;
  --text: #1c2430;
  --muted: #5b6573;
  --accent: #0b5cad;
  --box: #f2f5f9;
  --border: #d9dfe7;
  --warn: #fff6e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --text: #e6e9ee;
    --muted: #a3acb8;
    --accent: #7db4ff;
    --box: #1c232c;
    --border: #2f3946;
    --warn: #2e2716;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  padding: 0.8rem 16px;
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.top nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.95rem; }
.top nav a { text-decoration: none; }
.top nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
main { max-width: 760px; margin: 0 auto; padding: 1rem 16px 2rem; }
h1 { font-size: 1.9rem; line-height: 1.25; margin: 0.8rem 0 1rem; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
.lead { font-size: 1.1rem; }
.box, .checked, .note {
  background: var(--box);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 1.2rem 0;
}
.note { background: var(--warn); }
.checked { font-size: 0.9rem; color: var(--muted); }
.checked p { margin: 0.3rem 0; }
ol.steps { padding-left: 1.3rem; }
ol.steps li { margin-bottom: 0.5rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
th { background: var(--box); }

/* Räknare */
form.laskuri { background: var(--box); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin: 1.2rem 0; }
form.laskuri fieldset { border: 0; border-top: 1px solid var(--border); padding: 0.8rem 0 0.4rem; margin: 0 0 0.6rem; }
form.laskuri fieldset:first-child { border-top: 0; padding-top: 0; }
form.laskuri legend { font-weight: 700; padding: 0; }
.rivit { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.6rem 1rem; }
.kentta { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.3rem 0; font-size: 0.95rem; }
.kentta .rivi { display: flex; align-items: center; gap: 0.4rem; }
.kentta input, .kentta select, .kentta textarea {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 0.45rem 0.55rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.kentta textarea { font-size: 1rem; }
.yks { color: var(--muted); white-space: nowrap; }
.radiot { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0.6rem 0; }
.tulos { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px dashed var(--border); padding: 0.4rem 0; }
.tulos output { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.tulos.iso output { font-size: 1.5rem; color: var(--accent); }
.nappi { font: inherit; font-weight: 700; padding: 0.6rem 1.2rem; margin: 0.6rem 0; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--bg); cursor: pointer; }
.nopat { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 3.2rem; margin: 0.4rem 0; }
.noppa { display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; font-size: 1.5rem;
  font-weight: 700; border: 2px solid var(--text); border-radius: 10px; background: var(--bg); }
ol.arvonta { font-size: 1.3rem; font-weight: 700; }
details.taulu { margin-top: 0.8rem; }
details.taulu summary { cursor: pointer; color: var(--accent); }
details summary { cursor: pointer; font-weight: 600; }
details { margin: 0.6rem 0; }
.lahde { font-size: 0.9rem; color: var(--muted); }
ul.kortit { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.8rem; }
ul.kortit a { display: block; height: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--box); text-decoration: none; color: var(--text); }
ul.kortit a strong { display: block; color: var(--accent); }
ul.kortit a span { font-size: 0.9rem; color: var(--muted); }
aside.muut { border-top: 1px solid var(--border); margin-top: 2rem; }
aside.muut ul { columns: 2; padding-left: 1.1rem; }
footer { max-width: 760px; margin: 0 auto; padding: 1rem 16px 2rem; color: var(--muted); font-size: 0.9rem; }
