:root {
  --grund: #f4f6fb;
  --flaeche: #ffffff;
  --flaeche-2: #eef2f9;
  --linie: #dbe2ee;
  --text: #0f172a;
  --text-2: #475569;
  --akzent: #1d4ed8;
  --akzent-2: #2563eb;
  --akzent-hell: #dbe7ff;
  --gut: #047857;
  --gut-hell: #d1fae5;
  --warn: #b45309;
  --warn-hell: #fef3c7;
  --fehler: #b91c1c;
  --schatten: 0 1px 2px rgb(15 23 42 / .06), 0 4px 16px rgb(15 23 42 / .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0b1120;
    --flaeche: #111a2e;
    --flaeche-2: #18233b;
    --linie: #26334f;
    --text: #e6ebf5;
    --text-2: #9aa8c2;
    --akzent: #4f83ff;
    --akzent-2: #6b97ff;
    --akzent-hell: #1b2d57;
    --gut: #34d399;
    --gut-hell: #0f3a2e;
    --warn: #fbbf24;
    --warn-hell: #3b2f12;
    --fehler: #f87171;
    --schatten: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--grund);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2 { margin: 0; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 650; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--akzent-2); outline-offset: 2px; }

/* Kopf */
.kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}
.marke { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marke h1 { font-size: 20px; letter-spacing: -.01em; }
.marke > div { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 16px; row-gap: 2px; min-width: 0; }
.marke p { margin: 0; color: var(--text); font-size: 17px; font-weight: 550; }
@media (max-width: 960px) {
  .marke > div { flex-direction: column; }
  .marke p { font-size: 14.5px; white-space: nowrap; }
}
@media (max-width: 600px) {
  .marke p { font-size: 13.5px; }
  .lokal-text { display: none; }
  .lokal { padding: 7px; }
}
.kopf-rechts { display: flex; align-items: center; gap: 10px; }
.lokal {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--gut); background: var(--gut-hell);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}

/* Raster */
.raster {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1400px; width: 100%; margin: 0 auto;
  align-items: start;
}
@media (max-width: 960px) {
  .raster { grid-template-columns: 1fr; padding: 16px; gap: 14px; }
  /* Mobil: Profile zuerst, dann Bilder, dann die übrigen Einstellungen */
  .einstellungen > .karte { order: 1; }
  .einstellungen > .karte:first-child { order: -1; }
  .kopf { padding: 12px 16px; }
}

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.knopf:hover:not(:disabled) { border-color: var(--akzent-2); }
.knopf:active:not(:disabled) { transform: translateY(1px); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover:not(:disabled) { background: var(--akzent-2); }
.knopf.leise { background: transparent; border-color: transparent; color: var(--text-2); }
.knopf.leise:hover:not(:disabled) { background: var(--flaeche-2); border-color: transparent; }
.knopf.klein { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.knopf.betont { background: var(--warn-hell); border-color: var(--warn); color: var(--text); }

/* Ablagezone */
.ablagezone {
  border: 2px dashed var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
  padding: 36px 20px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.ablagezone.ziehen { border-color: var(--akzent-2); background: var(--akzent-hell); }
.ablage-ikon { width: 52px; height: 52px; color: var(--akzent); stroke-width: 2.2; }
.ablage-titel { font-size: 18px; font-weight: 600; margin: 8px 0 14px; }
.ablage-knoepfe { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ablage-klein { color: var(--text-2); font-size: 13px; margin: 14px 0 0; }
#beispiel { margin-top: 8px; color: var(--akzent-2); text-decoration: underline; text-underline-offset: 3px; }
a.knopf.leise { color: var(--text-2); }

/* Hinweise */
.hinweis {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 16px; border-radius: 12px;
  background: var(--warn-hell); border: 1px solid var(--warn);
}
.hinweis.neutral { background: var(--flaeche-2); border-color: var(--linie); }
.hinweis p { margin: 0; flex: 1 1 240px; }

/* Bilanz */
.bilanz {
  margin-top: 16px; padding: 14px 16px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: var(--schatten);
}
.zahlen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.zahlen div { min-width: 0; }
.zahlen dt { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.zahlen dd { margin: 0; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.spar-box dd { color: var(--gut); }
.bilanz-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.bilanz-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.status { font-size: 14px; color: var(--text-2); }
.status.laeuft::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--akzent-2); border-right-color: transparent; border-radius: 50%;
  animation: drehen .8s linear infinite;
}
@media (max-width: 560px) {
  .zahlen { grid-template-columns: repeat(2, 1fr); }
  .zahlen dd { font-size: 18px; }
}

.leer { color: var(--text-2); text-align: center; margin: 24px 0; }

/* Liste */
.liste { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.eintrag {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px;
  padding: 10px 12px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px;
}
.eintrag.veraltet { border-left: 4px solid var(--warn); }
.eintrag[data-status="fehler"] { border-color: var(--fehler); }
.vorschau {
  width: 64px; height: 64px; padding: 0; border: 0; border-radius: 8px; overflow: hidden;
  background: var(--flaeche-2); cursor: zoom-in; display: grid; place-items: center;
}
.vorschau:disabled { cursor: default; }
.vorschau img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lader {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--linie); border-top-color: var(--akzent-2);
  animation: drehen .8s linear infinite;
}
.eintrag[data-status="wartet"] .lader { animation: none; }
@keyframes drehen { to { transform: rotate(360deg); } }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { font-size: 13px; color: var(--text-2); }
.meta .ok { color: var(--gut); }
.meta .fehler, .fehler { color: var(--fehler); }
.groessen { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.groessen .alt { color: var(--text-2); font-size: 13px; }
.groessen .pfeil { color: var(--text-2); }
.spar { font-size: 12px; font-weight: 650; color: var(--gut); background: var(--gut-hell); padding: 2px 7px; border-radius: 999px; }
.spar.nichts { color: var(--text-2); background: var(--flaeche-2); }
.aktionen { display: flex; gap: 2px; }
.ikon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; font-size: 18px;
}
.ikon:hover:not(:disabled) { background: var(--flaeche-2); color: var(--text); }
.ikon:disabled { opacity: .35; cursor: default; }
@media (max-width: 720px) {
  .eintrag { grid-template-columns: 56px minmax(0, 1fr); gap: 6px 12px; }
  .vorschau { width: 56px; height: 56px; grid-row: span 2; }
  .groessen, .aktionen { grid-column: 2; }
  .aktionen { margin-left: -8px; }
}

/* Einstellungen */
.einstellungen { display: grid; gap: 14px; position: sticky; top: 16px; }
@media (max-width: 960px) { .einstellungen { position: static; display: contents; } }
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--schatten);
  display: grid; gap: 12px;
}
.karte-kopf { display: flex; justify-content: space-between; align-items: baseline; }
.profil-status { font-size: 13px; color: var(--warn); }
.profile { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profil {
  position: relative; text-align: left; font: inherit; color: var(--text);
  padding: 9px 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--linie); background: var(--flaeche);
  display: grid; gap: 1px;
}
.profil:hover { border-color: var(--akzent-2); }
.profil.aktiv { border-color: var(--akzent); background: var(--akzent-hell); box-shadow: inset 0 0 0 1px var(--akzent); }
.profil-name { font-weight: 600; font-size: 14px; padding-right: 16px; }
.profil-info { font-size: 12px; color: var(--text-2); }
.profil-weg { position: absolute; top: 6px; right: 6px; color: var(--text-2); font-size: 14px; border-radius: 4px; padding: 1px; }
.profil-weg:hover { color: var(--fehler); background: var(--flaeche-2); }

.feld { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.feld > label, .feld > legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; }
.feld output { color: var(--text); font-variant-numeric: tabular-nums; margin-left: 4px; }
.reihe { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reihe > input[type="text"], .reihe > select { flex: 1 1 140px; }
select, input[type="text"], input[type="number"] {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input[type="number"] { width: 100px; }
input[type="range"] { width: 100%; accent-color: var(--akzent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--akzent); }
.skala { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-top: -4px; }
.klein { font-size: 12.5px; color: var(--text-2); margin: 0; }

.segmente { display: flex; flex-wrap: wrap; gap: 6px; }
.segmente label { position: relative; }
.segmente input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmente span {
  display: block; padding: 6px 11px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--linie); background: var(--flaeche); cursor: pointer;
}
.segmente input:checked + span { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.segmente input:focus-visible + span { outline: 2px solid var(--akzent-2); outline-offset: 2px; }

.schalter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; cursor: pointer; }
.schalter input[type="number"] { width: 90px; }
.erweitert { border-top: 1px solid var(--linie); padding-top: 10px; }
.erweitert summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-2); }
.erweitert[open] { display: grid; gap: 12px; }

.ablage-wahl { display: grid; gap: 6px; }
.wahl {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 11px; border: 1px solid var(--linie); border-radius: 10px; cursor: pointer;
}
.wahl:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.wahl input { margin-top: 4px; }
.wahl span { display: grid; }
.wahl strong { font-size: 14px; font-weight: 600; }
.wahl small { font-size: 12px; color: var(--text-2); }
.wahl.gesperrt { opacity: .5; cursor: not-allowed; }

/* Vergleich */
.vergleich {
  width: min(1200px, 96vw); max-height: 94vh; padding: 0;
  border: 1px solid var(--linie); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / .35);
}
.vergleich[open] { display: flex; flex-direction: column; }
.vergleich::backdrop { background: rgb(8 12 24 / .65); }
.v-kopf, .v-fuss { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.v-kopf h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.v-fuss { font-size: 13px; font-variant-numeric: tabular-nums; border-top: 1px solid var(--linie); }
.v-rahmen {
  flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center;
  background: repeating-conic-gradient(var(--flaeche-2) 0 25%, var(--flaeche) 0 50%) 0 0 / 20px 20px;
}
.v-buehne {
  --teilung: 50%;
  position: relative; max-width: 100%; max-height: calc(94vh - 120px);
  width: 100%;
  user-select: none;
}
.vergleich[data-massstab="einpassen"] .v-buehne { width: auto; height: calc(94vh - 120px); max-width: 100%; }
.vergleich[data-massstab="1:1"] .v-buehne { max-width: none; max-height: none; }
.v-buehne img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.v-buehne img.neu { clip-path: inset(0 0 0 var(--teilung)); }
.v-linie { position: absolute; top: 0; bottom: 0; left: var(--teilung); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .3); pointer-events: none; }
.v-linie::after {
  content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111;
  display: grid; place-items: center; font-size: 16px; box-shadow: 0 2px 8px rgb(0 0 0 / .35);
}
#vSchieber { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }

/* Meldung */
.meldung {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--grund);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--schatten); z-index: 10; max-width: calc(100vw - 32px);
}
.meldung.fehler { background: var(--fehler); color: #fff; }

.fuss {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; font-size: 12.5px; color: var(--text-2);
}
.fuss a { color: inherit; }

/* Unterseiten (z. B. Lizenzen) */
a.marke { color: inherit; text-decoration: none; }
a.knopf { text-decoration: none; }
.seite { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 24px; }
.seite p { margin: 0; }
.seite-titel { font-size: 20px; }
code { font: 13px ui-monospace, Consolas, monospace; background: var(--flaeche-2); padding: 1px 5px; border-radius: 4px; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tabelle th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--linie); }
.tabelle td { padding: 12px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .seite { padding: 16px; }
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; }
  .tabelle tr { padding: 10px 0; border-bottom: 1px solid var(--linie); }
  .tabelle tr:last-child { border-bottom: 0; }
  .tabelle td { border: 0; padding: 3px 0; }
  .tabelle td::before { content: attr(data-titel); display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
}
