:root {
  --gelb: #ffcc00;
  --rot: #d40511;
  --dunkel: #1f2328;
  --grau: #f5f6f8;
  --rand: #e1e4e8;
  --text: #24292f;
  --text2: #57606a;
  --gruen: #1a7f37;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { font-family: "Segoe UI", system-ui, sans-serif; background: var(--grau); color: var(--text); }

header {
  background: var(--dunkel);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
header .logo {
  background: var(--gelb);
  color: var(--rot);
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}
header h1 { font-size: 16px; font-weight: 600; flex: 1; }
header button { background: none; border: 1px solid #4a5058; color: #c8ccd1; padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; }

main { max-width: 560px; margin: 0 auto; padding: 16px; }
main.breit { max-width: 1100px; }

.karte {
  background: #fff;
  border: 1px solid var(--rand);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}
.karte h2 { font-size: 15px; padding: 14px 16px; border-bottom: 1px solid var(--rand); }
.karte .innen { padding: 16px; }
.karte .inhalt { overflow-x: auto; }

label { font-size: 13px; color: var(--text2); display: block; margin: 12px 0 4px; }
input, select {
  width: 100%;
  padding: 12px;
  border: 1px solid #c3c9d0;
  border-radius: 8px;
  font-size: 17px;
}
/* iOS Safari: Datums-/Zeitfelder erzwingen sonst eine eigene Breite und ragen rechts heraus */
input[type="date"], input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
  min-height: 47px;
  background: #fff;
}
.btn {
  width: 100%;
  background: var(--rot);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
}
.btn:hover { background: #b00410; }
.btn.sekundaer { background: #fff; color: var(--text); border: 1px solid #c3c9d0; font-weight: 400; }
.btn.klein { width: auto; padding: 6px 12px; font-size: 13px; margin: 0; }

.meldung { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; display: none; }
.meldung.ok { display: block; background: #e6f4ea; color: var(--gruen); border: 1px solid #b7e1c1; }
.meldung.fehler { display: block; background: #fdecea; color: var(--rot); border: 1px solid #f5c6c3; }

.status {
  text-align: center;
  padding: 20px 16px;
}
.status .gross { font-size: 22px; font-weight: 700; }
.status .klein { font-size: 14px; color: var(--text2); margin-top: 4px; }
.haken { color: var(--gruen); font-size: 40px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; white-space: nowrap; }
th { background: #fafbfc; color: var(--text2); font-weight: 600; font-size: 12px; text-transform: uppercase; border-bottom: 1px solid var(--rand); }
td { border-bottom: 1px solid #f0f1f3; }
tr:last-child td { border-bottom: none; }
td.zahl, th.zahl { text-align: right; }
.offen { color: var(--rot); font-size: 12.5px; }
.badge { display: inline-block; background: var(--grau); border: 1px solid var(--rand); border-radius: 20px; padding: 2px 9px; font-size: 12.5px; }
.leer { padding: 30px; text-align: center; color: var(--text2); }
.fussnote { font-size: 12.5px; color: var(--text2); padding: 10px 16px 14px; }

nav.tabs { background: #fff; border-bottom: 1px solid var(--rand); display: flex; padding: 0 16px; }
nav.tabs button {
  background: none; border: none; padding: 12px 14px; font-size: 14px; cursor: pointer;
  color: var(--text2); border-bottom: 3px solid transparent;
}
nav.tabs button.aktiv { color: var(--text); border-bottom-color: var(--rot); font-weight: 600; }
.zeile2 { display: flex; gap: 10px; }
.zeile2 > div { flex: 1; }

.urlaub-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 18px; }
.urlaub-form > div { min-width: 0; }
.urlaub-form label { margin: 0 0 4px; }
.urlaub-form select, .urlaub-form input { width: 100%; min-width: 170px; }
.urlaub-form .btn { width: auto; padding: 12px 24px; margin: 0; font-size: 15px; }

/* Sortierbare Tabellen */
th.sortierbar { cursor: pointer; user-select: none; }
th.sortierbar:hover { color: var(--text); }
th.sortiert-auf::after { content: " ▲"; font-size: 9px; }
th.sortiert-ab::after { content: " ▼"; font-size: 9px; }

/* Filterleiste */
.filterleiste { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--rand); }
.filterleiste select { width: auto; padding: 8px 10px; font-size: 14px; }
.filterleiste label.kontrast { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--text); cursor: pointer; }
.filterleiste input[type="checkbox"] { width: auto; }

/* Balkendiagramm (Qualitätsverlauf) */
.diagramm { display: flex; align-items: flex-end; gap: 9px; padding: 18px 16px 12px; overflow-x: auto; }
.dia-spalte { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 34px; }
.dia-wert { font-size: 11.5px; color: var(--text2); white-space: nowrap; }
.dia-balken { width: 22px; min-height: 4px; border-radius: 6px 6px 0 0; background: #2da44e; }
.dia-balken.gelb { background: #d4a72c; }
.dia-balken.rot { background: var(--rot); }
.dia-tag { font-size: 10.5px; color: var(--text2); text-align: center; line-height: 1.3; white-space: nowrap; }

/* Balken-Rangliste */
.rang-zeile { display: flex; align-items: center; gap: 10px; padding: 5px 16px; }
.rang-name { width: 190px; flex-shrink: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rang-spur { flex: 1; background: var(--grau); border-radius: 8px; height: 22px; }
.rang-balken {
  height: 100%; background: var(--gelb); border-radius: 8px; min-width: 28px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px; font-size: 12px; font-weight: 700;
}
.rang-detail { width: 170px; flex-shrink: 0; font-size: 12px; color: var(--text2); }
@media (max-width: 640px) {
  .rang-name { width: 105px; font-size: 13px; }
  .rang-detail { display: none; }
}

/* Update-Seite: Zeitstrahl + geplante Karten */
.geplant-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px 16px; }
.geplant-karte {
  border: 1.5px dashed #e0c341; background: #fffdf0; border-radius: 12px; padding: 14px;
  font-size: 13.5px; line-height: 1.55; color: var(--text);
}
.geplant-karte .symbol { font-size: 24px; display: block; margin-bottom: 6px; }
.geplant-karte strong { display: block; margin-bottom: 4px; font-size: 14px; }

.zeitstrahl { position: relative; margin: 14px 10px 10px 26px; padding-left: 24px; border-left: 2px solid var(--rand); }
.zs-eintrag { position: relative; margin-bottom: 16px; }
.zs-punkt {
  position: absolute; left: -33px; top: 16px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--gelb); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--rand);
}
.zs-karte { background: #fff; border: 1px solid var(--rand); border-radius: 12px; padding: 12px 16px 14px; }
.zs-karte.fokus { border-color: var(--rot); box-shadow: 0 0 0 1px var(--rot); }
.zs-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.zs-symbol {
  font-size: 20px; width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grau); border-radius: 10px;
}
.zs-titel { font-weight: 700; font-size: 15px; }
.zs-datum {
  margin-left: auto; font-size: 12px; color: var(--text2);
  background: var(--grau); padding: 3px 9px; border-radius: 12px; white-space: nowrap;
}
.neu-abzeichen {
  background: var(--rot); color: #fff; font-size: 11px; padding: 2px 8px;
  border-radius: 10px; font-weight: 700; letter-spacing: .3px;
}
.zs-text { margin-top: 8px; font-size: 14px; line-height: 1.7; }
@media (max-width: 640px) {
  .zeitstrahl { margin-left: 16px; padding-left: 18px; }
  .zs-punkt { left: -27px; }
  .zs-datum { margin-left: 48px; }
}

/* Einstellungs-Menü */
.menue-zeile {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; border-bottom: 1px solid #f0f1f3; cursor: pointer;
}
.menue-zeile:last-child { border-bottom: none; }
.menue-zeile:hover { background: #fafbfc; }
.menue-text { font-size: 13px; color: var(--text2); margin-top: 2px; }
.menue-pfeil { font-size: 26px; color: #c3c9d0; margin-left: 12px; }

/* Handy-Ansicht */
@media (max-width: 640px) {
  .mobil-weg { display: none; }
  nav.tabs { scrollbar-width: none; }
  nav.tabs::-webkit-scrollbar { display: none; }
  header .woche-wahl { flex: 1; }
  header .woche-wahl select { flex: 1; max-width: none; }
  header { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  header h1 { font-size: 14px; }
  header .logo { font-size: 12px; padding: 2px 6px; }
  header select { max-width: 46vw; font-size: 13px; }
  header button { padding: 5px 9px; font-size: 12px; }
  main { padding: 10px; }
  nav.tabs { padding: 0 4px; }
  nav.tabs button { padding: 11px 10px; font-size: 13px; }
  th, td { padding: 8px 9px; font-size: 13px; }
  .karte h2 { font-size: 14px; padding: 12px 12px; }
  .zeile2 { flex-direction: column; gap: 0; }
  .urlaub-form { flex-direction: column; align-items: stretch; padding: 14px; }
  .urlaub-form select, .urlaub-form input { min-width: 0; }
  .urlaub-form .btn { width: 100%; }
}
