/* Numerosoitti: mobile-first, system fonts, light and dark themes. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #17202b;
  --muted: #4a5666;
  --border: #d5dce6;
  --brand: #1d4f91;
  --brand-strong: #163e73;
  --brand-contrast: #ffffff;
  --link: #1a4b8c;
  --focus: #8a4b00; /* 6.6:1 on white; dark theme uses amber */
  --ok-bg: #e6f4ea; --ok-fg: #1d5a2c;
  --info-bg: #e7eef8; --info-fg: #1d3f6e;
  --err-bg: #fbe9e7; --err-fg: #8a1f11;
  --ex-bg: #fff3cd; --ex-fg: #5c4400;
  /* Danger scale 1..5 (text on these backgrounds meets WCAG AA). */
  --d1: #2f7d4f; --d2: #6b7d1f; --d3: #a86200; --d4: #c2410c; --d5: #b3261e;
  --d-text: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 30, 50, .06), 0 4px 16px rgba(15, 30, 50, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1620;
    --surface: #17212e;
    --surface-2: #1f2b3a;
    --text: #e6ebf2;
    --muted: #a9b4c2;
    --border: #2d3a4b;
    --brand: #6ea4e8;
    --brand-strong: #8ab6ee;
    --brand-contrast: #0b1320;
    --link: #8fbaf0;
    --ok-bg: #173323; --ok-fg: #a6e3b8;
    --info-bg: #172a43; --info-fg: #b7d0f2;
    --err-bg: #3a1a17; --err-fg: #f5b5ab;
    --ex-bg: #3a2f0d; --ex-fg: #f7dc8a;
    --shadow: none;
    --focus: #f5b83d;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; margin-top: 1.2em; }
p, ul, ol { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding: 0 1rem; }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--surface); padding: .5rem 1rem; }
.nowrap { white-space: nowrap; }

/* Header and footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.logo-mark { color: var(--brand); flex: none; }
.nav { display: flex; gap: .25rem 1rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; padding: .35rem .2rem; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--brand); }
main { padding-top: 1.5rem; padding-bottom: 2.5rem; }
.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); font-size: .95rem; }
.footer-inner { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.footer-brand strong { color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; list-style: none; padding: 0; margin: 0; }

/* Hero and search */
.hero { padding: 1rem 0 1.5rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 42rem; }
.search { margin: 1rem 0 .75rem; max-width: 40rem; }
.search-label { display: block; font-weight: 600; margin-bottom: .35rem; }
.search-row { display: flex; gap: .5rem; }
.search input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.15rem; padding: .7rem .9rem;
  border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.search-large input { font-size: 1.35rem; padding: .85rem 1rem; }
.search input:focus { border-color: var(--brand); }
button, .btn-primary {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px;
  background: var(--brand); color: var(--brand-contrast); padding: .7rem 1.2rem; text-decoration: none; display: inline-block;
}
button:hover, .btn-primary:hover { background: var(--brand-strong); }
.search-large button { font-size: 1.15rem; padding: .85rem 1.4rem; }
.btn-link { background: none; color: var(--link); padding: .2rem 0; font-weight: 500; font-size: .9rem; text-decoration: underline; }
.btn-link:hover { background: none; }
.hint { color: var(--muted); font-size: .93rem; }
.field-error { color: var(--err-fg); background: var(--err-bg); padding: .35rem .6rem; border-radius: 8px; font-weight: 600; margin: .35rem 0; }

/* Layout */
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 48rem) { .grid { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .93rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 .5rem; }

/* Notices */
.notice { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok-fg); }
.notice-info { background: var(--info-bg); color: var(--info-fg); }
.notice-error { background: var(--err-bg); color: var(--err-fg); }
.notice-example { background: var(--ex-bg); color: var(--ex-fg); }
.notice a { color: inherit; }
.example-label {
  display: inline-block; background: var(--ex-bg); color: var(--ex-fg); border: 1px dashed currentColor;
  border-radius: 6px; padding: 0 .45rem; font-size: .8rem; font-weight: 700; margin-right: .35rem;
}

/* Number page */
.number-title { font-variant-numeric: tabular-nums; margin-bottom: .25rem; }
.empty-title { font-weight: 700; font-size: 1.1rem; }
.empty { padding: .25rem 0 .5rem; }
.meter { margin-bottom: 1rem; }
.meter-score { display: inline-flex; align-items: baseline; gap: .1rem; padding: .2rem .8rem; border-radius: 10px; color: var(--d-text); }
.meter-value { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.meter-max { font-size: 1.1rem; font-weight: 600; }
.meter-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: .6rem 0 .3rem; max-width: 18rem; }
.seg { height: .7rem; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.meter-label { font-weight: 700; font-size: 1.15rem; margin: 0; }
.external-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
@media (min-width: 48rem) { .external-list { grid-template-columns: 1fr 1fr; } }
.external-item { border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem; }
.external-item h3 { margin-top: 0; }
.external-item .stats { margin-bottom: .5rem; }
.external-danger { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; font-weight: 600; margin: 0 0 .5rem; }
.external-danger .badge { font-size: 1rem; }
.external-summary { font-weight: 600; margin: 0 0 .5rem; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 600; }
.d1 { background: var(--d1); } .d2 { background: var(--d2); } .d3 { background: var(--d3); } .d4 { background: var(--d4); } .d5 { background: var(--d5); }
.seg.on { border-color: transparent; }
.stats, .info { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.stats div, .info div { background: var(--surface-2); border-radius: 10px; padding: .5rem .75rem; }
.stats dt, .info dt { font-size: .85rem; color: var(--muted); }
.stats dd, .info dd { margin: 0; font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.info { grid-template-columns: 1fr; }
.info-notes { padding-left: 1.2rem; }
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; margin-bottom: .55rem; }
.bar-name { font-size: .95rem; }
.bar-num { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: .55rem; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.cat-huijaus { background: var(--d5); } .cat-myynti { background: var(--d3); } .cat-kysely { background: var(--brand); } .cat-muu { background: var(--muted); }
.w0{width:0%}
.w5{width:5%}
.w10{width:10%}
.w15{width:15%}
.w20{width:20%}
.w25{width:25%}
.w30{width:30%}
.w35{width:35%}
.w40{width:40%}
.w45{width:45%}
.w50{width:50%}
.w55{width:55%}
.w60{width:60%}
.w65{width:65%}
.w70{width:70%}
.w75{width:75%}
.w80{width:80%}
.w85{width:85%}
.w90{width:90%}
.w95{width:95%}
.w100{width:100%}

/* Forms */
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 700; margin-bottom: .5rem; padding: 0; }
.choice-grid { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 36rem) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.danger-choices { grid-template-columns: 1fr; }
@media (min-width: 48rem) { .danger-choices { grid-template-columns: repeat(5, 1fr); } }
.choice {
  display: flex; align-items: center; gap: .55rem; padding: .6rem .75rem; border: 2px solid var(--border);
  border-radius: 10px; background: var(--surface); cursor: pointer; line-height: 1.3;
}
.choice.d1, .choice.d2, .choice.d3, .choice.d4, .choice.d5 { background: var(--surface); border-left-width: 8px; }
.choice.d1 { border-left-color: var(--d1); } .choice.d2 { border-left-color: var(--d2); } .choice.d3 { border-left-color: var(--d3); }
.choice.d4 { border-left-color: var(--d4); } .choice.d5 { border-left-color: var(--d5); }
.choice input { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); flex: none; margin: 0; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--surface-2); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.field { margin-bottom: 1.25rem; }
.field label { font-weight: 700; display: block; margin-bottom: .25rem; }
.optional { font-weight: 400; color: var(--muted); }
textarea, .field input {
  width: 100%; font: inherit; padding: .6rem .75rem; border: 2px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
textarea:focus, .field input:focus { border-color: var(--brand); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Comments */
.comments { list-style: none; padding: 0; margin: 0 0 1rem; }
.comment { border-top: 1px solid var(--border); padding: .9rem 0; }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .9rem; color: var(--muted); margin-bottom: .35rem; }
.comment-text { margin: 0 0 .25rem; white-space: pre-line; overflow-wrap: anywhere; }
.badge { display: inline-block; color: var(--d-text); border-radius: 6px; padding: .05rem .5rem; font-weight: 700; font-size: .85rem; }
.tag { display: inline-block; background: var(--surface-2); color: var(--text); border-radius: 6px; padding: .05rem .5rem; font-size: .85rem; }
.flag-form { margin: 0; }
.permalink { color: var(--muted); font-size: .85rem; }

/* Lists */
.recent { list-style: none; padding: 0; margin: 0; }
.recent li + li { border-top: 1px solid var(--border); }
.recent a { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; padding: .6rem 0; text-decoration: none; color: var(--text); }
.recent a:hover .recent-number { text-decoration: underline; }
.recent-number { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 11rem; }
.recent-meta { color: var(--muted); font-size: .9rem; }
.guide-cards { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; }
@media (min-width: 48rem) { .guide-cards { grid-template-columns: repeat(3, 1fr); } }
.guide-cards a {
  display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: 1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text);
}
.guide-cards a strong { color: var(--link); font-size: 1.05rem; }
.guide-cards a span { color: var(--muted); font-size: .93rem; }
.guide-cards a:hover { border-color: var(--brand); }
.link-list { padding-left: 1.2rem; }
.steps { padding-left: 1.4rem; }
.steps li { margin-bottom: .4rem; }

/* Articles */
.article { max-width: 44rem; }
.article section { margin-bottom: 1.5rem; }
.article h2 { margin-top: 1.5rem; }
.sources { border-top: 1px solid var(--border); padding-top: 1rem; font-size: .95rem; }
.sources li { margin-bottom: .35rem; overflow-wrap: anywhere; }
.checked { color: var(--muted); }

/* Admin */
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--border); padding: .5rem; text-align: left; vertical-align: top; }
.admin-comment { max-width: 28rem; overflow-wrap: anywhere; }
.admin-actions { white-space: nowrap; }
.inline-form { display: inline-block; margin: 0 .25rem .25rem 0; }
.inline-form button { padding: .3rem .7rem; font-size: .85rem; }
.inline-form button.danger { background: var(--d5); color: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .choice, .guide-cards a, button { transition: border-color .15s ease, background-color .15s ease; }
}
@media print {
  .site-header nav, .rating-form, .flag-form, .search { display: none; }
}
