:root {
  --ink: #17212B; --muted: #5B6570; --ground: #F4F3EF; --card: #FFFFFF; --line: #E4E1DA; --line2: #EFEDE7;
  --accent: #1D5C8C; --accent-soft: #E3EDF5; --warm: #F2A65A; --rust: #A84E0B; --rust-dark: #8F420A;
  --ok: #2F6B3A; --ok-soft: #E3F0E5; --warn-soft: #FBEBDD; --bad: #8E2F1D; --bad-soft: #F8E1DC;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: Inter, system-ui, -apple-system, sans-serif; line-height: 1.5; }
a { color: var(--accent); }
a:hover { color: #123E61; }
h1, h2, h3, .display { font-family: 'Space Grotesk', Inter, sans-serif; line-height: 1.1; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; left: -9999px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { color: #fff; background: #26323E; }
.btn-light { background: #fff; color: var(--ink); border-color: #D9D6CE; }
.btn-warm { background: var(--warm); color: var(--ink); }
.btn-rust { background: var(--rust); color: #fff; }
.btn-rust:hover { color: #fff; }
.btn-block { width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pill-new { background: var(--accent-soft); color: var(--accent); }
.pill-work { background: var(--warn-soft); color: var(--rust-dark); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-grey { background: #F1EFEA; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line2); }
.row:last-child { border-bottom: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; }
.input { min-height: 48px; border-radius: 12px; border: 1px solid #D9D6CE; background: #fff; padding: 10px 14px; font-size: 16px; width: 100%; }
textarea.input { min-height: 110px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #D9D6CE; background: #fff; cursor: pointer; font-size: 14px; }
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.notice { background: var(--accent-soft); border-radius: 14px; padding: 14px 16px; font-size: 14px; }
.notice-warn { background: var(--warn-soft); }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 12px 14px; font-size: 14px; }

/* Portal (mobil først) */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.app-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 12px; gap: 12px; }
.app-head h1 { margin: 0; font-size: 24px; }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; text-decoration: none; flex: none; }
.app-main { flex: 1; padding: 4px 20px 110px; display: flex; flex-direction: column; gap: 14px; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 6px calc(10px + env(safe-area-inset-bottom)); }
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav a { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.nav a::before { content: ''; width: 22px; height: 4px; border-radius: 2px; background: transparent; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.nav a[aria-current="page"]::before { background: var(--accent); }
.hero-card { background: var(--ink); color: #fff; border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hero-card .big { font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 600; }
.hero-card .soft { color: #C9D2DB; font-size: 14px; }
.tile { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
.tile strong { font-size: 15px; }
.listlink { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #F7F6F2; color: var(--ink); text-decoration: none; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.msg.me { align-items: flex-end; }
.bubble { max-width: 86%; padding: 11px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; white-space: pre-line; font-size: 14px; }
.msg.me .bubble { background: var(--accent); color: #fff; border-color: var(--accent); border-radius: 16px; border-bottom-right-radius: 4px; }
.msg.internal .bubble { background: #FFF8E6; border-style: dashed; }
.meta { font-size: 11px; color: var(--muted); padding: 0 4px; }
.files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.files a, .files img, .files video { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: #D7DEE5; display: flex; align-items: center; justify-content: center; font-size: 11px; text-decoration: none; color: var(--ink); }
.steps { display: flex; gap: 6px; }
.steps div { flex: 1; display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.steps i { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--accent); }
.plan-box { background: #fff; border: 1px solid var(--line); border-radius: 18px; height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: manipulation; }
.plan-box svg { width: 92%; height: 92%; }
.seg { display: flex; background: #E4E1DA; border-radius: 12px; padding: 4px; flex: 1; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); }

/* Login-skærm */
.login { min-height: 100vh; background: var(--ink); color: #fff; display: flex; justify-content: center; }
.login-inner { width: 100%; max-width: 440px; padding: 56px 28px 32px; display: flex; flex-direction: column; gap: 28px; }
.login .input { background: #222E3A; border-color: #3A4754; color: #fff; }
.login label { color: #C9D2DB; }
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 19px; letter-spacing: .5px; text-decoration: none; color: inherit; }
.brand b { width: 36px; height: 36px; border-radius: 9px; background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.brand span { color: #B9C4CF; font-weight: 500; }

/* Admin */
.admin { max-width: 1400px; margin: 0 auto; padding: 20px 24px 40px; }
.admin-head { background: var(--ink); color: #fff; }
.admin-head .inner { max-width: 1400px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.admin-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.admin-cols > .list { flex: 1 1 320px; max-width: 400px; display: flex; flex-direction: column; gap: 10px; }
.admin-cols > .main { flex: 999 1 520px; min-width: 0; }
.case { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--ink); text-decoration: none; }
.case.active { border: 2px solid var(--accent); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line2); }
.scroll-x { overflow-x: auto; }

/* Forside */
.site-head { background: var(--ink); color: #fff; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; }
.site-nav nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.site-nav nav a { color: #DDE4EA; text-decoration: none; padding: 12px; font-size: 15px; }
.site-nav nav a.btn { color: var(--ink); padding: 0 18px; margin-left: 8px; }
.hero { background: var(--ink); color: #fff; }
.hero .wrap { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; padding-top: 48px; padding-bottom: 80px; }
.hero .col { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.kicker { font-size: 14px; font-weight: 600; letter-spacing: 1.5px; color: var(--rust); }
.hero .kicker { color: var(--warm); }
.hero h1 { margin: 0; font-size: clamp(40px, 6vw, 58px); font-weight: 600; }
.hero p { margin: 0; font-size: 19px; color: #C9D2DB; max-width: 520px; }
.hero-art { aspect-ratio: 4 / 3; border-radius: 20px; background: #2A3846; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.facts { margin-top: -36px; }
.facts .card { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.facts .card div { padding: 24px 28px; display: flex; flex-direction: column; gap: 4px; }
.facts .num { font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 600; }
.section { padding: 72px 0 24px; }
.section h2 { margin: 10px 0 28px; font-size: clamp(30px, 4vw, 40px); }
.split { display: flex; flex-wrap: wrap; gap: 48px; }
.split > :first-child { flex: 1 1 320px; }
.split > :last-child { flex: 2 1 480px; font-size: 17px; line-height: 1.65; }
.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.timeline div { border-top: 3px solid var(--ink); padding-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.timeline .yr { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 600; }
.stories { display: flex; flex-wrap: wrap; gap: 20px; }
.story { flex: 1 1 460px; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.story .ph { height: 240px; background: #D7DEE5; display: flex; align-items: center; justify-content: center; color: #34414E; font-weight: 600; font-size: 14px; }
.story .body { padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.portal-band { background: var(--ink); color: #fff; border-radius: 24px; padding: 44px; display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.site-foot { background: var(--ink); color: #DDE4EA; margin-top: 72px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; padding-top: 48px; padding-bottom: 48px; }
.site-foot a { color: #DDE4EA; }
@media (max-width: 640px) {
  .portal-band { padding: 28px; }
  .facts .card div { padding: 18px 20px; }
}

/* Admin-dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-num { font-family: 'Space Grotesk', sans-serif; font-size: 34px; font-weight: 600; line-height: 1.1; }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.dash-wide { grid-column: 1 / -1; }
@media (min-width: 1100px) { .dash-wide { grid-column: span 2; } }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar:hover path { opacity: .85; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.rank { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-size: 14px; padding: 4px 6px; border-radius: 8px; }
.rank-row:hover { background: #F7F6F2; }
.rank-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { display: block; height: 10px; border-radius: 5px; background: var(--track, #EFEDE7); overflow: hidden; }
.rank-fill { display: block; height: 100%; border-radius: 5px; }
.rank-value { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.meter { display: flex; flex-direction: column; gap: 6px; }

/* 3D-bygninger i lejeroversigten */
.bld-card { padding: 14px 16px; overflow-x: auto; }
.bld-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.bld-card svg { display: block; height: auto; }
.bld-unit { cursor: pointer; outline: none; transition: opacity .15s; }
.bld-unit:hover polygon, .bld-unit:focus polygon { stroke: #17212B; stroke-width: 2; }
.bld-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.bld-key { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.bld-key i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.bld-key b { font-weight: 600; color: var(--muted); }
.bld-key.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.bld-tip { position: fixed; z-index: 50; background: #17212B; color: #fff; font-size: 13px; padding: 10px 12px; border-radius: 10px; max-width: 280px; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.2); line-height: 1.45; }
[data-bld-mode][aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.bld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }

/* Forbrugsregnskab */
.cons summary { display: flex; justify-content: space-between; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; padding: 8px 0; border-top: 1px solid var(--line2); }
.cons summary::-webkit-details-marker { display: none; }
.cons-row { display: flex; flex-direction: column; gap: 4px; }
.cons-bar { height: 8px; background: #F1EFEA; border-radius: 4px; overflow: hidden; }
.cons-bar i { display: block; height: 100%; border-radius: 4px; }
.cons-up { color: var(--rust-dark); font-weight: 600; }
.cons-down { color: var(--ok); font-weight: 600; }

/* Rykkerforløb */
.flowsteps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.flowsteps li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; background: #fff; }
.flowsteps li span { color: var(--muted); font-size: 12px; }
.flowsteps li.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.flowsteps li.next { border: 2px solid var(--bad); background: var(--bad-soft); color: var(--bad); }
.flowsteps li.next span { color: var(--bad); }

/* Lejere og dokumenter i admin */
.person { display: flex; gap: 12px; align-items: flex-start; }
.avatar-sm { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.ico-line { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); text-decoration: none; min-width: 0; }
.ico-line span { overflow-wrap: anywhere; }
.ico-line svg { flex: none; color: var(--muted); }
a.ico-line:hover span { text-decoration: underline; }
.doc-line { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-size: 14px; padding: 6px; margin: 0 -6px; border-radius: 10px; }
.doc-line:hover { background: #F6F4EF; }
.doc-ico { width: 34px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #F1EFEA; color: var(--muted); flex: none; }
.doc-ico.c { background: #F4E4E0; color: #8E2F1D; }
.doc-ico.t { background: var(--accent-soft); color: var(--accent); }
.doc-ico.u { background: var(--ok-soft); color: var(--ok); }
