

:root {
    --bf-bg: #37475b;
    --bf-surface: #ffffff;
    --bf-ink: #1c2531;
    --bf-muted: #5b6776;
    --bf-line: #d9dee5;
    --bf-accent: #37475b;
    --bf-accent-ink: #ffffff;
    --bf-error: #b3261e;
    --bf-error-bg: #fbeaea;
    --bf-error-line: #e7b7b4;
    --bf-ok: #1f7a3d;
    --bf-ok-soft: #7bc47f;
    --bf-warn: #e6b450;
    --bf-warn-ink: #6b5300;
    --bf-warn-bg: #fff6d6;
    --bf-warn-line: #f0d98a;
    --bf-surface-2: #f6f8fa;
    --bf-shade: rgba(0, 0, 0, 0.5);
    --bf-code-bg: rgba(0, 0, 0, 0.06);
    --bf-line-inverse: rgba(255, 255, 255, 0.25);
    --bf-radius: 10px;
    --bf-gap: clamp(16px, 4vw, 32px);
    --bf-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--bf-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--bf-ink);
    background: var(--bf-bg);
}

a { color: var(--bf-accent); }

#b2b_topbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px var(--bf-gap);
    background: var(--bf-surface);
    border-bottom: 1px solid var(--bf-line);
}

#b2b_topbar .brand { display: flex; }
#b2b_topbar .brand .b2b-logo { height: 30px; width: auto; display: block; }
#b2b_topbar .brand .logo-main path { fill: var(--bf-ink); stroke: var(--bf-ink); }
#b2b_topbar .brand .logo-accent path { fill: var(--bf-muted); }

#b2b_topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}
#b2b_topbar nav a { text-decoration: none; padding: 6px 4px; }
#b2b_topbar nav a:hover { text-decoration: underline; }
#b2b_topbar nav .b2b_nav_logout { color: var(--bf-muted); }

#b2b_nav_admin {
    align-items: baseline;
    gap: 8px 14px;
    padding-top: 8px;
    border-top: 1px solid var(--bf-line);
    font-size: 14px;
}
#b2b_nav_admin .b2b-nav-admin-label { color: var(--bf-muted); font-weight: 600; }

#b2b_content {
    max-width: 1320px;
    margin: var(--bf-gap) auto;
    padding: 0 var(--bf-gap);
}

.b2b-card,
.b2b-page {
    background: var(--bf-surface);
    border-radius: var(--bf-radius);
    padding: var(--bf-gap);
}

.b2b-login { max-width: 460px; margin: 0 auto; }

.b2b-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

h1 { font-size: clamp(1.3rem, 4vw, 1.7rem); margin: 0 0 .4em; }
h2 { font-size: 1.1rem; margin: 1.6em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--bf-line); }

.b2b-field { margin: 0 0 16px; }
.b2b-field label { display: block; font-weight: 600; margin-bottom: 4px; }
.b2b-field input,
.b2b-field textarea {
    width: 100%;
    padding: 12px;
    font: inherit;
    border: 1px solid var(--bf-line);
    border-radius: 8px;
}
.b2b-field textarea { min-height: 80px; resize: vertical; }
.b2b-field input:focus-visible,
.b2b-field textarea:focus-visible { outline: 2px solid var(--bf-accent); outline-offset: 1px; }

.b2b-field.b2b-check { display: flex; }
.b2b-field.b2b-check label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}
.b2b-field.b2b-check input[type="checkbox"] { width: auto; margin: 0; flex: none; }

.b2b-search { margin: 0 0 14px; }
.b2b-search input {
    width: 100%;
    max-width: 360px;
    padding: 10px 12px;
    font: inherit;
    border: 1px solid var(--bf-line);
    border-radius: 8px;
}

.b2b-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.b2b-error { color: var(--bf-error); font-weight: 600; }
.b2b-ok { color: var(--bf-ok); font-weight: 600; }
.b2b-empty { color: var(--bf-muted); }
.b2b-hint { color: var(--bf-muted); font-size: 14px; margin: 4px 0 0; }

.b2b-creative-preview { margin: 0 0 8px; }
.b2b-creative-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--bf-line);
    border-radius: 6px;
    background: var(--bf-surface-2);
}

.b2b-warn {
    margin: 6px 0 0;
    padding: 8px 10px;
    font-size: 14px;
    color: var(--bf-warn-ink);
    background: var(--bf-warn-bg);
    border: 1px solid var(--bf-warn-line);
    border-radius: var(--bf-radius);
}
.b2b-warn a { color: var(--bf-warn-ink); font-weight: 600; }
.b2b-warn code { background: var(--bf-code-bg); padding: 0 4px; border-radius: 4px; }

.upload-area { margin-bottom: 4px; }
.upload-area .upload-input { display: none; }
.upload-drop-zone {
    border: 2px dashed var(--bf-line);
    border-radius: var(--bf-radius);
    padding: 1.5em;
    text-align: center;
    cursor: pointer;
    color: var(--bf-muted);
    transition: border-color .2s, background .2s;
}
.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--bf-accent);
    background: var(--bf-surface-2);
}
.upload-drop-zone p { margin: 0; }
.upload-queue { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.upload-file {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--bf-line);
    border-radius: 6px;
    padding: 10px 12px;
}
.upload-file-name { font-weight: 600; }
.upload-file-size { font-size: 12px; color: var(--bf-muted); }
.upload-progress { width: 160px; height: 8px; background: var(--bf-line); border-radius: 6px; overflow: hidden; }
.upload-progress-bar { height: 100%; width: 0; background: var(--bf-accent); transition: width .3s; }
.upload-file-status { font-size: 12px; color: var(--bf-muted); }
.upload-notice { margin-top: 8px; padding: 8px 10px; border-radius: var(--bf-radius); font-size: 14px; }
.upload-notice-error { color: var(--bf-error); background: var(--bf-error-bg); border: 1px solid var(--bf-error-line); }

.b2b-btn {
    display: inline-block;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    color: var(--bf-accent-ink);
    background: var(--bf-accent);
    border: 0;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
}
.b2b-btn:hover { filter: brightness(1.08); }
.b2b-btn-small { padding: 6px 12px; font-size: .85rem; }

.b2b-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.b2b-pay-btn { width: 100%; text-align: center; }

/* .b2b-datalist: grid-erstatning for de gamle <table>-lister (svoren ed: ingen
   <table> på sitet). display:contents på head/body/row → alle celler bliver
   items i ÉT fælles grid, så overskrifter flugter med celler. Baggrund/kant på
   CELLERNE (rækken har ingen egen boks). Kolonner sættes pr. liste via
   --b2b-cols. ARIA-roller bærer tabel-semantikken. */
.b2b-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Admin-statistik: blok pr. annoncør; udløbne kampagner er collapsede som standard */
.b2b-adminstats-user { margin-top: 2.5rem; }
.b2b-adminstats-collapse { margin-top: 1rem; }
.b2b-adminstats-collapse > summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.25rem 0;
    user-select: none;
}
.b2b-adminstats-collapse .b2b-collapse-count { font-weight: 400; color: var(--bf-muted); }
.b2b-adminstats-collapse[open] > summary { margin-bottom: 0.5rem; }
.b2b-datalist {
    display: grid;
    grid-template-columns: var(--b2b-cols);
    align-items: stretch;
    min-width: 480px;
}
.b2b-datalist-head,
.b2b-datalist-body,
.b2b-datalist-foot,
.b2b-datalist-row { display: contents; }

.b2b-datalist-head > * ,
.b2b-datalist-row > * {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--bf-line);
}
.b2b-datalist-head > * {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--bf-muted);
    white-space: nowrap;
}
.b2b-datalist .num { text-align: right; white-space: nowrap; }
.b2b-datalist .b2b-rowactions { white-space: nowrap; }

/* Celle der spænder over to kolonner (faktura-fodens "Ekskl. moms" mv.) —
   erstatter det gamle colspan="2". */
.b2b-datalist .b2b-span2 { grid-column: span 2; }

/* Total-række: fremhæv cellerne (rækken har ingen egen boks pga. display:contents). */
.b2b-datalist .b2b-total > * { font-weight: 700; border-top: 2px solid var(--bf-line); }

/* Skjult feed-nyhed: dæmp cellerne (opacity kunne ikke ligge på selve rækken). */
.b2b-datalist .b2b-post-hidden > * { opacity: 0.55; }
.b2b-datalist .b2b-post-hidden > .b2b-rowactions { opacity: 1; }

.b2b-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 5vh 16px;
    overflow-y: auto;
    background: var(--bf-shade);
}
.b2b-modal {
    width: 100%;
    max-width: 560px;
    background: var(--bf-surface);
    border-radius: var(--bf-radius);
    padding: var(--bf-gap);
}
.b2b-modal h1 { margin-top: 0; }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5vh 16px;
    background: var(--bf-shade);
}
.modal-dialog {
    width: 100%;
    max-width: 420px;
    background: var(--bf-surface);
    border-radius: var(--bf-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--bf-gap);
    border-bottom: 1px solid var(--bf-line);
}
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-close {
    background: none;
    border: 0;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--bf-muted);
}
.modal-body { padding: var(--bf-gap); }

.bf-confirm-message { margin: 0 0 1.25rem; line-height: 1.35; }
.bf-confirm-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}
.bf-confirm-actions button {
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.bf-confirm-actions .bf-confirm-cancel { background: var(--bf-line); color: var(--bf-ink); }
.bf-confirm-actions .bf-confirm-ok { background: var(--bf-accent); color: var(--bf-accent-ink); }
.bf-confirm-actions button:hover { filter: brightness(1.08); }

#bf_boot_splash {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: var(--bf-bg);
    z-index: 1000;
}
#bf_boot_splash.is-open { display: grid; }
.bf-boot-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--bf-line-inverse);
    border-top-color: var(--bf-surface);
    border-radius: 50%;
    animation: bf-spin 0.8s linear infinite;
}
@keyframes bf-spin { to { transform: rotate(360deg); } }

.b2b-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 0 0 22px;
}
.b2b-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background: var(--bf-surface-2);
    border: 1px solid var(--bf-line);
    border-radius: var(--bf-radius);
}
.b2b-kpi-val { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--bf-ink); }
.b2b-kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bf-muted); }

.b2b-trend { margin: 0 0 8px; }
.b2b-trend-svg { display: block; width: 100%; height: 120px; }
.b2b-trend-area { fill: var(--bf-accent); opacity: .12; }
.b2b-trend-line { fill: none; stroke: var(--bf-accent); stroke-width: 2; vector-effect: non-scaling-stroke; }

.b2b-spark { display: inline-block; vertical-align: middle; }
.b2b-spark-line { fill: none; stroke: var(--bf-accent); stroke-width: 1.5; }

.b2b-progress {
    position: relative;
    min-width: 130px;
    height: 22px;
    background: var(--bf-line);
    border-radius: 6px;
    overflow: hidden;
}
.b2b-progress-bar { height: 100%; width: 0; background: var(--bf-ok-soft); transition: width .3s; }
.b2b-progress-behind .b2b-progress-bar { background: var(--bf-warn); }
.b2b-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--bf-ink);
    white-space: nowrap;
}

.b2b-kpis-sm { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 16px; }
.b2b-kpis-sm .b2b-kpi-val { font-size: 1.3rem; }

.b2b-actions-top { margin: 0 0 16px; }

.b2b-pool-img { display: block; height: 34px; width: auto; max-width: 280px; border: 1px solid var(--bf-line); border-radius: 4px; }

.b2b-compare { margin: 0 0 10px; }
.b2b-compare-list { display: flex; flex-direction: column; gap: 8px; }
.b2b-compare-row {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) 2fr minmax(130px, auto);
    gap: 12px;
    align-items: center;
}
.b2b-compare-name { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b2b-compare-track { height: 16px; background: var(--bf-line); border-radius: 6px; overflow: hidden; }
.b2b-compare-bar { height: 100%; background: var(--bf-accent); }
.b2b-compare-val { font-size: 13px; color: var(--bf-muted); white-space: nowrap; text-align: right; }

@media (max-width: 560px) {
    .b2b-compare-row { grid-template-columns: 1fr; gap: 3px; }
    .b2b-compare-val { text-align: left; }
}
