:root {
  --grund: #f6f5f2;
  --flaeche: #ffffff;
  --rand: #e2dfd8;
  --text: #1d1c1a;
  --leise: #6b6860;
  --akzent: #2f5d50;
  --akzent-text: #ffffff;
  --gut: #2f7d4f;
  --warn: #a8641a;
  --schlecht: #b3372f;
  --balken: #e8e5de;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.04), 0 2px 8px rgb(0 0 0 / 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #161614;
    --flaeche: #1f1f1c;
    --rand: #33322e;
    --text: #ecebe6;
    --leise: #9d9a91;
    --akzent: #7fbfa9;
    --akzent-text: #10201b;
    --gut: #7cc49a;
    --warn: #e0a65e;
    --schlecht: #ec8b83;
    --balken: #2c2b27;
    --schatten: none;
    color-scheme: dark;
  }
}

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

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; }

.kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
}
.marke { display: flex; gap: 12px; align-items: center; }
.logo {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--akzent); color: var(--akzent-text); font-size: 18px;
}
.unter { margin: 0; color: var(--leise); font-size: 0.85rem; }
.ich { display: flex; gap: 12px; align-items: center; color: var(--leise); font-size: 0.9rem; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }

.leiste { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.leiste-rechts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stand { color: var(--leise); font-size: 0.85rem; }

button {
  font: inherit; font-size: 0.9rem;
  padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--leise); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
select {
  font: inherit; font-size: 0.9rem;
  padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
}
select:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
button.haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
button.leise { background: transparent; }
button.gefahr { color: var(--schlecht); border-color: var(--schlecht); background: transparent; }

.meldung { padding: 10px 14px; border-radius: 8px; background: var(--flaeche); border: 1px solid var(--rand); }
.meldung.fehler { border-color: var(--schlecht); color: var(--schlecht); }
.meldung.gut { border-color: var(--gut); color: var(--gut); }

.anmelden { max-width: 460px; margin: 64px auto; text-align: center; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 32px; }
.anmelden p { color: var(--leise); }

.mandanten { display: grid; gap: 14px; }
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 18px 20px; box-shadow: var(--schatten); }
.karte-kopf { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.quelle { margin: 2px 0 0; color: var(--leise); font-size: 0.85rem; overflow-wrap: anywhere; }
.abzeichen { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.marke-klein { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rand); color: var(--leise); white-space: nowrap; }
.marke-klein.gut { color: var(--gut); border-color: var(--gut); }
.marke-klein.warn { color: var(--warn); border-color: var(--warn); }
.marke-klein.schlecht { color: var(--schlecht); border-color: var(--schlecht); }
.marke-klein.laeuft { color: var(--akzent-text); background: var(--akzent); border-color: var(--akzent); }

.zahlen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0 12px; }
.zahl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.was { color: var(--leise); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.wert { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.neben { color: var(--leise); font-size: 0.82rem; }
.balken { height: 6px; border-radius: 3px; background: var(--balken); overflow: hidden; margin: 4px 0 2px; }
.balken span { display: block; height: 100%; width: 0; background: var(--akzent); border-radius: 3px; transition: width 0.4s; }

.fehler { margin: 0 0 12px; font-size: 0.88rem; }
.fehler summary { cursor: pointer; color: var(--warn); }
.fehler .ids { font: 0.85rem ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-word; }

.aktionen { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--rand); padding-top: 12px; }
.trenner { flex: 1; }

.hinweis { color: var(--leise); font-size: 0.85rem; }
.warnung { color: var(--warn); font-size: 0.9rem; }

dialog {
  border: 1px solid var(--rand); border-radius: 12px; padding: 20px 22px;
  background: var(--flaeche); color: var(--text);
  width: min(520px, calc(100vw - 32px));
}
dialog.breit { width: min(960px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.dialog-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

fieldset { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 12px; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
label { display: grid; gap: 4px; font-size: 0.88rem; font-weight: 500; }
label small, fieldset > small { font-weight: 400; color: var(--leise); }
input {
  font: inherit; font-weight: 400;
  padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--rand); background: var(--grund); color: var(--text);
  width: 100%;
}
input:invalid:not(:placeholder-shown) { border-color: var(--schlecht); }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.uebertrag { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rand); }
.uebertrag .was { margin: 0 0 6px; }
.uebertrag dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; align-items: center; }
.uebertrag dt { font-size: 0.85rem; color: var(--leise); }
.uebertrag dd { margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.uebertrag code { font: 0.85rem ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; min-width: 0; }
.uebertrag code.leer { color: var(--leise); font-family: inherit; font-style: italic; }
.kopieren { padding: 3px 9px; font-size: 0.8rem; flex: none; }

.lauf-wahl { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.lauf-wahl select { max-width: 100%; min-width: 0; }

.protokoll {
  margin: 0; max-height: 60vh; overflow: auto;
  background: var(--grund); border: 1px solid var(--rand); border-radius: 8px;
  padding: 12px; font: 0.8rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; word-break: break-word;
}

@media (max-width: 640px) {
  .kopf { padding: 12px 16px; flex-wrap: wrap; }
  .unter { display: none; }
  .ich { width: 100%; justify-content: space-between; min-width: 0; }
  #ich-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .karte-kopf { flex-direction: column; }
  .abzeichen { justify-content: flex-start; }
  .zahlen { grid-template-columns: 1fr; gap: 10px; }
  .zwei { grid-template-columns: 1fr; }
  .uebertrag dl { grid-template-columns: 1fr; }
  .trenner { display: none; }
}
