:root {
  --bg: #f3f4f6;
  --flade: #ffffff;
  --flade-2: #f8f9fb;
  --tekst: #1b2230;
  --daempet: #5b6475;
  --svag: #8a92a3;
  --linje: #e1e4ea;
  --linje-2: #cfd4dd;
  /* Brdr. Jensens lyseblå (logoet) og en mørkere udgave, der kan bære hvid tekst */
  --brand: #70b3da;
  --accent: #23709f;
  --accent-moerk: #1a5881;
  --accent-lys: #e7f2f9;
  --ok: #1d7348;
  --ok-lys: #e4f3ea;
  --advarsel: #8f5300;
  --advarsel-lys: #fff3dc;
  --fejl: #b42318;
  --fejl-lys: #fdeceb;
  --radius: 8px;
  --skygge: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .05);
  --top-h: 56px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tekst);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; margin: 16px 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
.under { color: var(--daempet); margin: 4px 0 0; }
.under.lille { font-size: 12.5px; }

/* ---------- top ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 20px;
  background: var(--flade);
  border-bottom: 1px solid var(--linje);
}
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand-logo { display: block; height: 36px; width: auto; border-radius: 3px; }
.brand-tekst { font-size: 13px; font-weight: 600; color: var(--daempet); padding-left: 12px; border-left: 1px solid var(--linje); line-height: 28px; }
#faner { display: flex; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; }
#faner::-webkit-scrollbar { display: none; }
#faner button {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  height: 100%; padding: 0 14px;
  border: 0; background: none; cursor: pointer;
  color: var(--daempet); font-weight: 550; white-space: nowrap;
}
#faner button:hover { color: var(--tekst); }
#faner button.aktiv { color: var(--accent); }
#faner button.aktiv::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.tael:empty { display: none; }
.tael {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 650;
}

main { padding: 20px; max-width: 1680px; margin: 0 auto; }
.side-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.knapper { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- knapper ---------- */
.knap {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--linje-2); border-radius: 7px;
  background: var(--flade); color: var(--tekst);
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.knap:hover { background: var(--flade-2); border-color: #b9c0cc; }
.knap:focus-visible, .kort:focus-visible, .kop:focus-visible, .filter:focus-visible, #faner button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.knap.primaer { background: var(--accent); border-color: var(--accent); color: #fff; }
.knap.primaer:hover { background: var(--accent-moerk); border-color: var(--accent-moerk); }
.knap.farlig { background: var(--fejl); border-color: var(--fejl); color: #fff; }
.knap.ok { background: var(--ok-lys); border-color: #b9dfc8; color: var(--ok); }
.knap.ok:hover { background: #d3ecdd; }
.knap.stille { border-color: transparent; background: none; }
.knap.stille:hover { background: var(--flade-2); }
.knap.farlig-tekst { color: var(--fejl); }
.knap.lille { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.knap.fuld { width: 100%; }
.knap:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }

/* ---------- chips og mærker ---------- */
.chip {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 11px;
  background: #eef0f3; color: var(--daempet); font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.chip.ok { background: var(--ok-lys); color: var(--ok); }
.chip.blaa { background: var(--accent-lys); color: var(--accent); }
.chip.advarsel { background: var(--advarsel-lys); color: var(--advarsel); }
.maerke {
  font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: .2px;
  padding: 1px 6px; border-radius: 4px; background: var(--accent-lys); color: var(--accent);
  vertical-align: 1px;
}
.maerke.groen { background: var(--ok-lys); color: var(--ok); }

/* ---------- felter ---------- */
.felter { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.felt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.felt.bred { grid-column: 1 / -1; }
.felt-navn { font-size: 12.5px; font-weight: 600; color: var(--daempet); }
.hint { font-size: 12px; color: var(--svag); }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--linje-2); border-radius: 6px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 56px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35, 112, 159, .16); }
.med-knap { display: flex; gap: 6px; }
.med-knap input { flex: 1; min-width: 0; }
.med-knap .knap { flex: none; min-height: 36px; }
.cvr-status { grid-column: 1 / -1; font-size: 13px; padding: 7px 11px; border-radius: 6px; background: var(--flade-2); color: var(--daempet); }
.cvr-status:empty { display: none; }
.cvr-status.ok { background: var(--ok-lys); color: var(--ok); }
.cvr-status.advarsel { background: var(--advarsel-lys); color: var(--advarsel); }
.cvr-status.fejl { background: var(--fejl-lys); color: var(--fejl); }
.cvr-status a { margin-left: 4px; color: inherit; font-weight: 600; }

/* søgning i toppen */
.tael.roed { background: var(--fejl); }
.globalsoeg { position: relative; margin-left: auto; flex: 0 1 260px; min-width: 150px; display: flex; align-items: center; }
.globalsoeg svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--svag); pointer-events: none; }
.globalsoeg input { padding-left: 32px !important; padding-right: 54px !important; background: var(--flade-2) !important; min-height: 34px !important; }
.globalsoeg input:focus { background: #fff !important; }
.globalsoeg kbd {
  position: absolute; right: 8px; font: 600 10.5px/1 "Segoe UI", system-ui, sans-serif; color: var(--svag);
  border: 1px solid var(--linje-2); border-radius: 4px; padding: 3px 5px; background: #fff; pointer-events: none;
}
#soegresultater {
  position: absolute; right: 0; top: 42px; width: min(460px, calc(100vw - 24px)); z-index: 30;
  list-style: none; margin: 0; padding: 4px; max-height: 70vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--linje-2); border-radius: 8px; box-shadow: 0 12px 30px rgba(20, 30, 50, .18);
}
.soegresultat { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; }
.soegresultat:hover, .soegresultat:focus-visible { background: var(--accent-lys); outline: none; }
.soegresultat .chip { flex: none; min-width: 84px; justify-content: center; }
.sr-tekst { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sr-tekst span { font-size: 12.5px; color: var(--daempet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* overblik */
.chip.roed { background: var(--fejl-lys); color: var(--fejl); }
.chip.gul { background: var(--advarsel-lys); color: var(--advarsel); }
.fliser { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 6px 0 22px; }
.flise {
  display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px 18px; cursor: pointer;
  background: var(--flade); border: 1px solid var(--linje); border-left: 4px solid var(--brand); border-radius: var(--radius);
  box-shadow: var(--skygge); transition: border-color .12s, transform .12s;
}
button.flise:hover { border-color: var(--linje-2); border-left-color: var(--accent); transform: translateY(-1px); }
.flise.stille { cursor: default; }
.flise.roed { border-left-color: var(--fejl); }
.flise.gul { border-left-color: #e09a2d; }
.flise-titel { font-size: 12.5px; font-weight: 600; color: var(--daempet); text-transform: uppercase; letter-spacing: .4px; }
.flise strong { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.flise-under { font-size: 12.5px; color: var(--svag); }
.overblik-h2 { margin: 4px 0 10px; }
.opgaver { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 980px; }
.opgave {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--flade); border: 1px solid var(--linje); border-radius: var(--radius);
}
.opgave .prik { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--svag); }
.opgave.p1 .prik { background: var(--fejl); box-shadow: 0 0 0 4px var(--fejl-lys); }
.opgave.p2 .prik { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-lys); }
.opg-tekst { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.opg-tekst span { font-size: 13px; color: var(--daempet); }
.opgave .knap { flex: none; }
.alt-klaret { max-width: 980px; padding: 18px 20px; border-radius: var(--radius); background: var(--ok-lys); color: var(--ok); }

/* betalinger og moms */
.sum-lille { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--daempet); font-variant-numeric: tabular-nums; }
.gruppe { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; padding-left: 10px; border-left: 3px solid var(--linje-2); font-size: 13.5px; }
.gruppe span { color: var(--daempet); font-weight: 500; }
.gruppe.roed { border-left-color: var(--fejl); color: var(--fejl); }
.gruppe.gul { border-left-color: #e09a2d; color: var(--advarsel); }
.nowrap { white-space: nowrap; }
.kort-hoved { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tal-tabel { min-width: 560px; }
.tal-tabel td { padding: 8px 6px; border-top: 1px solid var(--linje); }
.tal-tabel td.h { font-variant-numeric: tabular-nums; white-space: nowrap; }
.moms .kort-flade { margin-bottom: 16px; }
.felt.periode { min-width: 210px; }
.visning-noter { max-width: 794px; margin: 0 auto 14px; }

/* afregningsbilag */
.koeb-ekstra { display: flex; justify-content: flex-end; margin: -6px 0 14px; }
.forhaand-flade.papir-ramme { margin: 0; border-radius: 0; padding: 14px; max-height: calc(100vh - var(--top-h) - 90px); overflow: auto; }
.raad-linje { margin: 10px 0 0; font-size: 12.5px; color: var(--advarsel); background: var(--advarsel-lys); padding: 7px 11px; border-radius: 6px; }
fieldset.underskrift { background: var(--flade-2); border: 1px solid var(--linje); border-radius: var(--radius); padding: 12px 14px; }
fieldset.underskrift legend { float: left; width: 100%; margin-bottom: 8px; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: var(--flade-2); color: var(--daempet); }
.knapper.byttebiler { margin: 10px 0 0; }
.a4-intro { margin: -14px 0 22px; color: #555; }
.afregning-pris { margin-top: 6px; }
.a4-underskrifter { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 46px; font-size: 12px; color: #444; }
.a4-streg { border-bottom: 1px solid #222; height: 44px; margin-bottom: 6px; }

/* bilsøgning */
.bilvaelger { position: relative; margin-bottom: 14px; }
.bilvaelger-soeg {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px;
  border: 1px solid var(--linje-2); border-radius: 8px; background: var(--accent-lys);
}
.bilvaelger-soeg:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35, 112, 159, .16); }
.bilvaelger-soeg svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.bilvaelger-soeg input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding-left: 0; }
.bilvaelger-info { font-size: 12px; color: var(--svag); margin-top: 5px; }
.bilvaelger-info.fejl { color: var(--fejl); }
.bilresultater {
  position: absolute; z-index: 15; left: 0; right: 0; top: 48px;
  list-style: none; margin: 0; padding: 4px; max-height: 430px; overflow-y: auto;
  background: #fff; border: 1px solid var(--linje-2); border-radius: 8px; box-shadow: 0 12px 30px rgba(20, 30, 50, .16);
}
.bilresultat {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 6px 8px;
  border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer;
}
.bilresultat:hover, .bilresultat:focus-visible { background: var(--accent-lys); outline: none; }
.bilresultat img, .br-tomt { width: 75px; height: 50px; border-radius: 4px; object-fit: cover; flex: none; background: #e9ebef; }
.br-tekst { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.br-tekst span { font-size: 12.5px; color: var(--daempet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-tekst .br-data { color: var(--svag); }
.br-pris { text-align: right; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; }
.br-pris small { font-weight: 500; font-size: 11px; color: var(--svag); }
.br-flere { padding: 8px 10px; font-size: 12.5px; color: var(--daempet); }
input:disabled, select:disabled { background: var(--flade-2); color: var(--daempet); }
input.tal, td.tal, .h { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
fieldset { border: 0; margin: 0 0 18px; padding: 0; }
legend { font-weight: 650; font-size: 14px; padding: 0; margin-bottom: 10px; }
.tjek { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }

.info {
  margin: 10px 0; padding: 9px 12px; border-radius: 7px;
  background: var(--accent-lys); color: #1b4d6e; font-size: 13px;
}
.advarsler { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.advarsler li {
  padding: 8px 12px 8px 34px; border-radius: 7px; position: relative;
  background: var(--advarsel-lys); color: #6b3f00; font-size: 13px;
}
.advarsler li::before {
  content: "!"; position: absolute; left: 11px; top: 8px;
  width: 16px; height: 16px; border-radius: 50%; background: #e09a2d; color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.moms-raad:empty { display: none; }
.moms-raad { margin-top: 14px; }
.moms-raad .advarsler { margin-bottom: 8px; }
.raad { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.raad li {
  padding: 8px 12px 8px 34px; border-radius: 7px; position: relative;
  background: var(--accent-lys); color: #1b4d6e; font-size: 13px;
}
.raad li::before {
  content: "i"; position: absolute; left: 11px; top: 8px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; font-style: italic; font-family: Georgia, serif;
}
.status-linje { margin: 0 auto 0 0; font-size: 13px; font-weight: 550; }
.status-linje.ok { color: var(--ok); }
.status-linje.blaa { color: var(--accent); }
.status-linje.advarsel { color: var(--advarsel); }
.tom { padding: 40px 20px; text-align: center; color: var(--daempet); }
.tom.stor { padding: 70px 20px; }
.tom.stor p { margin: 0 0 6px; }
.tom.stor .knap { margin-top: 14px; }
.tom-linje { color: var(--daempet); padding: 12px 2px; margin: 0; list-style: none; }

/* ---------- lister ---------- */
.liste-kolonne { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.filtre { display: flex; gap: 4px; padding: 3px; background: #e7e9ee; border-radius: 8px; }
.filter {
  flex: 1; border: 0; background: none; padding: 6px 4px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--daempet); white-space: nowrap;
}
.filter span { color: var(--svag); font-weight: 500; margin-left: 2px; }
.filter.aktiv { background: #fff; color: var(--tekst); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.kortliste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.kort {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--linje); background: var(--flade);
  transition: border-color .12s, box-shadow .12s;
}
.kort:hover { border-color: var(--linje-2); }
.kort.valgt { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kort-top, .kort-bund { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; }
.kort-top strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kort-bund { font-size: 12.5px; color: var(--daempet); }
.beloeb { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* ---------- købsfakturaer ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 44px 20px; margin-bottom: 18px;
  border: 2px dashed #b8c2d3; border-radius: 12px; background: var(--flade);
  text-align: center; cursor: pointer; color: var(--daempet);
  transition: border-color .15s, background .15s;
}
.drop:hover, body.traekker .drop { border-color: var(--accent); background: var(--accent-lys); }
.drop-ikon { width: 34px; height: 34px; color: var(--accent); }
.drop-tekst { color: var(--tekst); font-size: 15px; }
.drop-hint { font-size: 12.5px; }
.drop.lille { flex-direction: row; padding: 12px 16px; margin-bottom: 14px; gap: 12px; justify-content: flex-start; text-align: left; }
.drop.lille .drop-ikon { width: 22px; height: 22px; flex: none; }
.drop.lille .drop-tekst { font-size: 14px; }
.drop.lille .drop-hint { margin-left: auto; }
body.traekker::after {
  content: "Slip filerne for at lægge dem ind";
  position: fixed; inset: 10px; z-index: 50; pointer-events: none;
  display: grid; place-items: center;
  border: 3px dashed var(--accent); border-radius: 16px;
  background: rgba(233, 239, 248, .85); color: var(--accent); font-size: 20px; font-weight: 650;
}

.koeb-grid, .salg-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
.koeb-grid .liste-kolonne, .salg-grid .liste-kolonne { position: sticky; top: calc(var(--top-h) + 20px); max-height: calc(100vh - var(--top-h) - 40px); }
.detalje { min-width: 0; }
.bilag { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); gap: 18px; align-items: start; }
.forhaand {
  position: sticky; top: calc(var(--top-h) + 20px);
  background: var(--flade); border: 1px solid var(--linje); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--skygge);
}
.forhaand-top {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--linje); font-size: 12.5px; color: var(--daempet); background: var(--flade-2);
}
.filnavn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sidenav { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sidenav button { border: 1px solid var(--linje-2); background: #fff; border-radius: 5px; width: 24px; height: 24px; cursor: pointer; }
.sidenav button:disabled { opacity: .4; cursor: default; }
.forhaand-flade { max-height: calc(100vh - var(--top-h) - 90px); overflow: auto; background: #e9ebef; }
.forhaand-flade canvas, .forhaand-flade img { display: block; max-width: 100%; margin: 0 auto; background: #fff; }
.bilag-form, .faktura-form, .udstedt, .kort-flade, .start {
  background: var(--flade); border: 1px solid var(--linje); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--skygge);
}
.handlinger { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--linje); }
.handlinger .status-linje { flex-basis: 100%; margin: 0 0 4px; text-align: right; }

.start { max-width: 760px; margin: 0 auto; padding: 26px 28px; }
.start h1 { font-size: 19px; margin-bottom: 14px; }
.trin { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 10px; }
.trin li::marker { color: var(--accent); font-weight: 700; }

/* ---------- fakturering ---------- */
.form-hoved { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.form-hoved h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.tabel-ramme { overflow-x: auto; }
.linjer { width: 100%; border-collapse: collapse; min-width: 620px; }
.linjer th { font-size: 12px; font-weight: 600; color: var(--daempet); text-align: left; padding: 0 6px 6px; }
.linjer td { padding: 3px 6px; vertical-align: middle; }
.linjer td:first-child { width: 46%; }
.linjer .smal { width: 74px; }
.linjer td.tal { white-space: nowrap; font-weight: 550; min-width: 100px; }
.linjer tr.bytte td { background: #f6f7f9; }
.linjer tr.bytte td:first-child { border-radius: 6px 0 0 6px; }
.linjer tr.bytte td:last-child { border-radius: 0 6px 6px 0; }
.c { text-align: center; }
.fjern {
  width: 28px; height: 28px; border-radius: 6px; border: 0; background: none; cursor: pointer;
  color: var(--svag); font-size: 18px; line-height: 1;
}
.fjern:hover { background: var(--fejl-lys); color: var(--fejl); }
.linje-knapper { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
fieldset.intern { background: var(--flade-2); border: 1px dashed var(--linje-2); border-radius: var(--radius); padding: 12px 14px 14px; }
fieldset.intern legend { float: left; width: 100%; margin-bottom: 8px; color: var(--daempet); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.totaler { display: flex; flex-direction: column; align-items: flex-end; margin-top: 18px; }
.totaler-tabel { border-collapse: collapse; min-width: 300px; font-variant-numeric: tabular-nums; }
.totaler-tabel th { text-align: left; font-weight: 500; color: var(--daempet); padding: 3px 24px 3px 0; }
.totaler-tabel td { text-align: right; padding: 3px 0; }
.totaler-tabel tr.sum th, .totaler-tabel tr.sum td { font-weight: 700; color: var(--tekst); font-size: 15px; border-top: 1px solid var(--linje-2); padding-top: 7px; }
.intern-tal { margin: 10px 0 0; font-size: 13px; color: var(--daempet); text-align: right; }
.papir-ramme { margin-top: 16px; background: #e9ebef; border-radius: var(--radius); padding: 18px; overflow: hidden; }

/* ---------- til helios ---------- */
.helios h2 { margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.tael-lille { font-size: 12px; font-weight: 600; color: var(--daempet); background: #e7e9ee; border-radius: 10px; padding: 1px 8px; }
.helios-tabel {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--flade); border: 1px solid var(--linje); border-radius: var(--radius); overflow: hidden;
  font-size: 13px;
}
.helios-tabel th {
  text-align: left; font-size: 11.5px; font-weight: 650; color: var(--daempet); text-transform: uppercase; letter-spacing: .3px;
  padding: 9px 8px; background: var(--flade-2); border-bottom: 1px solid var(--linje); white-space: nowrap;
}
.helios-tabel td { padding: 4px 4px; border-bottom: 1px solid var(--linje); vertical-align: middle; }
.helios-tabel tr:last-child td { border-bottom: 0; }
.helios-tabel tbody tr:hover td { background: #fafbfd; }
.helios-tabel td.noter { font-size: 12px; color: var(--advarsel); padding: 4px 8px; min-width: 120px; }
.helios-tabel.daempet { opacity: .8; }
.kop {
  display: block; width: 100%; text-align: inherit;
  padding: 5px 6px; border-radius: 5px; border: 1px solid transparent; background: none; cursor: copy;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.helios-tabel td.bryd .kop { white-space: normal; min-width: 96px; overflow-wrap: anywhere; }
.helios-tabel td.lang .kop { min-width: 130px; font-size: 12px; }
.kop:hover { background: var(--accent-lys); border-color: #c9d6ea; }
.kop.kopieret { background: var(--ok-lys); border-color: #a9d6bb; color: var(--ok); }
.tom-celle { color: var(--svag); padding: 0 6px; }
.historik { margin-top: 26px; }
.historik summary { cursor: pointer; font-weight: 600; color: var(--daempet); }

/* ---------- indstillinger ---------- */
.indst { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.indst h1 { margin-bottom: 2px; }
.kort-flade h2 { margin-bottom: 2px; }
.kort-flade > .felter, .kort-flade > .tabel-ramme { margin-top: 14px; }
.kort-flade > .knapper { margin-top: 12px; }
.kort-flade > .knap { margin-top: 10px; }
.logo-linje { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.logo-vis { max-height: 52px; max-width: 220px; border: 1px solid var(--linje); border-radius: 6px; padding: 4px; background: #fff; }
.redigerbar { width: 100%; border-collapse: collapse; min-width: 640px; }
.redigerbar th { text-align: left; font-size: 12px; font-weight: 600; color: var(--daempet); padding: 0 6px 6px; }
.redigerbar td { padding: 3px 6px; }
.redigerbar input.smal { max-width: 120px; }

/* ---------- dialoger ---------- */
.dlg { border: 0; border-radius: 12px; padding: 22px 22px 18px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(15, 25, 45, .25); }
.dlg::backdrop, .visning::backdrop { background: rgba(20, 28, 45, .45); }
.dlg h3 { margin: 0 0 8px; font-size: 17px; }
.dlg p { margin: 0 0 18px; color: var(--daempet); }
.dlg-knapper { display: flex; justify-content: flex-end; gap: 8px; }
.visning {
  border: 0; padding: 0; border-radius: 12px; width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: #e9ebef; box-shadow: 0 20px 50px rgba(15, 25, 45, .3);
}
.visning-top { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--flade); border-bottom: 1px solid var(--linje); flex-wrap: wrap; }
.visning-papir { padding: 20px; overflow: hidden; }

#toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 8px;
  background: #1f2737; color: #fff; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  transition: opacity .18s, transform .18s;
}
#toast.vis { opacity: 1; transform: translate(-50%, 0); }
#toast.ok { background: #18603c; }
#toast.fejl { background: #9b1c13; }

/* ---------- fakturaen (A4) ---------- */
.a4 {
  width: 794px; min-height: 1123px; margin: 0 auto; padding: 56px 60px 48px;
  background: #fff; color: #1a1a1a; box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  font: 13px/1.5 "Segoe UI", Arial, sans-serif;
  display: flex; flex-direction: column;
}
.a4-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; margin-bottom: 34px; }
.a4-logo { max-width: 240px; max-height: 80px; }
.a4-firmanavn { font-size: 19px; font-weight: 700; max-width: 320px; line-height: 1.25; }
.a4-titel h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; text-align: right; letter-spacing: .3px; }
.a4-titel table { border-collapse: collapse; margin-left: auto; }
.a4-titel th { text-align: left; font-weight: 500; color: #666; padding: 1px 16px 1px 0; }
.a4-titel td { text-align: right; font-weight: 600; }
.a4-parter { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 26px; }
.a4-parter > div:last-child { text-align: right; }
.a4-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #888; margin-bottom: 4px; }
.a4-bil { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 12px 14px; margin-bottom: 22px; background: #f5f6f8; border-radius: 6px; }
.a4-bil div { display: flex; flex-direction: column; }
.a4-bil span { font-size: 11px; color: #777; }
.a4-linjer { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.a4-linjer th { text-align: left; font-size: 11.5px; font-weight: 600; color: #555; border-bottom: 1.5px solid #222; padding: 6px 8px; }
.a4-linjer td { padding: 8px; border-bottom: 1px solid #e5e5e5; vertical-align: top; }
.a4-linjer .h { text-align: right; white-space: nowrap; }
.a4-momsfri { font-size: 11px; color: #777; }
.a4-totaler { border-collapse: collapse; margin-left: auto; min-width: 300px; font-variant-numeric: tabular-nums; }
.a4-totaler th { text-align: left; font-weight: 500; padding: 3px 28px 3px 0; color: #444; }
.a4-totaler td { text-align: right; padding: 3px 8px 3px 0; white-space: nowrap; }
.a4-totaler tr.sum th, .a4-totaler tr.sum td { font-weight: 700; font-size: 15px; color: #111; border-top: 1.5px solid #222; padding-top: 7px; }
.a4-momstekst { margin: 22px 0 0; padding: 10px 12px; border-left: 3px solid #222; background: #f5f6f8; font-size: 12.5px; }
.a4-bem { margin: 18px 0 0; }
.a4-fod { margin-top: auto; padding-top: 30px; font-size: 12px; color: #444; }
.a4-fod p { margin: 0 0 12px; }
.a4-fodlinje { border-top: 1px solid #ddd; padding-top: 10px; font-size: 11px; color: #777; text-align: center; }

#udskrift { display: none; }

/* ---------- smalle skærme ---------- */
@media (max-width: 1250px) {
  .bilag { grid-template-columns: 1fr; }
  .forhaand { position: static; }
  .forhaand-flade { max-height: 60vh; }
}
@media (max-width: 1180px) {
  .globalsoeg kbd { display: none; }
  .globalsoeg { flex-basis: 180px; }
  .globalsoeg input { padding-right: 10px !important; }
  .fliser { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  main { padding: 14px 16px; }
  .top { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
  #faner { order: 3; flex-basis: 100%; height: 40px; }
  .globalsoeg { flex: 1 1 160px; }
  .opgave { flex-wrap: wrap; }
  .top { gap: 12px; padding: 0 12px; }
  .brand-tekst { display: none; }
  #faner button { padding: 0 10px; }
  .koeb-grid, .salg-grid { grid-template-columns: 1fr; }
  .koeb-grid .liste-kolonne, .salg-grid .liste-kolonne { position: static; max-height: none; }
  .kortliste { max-height: 260px; }
  .drop.lille .drop-hint { display: none; }
  .bilag-form, .faktura-form, .udstedt, .kort-flade, .start { padding: 14px; }
  .papir-ramme, .visning-papir { padding: 8px; }
  .handlinger { justify-content: stretch; }
  .handlinger .knap { flex: 1 1 auto; }
}

/* ---------- udskrift ---------- */
@page { size: A4; margin: 0; }
@page liste { size: A4 landscape; margin: 12mm; }
@media print {
  body { background: #fff; }
  body > *:not(#udskrift) { display: none !important; }
  #udskrift { display: block; }
  #udskrift .a4 { width: auto; min-height: 297mm; box-shadow: none; padding: 16mm 16mm 14mm; zoom: 1 !important; }
  #udskrift.liste { page: liste; }
  .liste-udskrift { font: 10.5px/1.35 "Segoe UI", Arial, sans-serif; color: #000; }
  .liste-udskrift h1 { font-size: 15px; margin-bottom: 8px; }
  .liste-udskrift table { width: 100%; border-collapse: collapse; }
  .liste-udskrift th, .liste-udskrift td { border: 1px solid #999; padding: 3px 4px; text-align: left; }
  .liste-udskrift th { background: #eee; }
  .liste-udskrift .h { text-align: right; white-space: nowrap; }
  .liste-udskrift .kryds { width: 22px; }
}
