:root {
  --brand: #0f5c4d;
  --brand-ink: #ffffff;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2430;
  --muted: #5d6675;
  --line: #e3e6ea;
  --soft: #f0f2f4;
  --ok: #157347;
  --ok-soft: #e6f4ec;
  --warn: #9a6200;
  --warn-soft: #fdf3e1;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --info: #1d4f91;
  --info-soft: #e8f0fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; word-break: break-all; }
.pre { white-space: pre-line; }

/* Layout */
.topbar { background: var(--brand); color: var(--brand-ink); }
.topbar .in { max-width: 1100px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.topbar .name { font-weight: 700; font-size: 1.05rem; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button.link { color: var(--brand-ink); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 120px; }
.narrow { max-width: 860px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card > :last-child { margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } .wrap { padding-top: 16px; } h1 { font-size: 1.35rem; } }

/* Knapper */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.big { min-height: 52px; font-size: 1.05rem; padding: 12px 24px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

/* Formularer */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 5px; }
label.f > small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfd4da; border-radius: 9px; background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--brand); }

/* Status-chips */
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.afventer, .chip.aabnet { background: var(--info-soft); color: var(--info); }
.chip.kommentar { background: var(--warn-soft); color: var(--warn); }
.chip.godkendt { background: var(--ok-soft); color: var(--ok); }
.chip.afvist { background: var(--bad-soft); color: var(--bad); }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--info); margin-bottom: 16px; font-size: .95rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* PDF-visning */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: .9rem; }
.tab[aria-selected=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .done { color: var(--ok); margin-left: 4px; }
.tab[aria-selected=true] .done { color: #8ee3b3; }
.viewer { background: #e4e7eb; border-radius: 10px; padding: 12px; max-height: 78vh; overflow: auto; }
.viewer .page { background: #fff; margin: 0 auto 12px; box-shadow: 0 1px 4px rgba(0,0,0,.15); max-width: 900px; }
.viewer .page canvas { display: block; width: 100%; height: auto; }
.viewer .end { text-align: center; color: var(--muted); font-size: .85rem; padding: 6px 0 2px; }
.viewer .loading { text-align: center; color: var(--muted); padding: 40px 0; }
@media (max-width: 760px) { .viewer { padding: 6px; max-height: none; } }

/* Samtale */
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; background: var(--soft); }
.msg.os { align-self: flex-start; background: color-mix(in srgb, var(--brand) 10%, #fff); }
.msg.kunde { align-self: flex-end; background: var(--soft); }
.msg .who { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }

/* Handlingsbjælke på kundesiden */
.actionbar { position: sticky; bottom: 0; z-index: 5; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16,24,40,.08); }
.actionbar .in { max-width: 860px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actionbar .hint { flex: 1 1 220px; font-size: .9rem; color: var(--muted); }
@media (max-width: 560px) {
  .actionbar .in { gap: 8px; padding-top: 8px; }
  .actionbar .hint { flex-basis: 100%; font-size: .8rem; }
  .actionbar #btnComment { flex: 0 1 auto; padding: 10px 14px; }
  .actionbar #btnApprove { flex: 1 1 auto; min-height: 46px; }
}

/* Dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
dialog .dh { padding: 18px 20px 0; }
dialog .db { padding: 12px 20px; }
dialog .df { padding: 0 20px 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.sigpad { position: relative; border: 1px dashed #b8bfc8; border-radius: 10px; background: #fcfcfd; }
.sigpad canvas { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
.sigpad .line { position: absolute; left: 16px; right: 16px; bottom: 34px; border-bottom: 1px solid #d5dae0; pointer-events: none; }
.sigpad .ph { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: .8rem; color: #98a1ad; pointer-events: none; }
.sigpad .clear { position: absolute; top: 6px; right: 8px; font-size: .8rem; }

/* Kvittering */
.done-hero { text-align: center; padding: 28px 20px; }
.done-hero .icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 12px; font-size: 34px; }
.done-hero.bad .icon { background: var(--bad-soft); color: var(--bad); }
.done-hero.neutral .icon { background: var(--soft); color: var(--muted); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .875rem; }
dl.kv dd { margin: 0; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; gap: 0; } dl.kv dd { margin-bottom: 8px; } }

/* Admin */
.drop { border: 2px dashed #c3c9d1; border-radius: 12px; padding: 28px 16px; text-align: center; cursor: pointer; background: #fafbfc; }
.drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.filelist { list-style: none; margin: 12px 0 0; padding: 0; }
.filelist li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; }
.filelist li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--soft); }
table.list .t { font-weight: 600; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-left: 6px; vertical-align: middle; }
@media (max-width: 760px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  table.list td { border: 0; padding: 2px 4px; }
}
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.timeline li { padding: 6px 0 6px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.center-box { max-width: 380px; margin: 12vh auto; }

/* SaaS: navigation, adgangsbjælke, indstillinger */
.topnav { display: flex; gap: 16px; }
.topnav a { text-decoration: none; opacity: .85; font-size: .95rem; }
.topnav a[aria-current="page"] { opacity: 1; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
#accessbar:empty { display: none; }
#accessbar { background: var(--warn-soft); color: var(--warn); font-size: .92rem; }
#accessbar.bad { background: var(--bad-soft); color: var(--bad); }
#accessbar .in { max-width: 1100px; margin: 0 auto; padding: 9px 16px; }
.logo-prev { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.logo-prev img { max-height: 48px; max-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.swatch { width: 52px; height: 40px; padding: 2px; border-radius: 8px; }
.team li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.team li:last-child { border-bottom: 0; }
.team { list-style: none; margin: 0 0 12px; padding: 0; }
.center-box .alt { margin-top: 14px; text-align: center; font-size: .92rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.plan { display: flex; align-items: baseline; gap: 8px; }
.plan strong { font-size: 1.6rem; }
@media (max-width: 720px) {
  .topbar .in { flex-wrap: wrap; row-gap: 8px; }
  .topnav { order: 5; width: 100%; }
}

.logo-pill { display: inline-flex; background: #fff; border-radius: 8px; padding: 5px 10px; }
.logo-pill img { max-height: 32px; max-width: 180px; display: block; }
.via { text-align: center; font-size: .8rem; margin: 8px 0 120px; }
.via a { color: var(--muted, #6b7280); text-decoration: none; }
