/* Inkassoportal – stilark */
:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --ink: #111111;
  --ink-2: #111111;
  --muted: #111111;
  --line: #e1e3de;
  --nav-bg: #122741;
  --nav-ink: #c9d2da;
  --nav-active: #ffffff;
  --accent: #122741;      /* mørkeblå (No Risk) */
  --accent-ink: #ffffff;
  --accent-soft: #eef0f4;
  --gold: #bcb18b;        /* guld/sand (No Risk) */
  --gold-soft: #f6f3ea;
  --danger: #b4372f;
  --danger-soft: #fbe9e7;
  --warn: #9a6512;
  --warn-soft: #fbf1df;
  --info: #2b5b8a;
  --info-soft: #e5eef7;
  --ok: #2f7a3a;
  --ok-soft: #e4f2e5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 43, .06), 0 4px 16px rgba(22, 32, 43, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: -.4rem 0 .9rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Layout ---------- */
body.has-nav { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.topbar { display: none; }
.sidenav { background: var(--nav-bg); color: var(--nav-ink); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .5rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 650; font-size: 1.02rem; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #d6ccaa, #bcb18b); flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.nav-role { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #8494a3; margin: 1rem .6rem .25rem; }
.sidenav nav { display: flex; flex-direction: column; gap: 2px; }
.sidenav nav a { color: var(--nav-ink); text-decoration: none; padding: .5rem .6rem; border-radius: 7px; font-size: .94rem; }
.sidenav nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidenav nav details.nav-group summary { color: var(--nav-ink); padding: .5rem .6rem; border-radius: 7px; font-size: .94rem; cursor: pointer; list-style: none; }
.sidenav nav details.nav-group summary::-webkit-details-marker { display: none; }
.sidenav nav details.nav-group summary::after { content: '▸'; float: right; opacity: .7; }
.sidenav nav details.nav-group[open] summary::after { content: '▾'; }
.sidenav nav details.nav-group summary:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidenav nav details.nav-group a { display: block; padding-left: 1.4rem; }
.sidenav nav a.active { background: rgba(188,177,139,.16); color: var(--nav-active); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.nav-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 1rem .6rem 0; display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; }
.nav-user-name { color: #fff; font-weight: 600; }
.nav-user a, .nav-user .linklike { color: var(--nav-ink); text-decoration: none; text-align: left; }
.nav-user a:hover, .nav-user .linklike:hover { color: #fff; }
.main { padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; max-width: 1240px; width: 100%; }
body.no-nav .main { max-width: none; padding: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: .25rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card > h2:first-child { margin-bottom: .9rem; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.cols-even { grid-template-columns: 1fr 1fr; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: .82rem; }
.kpi-value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: .15rem; letter-spacing: -.01em; }
.kpi-note { color: var(--muted); font-size: .8rem; }
.kpi-accent { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- Tabeller ---------- */
.table-wrap { overflow-x: auto; margin: 0 -.25rem; padding: 0 .25rem; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); padding: .55rem .6rem; white-space: nowrap; }
.table td { border-bottom: 1px solid var(--line); padding: .6rem .6rem; vertical-align: top; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tfoot th { border-top: 2px solid var(--ink); border-bottom: 0; color: var(--ink); font-size: .92rem; text-transform: none; letter-spacing: 0; }
.table-compact td, .table-compact th { padding: .45rem .5rem; }
.table a.rowlink { font-weight: 600; text-decoration: none; }
.table a[href*="case.php"], .table a[href*="settlement="] { white-space: nowrap; }
.table a.rowlink:hover { text-decoration: underline; }
.table .sub { color: var(--muted); font-size: .82rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem !important; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-muted { background: #eceeea; color: var(--ink-2); }
.tag { display: inline-block; font-size: .74rem; color: var(--ink-2); background: #eceeea; padding: .05rem .45rem; border-radius: 4px; }

/* ---------- Formularer ---------- */
label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-2); margin-bottom: .9rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #cfd3cc; border-radius: 7px; padding: .55rem .65rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(188,177,139,.6); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 .4rem 0 0; vertical-align: -2px; }
label.check:has(input[type=radio]) { display: inline-block; margin-right: 1.25rem; }
label.check { font-weight: 500; color: var(--ink); }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem .2rem; margin: 0 0 1.1rem; }
legend { font-weight: 650; padding: 0 .35rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.span-2 { grid-column: span 2; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { margin: 0; min-width: 160px; flex: 1 1 160px; }
.filters .btn { flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .9rem; padding: .55rem 1rem; border-radius: 7px; border: 1px solid #cfd3cc; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover, details[open] > summary.btn-primary { background: #0c1b2e; border-color: #0c1b2e; }
.btn-danger { color: var(--danger); border-color: #e6bdb9; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { padding: .35rem .7rem; font-size: .84rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.linklike.danger { color: var(--danger); }
form.inline { display: inline; }

/* ---------- Beskeder ---------- */
.flash { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.flash ul { margin: 0; padding-left: 1.1rem; }
.flash-success { background: var(--ok-soft); border-color: #bfdcc2; color: #1f5a28; }
.flash-error { background: var(--danger-soft); border-color: #efc4c0; color: #8a2620; }
.flash-info { background: var(--info-soft); border-color: #c4d6ea; color: #23496e; }
.flash-warn { background: var(--warn-soft); border-color: #ebd5ab; color: #73490a; }
.secret { font-family: var(--mono); font-size: 1.1rem; background: #fff; padding: .2rem .5rem; border-radius: 5px; border: 1px dashed #9db; user-select: all; }

/* ---------- Detaljer ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; }
.balance-total { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.2rem; border-left: 2px solid var(--line); margin-left: .35rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: #c3c8c0; }
.timeline li.tl-status::before { background: var(--accent); }
.timeline li.tl-payment::before { background: var(--ok); }
.timeline li:last-child { border-left-color: transparent; }
.tl-meta { font-size: .8rem; color: var(--muted); }
.tl-msg { font-size: .93rem; }

.doclist { list-style: none; padding: 0; margin: 0; }
.doclist li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.doclist li:last-child { border-bottom: 0; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; font-size: .9rem; }

details.panel { border-top: 1px solid var(--line); padding: .75rem 0 0; margin-top: .75rem; }
details.panel summary { cursor: pointer; font-weight: 650; color: var(--accent); }
details.panel[open] summary { margin-bottom: .8rem; }

.pay-box { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: var(--radius); padding: 1rem 1.15rem; }
.pay-box .hint { margin: .9rem 0 0; }
.pay-box .dl dd { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Søjlediagram (rapporter) */
.bars { display: grid; gap: .4rem; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 120px; gap: .75rem; align-items: center; font-size: .86rem; }
.bar-track { background: var(--surface-2); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-fill.w0 { width: 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(1200px 600px at 10% -10%, #dfe9e4 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; box-shadow: 0 10px 40px rgba(22,32,43,.08); }
.login-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; margin-bottom: 1.5rem; }
.login-help { font-size: .84rem; color: var(--muted); margin: 1.25rem 0 0; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  body.has-nav { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--nav-bg); padding: .75rem 1rem; position: sticky; top: 0; z-index: 20; }
  .nav-toggle { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: .35rem .7rem; font: inherit; }
  .sidenav { display: none; position: static; height: auto; }
  .sidenav.open { display: flex; }
  .brand-side { display: none; }
  .cols, .cols-even { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .main { padding-top: 1.25rem; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .bar-row { grid-template-columns: 56px 1fr 92px; }
  .card { padding: 1rem; }
}

@media print {
  .sidenav, .topbar, .actions, form, .btn { display: none !important; }
  body.has-nav { display: block; }
  .card { box-shadow: none; }
}
[hidden] { display: none !important; }

/* Fakturalinjer */
.invoice-rows { display: grid; gap: .25rem; }
.invoice-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr auto; gap: 0 .75rem; align-items: end; }
.invoice-row .invoice-remove { margin-bottom: 1.4rem; }
@media (max-width: 760px) { .invoice-row { grid-template-columns: 1fr 1fr; border-bottom: 1px dashed var(--line); padding-bottom: .5rem; } }

/* Nøgle/værdi-tabeller (økonomisk oversigt, restgæld) */
.table.kv td { border-bottom: 1px dashed var(--line); }
.table.kv tfoot tr.minor td { color: var(--muted); border: 0; padding-top: .3rem; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.box-head h2 { margin: 0; }
.box-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.party .dl { grid-template-columns: max-content 1fr; font-size: .93rem; }
.party .addr { margin: .25rem 0 .75rem; line-height: 1.45; }
.notice { border-left: 4px solid var(--gold); background: var(--accent-soft); padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 1.25rem; }
.notice h2 { margin-bottom: .35rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.mail-preview { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; font-size: .92rem; }
.letter-opts { display: grid; grid-template-columns: auto 1fr 160px; gap: .5rem 1rem; align-items: center; margin-bottom: 1rem; }
.letter-opts label { margin: 0; }
.letter-opts input[type=text], .letter-opts input:not([type]) { margin: 0; }
@media (max-width: 560px) { .letter-opts { grid-template-columns: auto 1fr; } .letter-opts .amt { grid-column: 2; } }
.narrow-wide { max-width: 760px; }
.interest-form { margin-top: .9rem; }
.interest-form label .btn { margin-top: .3rem; }

.table th.num, .table td.num { text-align: right; }
.owner-select { margin-top: .35rem; max-width: 220px; font-size: .85rem; padding: .3rem .5rem; }
.complete-case { border-color: #c4d6ea; box-shadow: 0 0 0 3px var(--info-soft); }
.statement-preview table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.statement-preview td { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.statement-preview td + td { text-align: right; white-space: nowrap; }
.statement-preview h3 { color: var(--accent); margin: 1.2rem 0 .3rem; }
.statement-preview tr:last-child td { font-weight: 700; border-top: 2px solid var(--ink); }
.btn + .hint { margin-top: .6rem; }

/* Synlighed i tidslinjen: grøn = kun internt, blå = internt og kreditor, rød = også skyldner */
.tag.vis-internal { background: #e1f3e3; color: #1d5e27; font-weight: 600; }
.tag.vis-creditor { background: #e1ecfa; color: #1f4f8f; font-weight: 600; }
.tag.vis-all      { background: #fbe3e1; color: #9b2a22; font-weight: 600; }
select.vis-select { border-left-width: 5px; }
select.vis-select[data-vis="internal"] { border-left-color: #2f8a3c; }
select.vis-select[data-vis="creditor"] { border-left-color: #2e6cc2; }
select.vis-select[data-vis="all"]      { border-left-color: #c2382e; }
.tl-doc { margin-top: .2rem; font-size: .88rem; }
.timeline li.tl-mail_failed::before { background: var(--danger); }
.timeline li.tl-mail_failed .tl-msg { color: var(--danger); font-weight: 600; }
.timeline li.tl-letter::before { background: var(--info); }
.timeline li.tl-court::before { background: #6a3fb5; }

/* Opfølgning */
.fu-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.fu-label { font-weight: 600; }
/* v17.2 (punkt 185): grupper med overskrift over knapperne */
.fu-group { display: flex; flex-direction: column; gap: .35rem; }
.fu-group .fu-label { font-size: .8rem; color: var(--ink-2); }
.fu-seg { display: flex; align-items: stretch; flex-wrap: wrap; gap: 0; }
.fu-seg > .btn, .fu-seg form input { height: 2.1rem; margin: 0; display: inline-flex; align-items: center; white-space: nowrap; gap: .35rem; }
.fu-seg > .btn:first-child { border-radius: 8px 0 0 8px; }
.fu-seg > .btn + .btn { border-radius: 0; margin-left: -1px; }
.fu-seg form.fu-date input, .fu-seg form.fu-date .date-da { border-radius: 0 8px 8px 0; margin-left: -1px; }
.fu-group .fu-sort select { height: 2.1rem; min-width: 260px; margin: 0; }
.fu-spacer { flex: 1; }
.fu-bar form.fu-date { display: inline-flex; flex-wrap: nowrap; gap: .4rem; align-items: center; }
.fu-date input { margin: 0; width: auto; padding: .3rem .5rem; }
.btn .count { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 999px; background: rgba(0,0,0,.08); font-size: .8em; }
.btn-alert { border-color: #e6bdb9; color: var(--danger); }
.fu-late { color: var(--danger); font-weight: 700; }
.fu-today { color: var(--accent); font-weight: 700; }
.followup-card.is-late { border-color: #efc4c0; box-shadow: 0 0 0 3px var(--danger-soft); }
a.kpi-link { color: inherit; text-decoration: none; }
a.kpi-link:hover { border-color: var(--accent); }

/* v5: kreditnota-formular adskilt fra fakturaformularen */
.credit-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* v6: Klient- og Skyldner-boksen – én skrifttype og -størrelse, tættere linjer */
.party { padding: 1rem 1.1rem; }
.party .box-head { margin-bottom: .5rem; }
.party .box-head h2 { font-size: 1.05rem; }
.party .party-dl { grid-template-columns: 8.5rem 1fr; gap: .2rem .9rem; font-size: .88rem; line-height: 1.4; }
.party .party-dl dt, .party .party-dl dd { font-size: inherit; font-weight: 400; color: var(--ink); }
.party .party-dl dd { overflow-wrap: anywhere; }
.party form { margin-top: .6rem; }
@media (max-width: 520px) { .party .party-dl { grid-template-columns: 7rem 1fr; } }

/* v6: CVR-opslag */
.cvr-status { display: block; margin-top: .3rem; font-size: .82rem; line-height: 1.35; }
.cvr-status.is-busy { color: var(--ink); }
.cvr-status.is-ok { color: #1d6b4f; }
.cvr-status.is-warning { color: #8a4b00; font-weight: 600; }
.cvr-status.is-error { color: #b3261e; }

/* v7: tre bokse på én række (økonomi · restgæld · indbetaling) */
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* v7: "Ret" i tidslinjen og posteringer */
.tl-edit { margin-left: .5rem; font-size: .8rem; }
.tl-edited { color: var(--ink); font-style: italic; font-size: .8rem; }
.fee-locked { opacity: .55; }
.mail-frame { width: 100%; min-height: 1000px; border: 1px solid var(--line); border-radius: var(--radius); background: #f4f5f2; }
.nowrap { white-space: nowrap; }

/* v8: rulleliste "Handlinger" */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--gold); border-radius: 8px; box-shadow: 0 8px 28px rgba(18,39,65,.16); padding: .35rem 0; display: flex; flex-direction: column; }
.menu-list a { padding: .55rem 1rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.menu-list a:hover, .menu-list a:focus { background: var(--accent-soft); }
.menu-list a.danger { color: var(--danger); border-top: 1px solid var(--line); margin-top: .25rem; }
.delete-case { border-color: var(--danger); }

/* v8: Klient- og Skyldner-boksen – samme størrelse, mindre skrift; Klient i to kolonner */
.party-row { align-items: stretch; }
.party-row > .party { margin-bottom: 1.25rem; }
.party .party-dl { font-size: .76rem; gap: .12rem .6rem; grid-template-columns: max-content 1fr; line-height: 1.35; }
.party .party-dl dd { overflow-wrap: break-word; }
.party { padding: .9rem 1rem; }
.party .box-head h2 { font-size: .98rem; }
.party-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; align-items: start; }
@media (max-width: 1250px) { .party-split { grid-template-columns: 1fr; } .party-split .party-dl + .party-dl { margin-top: .12rem; } }

/* v8: rentelinjen nederst i "Oversigt over restgæld" */
.cols-3 > .card { display: flex; flex-direction: column; }
.interest-line { margin: auto 0 0; padding-top: .6rem; font-size: .64rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
@media (max-width: 760px) { .interest-line { white-space: normal; } }

/* v8: afdragsordning */
.plan-fields { border-left: 3px solid var(--gold); padding-left: .8rem; margin-bottom: .6rem; }
.plan-card .table input[type=date] { padding: .2rem .35rem; font-size: .85rem; }
.pay-lines { list-style: none; margin: 0; padding: 0; font-weight: 700; line-height: 1.7; }

/* v9: retskredse – upload */
.actions-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.inline-upload { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.notice-card { border-left: 4px solid var(--gold); }
.court-status { display: block; margin-top: .3rem; font-size: .82rem; font-weight: 400; }
.court-status.is-warning { color: #8a4b00; }

/* v9: indbetalinger i fuld bredde; klient/skyldner mindre bokse, lidt større skrift */
.payments-card .table td, .payments-card .table th { padding-top: .6rem; padding-bottom: .6rem; }
.party { padding: .75rem .9rem; }
.party .box-head { margin-bottom: .35rem; }
.party .box-head h2 { font-size: .95rem; }
.party .box-head .btn-small { padding: .15rem .55rem; font-size: .78rem; }
.party .party-dl { font-size: .82rem; gap: .05rem .6rem; line-height: 1.3; }
.party form { margin-top: .45rem; }
.party form .btn-small { padding: .2rem .6rem; font-size: .78rem; }
.our-rest th { color: var(--accent); border-top: 1px solid var(--gold); }

/* v9: Betalingspåkrav */
.bp-dialog { border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: var(--radius); padding: 1.25rem 1.4rem; max-width: 460px; width: calc(100% - 2rem); box-shadow: 0 18px 50px rgba(18,39,65,.3); }
.bp-dialog::backdrop { background: rgba(18,39,65,.45); }
.bp-about { max-width: 560px; }
.bp-form textarea { font-family: var(--font); }

/* v11: Overblik – status på én linje */
.status-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .8rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.status-strip-label { font-weight: 600; font-size: .86rem; margin-right: .35rem; }
.status-strip .status-search { width: 200px; max-width: 100%; padding: .3rem .6rem; font-size: .86rem; margin-right: .35rem; }
.status-chip[hidden] { display: none; }
.status-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; color: var(--ink); text-decoration: none; white-space: nowrap; background: #fff; }
.status-chip:hover { border-color: var(--accent); }
.status-chip .count { font-weight: 650; font-variant-numeric: tabular-nums; }
/* v11: flyt opfølgning for flere sager */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .55rem .8rem; margin-bottom: .75rem; border: 1px solid var(--gold); background: var(--gold-soft); border-radius: var(--radius); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-date { display: inline-flex; align-items: center; gap: .45rem; margin: 0; font-weight: 500; }
.bulk-bar .bulk-date input { margin: 0; width: auto; padding: .3rem .5rem; }
.bulk-sep { color: var(--muted); }
.table th.sel, .table td.sel { width: 1.6rem; padding-right: 0; }
.table td.sel input, .table th.sel input { width: auto; margin: 0; }
/* v11: portal – Oplysninger */
.info-debtor { background: var(--gold-soft); border-left: 3px solid var(--gold); border-radius: 6px; padding: .7rem .85rem; margin: .4rem 0 1rem; }
.info-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: .15rem; }
.info-name { font-size: 1.05rem; font-weight: 650; color: var(--accent); }
.info-addr { font-size: .9rem; margin-top: .1rem; }
.info-invoices { list-style: none; margin: .2rem 0 0; padding: 0; }
.info-invoices li { display: flex; justify-content: space-between; gap: 1rem; padding: .32rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.info-invoices li:last-child { border-bottom: 0; }
.info-invoices .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* v11: knapper og popups på sagen */
.btn-drive { border-color: var(--gold); }
.radio-list { border: 0; padding: 0; margin: .3rem 0 .8rem; }
.radio-list legend { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; padding: 0; }
.radio-list .check { display: block; margin: .25rem 0; font-weight: 400; }
.sk-dialog { max-width: 520px; }
[data-sk-show][hidden] { display: none; }
.party-row .followup-card .grid-2 { grid-template-columns: 1fr; }
/* v12 */
.main.main-wide { max-width: none; }
.party .party-dl dt { font-weight: 650; }
.new-bk-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: .75rem; align-items: end; }
.new-bk-row label { margin: 0; }
.new-bk-row .btn { white-space: nowrap; }
.new-bk .new-bk-row + .hint { margin: .9rem 0 0; }
@media (max-width: 900px) { .new-bk-row { grid-template-columns: 1fr; } }
.case-number-row { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr; gap: 1rem; align-items: end; margin-bottom: .5rem; }
.case-number-row label { margin: 0; }
.case-number-row input { font-weight: 650; font-variant-numeric: tabular-nums; }
.case-number-row .hint { margin: 0 0 .55rem; }
@media (max-width: 700px) { .case-number-row { grid-template-columns: 1fr; } }
.menu-list { max-height: 75vh; overflow-y: auto; }
.menu-list form { margin: 0; }
.menu-list form button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .55rem 1rem; font: inherit; color: var(--ink); cursor: pointer; white-space: nowrap; }
.menu-list form button:hover, .menu-list form button:focus { background: var(--accent-soft); }
.note-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.note-status-grid h2 { margin-top: 0; }
@media (max-width: 900px) { .note-status-grid { grid-template-columns: 1fr; gap: 1rem; } }

/* v12: mails til kunden fra Handlinger, "Opret en ny sag", "Nye sager oprettet" */
.mail-dialog { max-width: 680px; }
.mail-dialog textarea { min-height: 16rem; font-size: .9rem; line-height: 1.45; }
.mail-dialog .radio-list .muted { font-size: .85rem; }
.nav-count { display: inline-block; min-width: 1.35rem; padding: 0 .4rem; margin-left: .35rem; border-radius: 999px; background: var(--gold); color: #122741; font-size: .76rem; font-weight: 700; line-height: 1.35rem; text-align: center; }
.form-narrow { max-width: 760px; }
.request-done { max-width: 760px; }
.request-done h1 { margin-bottom: .4rem; }
.request-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; margin-bottom: .6rem; }
.request-head h2 { margin: 0; }
.request-dl { display: grid; grid-template-columns: 12rem 1fr; gap: .35rem 1rem; margin: 0 0 .9rem; }
.request-dl dt { font-weight: 650; }
.request-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .request-dl { grid-template-columns: 1fr; } .request-dl dd { margin-bottom: .4rem; } }
.comp-row .comp-ours { align-self: end; padding-bottom: .55rem; }

/* v13 */
.tl-filter { display: flex; align-items: center; gap: .45rem; margin: 0; font-weight: 500; font-size: .85rem; }
.tl-filter select { width: auto; padding: .3rem .5rem; font-size: .85rem; }
.timeline > li[hidden] { display: none; }
.fr-dialog { max-width: 720px; }
.fr-parties { font-size: .9rem; margin-bottom: .6rem; }
.fr-rows { display: grid; gap: .4rem; }
.fr-row { display: grid; grid-template-columns: 1fr 10rem; gap: .6rem; }
.fr-row label { margin: 0; }
@media (max-width: 600px) { .fr-row { grid-template-columns: 1fr; } }

/* v14 */
.bank-text { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .9rem; }
.bank-text-label { color: var(--muted); }
.bank-text-edit { margin-top: .35rem; }
.bank-text-edit summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.inline-field { display: flex; gap: .4rem; align-items: center; margin-top: .3rem; }
.inline-field input { flex: 1; min-width: 0; }
.row-pending td { background: rgba(188,177,139,.08); }
.limitation-card .row-late td { background: rgba(190,40,40,.06); }
.meeting-info { font-size: .88rem; margin: 0 0 .5rem; font-weight: 600; }
.fu-sort select { width: auto; padding: .3rem .5rem; font-size: .85rem; }

/* v15: Kalender */
.cal-form-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: .75rem; }
@media (max-width: 800px) { .cal-form-row { grid-template-columns: 1fr; } }
.cal-delete { margin: -.6rem 0 1rem; }
.cal-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.cal-nav, .cal-views { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.cal-heading { margin-left: .5rem; font-size: 1.05rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-wd { padding: .35rem .45rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg, #f6f5f1); }
.cal-day { min-height: 7.2rem; padding: .3rem .35rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-week .cal-day { min-height: 18rem; }
.cal-day.is-out { background: rgba(0,0,0,.025); }
.cal-day.is-out .cal-daynum { opacity: .45; }
.cal-day.is-today { background: rgba(188,177,139,.13); }
.cal-daynum { font-size: .8rem; font-weight: 700; color: var(--ink); text-decoration: none; align-self: flex-start; padding: 0 .2rem; border-radius: 4px; }
.cal-daynum:hover { background: rgba(0,0,0,.06); }
.cal-item { display: block; padding: .18rem .35rem; border-radius: 5px; font-size: .74rem; line-height: 1.25; text-decoration: none; color: var(--ink); border-left: 3px solid #8a8f98; background: #f1f2f4; overflow: hidden; }
.cal-item:hover { filter: brightness(.96); }
.cal-item-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item-sub { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-court  { border-left-color: #b42318; background: #fdecea; }
.cal-prep   { border-left-color: #b54708; background: #fef3e2; }
.cal-main   { border-left-color: #7a2e9e; background: #f4ebfa; }
.cal-answer { border-left-color: #175cd3; background: #e9f1fd; }
.cal-reopen { border-left-color: #067647; background: #e8f6ef; }
.cal-manual { border-left-color: #122741; background: #eef0f4; }
.cal-list-day { display: grid; grid-template-columns: 11rem 1fr; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.cal-list-day.is-today .cal-list-date { color: var(--accent, #122741); }
.cal-list-date { font-weight: 700; font-size: .88rem; }
.cal-list-items { display: grid; gap: .3rem; }
.cal-list-items .cal-item { font-size: .85rem; }
.cal-list-items .cal-item-title, .cal-list-items .cal-item-sub { display: inline; }
.cal-list-items .cal-item-sub::before { content: ' · '; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.cal-legend .cal-item { display: inline-block; }
@media (max-width: 700px) { .cal-list-day { grid-template-columns: 1fr; } .cal-day { min-height: 4.5rem; } .cal-item-sub { display: none; } }

/* v16 */
.flash-warn { background: #fff6e5; border-color: #f1d7a6; color: #7a4b00; }
.integrations .grid-2 { margin-bottom: .6rem; }
.integrations-clear { display: flex; flex-direction: column; justify-content: flex-end; gap: .2rem; }
.integration-tests { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.integration-tests .inline-field { margin: 0; }
.syscheck td.ok { color: #1f5a28; font-weight: 700; }
.syscheck td.bad { color: #8a2620; font-weight: 700; }
.syscheck td.warn { color: #7a4b00; font-weight: 700; }
.upload-box { border: 1px dashed var(--line); border-radius: 10px; padding: .8rem; margin-bottom: 1rem; }
.upload-box input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.upload-list { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .3rem; }
.upload-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .35rem .55rem; background: #f6f5f1; border-radius: 6px; font-size: .88rem; }
.upload-list .muted { margin-left: .4rem; }

/* v17 */
.rki-box { display: inline-flex; align-items: center; min-height: 1.75rem; margin: 0 0 .9rem; padding: 0 .7rem; background: #f70000; color: #000; font-weight: 700; font-size: .95rem; border-radius: 6px; line-height: 1.2; }
.rki-box-link { color: inherit; text-decoration: none; cursor: pointer; }
.rki-box-link:hover, .rki-box-link:focus-visible { text-decoration: underline; }
.btn-statement { margin-left: .35rem; vertical-align: middle; }
h1 .btn-statement { font-size: .8rem; }
.statement-dialog { max-width: 760px; }
.statement-dialog .mail-frame { min-height: 70vh; }
.statement-cols { align-items: start; }
.statement-edit { margin: 1rem 0; }
.statement-edit > summary { display: inline-block; cursor: pointer; }
.statement-edit h3 { margin: 1rem 0 .4rem; font-size: .95rem; color: var(--accent, #122741); }
.st-rows { display: grid; gap: .35rem; }
.st-row { display: grid; grid-template-columns: 1fr 9rem auto; gap: .4rem; align-items: center; }
.st-row[hidden] { display: none; }
.st-row input { margin: 0; }
.st-vat { margin-top: .5rem; max-width: 14rem; }
.combo-row { display: flex; align-items: flex-end; gap: .6rem; flex-wrap: wrap; }
.combo { position: relative; flex: 1 1 22rem; max-width: 36rem; }
.combo label { display: block; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: .15rem 0 0; padding: .25rem 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(18,39,65,.18); max-height: 320px; overflow-y: auto; }
.combo-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .45rem .75rem; cursor: pointer; font: inherit; }
.combo-list button:hover, .combo-list button:focus, .combo-list button.is-active { background: #f1f0eb; outline: none; }
.combo-list .combo-sub { display: block; font-size: .8rem; color: #6b7480; }
.combo-list .combo-empty { padding: .45rem .75rem; color: #6b7480; font-size: .88rem; }
.creditor-dialog { max-width: 820px; max-height: 92vh; overflow-y: auto; }
.pre-row { grid-template-columns: 1fr 1fr auto; }
.pre-wrap { white-space: pre-wrap; }
.login-card form.login-help { margin: 1.1rem 0 .4rem; }
.pay-box + .hint { margin-top: .9rem; }

/* v17.2 (punkt 178): blyant ved "Sagsmappe Drive" */
.drive-group { display: inline-flex; }
.drive-group .btn-drive:first-child { border-radius: 8px 0 0 8px; }
.drive-group .btn-icon { border-radius: 0 8px 8px 0; margin-left: -1px; padding-left: .65rem; padding-right: .65rem; }

/* v17.2 (punkt 159): brevsider som popup på sagssiden */
dialog.popup-frame-dialog { width: min(1180px, 96vw); height: 92vh; max-height: 92vh; padding: 0; border: 0; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
dialog.popup-frame-dialog:not([open]) { display: none; }
dialog.popup-frame-dialog::backdrop { background: rgba(18, 39, 65, .45); }
.popup-frame-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
dialog.popup-frame-dialog iframe { flex: 1; width: 100%; border: 0; background: var(--bg, #f4f5f2); }
body.popup .main { margin: 0; max-width: none; padding: 1rem 1.25rem; }
body.popup .page-head .actions a[href*="case.php"] { display: none; }

/* v17.2 (punkt 169/184): automatisk påkrav og ubetalte fakturaer */
.tl-auto { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.auto-pakrav { margin-top: .6rem; }
.unpaid-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.2rem; padding: .8rem 1rem;
  background: var(--danger-soft); border: 1px solid #efc4c0; border-radius: 10px; color: var(--danger); }
.unpaid-box p { margin: 0; }
.unpaid-box strong { color: #8a2620; }
.bp-dialog.wide-dialog { width: min(1100px, calc(100vw - 2rem)); max-width: none; }
.danger-text { color: var(--danger); font-weight: 600; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.remind-row { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; }
.remind-row label { margin: 0; }

/* v17.2 (punkt 161–192): portalen */
.upcoming-list { list-style: none; margin: 0; padding: 0; }
.upcoming-list li { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.upcoming-list li:first-child { border-top: 0; }
.upcoming-date { font-weight: 700; }
.upcoming-list .sub { display: block; }
@media (max-width: 640px) { .upcoming-list li { grid-template-columns: 1fr; gap: .2rem; } }
.claim-dl { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: .8rem 0 .3rem; }
.claim-dl dt { font-weight: 600; }
.claim-dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.action-card { border-left: 4px solid var(--warn); }
.action-list, .msg-list { list-style: none; margin: 0; padding: 0; }
.action-list li, .msg-list li { padding: .6rem 0; border-top: 1px solid var(--line); }
.action-list li:first-child, .msg-list li:first-child { border-top: 0; }
.msg-item { padding: .8rem 0; border-top: 1px solid var(--line); }
.msg-item:first-of-type { border-top: 0; }
.msg-body { white-space: normal; margin: .35rem 0; padding: .5rem .7rem; background: var(--bg, #f5f4f1); border-radius: 6px; }
.info-line { margin: 0 0 1rem; }
.earn-total { font-weight: 700; font-size: 1.05rem; }
.earn-card h3 { margin: 1rem 0 .4rem; font-size: 1rem; }
/* v17.2 (punkt 186): datofelter som dd.mm.åååå */
.dmy-wrap { position: relative; display: flex; align-items: stretch; width: 100%; }
.dmy-wrap .dmy-text { flex: 1; min-width: 0; padding-right: 2.4rem; }
.dmy-wrap .dmy-native { position: absolute; right: 0; bottom: 0; width: 2.2rem; height: 100%; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.dmy-btn { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1; padding: .3rem; opacity: .75; }
.dmy-btn:hover, .dmy-btn:focus-visible { opacity: 1; }
.bulk-date .dmy-wrap, .filters .dmy-wrap { width: auto; min-width: 9.5rem; }
/* v17.2 punkt 215: sortérbar kolonneoverskrift */
.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort:hover { text-decoration: underline; }
.dl-all { margin-top: 8px; }
.h1-sub { font-size: .6em; font-weight: 500; color: var(--muted, #667); }
.konkurs-close { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #e3e6ea); }
/* v17.2 punkt 200: vores svar på en besked */
.msg-reply { margin-top: 6px; padding: 8px 10px; border-left: 3px solid var(--ok, #2e7d4f); background: var(--ok-soft); border-radius: 4px; }
/* v17.2 punkt 213: Forlig */
.forlig-table .num-input { width: 8rem; text-align: right; padding: .3rem .5rem; }
.fl-check { font-weight: 600; }
.fl-ok { color: #2f7d4f; }
.fl-bad { color: #a12a22; }
.forlig-notice .inline { margin-top: .5rem; }
/* v17.2 punkt 216: udlæg – vejledning */
.inline-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .35rem 0; }
.ug-box { margin-top: 1rem; }
.case-actions-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1rem; }
.tabs-row { display: flex; gap: .5rem; margin: 0 0 1rem; }
/* v17.2 punkt 223/236: ekstra rækker i Saldo-tabellen */
.balance tfoot tr.bal-extra th { border-top: none; font-weight: 600; }
.balance tfoot tr.bal-first th { padding-top: .9rem; }
.balance tfoot tr.bal-sub th:first-child { font-weight: 500; padding-left: 1.4rem; }
.qm { display: inline-flex; width: 17px; height: 17px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; margin-left: 4px; vertical-align: 1px; cursor: help; position: relative; }
.qm-tip { position: absolute; z-index: 60; background: var(--accent); color: #fff; padding: .6rem .8rem; border-radius: 8px; font-size: .85rem; font-weight: 400; line-height: 1.4; width: 320px; max-width: 80vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); text-align: left; }
/* v17.2 punkt 235: afregning */
.afr-card > summary { cursor: pointer; list-style: none; }
.afr-card > summary::-webkit-details-marker { display: none; }
.afr-line { display: grid; grid-template-columns: 1fr 170px 240px; gap: 1rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--line, #e3e6ea); }
.afr-title { font-weight: 700; }
.afr-texts { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .35rem; }
.afr-tag { background: #f4f1ea; padding: .25rem .5rem; border-radius: 6px; font-size: .9rem; }
.afr-edit { display: inline-block; }
.afr-edit > summary { list-style: none; cursor: pointer; }
.afr-edit > summary::-webkit-details-marker { display: none; }
.afr-edit .if-open { display: none; }
.afr-edit[open] .if-open { display: inline; }
.afr-edit[open] .if-closed { display: none; }
.afr-edit-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-top: .35rem; }
.afr-edit-form label { margin: 0; font-size: .85rem; }
.afr-edit-form input { min-width: 22rem; }
.afr-amt { text-align: right; font-weight: 700; font-size: 1.1rem; }
.afr-nr { width: 100px; padding: .2rem .4rem; }
@media (max-width: 800px) { .afr-line { grid-template-columns: 1fr; } .afr-amt { text-align: left; } }
.afr-filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .8rem; }
.afr-export { margin-left: auto; }
.afr-day { margin: 1rem 0 .4rem; }
.row-void td { color: var(--muted, #667); text-decoration: line-through; }
.afr-bulk { margin-top: .8rem; align-items: center; gap: .8rem; }
.balance tfoot tr.bal-gap th { padding-top: .9rem; }
/* 234: Vælg din adgangskode */
.pw-choose { max-width: 460px; }
.pw-choose .pw-steps { margin: 4px 0 14px 20px; padding: 0; }
.pw-choose .pw-steps li { margin: 3px 0; }
.pw-choose label { display: block; margin-bottom: 10px; }
.pw-choose input[type=password] { width: 100%; }
/* 238: masse-handlinger */
.bulk-op select { margin-left: 6px; }
.bulk-confirm .bulk-list { max-height: 260px; overflow: auto; margin-bottom: 10px; }
.bulk-skiplist { margin: 4px 0 12px 18px; padding: 0; color: var(--muted, #6b7280); }
.bulk-skiplist li { margin: 2px 0; }
.bulk-result .bulk-ok td:last-child { color: #166534; }
.bulk-result .bulk-skip td:last-child { color: #9a3412; }
/* 254: Afregninger som bokse pr. dag */
.afr-day-bar { margin: 1.4rem 0 .3rem; padding: .6rem .9rem; background: #122741; color: #fff; border-radius: 8px; font-size: 1rem; }
.afr-case { margin: 1rem 0 .35rem .25rem; font-size: .9rem; color: #475569; }
/* 259: udførte trin i afregningen markeres med gult */
.afr-line-done { background: #fdf1c7; border-left: 5px solid #e0b100; border-radius: 8px; padding: .8rem .75rem; margin: .25rem -.75rem; border-top-color: transparent; }
.btn.btn-done { background: #e0b100; border-color: #c89d00; color: #1f2937; }
.btn.btn-done:hover { background: #cfa300; }
/* 262: "Hent" ved siden af filer der åbnes i ny fane */
.dl-link { font-size: .85em; margin-left: .25rem; color: var(--muted, #6b7280); }
/* 256: tilgodehavende-linjerne i administratorens "Økonomisk oversigt" */
.table.kv .bal-extra th:first-child { white-space: normal; }
.table.kv .bal-extra th.num { white-space: nowrap; }
/* 248/247: Overblik */
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.status-phases { display: block; }
.status-strip-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .5rem; }
.status-phase { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .35rem 0; }
.status-phase-label { width: 160px; flex: none; font-size: .85rem; font-weight: 600; color: var(--ink-2, #475569); }
/* 244: lave rækker i admins sagslister – opfølgningsteksten vises, når man holder musen over datoen */
.cases-compact .table td { padding-top: .3rem; padding-bottom: .3rem; }
.cases-compact .table td.cell-name { white-space: nowrap; max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.cases-compact .table td .sub { display: none; }
.cases-compact .table td span[title] { cursor: help; }
/* 245: kolonneoverskrifterne bliver stående, når man scroller */
@media (min-width: 900px) {
  .cases-compact { overflow: visible; }
  .cases-compact .table thead th { position: sticky; top: 0; z-index: 2; background: var(--card, #fff); box-shadow: 0 1px 0 var(--line, #e3e6ea); }
}
/* 246: hurtigfiltre */
.quick-filters { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
/* 240: afregning som én linje øverst */
.afr-bar { display: flex; align-items: center; gap: 1rem; background: #fff8e1; border: 1px solid #f0d58a; border-radius: 10px; padding: .6rem 1rem; margin: 0 0 1rem; font-weight: 600; }
.afr-bar .btn { margin-left: auto; }
.afr-section > .afr-card { margin-top: .8rem; }
/* 242: kun "Kun internt" får et (gult) mærke; filterknapper */
/* v17.2 punkt 272: grøn "Kun internt" og blå "Kunde & Bogholder" til venstre for datoen (kun admin) */
.tag.vis-internal { background: #15803d; color: #fff; font-weight: 700; border-radius: 999px; padding: .05rem .55rem; margin-right: .3rem; }
.tag.vis-cb { background: #1d4ed8; color: #fff; font-weight: 700; border-radius: 999px; padding: .05rem .55rem; margin-right: .3rem; }
.tl-chips { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.tl-chip { border: 1px solid var(--line, #cbd5e1); background: #fff; border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; cursor: pointer; color: var(--ink, #1f2937); }
.tl-chip.on { background: #122741; border-color: #122741; color: #fff; }
.tl-chips .btn { margin-left: .4rem; }
#dlg-status, #dlg-note { width: min(560px, 94vw); }
.status-phase { flex-wrap: nowrap; align-items: flex-start; }
.status-phase-label { padding-top: .3rem; }
.status-phase-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
/* 268: CVR-mærker og Overblik-boksen */
.cvr-flag { display: inline-block; background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; border-radius: 999px; padding: .1rem .55rem; font-size: .76rem; font-weight: 700; margin-left: .4rem; vertical-align: middle; white-space: nowrap; cursor: help; }
.info-flag .cvr-flag { margin: .3rem 0 0; }
.cvr-alerts { border: 2px solid #f87171; background: #fff5f5; }
.cvr-alerts h2 { color: #b91c1c; }
.cvr-alert-list { list-style: none; margin: 0; padding: 0; }
.cvr-alert-list li { padding: .45rem 0; border-top: 1px solid #fecaca; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.cvr-alert-list li:first-child { border-top: 0; }
.cvr-alert-list form { margin-left: auto; }
.afr-cvr-warn { margin: .5rem 0 0; }

/* v17.2 punkt 282: kunde-/bogholderlister – én linje pr. sag, ingen afskårne kolonner */
.portal-compact .table { font-size: .9rem; }
.portal-compact .table td, .portal-compact .table th { padding-left: .5rem; padding-right: .5rem; vertical-align: middle; }
.portal-compact .table th { white-space: nowrap; }
.portal-compact .table td.cell-name { white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.portal-compact .table td.num, .portal-compact .table td:first-child { white-space: nowrap; }
.portal-compact .table td .badge { white-space: normal; line-height: 1.25; display: inline-block; max-width: 210px; }
.portal-compact .table td .sub { font-size: .75rem; white-space: nowrap; }
.latest-more { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .6rem; font-size: .92rem; flex-wrap: wrap; }
.latest-more a { font-weight: 700; }

/* v17.2 punkt 273: Skyldners aktiver (kun internt) */
.asset-box { margin-top: .9rem; border: 1px solid #cbd5e1; border-radius: 10px; padding: .6rem .7rem; background: #f8fafc; }
.asset-box .asset-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.asset-box h3 { margin: 0; font-size: .95rem; }
.asset-box textarea { width: 100%; box-sizing: border-box; min-height: 70px; font-size: .88rem; }
.asset-box .asset-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .35rem; font-size: .78rem; }

/* v17.2 punkt 274: søgning i tidslinjen */
tr.tl-hit-row td { padding-top: 0 !important; border-top: 0 !important; }
.tl-hit { font-size: .8rem; color: #64748b; padding: 0 0 .35rem; }
.tl-hit mark { background: #fde68a; color: #111; border-radius: 3px; padding: 0 .1rem; }
.tl-hit .tag { font-size: .68rem; }
.also-found { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 8px; padding: .45rem .7rem; margin: .4rem 0 .6rem; font-size: .9rem; }
.also-found a { font-weight: 700; }

/* v17.2 punkt 276: acceptér/afvis tilbud i portalen */
.offer-answer { border: 2px solid #15803d; border-radius: 10px; padding: .8rem; background: #f0fdf4; margin: .6rem 0; }
.offer-answer .check { display: flex; gap: .5rem; align-items: flex-start; margin: 0 0 .7rem; font-size: .92rem; }
.btn.btn-accept { background: #15803d; color: #fff; border-color: #15803d; font-weight: 700; }
.btn.btn-decline { background: #fff; color: #b91c1c; border: 1px solid #b91c1c; }
.plan-late { color: #b91c1c; font-weight: 700; }
.pay-plan-note { background: #fff7ed; border-left: 3px solid #c2410c; padding: .4rem .6rem; border-radius: 6px; }

/* v17.2 punkt 288: Saldo-bunden hos kunde/bogholder */
.sum-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.sum-tile { border-radius: 10px; padding: .75rem .9rem; border: 1px solid #e2e8f0; background: #f8fafc; }
.sum-tile .lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 700; }
.sum-tile .amt { font-size: 1.4rem; font-weight: 800; margin-top: .15rem; }
.sum-tile .note { font-size: .8rem; color: #64748b; margin-top: .2rem; line-height: 1.35; }
.sum-tile.green { background: #f0fdf4; border-color: #bbf7d0; } .sum-tile.green .amt { color: #166534; }
.sum-tile.blue { background: #eff6ff; border-color: #bfdbfe; } .sum-tile.blue .amt { color: #1e3a8a; }
.sum-tile.wide { grid-column: 1 / -1; }
.sum-paid { font-size: .85rem; color: #475569; margin: .5rem 0 0; }
@media (max-width: 640px) { .sum-tiles { grid-template-columns: 1fr; } }
.offer-decline { margin: .2rem 0 .9rem; }

/* v17.2 punkt 290: login overblik (kun visning) */
.view-as-bar { position: sticky; top: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: #fde68a; color: #78350f; border: 1px solid #f59e0b; border-radius: 10px; padding: .55rem .9rem; margin: 0 0 1rem; font-size: .92rem; }
.view-as-bar .muted { color: #92400e; }
.view-as-form { display: inline; margin-left: .4rem; }

/* v17.2 punkt 300: "heraf N i overvågning" under Åbne sager */
.kpi-sub { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
/* v17.2 punkt 296: lange statusser i sagslister brydes over flere linjer, så tabellen bliver inde i kortet */
.table td .badge { white-space: normal; max-width: 300px; line-height: 1.3; border-radius: .7rem; vertical-align: middle; }
/* v17.2 punkt 316: "Klient"/"Skyldner" på sagen er links */
.box-title-link { color: inherit; text-decoration: none; }
.box-title-link:hover { text-decoration: underline; }
/* v17.2 punkt 317: kundens sagsnr. i toplinjen */
.h1-ref { font-size: .9rem; font-weight: 400; margin-left: .25rem; vertical-align: middle; }
.h1-ref strong { font-weight: 600; }
/* v17.2 punkt 326: "Kundens tilgodehavende" er en lille grå mellemoverskrift (ikke en række uden beløb) */
.table.kv tr.bal-extra.bal-head th { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: .9rem; padding-bottom: .2rem; border-top: none; border-bottom: none; }
.table.kv tr.bal-extra.bal-head + tr th { border-top: none; }
/* v17.2 punkt 328: på mobil viser saldo-tabellen kun Post og Restgæld (Pålagt/Betalt skjules), så intet skæres af */
@media (max-width: 640px) {
  .table.balance thead th:nth-child(2), .table.balance thead th:nth-child(3),
  .table.balance tbody td:nth-child(2), .table.balance tbody td:nth-child(3),
  .table.balance tfoot tr:first-child th:nth-child(2), .table.balance tfoot tr:first-child th:nth-child(3) { display: none; }
}
/* v17.2 punkt 324: hurtigsøgning øverst i menuen */
.nav-search { margin: .2rem 0 .8rem; }
.nav-search input { width: 100%; padding: .45rem .65rem; border-radius: .5rem; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: .88rem; }
.nav-search input::placeholder { color: rgba(255,255,255,.55); }
.nav-search input:focus { outline: none; border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.12); }
