/* finnsvar.no – one stylesheet for every page. System fonts and no frameworks, so pages load fast on phones. */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #16202e;
  --muted: #566275;
  --line: #dde3ec;
  --brand: #1d5bbf;
  --brand-dark: #154594;
  --brand-soft: #e7effb;
  --accent: #f2a93b;
  --ok: #1f7a4d;
  --ok-soft: #e4f4ea;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 46, .06), 0 4px 16px rgba(22, 32, 46, .05);
  --on-brand: #fff;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
/* Dark: follows the device unless the visitor picked light or dark with the header button (data-mode on <html>) */
:root[data-mode="dark"] {
  --bg: #0f1520;
  --surface: #172030;
  --text: #e8edf4;
  --muted: #a3afc0;
  --line: #2a3648;
  --brand: #6ea2f5;
  --brand-dark: #93bbff;
  --brand-soft: #1c2b44;
  --accent: #f2b04f;
  --ok: #6fd19c;
  --ok-soft: #173326;
  --bad: #ff8f85;
  --bad-soft: #3a1d1b;
  --shadow: none;
  --on-brand: #0f1520;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --bg: #0f1520;
    --surface: #172030;
    --text: #e8edf4;
    --muted: #a3afc0;
    --line: #2a3648;
    --brand: #6ea2f5;
    --brand-dark: #93bbff;
    --brand-soft: #1c2b44;
    --accent: #f2b04f;
    --ok: #6fd19c;
    --ok-soft: #173326;
    --bad: #ff8f85;
    --bad-soft: #3a1d1b;
    --shadow: none;
    --on-brand: #0f1520;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--font); }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: clamp(22px, 3.2vw, 28px); margin-top: 1.6em; }
h3 { font-size: 19px; }
p, ul, ol { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 28px; } }
.narrow { max-width: 760px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
h2 a { text-decoration: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header and footer */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; }
.logo svg { width: 28px; height: 28px; flex: none; }
.logo b { color: var(--brand); font-weight: 700; }
.logo > span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.top nav { display: flex; gap: 4px 18px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 16px; padding: 6px 0; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.top nav { align-items: center; }
.mode { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.mode:hover { color: var(--text); border-color: var(--muted); }
.mode svg { width: 20px; height: 20px; }
.mode .sun { display: none; }
:root[data-mode="dark"] .mode .sun { display: block; }
:root[data-mode="dark"] .mode .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .mode .sun { display: block; }
  :root:not([data-mode="light"]) .mode .moon { display: none; }
}
.foot { margin-top: 64px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 15px; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-top: 24px; padding-bottom: 32px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot a { color: var(--muted); }

/* Page heads and breadcrumbs */
.hero { padding-top: 40px; padding-bottom: 8px; }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 680px; }
.crumbs { font-size: 15px; color: var(--muted); margin: 20px 0 0; }
.crumbs a { color: var(--muted); }
.badge { display: inline-block; font-size: 13px; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 99px; padding: 3px 10px; margin-bottom: 12px; }

/* Search and tool cards */
.search { position: relative; max-width: 560px; margin: 8px 0 8px; }
.search input { width: 100%; font: inherit; font-size: 18px; padding: 14px 16px 14px 46px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.search input:focus { outline: none; border-color: var(--brand); }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 0; list-style: none; margin: 16px 0 0; }
.card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--brand); color: var(--text); transform: translateY(-2px); }
.card h3 { margin: 0; color: var(--brand); }
.card p { margin: 0; color: var(--muted); font-size: 16px; }
.card.soon { box-shadow: none; background: transparent; border-style: dashed; }
.card.soon h3 { color: var(--muted); }
.card.soon:hover { transform: none; border-color: var(--line); }
.icon { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 6px; }
.icon svg { width: 22px; height: 22px; }
.empty { color: var(--muted); }

/* Panels and forms */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 3vw, 28px); margin: 16px 0; min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-weight: 600; font-size: 16px; }
.optional { font-weight: 400; color: var(--muted); }
.hint { font-size: 15px; color: var(--muted); margin: 0; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 46px; width: 100%; min-width: 0; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 16px; font-weight: 600; min-height: 46px; padding: 10px 18px; border-radius: 10px; border: 1.5px solid var(--brand); background: var(--brand); color: var(--on-brand); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--text); background: var(--brand-soft); }
.btn:disabled { opacity: .6; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

/* Tables (calculators) */
.scroll { position: relative; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 16px; }
.t th { text-align: left; font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.t td input { min-width: 80px; }
.t td:first-child input { min-width: 140px; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t tfoot td { font-weight: 700; border-bottom: 0; }
.remove { width: 46px; height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.remove:hover { color: var(--bad); border-color: var(--bad); }

/* Results */
.result { margin-top: 8px; }
.result-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 32px; }
.result-head h2 { margin: 0; }
.big { font-size: clamp(24px, 4vw, 32px); font-weight: 700; margin: 0; }
.verdict { border-radius: var(--radius); padding: 18px 20px; margin: 8px 0; }
.verdict.yes { background: var(--ok-soft); color: var(--ok); }
.verdict.no { background: var(--bad-soft); color: var(--bad); }
.verdict p { margin: 4px 0 0; color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat span { display: block; font-size: 14px; color: var(--muted); }
.stat strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.dates { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.dates li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.dates li.key { border-color: var(--brand); background: var(--brand-soft); }
.dates strong { font-variant-numeric: tabular-nums; }
.form-status { margin: 0; font-size: 15px; }
.form-status.ok { color: var(--ok); }
.form-status.error { color: var(--bad); }

/* Long text under tools */
.text > * { max-width: 760px; }
form.signup { display: flex; flex-direction: column; gap: 14px; }
form.signup .actions { margin-top: 0; }
.text li { margin-bottom: .5em; }
.note { border-left: 4px solid var(--accent); background: var(--surface); padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 16px 0; font-size: 16px; }
.split { display: grid; gap: 24px; align-items: start; }
@media (min-width: 860px) { .split { grid-template-columns: 1fr 1fr; } }

@media print {
  .top, .foot, .skip, .noprint, .crumbs, .hero, .actions, .text, .signup { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .panel, .stat, .dates li { box-shadow: none; border-color: #999; }
}

/* Fordelingsnøkkel: show only the columns the chosen key uses */
#vl-form[data-model="equal"] .vl-use, #vl-form[data-model="equal"] .vl-fixed,
#vl-form[data-model="use"] .vl-fixed, #vl-form[data-model="mix"] .vl-fixed,
#vl-form[data-model="fixed"] .vl-use, .vl-use-hint { display: none; }
#vl-form[data-model="use"] .vl-use-hint, #vl-form[data-model="mix"] .vl-use-hint { display: block; margin-top: 12px; }
.table-gap { margin-top: 16px; }
.actions.flush { margin: 0; }

