/* ------------------------------------------------------------------
   CVE Abgleich · Leitstand-Design
   Eine Schriftfamilie für Text, eine für Kennungen und Versionen.
   Farben sind Tokens. Status- und Schweregrad-Farben stammen aus der
   validierten Datenvisualisierungs-Palette (siehe README).
   ------------------------------------------------------------------ */

@font-face {
  font-family: "Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  /* Flächen */
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --rule: #dfe3ea;

  /* Schrift */
  --ink: #14171f;
  --ink-2: #3f4658;
  --muted: #5b6378;

  /* Aktion und Fokus */
  --accent: #2a64c4;
  --accent-ink: #ffffff;
  --link: #2458b8;
  --focus: #2458b8;

  /* Status: Füllfarbe für Diagramme, Textfarbe für Badges */
  --s-betroffen: #d03b3b;
  --s-nicht: #2a78d6;
  --s-behoben: #0ca30c;
  --s-unbekannt: #eda100;
  --s-keine: #898781;

  --t-betroffen: #b42318;
  --t-nicht: #1f5fb0;
  --t-behoben: #006300;
  --t-unbekannt: #8a5a00;
  --t-keine: #4a4a46;

  --b-betroffen: #fde8e6;
  --b-nicht: #e4eefb;
  --b-behoben: #e3f4e6;
  --b-unbekannt: #fdf1d6;
  --b-keine: #e9e8e4;

  /* Schweregrad: eine Farbe, hell nach dunkel */
  --sev-low: #86b6ef;
  --sev-medium: #3987e5;
  --sev-high: #1c5cab;
  --sev-critical: #0d366b;
  --sev-none: #e5e4df;
  --sev-on-low: #0d366b;
  --sev-on-medium: #0b0b0b;
  --sev-on-high: #ffffff;
  --sev-on-critical: #ffffff;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 23, 31, 0.06);
  --font-sans: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;
}

/* Dunkles Design: gilt bei Systemvorgabe dunkel oder bei data-theme="dark" */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0e1116;
    --surface: #161a22;
    --surface-2: #1d222c;
    --rule: #2a3140;
    --ink: #e8ebf1;
    --ink-2: #c4cad8;
    --muted: #9aa3b8;
    --accent: #8fb8ff;
    --accent-ink: #0b1220;
    --link: #8fb8ff;
    --focus: #8fb8ff;
    --s-betroffen: #d03b3b;
    --s-nicht: #3987e5;
    --s-behoben: #0ca30c;
    --s-unbekannt: #fab219;
    --s-keine: #898781;
    --t-betroffen: #ff8a80;
    --t-nicht: #8fb8ff;
    --t-behoben: #5fd28a;
    --t-unbekannt: #fcd34d;
    --t-keine: #c4cad8;
    --b-betroffen: #2a1518;
    --b-nicht: #152238;
    --b-behoben: #132a1b;
    --b-unbekannt: #2a2412;
    --b-keine: #232731;
    --sev-low: #9ec5f4;
    --sev-medium: #6da7ec;
    --sev-high: #3987e5;
    --sev-critical: #1c5cab;
    --sev-none: #2a2f3a;
    --sev-on-low: #0b1220;
    --sev-on-medium: #0b1220;
    --sev-on-high: #0b1220;
    --sev-on-critical: #ffffff;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0e1116;
  --surface: #161a22;
  --surface-2: #1d222c;
  --rule: #2a3140;
  --ink: #e8ebf1;
  --ink-2: #c4cad8;
  --muted: #9aa3b8;
  --accent: #8fb8ff;
  --accent-ink: #0b1220;
  --link: #8fb8ff;
  --focus: #8fb8ff;
  --s-betroffen: #d03b3b;
  --s-nicht: #3987e5;
  --s-behoben: #0ca30c;
  --s-unbekannt: #fab219;
  --s-keine: #898781;
  --t-betroffen: #ff8a80;
  --t-nicht: #8fb8ff;
  --t-behoben: #5fd28a;
  --t-unbekannt: #fcd34d;
  --t-keine: #c4cad8;
  --b-betroffen: #2a1518;
  --b-nicht: #152238;
  --b-behoben: #132a1b;
  --b-unbekannt: #2a2412;
  --b-keine: #232731;
  --sev-low: #9ec5f4;
  --sev-medium: #6da7ec;
  --sev-high: #3987e5;
  --sev-critical: #1c5cab;
  --sev-none: #2a2f3a;
  --sev-on-low: #0b1220;
  --sev-on-medium: #0b1220;
  --sev-on-high: #0b1220;
  --sev-on-critical: #ffffff;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.55 var(--font-sans);
  min-height: 100vh;
}

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
h3 { font-size: 15px; font-weight: 600; margin: 22px 0 10px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Kopfzeile ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 { font-size: 17px; font-weight: 600; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.logo { width: 36px; height: 36px; flex: none; }
.topbar-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; }
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 10px 14px;
  min-height: 44px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.icon-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 17px;
}

/* ---------- Layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 80px; }
.view { display: grid; gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.error-text { color: var(--t-betroffen); }

/* ---------- Kennzahlen als Leiste ---------- */
.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.strip > div { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.strip > div + div { border-left: 1px solid var(--rule); }
.strip strong {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.strip strong.text { font-size: 16px; font-weight: 500; letter-spacing: 0; line-height: 1.4; }
@media (max-width: 760px) {
  .strip { grid-template-columns: 1fr 1fr; }
  .strip > div:nth-child(3) { border-left: 0; }
  .strip > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 16px;
  min-height: 44px;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.link {
  background: none; border: 0; padding: 0; color: var(--link);
  font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  font-family: var(--font-mono); font-size: 13.5px;
}

/* ---------- Fortschritt ---------- */
.progress {
  height: 6px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin: 18px 0 10px;
}
.progress-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.progress-bar.indeterminate { width: 40%; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

/* ---------- Schweregrad-Diagramm ---------- */
.sev-row {
  display: grid; grid-template-columns: 96px 1fr 56px;
  align-items: center; gap: 12px; margin: 12px 0;
}
.bar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.sev-count { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.bar.sev-bg-critical { background: var(--sev-critical); }
.bar.sev-bg-high { background: var(--sev-high); }
.bar.sev-bg-medium { background: var(--sev-medium); }
.bar.sev-bg-low { background: var(--sev-low); }
.bar.sev-bg-none { background: var(--sev-none); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
  line-height: 1.5;
}
.badge.neutral { background: var(--surface-2); color: var(--ink); }
.badge.sev-critical { background: var(--sev-critical); color: var(--sev-on-critical); }
.badge.sev-high { background: var(--sev-high); color: var(--sev-on-high); }
.badge.sev-medium { background: var(--sev-medium); color: var(--sev-on-medium); }
.badge.sev-low { background: var(--sev-low); color: var(--sev-on-low); }
.badge.sev-none { background: var(--sev-none); color: var(--ink-2); }
.badge.st-betroffen { background: var(--b-betroffen); color: var(--t-betroffen); }
.badge.st-behoben { background: var(--b-behoben); color: var(--t-behoben); }
.badge.st-nicht { background: var(--b-nicht); color: var(--t-nicht); }
.badge.st-unbekannt { background: var(--b-unbekannt); color: var(--t-unbekannt); }
.badge.st-keine { background: var(--b-keine); color: var(--t-keine); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); }
.table-wrap.tall { max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.desc { max-width: 430px; color: var(--muted); font-size: 13.5px; }
/* Kundenreiter: breite Tabellen, damit Maßnahme und Beschreibung lesbar bleiben */
main:has(#view-compare-customer:not([hidden])) { max-width: 1680px; }
#view-compare-customer td.desc { max-width: 620px; }
#view-compare-customer td.measure { min-width: 260px; }
td.version { font-family: var(--font-mono); font-size: 13px; }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* Statusmarkierung am Zeilenanfang: Form und Farbe, nie Farbe allein */
tbody tr.row-betroffen td:first-child { box-shadow: inset 3px 0 0 var(--s-betroffen); }
tbody tr.row-behoben td:first-child { box-shadow: inset 3px 0 0 var(--s-behoben); }
tbody tr.row-nicht td:first-child { box-shadow: inset 3px 0 0 var(--s-nicht); }
tbody tr.row-unbekannt td:first-child { box-shadow: inset 3px 0 0 var(--s-unbekannt); }

/* ---------- Werkzeugleiste, Suche, Seiten ---------- */
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
input[type="search"] {
  padding: 9px 14px; border-radius: var(--radius); min-height: 44px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font: inherit; min-width: 240px; flex: 1; max-width: 420px;
}
input[type="search"]::placeholder { color: var(--muted); }
.pager { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Filter ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 6px 14px; min-height: 40px;
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.chip span { font-family: var(--font-mono); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip[aria-pressed="true"] span { color: inherit; }

/* ---------- Abgleich: Dropzone, Ergebnis ---------- */
.dropzone {
  text-align: center; padding: 40px 24px;
  border: 1.5px dashed var(--muted);
  box-shadow: none;
  transition: background 0.2s;
}
.dropzone.drag { background: var(--surface-2); border-style: solid; border-color: var(--accent); }
.dropzone.busy { opacity: 0.6; pointer-events: none; }
.drop-icon {
  width: 48px; height: 48px; border-radius: var(--radius); margin: 0 auto 14px;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
}
.drop-icon svg { width: 22px; height: 22px; }
.dropzone p { max-width: 560px; margin: 0 auto 18px; color: var(--muted); }

.chart-card { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; justify-content: center; }
.donut {
  width: 180px; height: 180px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
}
.donut-hole {
  width: 116px; height: 116px; border-radius: 50%; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-hole strong { font-family: var(--font-mono); font-size: 26px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.donut-hole span { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; flex: 1; min-width: 230px; }
.legend li { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.legend li strong { margin-left: auto; font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 12px 0 18px; border: 1px solid var(--rule); border-radius: var(--radius); }
.kv > div { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv > div + div { border-left: 1px solid var(--rule); }
.kv strong { font-family: var(--font-mono); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; }
  .kv > div + div { border-left: 0; border-top: 1px solid var(--rule); }
}
#m-file { word-break: break-all; font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); }

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink);
  width: min(780px, 92vw); max-height: 86vh; padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(10, 12, 18, 0.5); }
.dialog-inner { padding: 24px; position: relative; overflow: auto; max-height: 86vh; }
.dialog-close {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px;
  border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink); cursor: pointer; font-size: 16px;
}
.dialog-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-right: 48px; }
.dialog-head h2 { font-family: var(--font-mono); font-weight: 500; font-size: 20px; margin: 0; }
.meta { margin: 8px 0 14px; font-size: 13px; }
.desc-full { line-height: 1.6; font-size: 15px; }

/* ---------- Meldungen ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast {
  background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: var(--radius);
  max-width: 360px; transition: opacity 0.4s;
}
.toast.error { background: #b42318; color: #ffffff; }
.toast.ok { background: #006300; color: #ffffff; }
.toast.hide { opacity: 0; }

/* Keine Bewegung, wenn der Nutzer es nicht möchte */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .progress-bar.indeterminate { width: 100%; opacity: 0.5; }
}

@media (max-width: 640px) {
  main { padding: 16px 12px 80px; }
  .topbar { padding: 10px 12px; }
  .brand p { display: none; }
  input[type="search"] { min-width: 0; width: 100%; max-width: none; }
  .donut { width: 150px; height: 150px; }
  .donut-hole { width: 98px; height: 98px; }
  .donut-hole strong { font-size: 22px; }
}

/* Sprunglink und Hilfsklassen für Screenreader */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: var(--radius); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Anmeldung ---------- */
.login-page { background: var(--page); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 22px; padding: 28px; }
.login-card h1 { font-size: 18px; font-weight: 600; }
.login-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.login-form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field input {
  padding: 10px 12px; min-height: 44px; font: inherit;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.field input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.login-form .btn.primary { width: 100%; }
.login-form .error-text { margin: 0; font-size: 14px; }
.login-card p.error-text { color: var(--t-betroffen); font-weight: 500; }

/* ---------- Ansicht umschalten, Zusammenfassung ---------- */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius);
}
.seg {
  appearance: none; border: 0; background: transparent; color: var(--ink-2);
  padding: 8px 14px; min-height: 40px; border-radius: 7px; font: inherit; font-weight: 500; cursor: pointer;
}
.seg[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.group-toggle { text-align: left; }
.group-toggle::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); }
.group-toggle[aria-expanded="true"]::before { content: "▾"; }
tr.group-detail > td { background: var(--surface-2); padding: 14px 16px; }
tr.group-detail table { background: var(--surface); border-radius: 8px; border: 1px solid var(--rule); }

/* ---------- Einstellungen ---------- */
.note {
  margin: 0 0 16px; padding: 12px 16px;
  background: var(--surface-2); color: var(--ink-2);
  border-left: 4px solid var(--accent); border-radius: 6px; font-size: 14px;
}
.fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.fieldset > .label { display: block; margin-bottom: 8px; }
.fieldset:disabled, fieldset:disabled .segmented { opacity: 0.6; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.swatch-item { position: relative; }
.swatch-item input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.swatch-card {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; font-size: 14px; color: var(--ink);
}
.swatch-card:hover { border-color: var(--muted); }
.swatch-item input:checked + .swatch-card { border: 2px solid var(--accent); padding: 7px 9px; font-weight: 600; }
.swatch-item input:focus-visible + .swatch-card { outline: 3px solid var(--focus); outline-offset: 2px; }
.swatch { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--rule); flex: none; }
.swatch-light, .swatch-dark { width: 22px; height: 26px; display: block; }
.seg-radio {
  display: inline-flex; align-items: center; position: relative; min-height: 40px;
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--ink-2);
}
.seg-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-radio:has(input:checked) { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.seg-radio:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.field label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field select {
  padding: 10px 12px; min-height: 44px; font: inherit;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.field select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.field .hint { font-size: 13px; color: var(--muted); }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0; }
.inline-form .field { min-width: 220px; flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.user-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rule); }
.user-form h3 { margin: 0 0 12px; font-size: 16px; }
.key-new {
  margin: 0 0 16px; padding: 14px 16px; background: var(--surface-2);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.key-new p { margin: 0 0 10px; font-size: 14px; }
.key-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.key-row code {
  flex: 1; min-width: 0; word-break: break-all; font-family: var(--font-mono); font-size: 13.5px;
  padding: 8px 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
}
.btn.small-btn { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.danger { color: var(--t-betroffen); border-color: var(--t-betroffen); }

.form-grid .field { align-content: start; }

/* ---------- Vergleich mehrerer Systeme ---------- */
.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list li {
  display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
}
.file-list .fname { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fstatus { font-size: 13.5px; white-space: nowrap; }
.file-list .fstatus.bad { color: var(--t-betroffen); font-weight: 500; }
.file-list input {
  padding: 8px 10px; min-height: 40px; font: inherit; border: 1px solid var(--rule);
  border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%;
}
.file-list input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.chip {
  appearance: none; min-height: 36px; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 14px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sys-chip {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 6px;
  font-size: 13px; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-2);
}
.sys-chip.betroffen { color: var(--t-betroffen); border-color: var(--t-betroffen); }
.sys-chip.hint { color: var(--muted); }


/* Branding: Logo und Favicon */
.logo-slot { display: inline-flex; flex: none; }
img.logo { width: auto; height: 36px; max-width: 180px; object-fit: contain; flex: none; }
.brand-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.brand-item .small-h { margin: 0 0 6px; font-size: 15px; }
.brand-preview { min-height: 72px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--rule); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface); }
.brand-preview img { max-width: 100%; max-height: 48px; object-fit: contain; }
.brand-preview img.favicon-thumb { width: 32px; height: 32px; max-height: 32px; }


/* Portfolio-Report */
.kpi-line { font-weight: 600; margin: 12px 0 8px; }
@media print {
  .topbar, .tabs, .btn-row, #pf-note, #view-portfolio .card:first-child, #toasts, .note { display: none !important; }
  #view-portfolio { display: block !important; }
  .table-wrap { max-height: none !important; overflow: visible !important; }
  body { background: #fff; color: #000; }
}

/* Portfolio: Liste und Report untereinander, damit der Report die volle Breite hat */
#view-portfolio .grid-2 { grid-template-columns: 1fr; }

.field .check, label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink-2); }
.field label.check input[type="checkbox"] { width: auto; }
