/* Finvo webapp - design tokens og basis */

:root {
    color-scheme: light;

    --page:           #f7f6f2;
    --surface:        #ffffff;
    --surface-sunken: #f1f0ea;
    --text-primary:   #14171c;
    --text-secondary: #52514e;
    --text-muted:     #8b8a83;
    --border:         rgba(20, 23, 28, 0.11);
    --hairline:       #e5e3da;

    --ink:            #0f1b30;
    --ink-strong:     #0a1322;
    --on-ink:         #f4f6fb;
    --on-ink-muted:   rgba(244, 246, 251, 0.62);
    --on-ink-border:  rgba(244, 246, 251, 0.14);

    --accent:         #1f4fa3;
    --accent-strong:  #163a7c;
    --accent-wash:    rgba(31, 79, 163, 0.08);

    --danger:         #c53434;
    --danger-wash:    rgba(197, 52, 52, 0.08);
    --success:        #1a7a3d;
    --success-wash:   rgba(26, 122, 61, 0.10);
    --warn:           #a6650c;
    --warn-wash:      rgba(166, 101, 12, 0.10);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(15, 27, 48, 0.05), 0 1px 1px rgba(15, 27, 48, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 27, 48, 0.08), 0 2px 6px rgba(15, 27, 48, 0.04);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --page:           #0c0d10;
        --surface:        #17181c;
        --surface-sunken: #131417;
        --text-primary:   #f3f3f1;
        --text-secondary: #c3c2b7;
        --text-muted:     #8f8e87;
        --border:         rgba(255, 255, 255, 0.11);
        --hairline:       #2a2b2f;

        --on-ink-border:  rgba(244, 246, 251, 0.14);

        --accent:         #5c93e0;
        --accent-strong:  #7dabe8;
        --accent-wash:    rgba(92, 147, 224, 0.14);

        --danger:         #e5726b;
        --danger-wash:    rgba(229, 114, 107, 0.12);
        --success:        #4fbb7a;
        --success-wash:   rgba(79, 187, 122, 0.12);
        --warn:           #d29a4a;
        --warn-wash:      rgba(210, 154, 74, 0.12);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--page);
    color: var(--text-primary);
    font-family: -apple-system, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.005em; margin: 0 0 12px; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Sidelayout (topbar/indhold vokser, footer forbliver nederst) ---------- */

.app-frame {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

.app-frame > main { flex: 1 0 auto; }
.app-frame > .auth-wrap { flex: 1 0 auto; min-height: 0; }

/* ---------- Logo-mærke (topbar, footer, auth-sider) ---------- */

.logo-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.logo-mark .mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
}

.logo-mark .word {
    font-size: 18px;
    font-weight: 750;
    letter-spacing: -0.01em;
    color: inherit;
}

.logo-mark-lg .mark { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }
.logo-mark-lg .word { font-size: 21px; }

/* ---------- Login / fejlsider ---------- */

.auth-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 16px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
}

.auth-card .brand { margin-bottom: 20px; }
.auth-sub { color: var(--text-secondary); margin: 0 0 20px; }
.auth-foot { color: var(--text-muted); font-size: 13px; margin: 0; }

.auth-card label {
    display: block;
    font-size: 13px;
    font-weight: 550;
    color: var(--text-secondary);
    margin: 14px 0 4px;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card select {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text-primary);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

.auth-card input:focus,
.auth-card select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}

/* Opret konto / bekræft e-mail */
.auth-card-wide { max-width: 440px; }
.auth-card .label-hint { font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.auth-divider { border: 0; border-top: 1px solid var(--border); margin: 22px 0 6px; }
.auth-card label.auth-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
}
.auth-note { color: var(--text-secondary); font-size: 14px; margin: 0 0 16px; }
.auth-alt { color: var(--text-secondary); font-size: 14px; text-align: center; margin: 20px 0 0; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn-primary {
    width: 100%;
    margin-top: 20px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background-color .15s, box-shadow .15s, transform .05s;
}

.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(1px); }

.btn-link { color: var(--accent); text-decoration: none; font-weight: 550; }
.btn-link:hover { text-decoration: underline; }

/* Nedtonet knap til en sekundær handling under en primær CTA (fx "Gem som kladde"). */
.btn-subtle {
    display: block;
    width: 100%;
    margin: 0;
    padding: 4px;
    font: inherit;
    font-size: 13px;
    text-align: center;
    color: var(--text-muted);
    background: none;
    border: 0;
    cursor: pointer;
    transition: color .15s;
}

.btn-subtle:hover { color: var(--accent); text-decoration: underline; }

.alert {
    background: var(--danger-wash);
    border-left: 3px solid var(--danger);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 10px 12px;
    margin: 0 0 8px;
    font-size: 14px;
}

/* ---------- Topbar ---------- */

.topbar {
    background: var(--ink);
    border-bottom: 1px solid var(--ink-strong);
}

.topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar .logo-mark .word { color: var(--on-ink); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.user-name { color: var(--on-ink-muted); font-size: 14px; }

.org-form { display: flex; align-items: center; gap: 6px; }

.org-form select {
    font: inherit;
    font-size: 13px;
    color: var(--on-ink);
    background: rgba(244, 246, 251, 0.06);
    border: 1px solid var(--on-ink-border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    max-width: 220px;
}

.btn-ghost {
    display: inline-block;
    font: inherit;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background-color .15s;
}

.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); background: var(--surface-sunken); }

.topbar .btn-ghost {
    color: var(--on-ink-muted);
    background: transparent;
    border-color: var(--on-ink-border);
}

.topbar .btn-ghost:hover { color: var(--on-ink); border-color: rgba(244, 246, 251, 0.34); background: rgba(244, 246, 251, 0.06); }

/* ---------- Nav ---------- */

.nav {
    display: flex;
    gap: 2px;
    flex: 1;
    flex-wrap: wrap;
}

.nav a {
    color: var(--on-ink-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 550;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: color .15s, background-color .15s;
}

.nav a:hover { color: var(--on-ink); background: rgba(244, 246, 251, 0.08); }
.nav a.active { color: #fff; background: var(--accent); }

/* ---------- Sider ---------- */

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px 56px;
    width: 100%;
}

.page-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 20px; }

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 12px;
    margin: 20px 0 24px;
}

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.tile-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.tile-value { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.card th {
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--hairline);
}

.card td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--hairline);
}

.card tbody tr:last-child td { border-bottom: 0; }
.card tbody tr:hover td { background: var(--surface-sunken); }

/* Hele raekker/linjer der aabner en detaljeside ved klik - se app.js. */
[data-href] { cursor: pointer; }

.card .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.empty { color: var(--text-muted); margin: 0; }

/* ---------- Sideskift (paginering) ---------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pager-status {
    color: var(--text-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.pager .pager-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.alert-success {
    background: var(--accent-wash);
    border-left-color: var(--accent);
}

/* ---------- Sidehoved / handlinger ---------- */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-head h1 { margin-bottom: 0; }
.page-head .page-sub { margin: 4px 0 0; }

.page-actions { display: flex; gap: 8px; }

.card + .card { margin-top: 16px; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 650;
    padding: 3px 9px;
    border-radius: 999px;
}

.badge-ok    { color: var(--success); background: var(--success-wash); }
.badge-warn  { color: var(--warn); background: var(--warn-wash); }
.badge-muted { color: var(--text-muted); background: var(--surface-sunken); }

.row-muted { opacity: 0.55; }

/* Klikbar betalingsstatus (linker til betalingssiden) */
a.badge { text-decoration: none; }
a.badge:hover { text-decoration: underline; }

/* ---------- Betalinger paa en faktura ---------- */

.payment-summary { display: flex; flex-wrap: wrap; gap: 24px 40px; }
.payment-summary-value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.payments-table .actions { text-align: right; white-space: nowrap; }
.payments-table .actions form { display: inline; }
.payment-reversed td, .plain-list li.payment-reversed { color: var(--text-muted); }
.payment-reversed .amount { text-decoration: line-through; }
.btn-danger.btn-inline { width: auto; padding: 5px 12px; font-size: 13px; }

/* ---------- Generiske formularer ---------- */

.form label {
    display: block;
    font-size: 13px;
    font-weight: 550;
    color: var(--text-secondary);
    margin: 0 0 4px;
}

.form input[type="text"],
.form input[type="number"],
.form input[type="date"],
.form input[type="file"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="search"],
.form select {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text-primary);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

.form input:focus,
.form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 5px 0 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 16px;
    margin-bottom: 16px;
}

.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }

.filter-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-form > div { min-width: 160px; }
.filter-submit { padding-bottom: 1px; }

.btn-primary.btn-inline { width: auto; margin-top: 0; display: inline-block; text-decoration: none; text-align: center; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0 16px;
}

.checkbox-label input { width: auto; }

/* ---------- Kundevælger (fakturaformular) ---------- */

.customer-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.customer-search-row input { flex: 1; }
.customer-search-row .btn-ghost { white-space: nowrap; }

.customer-results { margin-top: 8px; }

.customer-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    font: inherit;
    color: var(--text-primary);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s;
}

.customer-result + .customer-result { margin-top: 6px; }

.customer-result:hover {
    border-color: var(--accent);
}

.customer-selected {
    margin: 8px 0 0;
    font-weight: 600;
    color: var(--accent-strong);
}

/* ---------- Fakturaformular ---------- */

.invoice-shell {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 860px) {
    .invoice-shell { grid-template-columns: 1fr; }
    .invoice-sidebar { order: -1; }
}

.invoice-sidebar {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.invoice-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.invoice-line {
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.invoice-line-desc {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.form .invoice-line-desc input[type="text"] {
    flex: 1;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    border-radius: 0;
    padding: 4px 0 6px;
    font-size: 15px;
    font-weight: 550;
}

.form .invoice-line-desc input[type="text"]:focus {
    box-shadow: none;
    border-bottom-color: var(--accent);
}

.invoice-line-drag {
    flex-shrink: 0;
    cursor: grab;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 4px;
    touch-action: none;
}

.invoice-line-drag:active { cursor: grabbing; }

.invoice-line.is-dragging { opacity: .4; }
.invoice-line.drag-over-top { box-shadow: inset 0 2px 0 var(--accent); }
.invoice-line.drag-over-bottom { box-shadow: inset 0 -2px 0 var(--accent); }

.invoice-line-remove,
.ledger-row-remove {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    color: var(--danger);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.invoice-line-remove:hover:not(:disabled),
.ledger-row-remove:hover:not(:disabled) { background: var(--danger-wash); border-color: var(--danger); }
.invoice-line-remove:disabled,
.ledger-row-remove:disabled { opacity: .35; cursor: not-allowed; }

.invoice-line-meta {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

@media (max-width: 900px) { .invoice-line-meta { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .invoice-line-meta { grid-template-columns: repeat(2, 1fr); } }

.invoice-line-meta label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.form .invoice-line-meta input,
.form .invoice-line-meta select {
    padding: 7px 8px;
    font-size: 13px;
}

.invoice-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin: 4px 0 16px;
    padding-top: 16px;
    border-top: 1px solid var(--hairline);
}

.invoice-totals-row {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    min-width: 220px;
    font-size: 14px;
    color: var(--text-secondary);
}

.invoice-totals-row.is-final {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    border-top: 1px solid var(--hairline);
    padding-top: 6px;
    margin-top: 2px;
}

.invoice-totals-note {
    font-size: 12px;
    color: var(--text-muted);
    margin: 2px 0 0;
}

/* ---------- Vedhæft fil (faktura + kasseklade) ---------- */

.file-drop {
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    text-align: center;
    background: var(--page);
    transition: border-color .15s, background-color .15s;
}

.file-drop.is-dragover { border-color: var(--accent); background: var(--accent-wash); }

.file-drop-title { font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.file-drop-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }

.file-drop-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; text-align: left; }

.file-drop-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.file-drop-list li + li { margin-top: 4px; }

.file-drop-list button {
    border: 0;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px;
}

.file-drop-list button:hover { color: var(--danger); }

/* ---------- Modal ---------- */

dialog.modal {
    width: min(640px, calc(100vw - 32px));
    padding: 20px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

dialog.modal::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.plain-list li:last-child { border-bottom: 0; }

/* ---------- Fakturapapir (oprettelse + detaljevisning) ----------
   Papiret er altid lyst - ogsaa i moerkt tema - som et dokument-preview.
   Tokens nulstilles til deres lyse vaerdier herinde, saa formularfelter
   (kontaktsøgning m.m.) ogsaa ser rigtige ud oven paa den hvide baggrund. */

.invoice-paper {
    --page:           #f7f6f2;
    --surface:        #ffffff;
    --surface-sunken: #f1f0ea;
    --text-primary:   #14171c;
    --text-secondary: #52514e;
    --text-muted:     #8b8a83;
    --border:         rgba(20, 23, 28, 0.11);
    --hairline:       #e5e3da;
    --accent:         #1f4fa3;
    --accent-strong:  #163a7c;
    --accent-wash:    rgba(31, 79, 163, 0.08);

    background: #ffffff;
    color: #14171c;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 44px 48px;
    font-size: 14px;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .invoice-paper { padding: 24px 20px; }
}

.paper-label {
    display: block;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b8a83;
    margin-bottom: 2px;
}

.paper-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 24px;
    margin-bottom: 36px;
}

@media (max-width: 560px) {
    .paper-top { grid-template-columns: 1fr; }
    .paper-sender { text-align: left; }
    .paper-logo { margin: 0 0 10px 0; }
}

.paper-recipient strong { display: block; font-size: 15px; margin-bottom: 2px; }
.paper-recipient div { color: #52514e; }
.paper-recipient .field-hint { color: #8b8a83; }

.paper-sender { text-align: right; color: #52514e; }

.paper-org-name {
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -0.01em;
    color: #14171c;
    margin-bottom: 4px;
}

.paper-meta {
    display: flex;
    gap: 32px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.paper-number { margin-left: auto; text-align: right; }
.paper-number-value { font-size: 22px; font-weight: 750; }

.paper-title {
    font-size: 17px;
    font-weight: 700;
    padding-bottom: 8px;
    border-bottom: 2px solid #14171c;
    margin-bottom: 0;
}

.paper-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}

.paper-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 650;
    color: #8b8a83;
    padding: 10px 8px 6px;
    border-bottom: 1px solid #e7e5dd;
}

.paper-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #efede6;
    vertical-align: top;
}

.paper-table .num { text-align: right; white-space: nowrap; }

.paper-line-meta {
    font-size: 12px;
    color: #8b8a83;
    margin-top: 2px;
}

.paper-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin: 12px 0 28px;
}

.paper-total-row {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    min-width: 260px;
    color: #52514e;
}

.paper-total-final {
    font-size: 16px;
    font-weight: 750;
    color: #14171c;
    border-top: 2px solid #14171c;
    padding-top: 6px;
    margin-top: 4px;
}

.paper-terms { color: #52514e; }
.paper-terms p { margin: 0 0 6px; }

.paper-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid #e7e5dd;
    text-align: center;
    font-size: 13px;
    color: #52514e;
}

.invoice-sidebar .card h2 { margin-bottom: 8px; }
.sidebar-action { margin-top: 8px; }
.invoice-sidebar .btn-ghost { width: 100%; }
.invoice-sidebar a.sidebar-action { display: block; }

.form textarea {
    width: 100%;
    padding: 9px 10px;
    font: inherit;
    color: var(--text-primary);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    resize: vertical;
}

.form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}

.btn-danger {
    display: inline-block;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: var(--danger);
    background: var(--surface);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    cursor: pointer;
    transition: background-color .15s;
}

.btn-danger:hover { background: var(--danger-wash); }
.invoice-sidebar .btn-danger { width: 100%; }

/* ---------- "Ny postering": valg af posteringstype ---------- */

.type-menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

@media (max-width: 640px) {
    .type-menu { grid-template-columns: 1fr; }
}

.type-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s, transform .1s;
}

.type-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.type-card h2 { margin: 0 0 4px; font-size: 15px; }
.type-card .page-sub { margin: 0; }

.line-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }

.line-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: 6px 8px;
    border-bottom: 1px solid var(--hairline);
}

.line-table td { padding: 5px 8px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.line-table tbody tr:last-child td { border-bottom: 0; }
.line-table tbody tr:hover td { background: var(--surface-sunken); }
.line-table input.num { text-align: right; }

.line-table th.line-num,
.line-table td.line-num {
    width: 26px;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.line-table th.line-actions,
.line-table td.line-actions { width: 34px; }

.form .line-table input,
.form .line-table select { padding: 7px 8px; font-size: 13px; }

.line-table-actions { display: flex; gap: 8px; margin-bottom: 16px; margin-top: -8px; }

/* ---------- Kasseklade: saldo-indikator ---------- */

.ledger-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ledger-balance {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface-sunken);
    font-size: 13px;
    color: var(--text-secondary);
}

.ledger-balance-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.ledger-balance.is-balanced .ledger-balance-value { color: var(--success); }
.ledger-balance.is-unbalanced .ledger-balance-value { color: var(--danger); }

.ledger-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ---------- Footer ---------- */

.site-footer {
    flex-shrink: 0;
    background: var(--ink);
    color: var(--on-ink-muted);
    font-size: 13px;
}

.footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-row + .footer-row { border-top: 1px solid var(--on-ink-border); }

.footer-row-brand .footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 28px;
    padding-bottom: 22px;
}

.footer-logo .word { color: var(--on-ink); }

.footer-address {
    font-style: normal;
    text-align: right;
    line-height: 1.6;
}

.footer-row-contact .footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    padding-top: 16px;
    padding-bottom: 16px;
}

.footer-row-contact a {
    color: var(--on-ink);
    text-decoration: none;
}

.footer-row-contact a:hover { text-decoration: underline; }

.footer-row-links .footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding-top: 16px;
    padding-bottom: 28px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: -4px -10px;
}

.footer-links a {
    color: var(--on-ink-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: color .15s, background-color .15s;
}

.footer-links a:hover { color: var(--on-ink); background: rgba(244, 246, 251, 0.08); }

.footer-copy { margin: 0; }

@media (max-width: 640px) {
    .footer-row-brand .footer-inner { flex-direction: column; align-items: flex-start; }
    .footer-address { text-align: left; }
    .footer-row-links .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Organisationslogo ---------- */

.org-logo-preview {
    display: block;
    max-width: 220px;
    max-height: 80px;
    width: auto;
    height: auto;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 6px;
    border: 1px solid var(--border);
}

.paper-logo {
    display: block;
    max-width: 100%;
    max-height: 56px;
    width: auto;
    height: auto;
    margin: 0 0 10px auto;
}

/* ---------- Regnskab-dropdown i topbaren ---------- */

.nav-dropdown { position: relative; }

.nav-dropdown summary {
    list-style: none;
    cursor: pointer;
    color: var(--on-ink-muted);
    font-size: 14px;
    font-weight: 550;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: color .15s, background-color .15s;
    user-select: none;
}

.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { color: var(--on-ink); background: rgba(244, 246, 251, 0.08); }
.nav-dropdown summary.active { color: var(--on-ink); background: rgba(244, 246, 251, 0.12); }
.nav-dropdown .nav-caret { font-size: 10px; opacity: .7; }

.nav-dropdown .nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 60;
    display: flex;
    flex-direction: column;
}

.nav-dropdown .nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
}

.nav-dropdown .nav-menu a:hover { background: var(--surface-sunken); }
.nav-dropdown .nav-menu a.active { color: var(--accent); font-weight: 650; }

/* ---------- Rapportcenter: filter + faner + tabeller ---------- */

.report-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.report-filter-label {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-right: 6px;
    border-right: 1px solid var(--hairline);
}

.report-filter select,
.report-filter input[type="date"] {
    font: inherit;
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.report-tabs {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 20px;
}

.report-tab {
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 550;
    color: var(--text-muted);
    background: var(--surface-sunken);
    border: 1px solid var(--hairline);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 9px 16px;
    margin-bottom: -1px;
    transition: color .15s, background-color .15s;
}

.report-tab:hover { color: var(--text-primary); }

.report-tab.active {
    color: var(--accent);
    font-weight: 700;
    background: var(--surface);
    border-color: var(--border);
    border-bottom: 1px solid var(--surface);
}

.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.report-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 10px 8px;
    border-bottom: 1px solid var(--hairline);
}

.report-table td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); }
.report-table .num, .report-table th.num-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table .row-total td { font-weight: 650; }
.report-table .row-grand td { font-weight: 750; border-top: 2px solid var(--border); border-bottom-width: 2px; }
.report-table .ob-input { max-width: 120px; text-align: right; }

.report-sheet h3 { margin: 26px 0 8px; font-size: 15px; font-weight: 720; }
.report-sheet .report-text { color: var(--text-secondary); max-width: 70ch; }
.report-sheet-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.report-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

.row-selected td { background: var(--accent-wash); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.row-actions form { display: inline; }

.inline-form { margin-top: 16px; }
.inline-form summary { list-style: none; display: inline-block; cursor: pointer; }
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form form { margin-top: 14px; }

.badge-danger { color: var(--danger); background: var(--danger-wash); }

.attachment-item { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.attachment-preview {
    display: block;
    max-width: 100%;
    max-height: 420px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}
.attachment-preview-pdf { width: 100%; height: 560px; }

.btn-link.small { font-size: 12.5px; }

/* ---------- "Report changes / bugs": fast knap i hoejre side + modal ---------- */

.feedback-tab {
    position: fixed;
    right: 0;
    top: 50%;
    z-index: 80;
    writing-mode: vertical-rl;
    transform: translateY(-50%) rotate(180deg);
    margin: 0;
    padding: 14px 9px 14px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: .02em;
    white-space: nowrap;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: background-color .15s, opacity .15s;
}

.feedback-tab:hover { background: var(--accent-strong); }
.feedback-tab:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.feedback-tab:disabled { cursor: progress; opacity: .85; }
.feedback-tab .feedback-tab-busy { display: none; }
.feedback-tab.is-busy .feedback-tab-label { display: none; }
.feedback-tab.is-busy .feedback-tab-busy { display: inline; }

@media print {
    .feedback-tab { display: none; }
}

.feedback-modal { width: min(720px, calc(100vw - 32px)); }
.feedback-modal h2 { margin-bottom: 6px; }
.feedback-intro { color: var(--text-secondary); font-size: 14px; margin: 0 0 14px; }

.feedback-preview {
    margin-bottom: 14px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.feedback-preview img {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    object-position: top center;
}

.feedback-preview-status {
    margin: 0;
    padding: 18px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Admin: fejlrapporter ---------- */

.bug-description { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.bug-screenshot {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.meta-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    margin: 0;
    font-size: 14px;
}

.meta-grid dt { color: var(--text-muted); font-weight: 600; }
.meta-grid dd { margin: 0; overflow-wrap: anywhere; }
.bug-user-agent { font-size: 13px; color: var(--text-secondary); }

@media (max-width: 560px) {
    .meta-grid { grid-template-columns: 1fr; gap: 2px 0; }
    .meta-grid dd { margin-bottom: 8px; }
}
