/* ===== Belegg · designsystem ===================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/vendor/inter/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/vendor/inter/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/vendor/inter/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/vendor/inter/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #F4F3EE; --surface: #FFFFFF; --surface-2: #F8F7F3; --surface-3: #EFEEE8;
  --line: #E4E2DA; --line-strong: #CBC8BE;
  --ink: #1A2420; --ink-2: #4B554F; --ink-3: #78827C; --ink-4: #A3ABA6;
  --brand: #0F3D2A; --brand-2: #16553A;
  --ours: #1D8A4F; --ours-ink: #136637; --ours-soft: #E1F2E7; --ours-mid: #8FCBA7;
  --comp: #8C918C; --comp-ink: #5A615C; --comp-soft: #ECEEEB;
  --amber: #A66A12; --amber-soft: #FBF0DA; --red: #B23F37; --red-soft: #F9E4E1; --blue: #2F6FB3; --blue-soft: #E3ECF7;
  --focus: #2F6FB3;
  --r-card: 14px; --r-ctl: 9px;
  --shadow: 0 1px 2px rgba(26,36,32,.05), 0 10px 30px -22px rgba(26,36,32,.35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tabbar-h: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; font-feature-settings: "cv11", "ss01"; }
a { color: var(--ours-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
h2 { font-size: 1.0625rem; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
h3 { font-size: 0.9375rem; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 0.8125rem; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ===== topp ===================================================================== */
.topbar { display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 60px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fff 0 5px, var(--ours) 6px); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-title { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.6875rem; opacity: .72; margin-top: 3px; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { color: rgba(255,255,255,.78); padding: 9px 13px; border-radius: 9px; font-weight: 500; font-size: 0.9375rem; transition: background .15s ease, color .15s ease; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.userbox { font-size: 0.8125rem; opacity: .9; white-space: nowrap; display: flex; align-items: center; gap: 12px; }
.userbox a { color: #fff; opacity: .85; }
.tabbar { display: none; }

/* ===== kontroller ================================================================= */
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 10px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 60px; z-index: 20; min-height: 56px; }
.controls:empty { display: none; }
.ctl { display: flex; align-items: center; gap: 8px; }
.ctl-label { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
input[type="date"], select { font-size: 0.875rem; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: #fff; color: var(--ink); min-height: 36px; }
.btn { font-size: 0.875rem; font-weight: 500; padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: #fff; color: var(--ink); cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; transition: border-color .15s ease, background .15s ease; }
.btn:hover { border-color: var(--ours); background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--ours); color: #fff; border-color: var(--ours); }
.btn.primary:hover { background: var(--ours-ink); }
.btn.icon { padding: 7px 10px; }
.btn.ghost { border-color: transparent; background: transparent; }
.chips { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-3); border-radius: 10px; }
.chips button { font-size: 0.875rem; font-weight: 500; padding: 5px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; min-height: 30px; transition: background .15s ease, color .15s ease; }
.chips button:hover { color: var(--ink); }
.chips button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(26,36,32,.12); }
.spacer { flex: 1; }
.datepicker { display: inline-flex; align-items: center; gap: 4px; }
.datepicker input { width: 150px; }

/* ===== innhold ==================================================================== */
.view { max-width: 1240px; margin: 0 auto; padding: 22px 24px 48px; }
.page-head { margin-bottom: 18px; }
.page-head .line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 6px; color: var(--ink-3); font-size: 0.875rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--ours-soft); color: var(--ours-ink); white-space: nowrap; }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: var(--surface-3); color: var(--ink-2); }
.badge.comp { background: var(--comp-soft); color: var(--comp-ink); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.grid { display: grid; gap: 16px; }
.grid.kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.stack > * + * { margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-head .sub { font-size: 0.8125rem; color: var(--ink-3); margin-top: 2px; }
.card-body { padding: 14px 18px 18px; }
.card-body.flush { padding: 8px 0 6px; }
.card-foot { padding: 0 18px 14px; font-size: 0.8125rem; color: var(--ink-3); }

/* nøkkeltall */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 18px 14px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tile.ours { background: linear-gradient(180deg, #F3FAF5 0%, #FFFFFF 70%); border-color: var(--ours-mid); }
.tile .label { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.tile .value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-top: 2px; }
.tile.ours .value { color: var(--ours-ink); }
.tile .sub { font-size: 0.8125rem; color: var(--ink-3); }
.delta { font-size: 0.8125rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--ours-ink); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--ink-3); font-weight: 500; }

/* innsikt */
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9375rem; line-height: 1.45; }
.insights li > span { flex: 1; min-width: 0; }
.insights li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ours); margin-top: 8px; flex: none; }
.insights li.warn::before { background: var(--amber); }
.insights li.bad::before { background: var(--red); }
.insights li.neutral::before { background: var(--comp); }
.insights b { font-weight: 600; }

/* rangering */
.rank { list-style: none; margin: 0; padding: 0 6px; }
.rank li { display: grid; grid-template-columns: 26px minmax(0, 2.4fr) minmax(90px, 1.6fr) 64px 78px; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; font-size: 0.9375rem; }
.rank li.link:hover { background: var(--surface-2); }
.rank li.ours { background: var(--ours-soft); }
.rank li.ours.link:hover { background: #D5EBDC; }
.rank .pos { color: var(--ink-3); font-weight: 600; font-size: 0.8125rem; text-align: right; }
.rank .name { min-width: 0; display: flex; flex-direction: column; }
.rank .name a { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .name .meta { font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank .extra { text-align: right; font-size: 0.8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rank .nodata { grid-column: 3 / -1; color: var(--ink-4); font-size: 0.8125rem; }
.bar { position: relative; height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--comp); border-radius: 5px; }
.bar.ours > i { background: var(--ours); }
.bar > s { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); opacity: .6; }

/* tabeller */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tbl th { text-align: left; font-weight: 600; font-size: 0.75rem; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: .02em; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.ours td { background: var(--ours-soft); }
.tbl tr.total td { font-weight: 600; background: var(--surface-2); }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.link:hover td { background: var(--surface-2); cursor: pointer; }
.tbl tr.ours.link:hover td { background: #D5EBDC; }
.tbl td.name { white-space: nowrap; font-weight: 500; }
.tbl td.name a { color: var(--ink); }
.tbl .pct { font-weight: 600; }
.tbl .sub { display: block; font-size: 0.75rem; color: var(--ink-3); font-weight: 400; }

/* heat */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; gap: 3px; font-size: 0.75rem; align-items: center; min-width: 620px; }
.heat .hl { position: sticky; left: 0; background: var(--surface); padding-right: 10px; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.heat .hl a { color: var(--ink); }
.heat .hl.ours { font-weight: 600; color: var(--ours-ink); }
.heat .hl.ours a { color: var(--ours-ink); }
.heat .hl.total { font-weight: 600; }
.heat .hh { text-align: center; color: var(--ink-3); font-size: 0.6875rem; font-variant-numeric: tabular-nums; }
.heat .hc { height: 28px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; font-weight: 500; }
.heat .hc.none { background: repeating-linear-gradient(45deg, #F3F4F0 0 4px, #E9EBE6 4px 8px); color: transparent; }
.heat .hc.total { box-shadow: inset 0 0 0 1px var(--line-strong); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--ink-2); margin-top: 12px; align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.scale { display: inline-block; width: 110px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #EEF3EF, #1D8A4F); vertical-align: middle; margin: 0 6px; }

/* nå */
.live { display: grid; gap: 2px; font-size: 0.75rem; min-width: 820px; align-items: center; }
.live .lh { font-size: 0.6875rem; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.live .lh.now { color: var(--ours-ink); font-weight: 700; }
.live .ll { position: sticky; left: 0; background: var(--surface); font-size: 0.8125rem; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.live .lv { font-weight: 600; padding: 12px 0 4px; grid-column: 1 / -1; border-top: 1px solid var(--line); position: sticky; left: 0; }
.live .lv.ours { color: var(--ours-ink); }
.live .lc { height: 22px; border-radius: 4px; background: var(--surface-3); }
.live .lc.available { background: #D9EEDF; }
.live .lc.booked { background: var(--ours); }
.live .lc.event { background: var(--blue); }
.live .lc.blocked { background: repeating-linear-gradient(45deg, #DAD9D3 0 4px, #C9C8C1 4px 8px); }
.live .lc.other { background: var(--amber-soft); }
.live .lc.none { background: transparent; }
.live .lc.nowcol { outline: 2px solid var(--ours-ink); outline-offset: -2px; }

/* diagram */
.chart { position: relative; height: 260px; }
.chart.tall { height: 300px; }
.chart.short { height: 190px; }
.spark { display: inline-block; vertical-align: middle; }

/* tilstander */
.notes { margin: 0 0 16px; padding: 12px 16px; background: var(--amber-soft); border-radius: 12px; color: #6B4607; font-size: 0.875rem; display: grid; gap: 4px; }
.error { padding: 14px 16px; background: var(--red-soft); color: var(--red); border-radius: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.empty { padding: 40px 24px; text-align: center; color: var(--ink-2); }
.empty h2 { margin-bottom: 6px; }
.empty p { max-width: 46ch; margin: 0 auto; }
.skeleton-page { display: grid; gap: 16px; }
.sk { background: linear-gradient(90deg, #ECEBE5 25%, #F4F3EE 50%, #ECEBE5 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 12px; }
.sk-title { height: 30px; width: 46%; }
.sk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.sk-tile { height: 112px; }
.sk-block { height: 320px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; color: var(--ours-ink); font-weight: 500; font-size: 0.875rem; padding: 4px 0; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; font-size: 0.75rem; transition: transform .15s ease; }
details.fold[open] > summary::before { transform: rotate(90deg); }
.foot { max-width: 1240px; margin: 0 auto; padding: 0 24px 40px; color: var(--ink-3); font-size: 0.8125rem; line-height: 1.6; }
.defs dt { font-weight: 600; margin-top: 10px; }
.defs dd { margin: 2px 0 0; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.875rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* innlogging */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--brand); margin: 0; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 30px 32px; width: min(400px, 100%); box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); }
.login-card .brand { color: var(--ink); margin-bottom: 20px; }
.login-card .brand-sub { color: var(--ink-3); opacity: 1; }
.login-card label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--ink-2); margin: 14px 0 6px; }
.login-card input { width: 100%; font-size: 1rem; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px; }
.login-card button { width: 100%; margin-top: 20px; font-size: 1rem; font-weight: 600; padding: 12px; border: 0; border-radius: 10px; background: var(--ours); color: #fff; cursor: pointer; }
.login-card button:hover { background: var(--ours-ink); }
.login-card .error { margin: 14px 0 0; }

/* ===== mobil ===================================================================== */
@media (max-width: 960px) {
  .grid.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .grid.main { grid-template-columns: 1fr; }
  .nav { display: none; }
  .userbox .name { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 14px; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar { height: 54px; padding: 0 14px; gap: 10px; }
  .brand-sub { display: none; }
  .controls { top: 54px; padding: 8px 14px; gap: 8px 12px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .controls::-webkit-scrollbar { display: none; }
  .ctl { flex: none; }
  .ctl-label { display: none; }
  .datepicker input { width: 136px; }
  .view { padding: 14px 14px 32px; }
  h1 { font-size: 1.25rem; }
  .tile { padding: 13px 14px 12px; }
  .tile .value { font-size: 1.625rem; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 12px 14px 14px; }
  .rank li { grid-template-columns: 22px minmax(0, 1fr) 64px; grid-template-areas: "pos name pct" ". bar bar" ". extra extra"; gap: 4px 8px; padding: 10px 8px; }
  .rank .pos { grid-area: pos; }
  .rank .name { grid-area: name; }
  .rank .bar { grid-area: bar; }
  .rank .pct { grid-area: pct; }
  .rank .extra { grid-area: extra; text-align: left; }
  .rank .nodata { grid-area: bar; }
  .chart { height: 220px; }
  .chart.tall { height: 250px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 30; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 0.6875rem; font-weight: 500; }
  .tabbar a svg { width: 22px; height: 22px; fill: currentColor; }
  .tabbar a.on { color: var(--ours-ink); }
  .tabbar a:hover { text-decoration: none; }
  .foot { padding: 0 14px 24px; }
  .sk-grid { grid-template-columns: repeat(2, 1fr); }
  .tbl th, .tbl td { padding: 9px 10px; }
  .userbox { font-size: 0.75rem; }
}
