:root {
  color-scheme: light;
  --brand: #041639;
  --brand-fg-muted: #d8e2e7;
  --bg: #f2f6f8;
  --card-bg: #ffffff;
  --text: #1e1e1e;
  --muted: #4d5a66;
  --border: #d8e2e7;
  --border-input: #6b7782;
  --accent: #0f62fe;
  --accent-hover: #0043ce;
  --accent-active: #002d9c;
  --accent-bg: #e8f7ff;
  --focus-ring: 2px solid var(--accent);

  /* Palette delt med webapp/business/slices/export_analysis/renderers.py COMPLIANCE_META/SEVERITY_META — hold i sync. */
  --ok-bg: #E6F4EA;   --ok-fg: #1E7B34;
  --afv-bg: #FDECEA;  --afv-fg: #B3261E;
  --fejl-bg: #FFF4E5; --fejl-fg: #92600D;
  --mild-bg: #FFF4CB; --mild-fg: #865D07;
}

* { box-sizing: border-box; }

/* Egne display-regler herunder (fx "button { display: inline-block }")
   vinder ellers over browserens [hidden]-regel og gør skjulte elementer synlige igen. */
[hidden] { display: none !important; }

/* Én eksplicit fokusstil overalt: samme ring, ingen ekstra farve- eller
   baggrundsskift ved fokus. Offset, så ringen står på fladen udenom, også på
   blå knapper. */
:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

button:not(:disabled):active, a.filter-menu-item:active, .entra-btn:active { transform: translateY(1px); }

.nowrap { white-space: nowrap; }

body {
  margin: 0;
  font-family: "Century Gothic", "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header { background: var(--brand); color: #fff; }
.app-header :focus-visible { outline-color: #fff; }
.page-title { max-width: 1400px; margin: 0 auto; padding: 20px 32px 4px; }
.page-title h1 { margin: 0; font-size: 1.6rem; }
.subtitle { color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }

.app-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 32px;
  min-height: 84px; /* header-højden er fast; indholdet er mindre og centreres */
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-logo { height: 20px; width: auto; display: block; flex-shrink: 0; }
.brand-logo-partner { height: 14px; padding-left: 16px; border-left: 1px solid var(--brand-fg-muted); box-sizing: content-box; }
.user-bar { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.current-user { color: var(--brand-fg-muted); font-size: 0.82rem; }

@media (max-width: 700px) {
  .app-header-inner { flex-wrap: wrap; padding: 12px 16px; }
  .brand { flex-wrap: wrap; gap: 8px 16px; }
  .brand-logo-partner { border-left: none; padding-left: 0; }
}


.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.app-header .link-btn { color: var(--brand-fg-muted); font-size: 0.82rem; }
.app-header .link-btn:hover { color: #fff; }

.logo-home {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
}
.logo-home:hover { color: var(--accent); }

.job-tabs {
  max-width: 1400px;
  /* padding-block: fokusringen (2px + 2px offset) må ikke klippes af
     overflow-x: auto, der også gør nav'en til scroll-container lodret. */
  margin: 8px auto 0;
  padding: 4px 32px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  --fade: 40px;
}
.job-tabs.can-scroll-right { mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent); }
.job-tabs.can-scroll-left { mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent); }
.job-tabs.can-scroll-left.can-scroll-right {
  mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
}

.job-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 7px 8px 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.88rem;
  flex-shrink: 0;
}
.job-tab:hover:not(.active) { border-color: var(--accent); }
.job-tab.active { border-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.job-tab-select {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.job-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}
.job-tab-dot.running { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.job-tab-dot.queued { background: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
.job-tab-dot.done { background: var(--ok-fg); }
/* Fejl er en ruder, ikke en prik: skelnes uden farve. */
.job-tab-dot.error { background: var(--afv-fg); border-radius: 1px; transform: rotate(45deg) scale(0.9); }
/* Afbrudt (serveren genstartede): samme neutrale tone som beskeden i
   progress-kortet, og en ring, så den ikke ligner "i kø". */
.job-tab-dot.interrupted { background: transparent; border: 2px solid var(--muted); }

.job-tab-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-tab-close {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.job-tab-close:hover { color: var(--afv-fg); }

.job-tab-new {
  display: flex;
  align-items: center;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 10px 10px 0 0;
  padding: 7px 14px;
  min-height: 42px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  flex-shrink: 0;
}
.job-tab-new:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.job-tab-new.active {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.job-tab-new.active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
}
.card h2 { margin: 0 0 4px; font-size: 1.1rem; }
#results-card h2 { margin-bottom: 18px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 4px 0 12px; }

#upload-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
input[type="file"] { flex: 1; min-width: 220px; font: inherit; font-size: 0.9rem; }

button, input, select, textarea { font-family: inherit; }
button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }
#start-btn:not(:disabled):hover { background: var(--accent-hover); }
#start-btn:not(:disabled):active { background: var(--accent-active); }

.error-text { color: var(--afv-fg); font-weight: 600; }
.warning-text { color: var(--fejl-fg); font-weight: 600; }
.info-text { display: flex; align-items: center; gap: 8px; margin-top: 28px; color: var(--muted); font-weight: 700; }
.info-text[hidden] { display: none; }
.info-text svg { flex: none; color: var(--fejl-fg); }

#job-error-summary { margin: 0; font-weight: 600; color: var(--afv-fg); }
.job-message-detail {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere; /* lange strenge uden mellemrum */
}
.job-message.job-message-neutral #job-error-summary { color: var(--muted); }

.progress-visual { display: flex; align-items: center; gap: 16px; margin: 12px 0; }
.pulse-icon {
  color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.pulse-icon.queued { color: var(--muted); }
.pulse-icon.stopped { animation: none; color: var(--muted); }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}
.progress-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}
#progress-text { min-width: 260px; margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.live-counts { display: flex; gap: 10px; flex-wrap: wrap; }
.count-pill {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.status-ok { background: var(--ok-bg); color: var(--ok-fg); }
.status-afvigelse { background: var(--afv-bg); color: var(--afv-fg); }
.status-fejl { background: var(--fejl-bg); color: var(--fejl-fg); }

.results-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.udbyder-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
.udbyder-tab {
  background: var(--card-bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.udbyder-tab:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.udbyder-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.summary-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.summary-card {
  flex: 1;
  min-width: 120px;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-card:hover:not(.active) { border-color: var(--accent); }
.summary-card.active { border-color: var(--accent); background: var(--accent-bg); }
.summary-card[data-filter="non_compliance"] .summary-value { color: var(--afv-fg); }
.summary-card[data-filter="compliance"] .summary-value { color: var(--ok-fg); }
.summary-card[data-filter="fejl"] .summary-value { color: var(--fejl-fg); }
.summary-card[data-filter="dubletter"] .summary-value { color: var(--accent); }
.summary-card[data-filter="udenlandske"] .summary-value { color: var(--accent); }
.summary-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.summary-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.export-bar { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.export-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #454b57;
  color: #fff;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.export-icon:hover { background: #2f333c; }

/* Tabellen scroller i sin egen boks i begge retninger: så kan overskriften
   og LPN-kolonnen stå fast, mens rækkerne scrolles. Samme
   boks bruges om dublettabellerne. */
.table-wrap { overflow: auto; max-height: 75vh; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td { font-variant-numeric: tabular-nums; }
th.num, td.num { text-align: right; }
thead th { position: sticky; top: 0; z-index: 2; background: var(--card-bg); }
#results-table tbody td:first-child { position: sticky; left: 0; z-index: 1; background: inherit; }
#results-table thead th:first-child { left: 0; z-index: 3; }
/* Rækker uden egen farve: den faste kolonne må ikke være gennemsigtig. */
#results-table tbody tr { background: var(--card-bg); }
.results-status { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.results-error { margin: 0 0 8px; }
/* Opdaterer: det gamle indhold dæmpes, så det ikke læses som det nye. */
.is-loading .table-wrap, .is-stale .table-wrap, .history-list.is-loading { opacity: 0.5; }
.is-loading .table-wrap, .history-list.is-loading { pointer-events: none; }
.loading-hint::before, .results-status.loading::before {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 6px;
  vertical-align: -0.1em;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.history-item.is-busy { opacity: 0.6; pointer-events: none; }
/* white-space: normal, ikke nowrap: en lang fejlbesked skal ikke alene
   tvinge hele tabellen ud i vandret scroll. */
/* Fejl-kolonnen står som nr. 2 efter LPN og får den meste plads. De øvrige kolonner bliver
   smallere (mindre luft, overskrifter må brydes) i stedet for at tabellen bliver bredere. */
.fejl-cell, th.fejl-col { white-space: normal; width: 340px; min-width: 340px; max-width: 340px; }
.fejl-cell { line-height: 1.4; white-space: pre-line; }
#results-table:has(.fejl-col:not([hidden])) th,
#results-table:has(.fejl-col:not([hidden])) td { padding: 8px 8px; }
#results-table:has(.fejl-col:not([hidden])) th { white-space: normal; vertical-align: bottom; }
.invalid-value { color: var(--fejl-fg); font-style: italic; }
#results-table.fejl-view thead .info-icon { display: none; }
#results-table th.num, #results-table td.num { text-align: left; }
#results-table td:first-child .invalid-value { display: block; white-space: normal; max-width: 120px; line-height: 1.3; }
#results-empty { margin: 12px 0 0; }

.info-icon {
  width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  border: none;
  font-size: 0.625rem;
  font-style: italic;
  font-weight: 700;
  line-height: 0.9375rem;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.info-icon:hover { background: var(--accent); color: #fff; }
.info-icon-heading { background: var(--accent); color: #fff; vertical-align: middle; }

/* position:fixed, ikke absolute: ellers klippes tooltippen af tabellens overflow-x: auto. */
.info-tooltip {
  display: none;
  position: fixed;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 8px;
  width: 240px;
  white-space: normal;
  text-align: left;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.info-tooltip.show { display: block; }

/* width: max-content, ellers krymper et lag med left: 50% til ca. 50vw. */
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  text-align: center;
  transform: translateX(-50%) translateY(8px);
  background: var(--brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Nederst i midten som toasten: dækker hverken logo, "Log ud" eller faner.
   Farver fra paletten. Luk-knappen gør banneret
   tastaturtilgængeligt; et klik på banneret lukker stadig. */
.app-notice {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--afv-bg);
  color: var(--afv-fg);
  border: 1px solid var(--afv-fg);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 8px 10px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 70;
}
.app-notice[hidden] { display: none; }
.app-notice-text { margin: 0; flex: 1 1 auto; min-width: 0; align-self: center; overflow-wrap: anywhere; }
.app-notice-close {
  flex-shrink: 0;
  background: none;
  color: inherit;
  border: none;
  border-radius: 4px;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
  font-size: 1.1rem;
  line-height: 1;
}
.app-notice-close:hover { background: var(--card-bg); }

.filter-icon {
  width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  border: none;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.filter-icon:hover { background: var(--accent); color: #fff; }
#status-filter-icon { margin-right: 6px; }
.filter-icon.active { background: var(--accent); color: #fff; }

.filter-menu {
  display: flex;
  flex-direction: column;
  position: fixed;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  min-width: 170px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  z-index: 50;
}
.filter-menu-item {
  display: block;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  text-decoration: none;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.filter-menu-item:hover { background: var(--bg); }
.filter-menu-item.active { background: var(--accent); color: #fff; }

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

.compliance-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 10px;
  font-weight: 700;
  font-size: 0.8rem;
}
.compliance-badge.compliant_exact { background: var(--ok-bg); color: var(--ok-fg); }
.compliance-badge.compliant_deviation { background: var(--mild-bg); color: var(--mild-fg); }
.compliance-badge.non_compliant { background: var(--afv-bg); color: var(--afv-fg); }
.compliance-badge.fejl { background: var(--fejl-bg); color: var(--fejl-fg); }

.severity-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 10px;
  font-weight: 700;
  font-size: 0.8rem;
}
.severity-badge.boedepligtig { background: var(--afv-bg); color: var(--afv-fg); }
.severity-badge.ikke_boedepligtig { background: var(--mild-bg); color: var(--mild-fg); }
.severity-badge.match { background: var(--ok-bg); color: var(--ok-fg); }

.dup-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
}

.dubletter-group { margin-top: 18px; }
.dubletter-group:first-child { margin-top: 0; }
.dubletter-group-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 1rem; }
.dubletter-group-count { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.dubletter-table .dubletter-file { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

.history-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.history-search-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.history-icons { display: flex; align-items: center; gap: 8px; flex-shrink: 0; position: relative; }
.history-search {
  width: 100%;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
}
/* Eksplicit farve og opacity 1: UA-standarden er for lys i WebKit. */
.history-search::placeholder { color: var(--muted); opacity: 1; }
.history-icons .filter-icon { width: 34px; height: 34px; flex-shrink: 0; }
.history-icons .filter-icon svg { width: 20px; height: 20px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
/* container query (ikke viewport): .history-item kan sidde i et smallere
   sidepanel end vinduet. Under 760px ligger ikonerne FAST på linje 1 (må
   aldrig følge badges ned), badges alene på egen linje under — .history-right
   opløses (display:contents) så badges/ikoner kan placeres uafhængigt via
   order. 760px-tærsklen: badges+ikoner+dato's faste bredde er ~700px
   (dato ~154px, badges+"Arkiveret" ~400px værste fald, ikoner ~66px,
   gaps/padding ~75px) plus luft til filnavnet. */
.history-item {
  container-type: inline-size;
  display: flex;
  align-items: center;
  /* Lodret afstand i en ombrudt række (6 px) er mindre end afstanden mellem
     rækker (8 px), så rækkerne kan skelnes. */
  gap: 6px 10px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
.history-item:hover { border-color: var(--accent); background: var(--accent-bg); }
.history-open {
  background: none;
  border: none;
  border-radius: 4px;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
/* flex-basis:0 (ikke "auto") er bevidst: flexbox' linjeskifts-afgørelse ser
   på elementers UBESKÅRNE naturlige bredde, ikke hvor meget de reelt KAN
   skrumpe til — med basis:auto ville et langt filnavns fulde bredde tælle
   med i regnestykket og udløse et unødvendigt linjeskift, selvom filnavnet
   sagtens kunne forkortes for at gøre plads. Med basis:0 fylder
   .history-left ingenting i den afgørelse, og vokser bagefter ind i den
   plads der reelt er tilbage. */
.history-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 0%; }
/* min-width:0 er nødvendigt for at ellipsis overhovedet virker på et
   flex-item: uden det er et nowrap-elements skrumpe-gulv dets fulde
   tekstbredde, så et langt filnavn aldrig trunkeres. */
.history-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex-shrink: 1; }
.history-meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; flex-shrink: 0; }
/* Sidste udvej på ekstremt smalle containere (under almindelig telefon-
   bredde): filnavnet er allerede skrumpet helt ind via ellipsis, og dato +
   ikoner alene kan stadig være for meget til én linje — lad datoen ombryde
   frem for at lade den skære ind over ikonerne. */
@container (max-width: 320px) {
  .history-meta { white-space: normal; flex-shrink: 1; min-width: 0; }
}
.history-right { display: contents; }
.history-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; order: 1; }
.history-badges { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 100%; order: 2; justify-content: flex-start; }
.history-badges .count-pill { font-size: 0.8rem; padding: 3px 10px; }
/* Smal række: metadata på egen linje under filnavnet, så filnavnet får
   bredden; metadata og badges flugter med filnavnet (prik 8 px + gap 10 px);
   lodret afstand i rækken under afstanden mellem rækker (8 px). */
@container (width < 760px) {
  .history-left { flex-wrap: wrap; row-gap: 2px; }
  .history-meta { flex-basis: 100%; padding-left: 18px; white-space: normal; }
  .history-badges { padding-left: 18px; gap: 4px 6px; }
}
@container (min-width: 760px) {
  .history-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .history-actions { order: initial; }
  .history-badges { flex: 0 1 auto; flex-wrap: nowrap; order: initial; justify-content: flex-end; }
}
.history-item.archived .count-pill {
  background: var(--border);
  color: var(--muted);
}
.history-archived-flag {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--border);
  color: var(--muted);
}
/* .history-actions er defineret sammen med .history-item ovenfor (bredde-
   afhængige layout). width/height: auto + padding (ikke fast pixelstørrelse)
   så knappen følger SVG'ens egen width/height uden separat justering. */
.history-action-btn { width: auto; height: auto; padding: 5px; flex-shrink: 0; }
.history-action-delete:hover { background: var(--afv-fg); color: #fff; }
.secondary-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  margin-top: 12px;
  align-self: flex-start;
  font-size: 0.85rem;
  padding: 8px 14px;
}
.secondary-btn:not(:disabled):hover { border-color: var(--accent); }

.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.login-page { background: var(--brand) url(/static/sb-waves.svg) no-repeat center bottom / 100% 62%; }
.login-card {
  width: min(420px, 92vw);
  padding: 40px 40px 36px;
  border: none;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.login-brand { height: 36px; width: auto; display: block; margin: 0 auto 28px; }
.login-logo { font-size: 1.5rem; margin: 0 0 8px; }
.login-card .hint { margin: 0 0 4px; }
.entra-btn {
  display: block;
  margin-top: 24px;
  padding: 13px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.entra-btn:hover { background: var(--accent-hover); }
.entra-btn:active { background: var(--accent-active); }

.secondary-login {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.secondary-login:hover { border-color: var(--accent); }
.login-switch {
  display: block;
  margin: 16px auto 0;
  padding: 4px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}
.login-form { margin-top: 24px; text-align: left; }
.login-form label { display: block; margin: 14px 0 4px; font-size: 0.9rem; font-weight: 600; }
.login-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}
.login-form .entra-btn { width: 100%; margin-top: 24px; cursor: pointer; }
.login-form .entra-btn:disabled { opacity: 0.7; cursor: default; }
.login-form .hint { margin: 0; }
.password-rules { margin: 8px 0 0; padding-left: 20px; font-size: 0.9rem; color: var(--muted); }
.password-rules li { margin: 2px 0; }

tr.row-compliant_exact { background: color-mix(in srgb, var(--ok-bg) 40%, white); }
tr.row-compliant_deviation { background: color-mix(in srgb, var(--mild-bg) 40%, white); }
tr.row-non_compliant { background: color-mix(in srgb, var(--afv-bg) 45%, white); }
tr.row-fejl { background: color-mix(in srgb, var(--fejl-bg) 45%, white); }

/* Overlayet scroller, og kortet centreres med margin: auto (ikke
   align-items: center), så toppen aldrig skæres utilgængeligt af ved lav
   højde eller 400 % zoom. */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 48, 0.45);
  display: flex;
  overflow-y: auto;
  padding: 24px;
  z-index: 100;
}
.modal-card {
  margin: auto;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 22px 24px;
  width: min(420px, 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.modal-card .modal-title { margin: 0 0 8px; font-size: 1.05rem; }
#confirm-modal-text { margin: 0; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions .secondary-btn { margin-top: 0; align-self: auto; }
.danger-btn { background: var(--afv-fg); }
.danger-btn:hover, .danger-btn:active { background: #922019; }

@media (max-width: 720px) {
  .app-header { padding: 16px 16px 8px; }
  .app-header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .job-tabs { padding: 4px 16px; }
  main { padding: 8px 16px 32px; }

  #upload-form { flex-direction: column; align-items: stretch; }
  input[type="file"] { min-width: 0; }

  .progress-visual { flex-wrap: wrap; }
  #progress-text { min-width: 0; width: 100%; }

  /* Eksportikonet bliver på linjen med udbyder-fanerne; fanerne ombrydes
     inden for deres egen boks. */
  .results-toolbar { flex-wrap: nowrap; }
  .summary-card { min-width: calc(50% - 6px); padding: 12px; }
  .history-item { padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Aktiv tilstand bygger ellers kun på farve og baggrund, som systemet
   overskriver. Her får den systemets markeringsfarve (Highlight), og
   ikonflader og badges får en kant, så de ikke forsvinder. */
@media (forced-colors: active) {
  .summary-card.active, .job-tab.active, .job-tab-new.active, .udbyder-tab.active,
  .filter-menu-item.active, .filter-icon.active {
    forced-color-adjust: none;
    background: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }
  .summary-card.active .summary-label, .summary-card.active .summary-value,
  .job-tab.active .job-tab-close { color: HighlightText; }
  .info-icon, .filter-icon, .export-icon, .job-tab-close,
  .compliance-badge, .severity-badge, .count-pill, .dup-flag, .history-archived-flag {
    border: 1px solid CanvasText;
  }
  .job-tab-dot, .progress-bar { forced-color-adjust: none; }
  .progress-track { border: 1px solid CanvasText; }
  .progress-bar { background: Highlight; }
  :focus-visible { outline-color: Highlight; }
}
