:root {
  --grund: #f6f6f5;
  --flaeche: #ffffff;
  --text: #171717;
  --leise: #6b6b6b;
  --linie: #e6e6e3;
  --linie-stark: #d4d4d0;
  --haupt: #171717;
  --haupt-text: #fafafa;
  --gruen: #15803d;
  --gruen-hell: #e9f6ee;
  --gelb: #b45309;
  --gelb-hell: #fdf3e2;
  --rot: #c81e1e;
  --rot-hell: #fdecec;
  --blau: #1d4ed8;
  --blau-hell: #e9effd;
  --lila: #7e22ce;
  --lila-hell: #f4ebfd;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #111111;
    --flaeche: #1a1a1a;
    --text: #ededed;
    --leise: #a0a0a0;
    --linie: #2b2b2b;
    --linie-stark: #3a3a3a;
    --haupt: #f2f2f2;
    --haupt-text: #111111;
    --gruen: #4ade80;
    --gruen-hell: #14301f;
    --gelb: #fbbf24;
    --gelb-hell: #33270f;
    --rot: #f87171;
    --rot-hell: #3a1717;
    --blau: #93b4ff;
    --blau-hell: #17233f;
    --lila: #d3a6ff;
    --lila-hell: #2d1a40;
    --schatten: none;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 24px;
}
h2 {
  font-size: 18px;
}
h3 {
  font-size: 14px;
  margin: 18px 0 8px;
  color: var(--leise);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
a {
  color: inherit;
}
code,
kbd {
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--grund);
  border: 1px solid var(--linie);
  border-radius: 5px;
  padding: 1px 5px;
}

/* Kopfzeile */
.kopf {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--flaeche) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--linie);
}
.kopf-innen {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.marke {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}
.navi {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.navi a {
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--leise);
  white-space: nowrap;
  font-weight: 500;
}
.navi a:hover {
  color: var(--text);
  background: var(--grund);
}
.navi a.aktiv {
  color: var(--text);
  background: var(--grund);
  box-shadow: inset 0 0 0 1px var(--linie);
}
.kopf-rechts {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.wer {
  color: var(--leise);
  font-size: 13px;
}

.inhalt {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.laden {
  color: var(--leise);
  text-align: center;
  margin-top: 20vh;
}

/* Karten */
.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--schatten);
}
.karte.schmal {
  max-width: 440px;
  width: 100%;
  margin: 6vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.karte.ohne-rand {
  padding: 0;
  overflow: hidden;
}
.karte > h2 + p,
.karte > h2 + form {
  margin-top: 10px;
}
.logo {
  margin-bottom: 4px;
}
.leise {
  color: var(--leise);
}
.klein-text {
  font-size: 13px;
  margin: 4px 0 0;
}
.link-feld {
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.nowrap {
  white-space: nowrap;
}
.rot-text {
  color: var(--rot);
}

.zeile-kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.zeile-kopf h1,
.zeile-kopf h2 {
  margin-right: auto;
}

/* Knöpfe */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--linie-stark);
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.knopf:hover {
  background: var(--grund);
}
.knopf:active {
  transform: translateY(1px);
}
.knopf:disabled {
  opacity: 0.55;
  cursor: progress;
}
.knopf.haupt {
  background: var(--haupt);
  border-color: var(--haupt);
  color: var(--haupt-text);
}
.knopf.haupt:hover {
  opacity: 0.9;
}
.knopf.leise {
  border-color: transparent;
  background: transparent;
  color: var(--leise);
}
.knopf.leise:hover {
  background: var(--grund);
  color: var(--text);
}
.knopf.klein {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
}
.aktionen {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
.aktionen.rechts {
  justify-content: flex-end;
  margin-top: 8px;
}

:focus-visible {
  outline: 2px solid var(--blau);
  outline-offset: 2px;
}

/* Formulare */
.formular {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.formular label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 550;
  color: var(--leise);
}
.formular label.haken {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 450;
  font-size: 14px;
}
.reihe {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.reihe > label {
  flex: 1 1 140px;
}
.reihe > label.breit {
  flex: 3 1 240px;
}
input,
select {
  font: inherit;
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--linie-stark);
  border-radius: 8px;
  min-height: 38px;
  padding: 6px 10px;
  width: 100%;
}
input[type='checkbox'] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--haupt);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--blau);
  box-shadow: 0 0 0 3px var(--blau-hell);
}
.auswahl {
  width: auto;
  min-width: 180px;
}
fieldset {
  border: 1px solid var(--linie);
  border-radius: 10px;
  padding: 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--leise);
  padding: 0 4px;
}
.tage-wahl {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 14px;
}

/* Hinweise und Chips */
.hinweis-box {
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0;
  background: var(--grund);
  border: 1px solid var(--linie);
  display: flex;
  gap: 8px 12px;
  align-items: center;
  flex-wrap: wrap;
}
.hinweis-box.gruen {
  background: var(--gruen-hell);
  border-color: transparent;
}
.hinweis-box.rot {
  background: var(--rot-hell);
  border-color: transparent;
}
.hinweis-box.blau {
  background: var(--blau-hell);
  border-color: transparent;
  flex-direction: column;
  align-items: flex-start;
}
.chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--grund);
  color: var(--leise);
  border: 1px solid var(--linie);
  white-space: nowrap;
}
.chip.rot {
  background: var(--rot-hell);
  color: var(--rot);
  border-color: transparent;
}
.chip.gelb {
  background: var(--gelb-hell);
  color: var(--gelb);
  border-color: transparent;
}
.chip.gruen {
  background: var(--gruen-hell);
  color: var(--gruen);
  border-color: transparent;
}
.chip.blau {
  background: var(--blau-hell);
  color: var(--blau);
  border-color: transparent;
}
.chip.lila {
  background: var(--lila-hell);
  color: var(--lila);
  border-color: transparent;
}

/* Status */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.punkt {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--linie-stark);
}
.status-da .punkt {
  background: var(--gruen);
  box-shadow: 0 0 0 4px var(--gruen-hell);
}
.status-pause .punkt {
  background: var(--gelb);
  box-shadow: 0 0 0 4px var(--gelb-hell);
}
.status-feierabend .punkt {
  background: var(--leise);
}

/* Stempeluhr */
.stempel {
  text-align: center;
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.datum {
  color: var(--leise);
  font-weight: 500;
}
.uhr {
  font-size: clamp(56px, 13vw, 96px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stempel .status {
  font-size: 17px;
  margin-top: 4px;
}
.stempel-knoepfe {
  display: flex;
  gap: 14px;
  margin: 18px 0 6px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.stempel-knopf {
  flex: 0 1 260px;
  min-height: 112px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.08s, filter 0.12s;
  box-shadow: 0 2px 0 rgb(0 0 0 / 0.12), 0 8px 24px rgb(0 0 0 / 0.08);
}
.stempel-knopf span {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.stempel-knopf small {
  font-size: 14px;
  opacity: 0.85;
}
.stempel-knopf:hover {
  filter: brightness(1.07);
}
.stempel-knopf:active {
  transform: scale(0.985);
}
.stempel-knopf:disabled {
  opacity: 0.6;
  cursor: progress;
}
.stempel-knopf.gruen {
  background: #16a34a;
}
.stempel-knopf.gelb {
  background: #d97706;
}
.stempel-knopf.dunkel {
  background: #262626;
}
@media (prefers-color-scheme: dark) {
  .stempel-knopf.dunkel {
    background: #404040;
  }
}
.heute-zeiten {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.heute-zeiten.links {
  justify-content: flex-start;
  margin: 12px 0 0;
}
.zeitblock {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--grund);
  border: 1px solid var(--linie);
  font-weight: 550;
}
.pause-strich {
  width: 14px;
  border-top: 2px dotted var(--linie-stark);
}

/* Kacheln */
.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kacheln.innen {
  margin-top: 14px;
}
.kachel {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kacheln.innen .kachel {
  background: var(--grund);
  border-color: transparent;
}
.kachel span {
  font-size: 12.5px;
  color: var(--leise);
  font-weight: 550;
}
.kachel b {
  font-size: 24px;
  letter-spacing: -0.02em;
}
.kachel small {
  color: var(--leise);
  font-size: 12.5px;
}
.plus {
  color: var(--gruen);
}
.minus {
  color: var(--rot);
}

/* Listen */
.liste {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.liste li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--linie);
  flex-wrap: wrap;
}
.liste li:first-child {
  border-top: 0;
}
.liste .breit {
  flex: 1 1 200px;
}
.liste.aufgaben {
  margin-top: 0;
}

/* Tabellen */
.tabelle-rahmen {
  overflow-x: auto;
}
.tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tabelle th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--leise);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: var(--grund);
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}
.tabelle td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--linie);
  vertical-align: middle;
}
.tabelle tbody tr:last-child td {
  border-bottom: 0;
}
.tabelle tfoot td {
  border-top: 2px solid var(--linie-stark);
  border-bottom: 0;
  font-weight: 600;
  background: var(--grund);
}
.tabelle .zahl {
  text-align: right;
  white-space: nowrap;
}
.tabelle .info {
  text-align: right;
}
.tabelle .info .chip {
  margin-left: 4px;
}
.tabelle tr.klickbar {
  cursor: pointer;
}
.tabelle tr.klickbar:hover td {
  background: var(--grund);
}
.tabelle tr.wochenende td {
  background: color-mix(in srgb, var(--grund) 60%, transparent);
  color: var(--leise);
}
.tabelle tr.heute td:first-child {
  box-shadow: inset 3px 0 0 var(--blau);
  font-weight: 650;
}
.tabelle tr.zukunft td {
  opacity: 0.5;
}
.tabelle td span.nowrap + span.nowrap {
  margin-left: 6px;
}
.protokoll td {
  vertical-align: top;
  font-size: 13px;
}
.aenderung .vorher {
  color: var(--rot);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--rot) 40%, transparent);
}
.aenderung .nachher {
  color: var(--gruen);
}

/* Dialog */
.dialog {
  border: 1px solid var(--linie);
  border-radius: 16px;
  padding: 20px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--flaeche);
  color: var(--text);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.25);
}
.dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}
.dialog-kopf {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.seg-zeile {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.seg-zeile input {
  width: 120px;
}
.seg-info {
  font-size: 12px;
  color: var(--leise);
  flex-basis: 100%;
  margin: -4px 0 4px;
}
.seg-info:empty {
  display: none;
}
#seg-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anleitung {
  margin: 10px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Kurzmeldung */
.meldung {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--haupt);
  color: var(--haupt-text);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 550;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
  max-width: calc(100vw - 32px);
  z-index: 20;
}
.meldung.fehler {
  background: var(--rot);
  color: #fff;
}

.monat-navi {
  display: flex;
  align-items: center;
  gap: 4px;
}
.monat-navi b {
  min-width: 128px;
  text-align: center;
}

.druck-kopf,
.unterschriften {
  display: none;
}

@media (max-width: 720px) {
  .kopf-innen {
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .navi {
    order: 3;
    flex-basis: 100%;
  }
  .wer {
    display: none;
  }
  .kopf-rechts {
    margin-left: auto;
  }
  .nur-breit {
    display: none;
  }
  .tabelle td,
  .tabelle th {
    padding: 8px;
  }
  .inhalt {
    padding-top: 16px;
  }
  .stempel-knopf {
    flex-basis: 100%;
    min-height: 96px;
  }
  .kacheln {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kachel b {
    font-size: 20px;
  }
}

@media print {
  :root {
    --grund: #fff;
    --flaeche: #fff;
    --text: #000;
    --leise: #444;
    --linie: #bbb;
    --linie-stark: #888;
  }
  body {
    font-size: 11px;
    background: #fff;
  }
  .kopf,
  .druck-aus,
  .meldung,
  .dialog {
    display: none !important;
  }
  .inhalt {
    padding: 0;
    max-width: none;
    gap: 10px;
  }
  .druck-kopf {
    display: block;
  }
  .druck-kopf p {
    margin: 2px 0 0;
  }
  .karte,
  .kachel {
    box-shadow: none;
    break-inside: avoid;
  }
  .nur-breit {
    display: table-cell !important;
  }
  .tabelle {
    font-size: 10.5px;
  }
  .tabelle td,
  .tabelle th {
    padding: 3px 6px;
  }
  .tabelle tr.zukunft td {
    opacity: 1;
  }
  .unterschriften {
    display: flex;
    gap: 48px;
    margin-top: 36px;
  }
  .unterschriften div {
    flex: 1;
    font-size: 11px;
    color: #444;
  }
  .unterschriften span {
    display: block;
    border-bottom: 1px solid #000;
    height: 36px;
    margin-bottom: 4px;
  }
  @page {
    size: A4;
    margin: 14mm;
  }
}
