/* Shared by index.html and budsjett.html. */
/* Layout: one calm column like a municipal report; ledger rows carry the detail, one Narvik-blue accent (#005fbe, from the coat of arms) marks the selected year and Narvik; red is kept for over budget and increases. */
:root {
  --paper: #f4f6f7;
  --surface: #ffffff;
  --ink: #17212b;
  --ink-2: #4c5966;
  --rule: #d9dfe4;
  --accent: #005fbe;
  --accent-soft: rgba(0, 95, 190, 0.10);
  --muted: #9aa6b1;
  --good: #2f7a52;
  --bad: #a3412a;
  --font-display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12181e; --surface: #1a222a; --ink: #e8edf1; --ink-2: #a4b0bb; --rule: #2c3741;
    --accent: #6aacf2; --accent-soft: rgba(106, 172, 242, 0.16); --muted: #6c7a87; --good: #6cc394; --bad: #e98a6f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12181e; --surface: #1a222a; --ink: #e8edf1; --ink-2: #a4b0bb; --rule: #2c3741;
  --accent: #6aacf2; --accent-soft: rgba(106, 172, 242, 0.16); --muted: #6c7a87; --good: #6cc394; --bad: #e98a6f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
.wrap { max-width: 880px; margin: 0 auto; display: grid; gap: 56px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.05; font-weight: 700; }
h2 { font-size: 1.5rem; line-height: 1.2; font-weight: 600; }
p { margin: 0; max-width: 65ch; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-2); font-weight: 600; }
.lead { color: var(--ink-2); font-size: 1.075rem; }
section { display: grid; gap: 20px; }
.section-head { display: grid; gap: 8px; }

/* site nav */
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: baseline; padding-top: 20px; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
.site-nav .brand { font: 700 1rem var(--font-display); color: var(--ink); text-decoration: none; margin-right: auto; }
.site-nav a:not(.brand) { font-size: 0.95rem; color: var(--ink-2); text-decoration: none; padding: 2px 0; border-bottom: 2px solid transparent; }
.site-nav a:not(.brand):hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.cross-link { font-size: 0.95rem; font-weight: 600; }

/* header */
header { display: grid; gap: 20px; padding-top: 24px; }
.years { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.years span { font-size: 0.85rem; color: var(--ink-2); margin-right: 6px; }
.years button {
  font: 600 0.95rem var(--font-body); font-variant-numeric: tabular-nums;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.years button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* summary */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.stat { background: var(--surface); padding: 18px 20px; display: grid; gap: 4px; align-content: start; }
.stat .big { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat .big small { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.stat .sub { color: var(--ink-2); font-size: 0.9rem; }
.equation { font-size: 0.92rem; color: var(--ink-2); max-width: none; }
.equation b { color: var(--ink); font-weight: 600; }

/* hundrelapp */
.note-bar { display: flex; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--rule); background: var(--surface); }
.note-bar a { border: 0; padding: 0; cursor: pointer; border-right: 2px solid var(--surface); background: var(--accent); min-width: 0; display: flex; align-items: flex-end; justify-content: flex-start; color: var(--paper); font: 700 0.95rem var(--font-display); }
.note-bar a span { padding: 0 0 8px 8px; white-space: nowrap; }
.note-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 20px; margin: 0; padding: 0; list-style: none; }
.note-legend li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: baseline; font-size: 0.95rem; }
.note-legend .kr { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ledger */
.ledger { border-top: 2px solid var(--ink); }
.ledger-head, .row-btn { display: grid; grid-template-columns: minmax(0, 1fr) 150px 96px 96px 80px; gap: 16px; align-items: center; }
.ledger-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); font-weight: 600; padding: 10px 4px; border-bottom: 1px solid var(--rule); }
.ledger-head .r, .row-btn .r { text-align: right; }
.row { border-bottom: 1px solid var(--rule); }
.row-btn { width: 100%; box-sizing: border-box; background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 14px 4px; cursor: pointer; text-decoration: none; }
.row-btn:hover { background: var(--accent-soft); }
.row-name { display: grid; gap: 2px; min-width: 0; }
.row-name b { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.row-name b::after { content: "\203A"; color: var(--accent); font-weight: 700; }
.row-name small { color: var(--ink-2); font-size: 0.82rem; }
.share { display: grid; gap: 4px; }
.share-track { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.share-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.share small { font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chg.up { color: var(--bad); }
.chg.down { color: var(--good); }
.chg { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.detail-scroll { overflow-x: auto; }
.offsets { display: grid; gap: 4px; }
.budget-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 96px 96px 80px; gap: 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--rule); }
.budget-row .r { text-align: right; }
.budget-row.total { font-weight: 600; border-bottom: 0; }
.budget-row .m-label { display: none; }
.dev { display: block; position: relative; height: 8px; background: var(--rule); border-radius: 4px; }
.dev::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-2); }
.dev span { display: block; position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.dev .over { left: 50%; background: var(--bad); }
.dev .under { right: 50%; background: var(--good); }
.status-note { font-size: 0.9rem; color: var(--ink); background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 4px; max-width: none; }

/* charts */
.chart { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 16px 8px; overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart text { font-family: var(--font-body); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.88rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.caption { font-size: 0.82rem; color: var(--ink-2); }

/* notes */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.notes div { display: grid; gap: 6px; align-content: start; }
.notes h3 { font-size: 1.05rem; font-weight: 600; }
.notes p { font-size: 0.92rem; color: var(--ink-2); }
a { color: var(--accent); }
footer { border-top: 1px solid var(--rule); padding-top: 20px; font-size: 0.85rem; color: var(--ink-2); display: grid; gap: 6px; }

@media (max-width: 680px) {
  .site-nav .brand { flex-basis: 100%; }
  .ledger-head { display: none; }
  .row-btn { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name amt" "share share" "pc chg"; gap: 6px 12px; }
  .row-btn .c-name { grid-area: name; } .row-btn .c-amt { grid-area: amt; }
  .row-btn .c-share { grid-area: share; } .row-btn .c-pc { grid-area: pc; text-align: left; } .row-btn .c-chg { grid-area: chg; }
  .row-btn .c-pc::after { content: " per innb."; color: var(--ink-2); font-size: 0.82rem; }
  .budget-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name amt" "share share" "y1 chg"; gap: 6px 12px; }
  .budget-row .c-name { grid-area: name; } .budget-row .c-amt { grid-area: amt; }
  .budget-row .c-share { grid-area: share; } .budget-row .c-y1 { grid-area: y1; text-align: left; color: var(--ink-2); font-size: 0.88rem; } .budget-row .c-chg { grid-area: chg; }
  .budget-row .m-label { display: inline; }
  .note-bar a span { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .share-fill, .note-bar a { transition: width 0.35s ease, flex-basis 0.35s ease; }
}

/* omrade.html: area › service › cost type */
.drill { display: grid; gap: 40px; }
.drill > * { min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: baseline; font-size: 0.9rem; color: var(--ink-2); padding-top: 20px; }
.crumbs a { font-weight: 600; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.drill-head { display: grid; gap: 14px; }
.drill-head h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.08; }
.years .chip { font: 600 0.95rem var(--font-body); font-variant-numeric: tabular-nums; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); padding: 6px 14px; border-radius: 999px; text-decoration: none; }
.years .chip[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.measures { margin: 4px 0 14px; }
.measures .chip { font-size: 0.85rem; padding: 6px 12px; }
.drill-sec { display: grid; gap: 14px; }
.drill-sec .lead { font-size: 0.98rem; }
.flow-bar { display: flex; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--rule); background: var(--surface); }
.flow-bar.parts { height: 44px; }
.flow-seg { display: flex; align-items: center; padding: 0 12px; min-width: 0; white-space: nowrap; overflow: hidden; color: var(--paper); font-weight: 700; font-size: 0.92rem; border-right: 2px solid var(--surface); flex-grow: 0; flex-shrink: 0; }
.flow-seg.own { background: var(--accent); }
.flow-seg.inc { background: color-mix(in srgb, var(--good) var(--mix, 100%), var(--surface)); }
.flow-seg.cost { background: color-mix(in srgb, var(--accent) var(--mix, 100%), var(--surface)); }
.flow-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.85rem; color: var(--ink-2); }
.flow-legend li { display: flex; align-items: center; gap: 6px; }
.flow-legend i { width: 10px; height: 10px; border-radius: 2px; padding: 0; border: 0; }
.rank { border-top: 1px solid var(--rule); }
.rank-row { display: grid; grid-template-columns: minmax(0, 250px) minmax(60px, 1fr) 80px 64px 16px; gap: 14px; align-items: center; padding: 10px 4px; min-height: 44px; box-sizing: border-box; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; }
a.rank-row:hover { background: var(--accent-soft); }
.rank-name { display: grid; gap: 1px; font-weight: 600; }
.rank-name small { font-weight: 400; font-size: 0.8rem; color: var(--ink-2); }
.rank-track { height: 14px; }
.rank-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; min-width: 2px; }
.rank.income .rank-fill { background: var(--good); }
.rank-amt { text-align: right; font-weight: 600; }
.rank-note { text-align: right; font-size: 0.88rem; color: var(--ink-2); }
.rank-go { color: var(--accent); font-weight: 700; }
.rank.income .rank-go { color: var(--good); }
.bars5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: end; border-bottom: 1px solid var(--ink); padding: 0 6px; }
.bar5 { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); font-size: 0.82rem; }
.bar5 i { display: block; width: 56%; background: var(--muted); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar5 b { font-weight: 400; margin-bottom: -26px; }
.bar5.sel { color: var(--ink); font-weight: 700; }
.bar5.sel i { background: var(--accent); }
.bar5.sel b { font-weight: 700; }
.bars5 + .caption { margin-top: 22px; }
.num-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; background: var(--surface); }
.num-table th, .num-table td { padding: 8px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.num-table th:first-child, .num-table td:first-child { text-align: left; white-space: normal; min-width: 160px; }
.num-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-2); font-weight: 600; }
.num-table .code { text-align: left; color: var(--ink-2); font-size: 0.78rem; }
.num-table .sel { background: var(--accent-soft); }
.num-table .sum td { font-weight: 700; border-top: 1px solid var(--ink-2); }
.num-table .derived td:first-child, .num-table .derived .code { font-style: italic; }
.all-numbers summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.source-box { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 22px; display: grid; gap: 10px; }
.source-box p { font-size: 0.95rem; max-width: none; }
.source-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.seg a { font-weight: 600; font-size: 0.85rem; background: var(--surface); color: var(--ink-2); padding: 0 14px; min-height: 42px; display: inline-flex; align-items: center; text-decoration: none; }
.seg a[aria-current] { background: var(--ink); color: var(--paper); }
.ssb-end { border: 1px dashed var(--muted); border-radius: 10px; padding: 16px 20px; display: grid; gap: 6px; }
.ssb-end p { font-size: 0.92rem; color: var(--ink-2); }
.source { border-top: 1px solid var(--rule); padding-top: 14px; max-width: none; }
.ledger { min-width: 0; }
@media (max-width: 680px) {
  .rank-row { grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: "name amt go" "track note go"; gap: 6px 12px; }
  .rank-name { grid-area: name; } .rank-amt { grid-area: amt; } .rank-track { grid-area: track; height: 8px; } .rank-note { grid-area: note; } .rank-go { grid-area: go; }
  .bars5 { gap: 6px; }
  .flow-seg { font-size: 0.8rem; padding: 0 8px; }
}

/* lopende.html: the year so far */
.used { display: grid; gap: 4px; }
.used-track { position: relative; height: 8px; background: var(--rule); border-radius: 4px; }
.used-fill { display: block; height: 100%; border-radius: 4px; }
.used-fill.over { background: var(--bad); }
.used-fill.under { background: var(--good); }
.used-track i { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); }
.used small { font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.reg-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; max-width: 65ch; }
.chart { position: relative; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; font-size: 0.85rem; display: grid; gap: 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); font-variant-numeric: tabular-nums; }
.legend span { display: inline-flex; align-items: center; }
#summary { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 680px) { .budget-row .c-amt .m-label, .budget-row .c-chg .m-label { color: var(--ink-2); font-size: 0.82rem; font-weight: 400; } }

/* index.html: Narvik against one comparison region, area by area */
.cmp-pick { flex-wrap: wrap; border-radius: 12px; justify-self: start; }
.cmp-pick button { font: 600 0.85rem var(--font-body); background: var(--surface); color: var(--ink-2); padding: 0 14px; min-height: 42px; border: 0; border-right: 1px solid var(--rule); cursor: pointer; }
.cmp-pick button:last-child { border-right: 0; }
.cmp-pick button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.cmp-list { border-top: 2px solid var(--ink); }
.cmp-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px 150px 72px; gap: 16px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; }
.cmp-row .r { text-align: right; }
a.cmp-row:hover { background: var(--accent-soft); }
a.cmp-row .c-name { font-weight: 600; }
a.cmp-row .c-name::after { content: " \203A"; color: var(--accent); font-weight: 700; }
.cmp-row .c-n { font-weight: 600; }
.cmp-row .c-r { color: var(--ink-2); }
.cmp-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); font-weight: 600; padding: 10px 4px; }
.cmp-row.total { font-weight: 700; border-bottom: 0; }
.dev .more { left: 50%; background: var(--accent); }
.dev .less { right: 50%; background: var(--muted); }
@media (max-width: 680px) {
  .cmp-head { display: none; }
  .cmp-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name d" "dev dev" "n r"; gap: 6px 12px; }
  .cmp-row .c-name { grid-area: name; } .cmp-row .c-d { grid-area: d; font-weight: 600; } .cmp-row .c-dev { grid-area: dev; }
  .cmp-row .c-n { grid-area: n; text-align: left; font-weight: 400; } .cmp-row .c-r { grid-area: r; }
  .cmp-row .c-n::before { content: "Narvik "; color: var(--ink-2); }
  .cmp-row .c-r::before { content: "mot "; }
  .cmp-row .c-d::after { content: " kr"; color: var(--ink-2); font-weight: 400; }
}
/* omrade.html: one area against the comparison regions */
.cmp-bars .rank-fill { background: var(--muted); }
.cmp-bars .me .rank-fill { background: var(--accent); }
.cmp-bars .me .rank-name, .cmp-bars .me .rank-amt { color: var(--accent); }
.cmp-bars .rank-row { grid-template-columns: minmax(0, 250px) minmax(60px, 1fr) 80px 116px 0; }
.cmp-bars .rank-note { white-space: nowrap; }
@media (max-width: 680px) { .cmp-bars .rank-row { grid-template-columns: minmax(0, 1fr) auto 0; } }
