:root {
  --gruen: #9EE036;
  --gruen-hell: #E4F6C9;
  --text: #2B2B2B;
  --leise: #5F5F5F;
  --linie: #D4D4D4;
  --grund: #F4F4F4;
  --weiss: #FFFFFF;
  --fehler: #B3261E;
  --fehler-hell: #FDECEA;
  --hinweis: #6B5200;
  --hinweis-hell: #FFF5D1;
  --fuss: calc(72px + env(safe-area-inset-bottom, 0px));
}

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

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.4 Arial, Helvetica, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 24px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 4px; }
label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 4px; }

input, select, button { font: inherit; color: inherit; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--weiss);
  border: 1px solid #8A8A8A;
  border-radius: 6px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}
input[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--fehler);
  background: var(--fehler-hell);
}

button { min-height: 44px; padding: 8px 14px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
.haupt { background: var(--gruen); color: var(--text); font-weight: 700; }
.haupt:hover:not(:disabled) { background: #8DCF2A; }
.leicht { background: var(--weiss); border-color: #8A8A8A; }
.leicht:hover:not(:disabled) { background: var(--grund); }

.leise { color: var(--leise); }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.fehlertext { color: var(--fehler); font-size: 14px; margin: 4px 0 0; }

.testband {
  background: var(--hinweis-hell);
  color: var(--hinweis);
  padding: 6px 16px;
  font-size: 14px;
  text-align: center;
}

.anmeldung { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.karte {
  width: min(100%, 360px);
  background: var(--weiss);
  border-top: 4px solid var(--gruen);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 8px;
}
.karte p { margin: 0 0 8px; }
.karte label { margin: 8px 0 0; }
.karte .haupt { margin-top: 12px; }

.kopf {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--weiss);
  border-bottom: 1px solid var(--linie);
}
.marke { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.markenpunkt { width: 14px; height: 14px; border-radius: 50%; background: var(--gruen); }
.kopfrechts { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kopfrechts select { width: auto; max-width: 160px; min-width: 0; }

.spalten {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(var(--fuss) + 24px);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

.wochenbereich, .formularbereich { min-width: 0; }

.tagwahl { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.tagwahl label { grid-column: 1 / -1; margin: 0; }

.wochenkopf { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-weight: 700; }
.pfeil { width: 44px; padding: 0; font-size: 22px; background: transparent; }
.pfeil:hover:not(:disabled) { background: var(--weiss); }

.woche { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }

.tagchip {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 2px;
  background: var(--weiss);
  border: 1px solid var(--linie);
}
.tagchip .kurz { font-weight: 700; font-size: 14px; }
.tagchip .nummer { font-size: 12px; color: var(--leise); }
.tagchip .punkte { display: flex; gap: 2px; min-height: 16px; }
.tagchip.voll { background: var(--gruen-hell); border-color: #A9CF74; }
.tagchip.teil { background: var(--hinweis-hell); border-color: #D9B84F; }
.tagchip.offen { border-color: var(--text); }
.tagchip.frei { background: #E9E9E9; }
.tagchip.gewaehlt { box-shadow: 0 0 0 2px var(--text); }

.punkt {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  background: var(--weiss);
  border: 1px solid #8A8A8A;
  line-height: 13px;
}
.punkt.voll { background: var(--gruen); border-color: var(--gruen); }
.punkt.teil { background: #F4CF5B; border-color: #F4CF5B; }

.wocheninfo { font-size: 14px; margin: 8px 0 0; }

.tagzeile { display: none; }

.reiter { display: flex; gap: 4px; margin: 12px 0; border-bottom: 2px solid var(--linie); overflow-x: auto; }
.reiter button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
  white-space: nowrap;
}
.reiter button[aria-selected="true"] { border-bottom-color: var(--gruen); font-weight: 700; }
.reiter .aenderung { color: var(--fehler); }

.hinweisbox {
  background: var(--hinweis-hell);
  color: var(--hinweis);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  margin: 8px 0;
}

.formular { display: grid; gap: 12px; }
fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  background: var(--weiss);
  border: 0;
  border-radius: 8px;
}
legend { float: left; width: 100%; padding: 0; margin-bottom: 8px; font-weight: 700; }
legend + * { clear: both; }

.raster { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster.einzeln { grid-template-columns: minmax(0, 1fr); }
.feld { min-width: 0; }
.feld .fehlertext { margin-top: 3px; }

.summenzeile { margin: 10px 0 0; font-size: 15px; }
.summenzeile.ok { color: #3C6300; }
.summenzeile.nein { color: var(--fehler); font-weight: 700; }

.ausgabe { font-size: 20px; font-weight: 700; margin: 0; }
#differenzText { margin: 4px 0 0; font-size: 14px; }
.ausgabe.warn { color: var(--fehler); }

.tabellenrahmen { overflow-x: auto; background: var(--weiss); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--linie); text-align: right; white-space: nowrap; }
th:nth-child(-n+3), td:nth-child(-n+3) { text-align: left; }
thead th { background: var(--grund); }
tfoot td { font-weight: 700; }

.laufeingabe { display: grid; gap: 10px; }
.laufeingabe .aktion { display: flex; flex-wrap: wrap; gap: 8px; }

.leiste {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  background: var(--weiss);
  border-top: 1px solid var(--linie);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
}
.leisteninhalt { max-width: 1048px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
#leisteText { flex: 1; min-width: 0; font-size: 14px; color: var(--leise); }
#speichern { min-width: 120px; }

.meldung {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--fuss) + 8px);
  z-index: 7;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--text);
  color: var(--weiss);
  font-size: 15px;
}
.meldung.nein { background: var(--fehler); }

dialog {
  width: min(calc(100% - 32px), 520px);
  border: 0;
  border-radius: 8px;
  padding: 20px;
  color: var(--text);
}
dialog::backdrop { background: rgba(43, 43, 43, .5); }
dialog h3 { margin: 0 0 8px; font-size: 18px; }
dialog p { margin: 0 0 12px; }
dialog td, dialog th { white-space: normal; text-align: left; padding: 6px 8px 6px 0; }
.dialogknoepfe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.wahl { display: grid; gap: 6px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--linie); }
.wahl label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.wahl input { width: 22px; min-height: 22px; }
.wahl strong { display: block; }

@media (max-width: 520px) {
  .kopf { gap: 8px; }
  .marke { font-size: 0; gap: 0; }
  .kopfrechts { flex: 1; }
  .kopfrechts select { flex: 1; max-width: none; }
  #abmelden { padding: 8px 10px; }
}

@media (min-width: 620px) {
  .raster.fuenf { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .spalten { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
  .wochenbereich { position: sticky; top: 76px; }
  .woche { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .tagchip {
    grid-template-columns: 34px 1fr auto;
    justify-items: start;
    align-items: center;
    padding: 8px 10px;
  }
  .tagchip .nummer { font-size: 14px; }
}
