:root {
  /* Layout: forside med romkort; kalkulator med inndata til venstre og resultat i fast kolonne til høyre. Flisrutenett som eneste dekor. */
  --bg: #f3f5f4;
  --surface: #ffffff;
  --ink: #17262a;
  --muted: #5b6b6f;
  --line: #d9e1e0;
  --accent: #1d5c66;
  --accent-soft: #e2eeee;
  --warm: #b8862b;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111a1c; --surface: #182427; --ink: #e6eeee; --muted: #9db0b2;
    --line: #2b3b3e; --accent: #6fbac4; --accent-soft: #1f3337; --warm: #e0b45a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111a1c; --surface: #182427; --ink: #e6eeee; --muted: #9db0b2;
  --line: #2b3b3e; --accent: #6fbac4; --accent-soft: #1f3337; --warm: #e0b45a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand .tile { width: 22px; height: 22px; border-radius: 4px; background:
  linear-gradient(var(--accent), var(--accent)) 0 0 / 10px 10px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 12px 12px / 10px 10px no-repeat,
  linear-gradient(var(--accent-soft), var(--accent-soft)) 12px 0 / 10px 10px no-repeat,
  linear-gradient(var(--accent-soft), var(--accent-soft)) 0 12px / 10px 10px no-repeat; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; padding: 6px 12px; border-radius: 999px; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav a:focus-visible, .room-card:focus-visible, .back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header.page { display: grid; gap: 8px; margin-bottom: 28px; max-width: 62ch; }
.badge {
  justify-self: start; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px;
}
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 5vw, 44px); line-height: 1.08; margin: 0; text-wrap: balance; }
.lede { color: var(--muted); margin: 0; font-size: 17px; }

/* Forside */
.hero { display: grid; gap: 12px; margin: 24px 0 32px; max-width: 34ch; }
.hero h1 { font-size: clamp(36px, 6vw, 56px); }
.hero .lede { max-width: 52ch; }
.rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .rooms { grid-template-columns: 1fr; } }
.room-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 22px 22px; border-radius: 16px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s;
}
a.room-card:hover { border-color: var(--accent); box-shadow: 0 6px 20px -12px var(--accent); }
.room-card .icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); display: grid; place-items: center; }
.room-card .icon svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rc-text { display: grid; gap: 2px; min-width: 0; }
.room-card h2 { font-family: var(--font-display); font-size: 21px; margin: 0; }
.room-card p { margin: 0; color: var(--muted); font-size: 15px; }
.room-card .from { margin-top: 6px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; color: var(--ink); }
.room-card .arrow { color: var(--accent); font-size: 22px; transition: transform .15s; }
a.room-card:hover .arrow { transform: translateX(3px); }
.room-card.quiet { background: transparent; border-style: dashed; }
.trust { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 14px; }
.trust li { display: flex; align-items: center; gap: 8px; }
.trust li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Kalkulator */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.inputs { display: grid; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }
legend { font-family: var(--font-display); font-weight: 700; font-size: 18px; padding: 0; margin-bottom: 2px; }
.hint { color: var(--muted); font-size: 14px; margin: -4px 0 0; }

.size-row { display: flex; align-items: center; gap: 16px; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 28px; min-width: 0; }
.size-out { font-family: var(--font-display); font-weight: 700; font-size: 26px; min-width: 96px; text-align: right; font-variant-numeric: tabular-nums; }

.seg { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .seg { grid-template-columns: 1fr; } }
.seg input, .checks input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: grid; gap: 2px; cursor: pointer; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 10px; background: var(--surface); transition: border-color .15s, background .15s;
}
.seg label strong { font-weight: 600; }
.seg label span { color: var(--muted); font-size: 13px; }
.seg input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.seg input:focus-visible + label, .checks input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.checks { display: grid; gap: 8px; }
.checks label {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; transition: border-color .15s, background .15s;
}
.checks label::before {
  content: ""; flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 5px;
  border: 1.5px solid var(--muted); background: var(--surface);
}
.checks input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.checks input:checked + label::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.checks .txt { display: grid; gap: 1px; }
.checks .txt span { color: var(--muted); font-size: 13px; }

.result { position: sticky; top: 20px; display: grid; gap: 18px; }
@media (max-width: 860px) { .result { position: static; } }
.est-label { color: var(--muted); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.range { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4.2vw, 36px); line-height: 1.1; font-variant-numeric: tabular-nums; text-wrap: balance; }
.mid { color: var(--muted); font-variant-numeric: tabular-nums; }
.mid b { color: var(--ink); }

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.bar-row .name { font-weight: 500; }
.bar-row .val { font-variant-numeric: tabular-nums; color: var(--muted); }
.track { grid-column: 1 / -1; height: 8px; background: var(--accent-soft); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s ease; }
.fill.save { background: var(--warm); }

.drivers { margin: 0; padding: 14px 16px; background: var(--accent-soft); border-radius: 10px; font-size: 14px; }
.drivers b { display: block; margin-bottom: 4px; }
.drivers ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }

.below { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
@media (max-width: 860px) { .below { grid-template-columns: 1fr; } }
h2.sec { font-family: var(--font-display); font-size: 20px; margin: 0 0 10px; }
.below ol, .below ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.below p { margin: 0 0 10px; color: var(--muted); font-size: 15px; max-width: 65ch; }
.sources { font-size: 14px; }
.disclaimer { margin-top: 24px; font-size: 13px; color: var(--muted); max-width: 70ch; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Del ditt tilbud */
.share { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.share p { margin: 0; color: var(--muted); font-size: 14px; }
.share-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.share-field { display: grid; gap: 4px; }
.share label { font-size: 13px; font-weight: 600; }
.money { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); }
.money:focus-within, .share select:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.money input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 10px 12px; font-variant-numeric: tabular-nums; outline: none; }
.money span { padding-right: 12px; color: var(--muted); }
.share select { border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; padding: 10px 12px; }
.share button { justify-self: start; font: inherit; font-weight: 600; color: var(--surface); background: var(--accent); border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; }
.share button:disabled { opacity: .6; cursor: default; }
.share button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.share .fine { font-size: 12px; }
.share .msg { font-size: 14px; font-weight: 500; color: var(--ink); min-height: 1.2em; }
.share .msg.ok { color: var(--accent); }
.share .msg.err { color: #b3261e; }
:root[data-theme="dark"] .share .msg.err { color: #f2b8b5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .share .msg.err { color: #f2b8b5; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 420px) { .share-row { grid-template-columns: 1fr; } }

/* Knapper */
.btn-secondary { justify-self: start; font: inherit; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 1.5px solid transparent; border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); }
.btn-secondary:disabled { opacity: .5; cursor: default; }
.btn-secondary a { color: inherit; }
.btn-link { font: inherit; font-size: 14px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.btn-secondary:focus-visible, .btn-link:focus-visible, .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Handleliste */
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.shop-list { list-style: none; padding: 0 !important; margin: 4px 0 0 !important; display: grid; gap: 0 !important; }
.shop-list li { border-top: 1px solid var(--line); }
.shop-list li:first-child { border-top: 0; }
.shop-list input { position: absolute; opacity: 0; pointer-events: none; }
.shop-list label { display: grid; grid-template-columns: 20px minmax(90px, auto) 1fr; gap: 12px; align-items: baseline; padding: 9px 0; cursor: pointer; font-size: 15px; }
.shop-list label::before { content: ""; width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 5px; align-self: center; }
.shop-list input:checked + label::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.shop-list input:checked + label .item { text-decoration: line-through; color: var(--muted); }
.shop-list input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.shop-list .qty { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.shop-list .item { display: grid; }
.shop-list .note { color: var(--muted); font-size: 13px; }
.shop-list .empty { color: var(--muted); padding: 8px 0; border: 0; }
.shop .msg { font-size: 14px; color: var(--accent); margin: 8px 0 0; min-height: 1.2em; }

/* Boligbudsjett */
.budget-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 24px; align-items: start; }
@media (max-width: 860px) { .budget-grid { grid-template-columns: 1fr; } }
table.budget { width: 100%; border-collapse: collapse; font-size: 15px; }
table.budget th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 0 8px; border-bottom: 1px solid var(--line); }
table.budget td { padding: 12px 0; border-bottom: 1px solid var(--line); }
table.budget .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
table.budget .act { text-align: right; width: 1%; padding-left: 16px; }
table.budget a { color: var(--ink); font-weight: 500; }
table.budget tr.buffer td { color: var(--muted); }
.pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-more { margin-top: 16px; }
.pill { text-decoration: none; font-weight: 600; font-size: 14px; color: var(--accent); background: var(--accent-soft); padding: 7px 14px; border-radius: 999px; }
.empty-budget { display: grid; gap: 12px; max-width: 560px; }
.empty-budget p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
