:root {
  --blue: #1f3a5f; --accent: #1d5fbf; --bg: #f5f6f8; --line: #d9dde3; --muted: #6b7280;
  --red: #b42318; --green: #027a48; --amber: #b54708;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: #1f2328; background: var(--bg); line-height: 1.4; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; align-items: center; gap: 24px; background: var(--blue); color: #fff; padding: 10px 20px; }
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; }
.brand span { font-weight: 400; opacity: .8; }
.brand:hover { text-decoration: none; }
.mainnav a { color: #dbe6f5; margin-right: 16px; padding: 4px 0; }
.mainnav a.active { color: #fff; border-bottom: 2px solid #fff; }
.userbox { margin-left: auto; display: flex; gap: 12px; align-items: center; color: #dbe6f5; }
.userbox form { margin: 0; }
.linkbtn { background: none; border: 0; color: #fff; cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }

main { padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; }
main.wide { max-width: none; }
main.narrow { max-width: 480px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 12px; }
h1 { font-size: 1.45rem; margin: 0 0 10px; }
h1 .sub { font-weight: 400; color: var(--muted); font-size: 1.05rem; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
code { font-family: Consolas, monospace; font-size: .85rem; background: #f3f4f6; padding: 1px 4px; border-radius: 4px; }

.btn { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #1f2328; font: inherit; cursor: pointer; }
.btn:hover { background: #eef2f7; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #174e9f; }
.btn.small { padding: 3px 9px; font-size: .85rem; }
.btn.disabled { opacity: .45; pointer-events: none; }

.searchform { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.searchform .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.searchform label, .login-box label { display: flex; flex-direction: column; font-size: .82rem; color: #374151; gap: 3px; }
.searchform label.wide { grid-column: 1 / -1; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid #c5cbd3; border-radius: 6px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: 2px solid #93b4e8; border-color: var(--accent); }
.actions { margin-top: 12px; display: flex; gap: 10px; align-items: center; }
.spinner { visibility: hidden; color: var(--muted); }
.spinner.htmx-request { visibility: visible; }

.resultbar { display: flex; gap: 12px; align-items: center; margin: 16px 0 8px; flex-wrap: wrap; }
.resultbar .btn { margin-left: auto; }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: 7px 10px; border-bottom: 1px solid #edf0f3; text-align: left; vertical-align: top; }
table.list thead th { background: #f0f3f7; font-size: .82rem; color: #374151; white-space: nowrap; }
table.list thead th a { color: inherit; }
table.list tbody tr:hover { background: #f7f9fc; }
table.list.compact th, table.list.compact td { padding: 5px 8px; }
table.list tfoot th { background: #f7f9fc; }
th.num, td.num { text-align: right; }
th.sorted a { color: var(--accent); }
.arrow { font-size: .7rem; margin-left: 4px; }
.amount.neg { color: var(--red); }

.badge { display: inline-block; font-size: .72rem; padding: 1px 6px; border-radius: 10px; background: #eef2f7; color: #374151; vertical-align: middle; }
.badge.kn { background: #fde8e7; color: var(--red); }
.badge.part, .badge.warn { background: #fff4e5; color: var(--amber); }
.st { font-size: .85rem; }
.st-bogfoert { color: var(--green); }
.st-afventer { color: var(--amber); }
.st-afvist { color: var(--red); }
.st-godkendt { color: #175cd3; }
.st-andet, .st-ingen { color: var(--muted); }
.ft { display: inline-block; min-width: 38px; text-align: center; font-size: .7rem; font-weight: 600; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--line); color: #374151; background: #fafafa; }
.ft-tif { border-color: #9db6dd; color: #1d4f9a; }
.ft-html { border-color: #9fd3b6; color: #08724a; }
.ft-pdf { border-color: #f0a9a3; color: #a3261b; }
.ft-jpg { border-color: #d7b5f0; color: #6b2fa3; }

.pager { display: flex; gap: 12px; justify-content: center; margin: 14px 0; align-items: center; }
.pager .disabled { color: #b6bcc6; }
.empty { color: var(--muted); padding: 10px 2px; }
.alert { background: #fdecea; border: 1px solid #f5c2bc; color: #7a271a; padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.note { background: #fff8e6; border: 1px solid #f6d58e; padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.pagehead { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.headactions { margin-left: auto; display: flex; gap: 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi-label { font-size: .8rem; color: var(--muted); }
.kpi-value { font-size: 1.45rem; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 1.05rem; }
.kpi-note { font-size: .78rem; color: var(--muted); margin-top: 4px; }
td.num, .amount { font-variant-numeric: tabular-nums; }

.inline-search { display: flex; gap: 8px; margin: 8px 0 10px; }
.inline-search input { width: 320px; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.box summary { cursor: pointer; font-weight: 600; }
ul.cols { columns: 3 260px; padding-left: 18px; }
.login-box, .errorbox { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-top: 40px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* bilagsside */
.doc-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(380px, 2fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .doc-layout { grid-template-columns: 1fr; } }
.doc-left { position: sticky; top: 10px; }
.viewer { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 300px; }
.viewer-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pagebox { overflow: auto; max-height: calc(100vh - 140px); }
.viewer img.page { width: 100%; height: auto; display: block; border: 1px solid #e5e7eb; cursor: zoom-in; background: #fff; }
.viewer img.page.zoom { width: auto; max-width: none; cursor: zoom-out; }
.doc-frame { width: 100%; height: calc(100vh - 150px); min-height: 600px; border: 1px solid #e5e7eb; background: #fff; }
.loading { color: var(--muted); padding: 30px; text-align: center; }
table.fields { border-collapse: collapse; width: 100%; background: #fff; border: 1px solid var(--line); }
table.fields th { text-align: left; width: 34%; font-weight: 500; color: #4b5563; background: #f7f9fc; padding: 6px 10px; vertical-align: top; border-bottom: 1px solid #edf0f3; }
table.fields td { padding: 6px 10px; border-bottom: 1px solid #edf0f3; }
td.path { font-family: Consolas, monospace; font-size: .8rem; word-break: break-all; }
.history td { font-size: .88rem; }
.history tr.ht-2 td:nth-child(3) { color: var(--green); font-weight: 600; }
.history tr.ht-7 td:nth-child(3) { color: var(--red); font-weight: 600; }
.history tr.ht-4 td:nth-child(3) { color: var(--amber); }
ul.notes { list-style: none; padding: 0; margin: 0; }
ul.notes li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.notetext { white-space: pre-wrap; }
ul.attachments { padding-left: 0; list-style: none; }
ul.attachments li { margin: 4px 0; }
pre.ocrtext { white-space: pre-wrap; font-family: Consolas, monospace; font-size: .8rem; max-height: 420px; overflow: auto; background: #fafafa; padding: 8px; border-radius: 6px; color: #1f2328; }
