/* Chello's Vagtplan – designsystem.
   Farver: neutrale grå med et strejf af grøn, Chello's grøn som accent, faste statusfarver.
   Typografi: Inter, skala 12 / 13 / 14 / 16 / 20 / 24. Spacing: 4-px grid (4, 8, 12, 16, 24, 32). */
:root {
  --brand: #00561c; --brand-2: #0a6b2a; --brand-soft: #e6f2ea; --brand-line: #b9dbc4; --on-brand: #fff;
  --bg: #f4f6f4; --surface: #ffffff; --surface-2: #f8faf8; --surface-3: #eef2ef; --line: #e1e7e2; --line-2: #cfd8d1;
  --fg: #111a14; --fg-2: #354139; --muted: #66746a; --faint: #8e9a91;
  --ok: #157a3c; --ok-soft: #e4f4ea;
  --warn: #a35a00; --warn-soft: #fff1dc;
  --bad: #b42318; --bad-soft: #fdecea;
  --info: #1d4ed8; --info-soft: #e8eefd;
  --kladde: #b7791f; --kladde-soft: #fff6e0;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --shadow-1: 0 1px 2px rgba(17,26,20,.06);
  --shadow-2: 0 2px 6px rgba(17,26,20,.06), 0 8px 24px rgba(17,26,20,.08);
  --shadow-3: 0 12px 40px rgba(17,26,20,.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="lys"]) {
    --brand: #43b86a; --brand-2: #5fcb84; --brand-soft: #16301f; --brand-line: #24502f; --on-brand: #06200f;
    --bg: #0d130f; --surface: #141c17; --surface-2: #19231c; --surface-3: #1f2b23; --line: #26332a; --line-2: #33443a;
    --fg: #e8efe9; --fg-2: #c3cec6; --muted: #93a398; --faint: #6f7f74;
    --ok: #4ade80; --ok-soft: #13301d; --warn: #f2a94e; --warn-soft: #36270f; --bad: #f47b6e; --bad-soft: #3a1815;
    --info: #86a8ff; --info-soft: #18223c; --kladde: #e9b44c; --kladde-soft: #33280f;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 2px 8px rgba(0,0,0,.4); --shadow-3: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-mode="mork"] {
    --brand: #43b86a; --brand-2: #5fcb84; --brand-soft: #16301f; --brand-line: #24502f; --on-brand: #06200f;
    --bg: #0d130f; --surface: #141c17; --surface-2: #19231c; --surface-3: #1f2b23; --line: #26332a; --line-2: #33443a;
    --fg: #e8efe9; --fg-2: #c3cec6; --muted: #93a398; --faint: #6f7f74;
    --ok: #4ade80; --ok-soft: #13301d; --warn: #f2a94e; --warn-soft: #36270f; --bad: #f47b6e; --bad-soft: #3a1815;
    --info: #86a8ff; --info-soft: #18223c; --kladde: #e9b44c; --kladde-soft: #33280f;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 2px 8px rgba(0,0,0,.4); --shadow-3: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
h1, h2, h3 { text-wrap: balance; margin: 0; letter-spacing: -.01em; }
kbd { font: 600 11px/1 var(--font); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: var(--surface); color: var(--fg-2); }

/* ---------- Knapper ---------- */
.btn { text-decoration: none; border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); border-radius: var(--r); padding: 7px 12px; font-size: 13.5px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; justify-content: center; white-space: nowrap; min-height: 36px; box-shadow: var(--shadow-1); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { border-color: transparent; background: none; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 30px; padding: 4px 9px; font-size: 12.5px; }
.btn.lg { min-height: 48px; padding: 10px 18px; font-size: 16px; border-radius: 10px; }
.btn.ikon { width: 36px; padding: 0; }
.btn.sm.ikon { width: 30px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:disabled { opacity: .45; cursor: default; }
.count { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; line-height: 16px; min-width: 18px; text-align: center; padding: 0 6px; font-weight: 600; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }

/* ---------- Statusmærker ---------- */
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; line-height: 18px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.kladde { background: var(--kladde-soft); color: var(--kladde); }
.pill.grey { background: var(--surface-3); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.dot.puls { animation: puls 1.6s ease-in-out infinite; }
@keyframes puls { 50% { opacity: .3; } }

/* ---------- Formularer ---------- */
.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.hjaelp { font-size: 12px; color: var(--muted); }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .field select, .field textarea, .input {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px 10px; width: 100%; min-height: 38px; transition: border-color .12s, box-shadow .12s; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.field textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--brand); width: 17px; height: 17px; flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.kontakt { position: relative; width: 36px; height: 20px; flex: none; }
.kontakt input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; }
.kontakt i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .15s; pointer-events: none; }
.kontakt i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .15s; }
.kontakt input:checked + i { background: var(--brand); }
.kontakt input:checked + i::after { transform: translateX(16px); }
.kontakt input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; cursor: pointer; background: var(--surface); font-size: 13px; line-height: 1.2; }
.chips input { accent-color: var(--brand); width: 15px; height: 15px; margin: 0; flex: none; }
.chips label:has(input:checked) { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); font-weight: 600; }

/* ---------- Flader ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 12px; }
.list { display: grid; gap: 8px; }
.litem { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 6px; background: var(--surface); }
.litem .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.litem .top > span:first-child { flex: 1; min-width: 0; }
.litem .top .actions { flex-wrap: nowrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.issue { border-radius: var(--r); padding: 8px 10px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.issue.advarsel { background: var(--warn-soft); color: var(--warn); }
.issue.fejl { background: var(--bad-soft); color: var(--bad); }
.issue.ok { background: var(--ok-soft); color: var(--ok); }
.issue.info { background: var(--info-soft); color: var(--info); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty b { color: var(--fg); font-size: 15px; }
.empty svg { width: 36px; height: 36px; color: var(--faint); }
.fejlboks { padding: 32px 16px; text-align: center; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.fejlboks b { color: var(--bad); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .02em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.klik { cursor: pointer; }
.tbl tr.klik:hover td { background: var(--surface-2); }
.tbl .sub { font-size: 12px; color: var(--muted); }
.scrollx { overflow-x: auto; }

/* ---------- Skelet (indlæsning) ---------- */
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; border-radius: 6px; min-height: 14px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-raekke { display: grid; gap: 10px; padding: 16px; }

/* ---------- Skuffe, dialog, toast, hover-kort ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,18,13,.38); z-index: 50; display: flex; justify-content: flex-end; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer { background: var(--surface); width: min(480px, 100%); height: 100%; overflow: auto; padding: 0; display: flex; flex-direction: column; box-shadow: var(--shadow-3); animation: ind .18s ease; }
@keyframes ind { from { transform: translateX(24px); opacity: .6; } }
.drawer > .hoved { padding: 18px 20px 12px; padding-top: calc(18px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.drawer > .indhold { padding: 16px 20px; display: grid; gap: 14px; align-content: start; flex: 1; }
.drawer h2 { font-size: 18px; }
.drawer .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.drawer .foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.drawer .foot .hoejre { margin-left: auto; display: flex; gap: 8px; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 14px; padding: 20px; width: min(440px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow-3); max-height: 90vh; overflow: auto; animation: pop .15s ease; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.dialog h2 { font-size: 17px; }
.code { font-size: 32px; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 12px; background: var(--surface-2); border-radius: 10px; user-select: all; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 10px; z-index: 90; font-weight: 500; max-width: calc(100% - 32px); box-shadow: var(--shadow-3); display: flex; gap: 12px; align-items: center; animation: op .2s ease; }
@keyframes op { from { transform: translate(-50%, 10px); opacity: 0; } }
.toast.fejl { background: var(--bad); color: #fff; }
.toast button { border: 0; background: rgba(255,255,255,.16); color: inherit; font-weight: 600; border-radius: 6px; padding: 4px 10px; }
.hoverkort { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 12px 14px; width: 280px; font-size: 13px; display: grid; gap: 6px; pointer-events: none; }
.hoverkort .r { display: flex; justify-content: space-between; gap: 8px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Mærker for områder og roller (farve fra data) */
.maerke { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 18px; border-radius: 999px; padding: 1px 8px 1px 7px; white-space: nowrap;
  color: color-mix(in srgb, var(--mf) 75%, var(--fg)); background: color-mix(in srgb, var(--mf) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--mf) 28%, transparent); margin: 1px 3px 1px 0; }
.maerke::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mf); flex: none; }
