:root {
  --petrol: #12807a;
  --petrol-dunkel: #0c5f5a;
  --hg: #f6f7f7;
  --flaeche: #ffffff;
  --text: #1d2427;
  --leise: #5c6a70;
  --linie: #dde3e5;
  --akzent-hg: #e3f2f1;
  --neu: #1d7f3c;
  --neu-hg: #e4f4e8;
  --geaendert: #8a5a00;
  --geaendert-hg: #fbf0d9;
  --geloescht: #a3282c;
  --geloescht-hg: #fbe4e4;
  --schatten: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --petrol: #3fb5ad;
    --petrol-dunkel: #6fd0c9;
    --hg: #121718;
    --flaeche: #1b2224;
    --text: #e6ecee;
    --leise: #9aa9ae;
    --linie: #2c3638;
    --akzent-hg: #173634;
    --neu: #6fd18c;
    --neu-hg: #16301f;
    --geaendert: #f0c060;
    --geaendert-hg: #33290f;
    --geloescht: #f08a8d;
    --geloescht-hg: #3a1a1b;
    --schatten: none;
    color-scheme: dark;
  }
}

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

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

a { color: var(--petrol); }
code { font-size: .9em; background: var(--akzent-hg); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }

.kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 5; }
.kopf-innen, .reiter, main { padding-left: 16px; padding-right: 16px; }
.kopf-innen { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; flex-wrap: wrap; }
.marke { display: flex; align-items: center; gap: 12px; }
.logo {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--petrol); color: var(--petrol); font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
h1 { margin: 0; font-size: 20px; }
.unterzeile, .stand { margin: 0; color: var(--leise); font-size: 13px; }
.stand.fehler { color: var(--geloescht); }

.reiter { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
.reiter a {
  padding: 8px 14px; text-decoration: none; color: var(--leise); font-weight: 600;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.reiter a[aria-current="page"] { color: var(--text); border-bottom-color: var(--petrol); }

main { padding-top: 16px; padding-bottom: 48px; }

.leiste { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.feld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--leise); }
.feld.suche { flex: 1 1 220px; }
select, input[type="search"] {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 8px; padding: 8px 10px; min-height: 38px; max-width: 100%;
}
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--petrol); outline-offset: 1px; }

button {
  font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; min-height: 38px;
}
button:hover { border-color: var(--petrol); }
.umschalter { display: flex; }
.umschalter button { border-radius: 0; margin-left: -1px; }
.umschalter button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.umschalter button:last-child { border-radius: 0 8px 8px 0; }
.umschalter button[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }

.nav-monat { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.nav-monat h2 { margin: 0 0 0 8px; font-size: 18px; }
.nav-monat button { min-width: 38px; }

/* Monatsansicht */
.monat {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--linie); gap: 1px; border: 1px solid var(--linie); border-radius: 10px; overflow: hidden;
}
.wt { background: var(--flaeche); padding: 6px; font-size: 12px; font-weight: 600; color: var(--leise); text-align: center; }
.tag { background: var(--flaeche); min-height: 110px; padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tag.fremd { background: var(--hg); }
.tag.fremd .nr { opacity: .5; }
.tag .nr { font-size: 12px; color: var(--leise); padding: 2px 4px; align-self: flex-end; }
.tag.heute .nr { background: var(--petrol); color: #fff; border-radius: 10px; font-weight: 700; }
.chip {
  display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--petrol);
  background: var(--akzent-hg); color: var(--text); border-radius: 4px; padding: 2px 5px; min-height: 0;
  font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto;
}
.chip .uhr { color: var(--leise); margin-right: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.ganztag { background: var(--petrol); color: #fff; border-left-color: var(--petrol-dunkel); }

.tag .nr { border: 0; background: none; min-height: 0; cursor: pointer; font: inherit; font-size: 12px; }
.tag .nr:hover { color: var(--petrol); }

/* Woche */
.woche { border: 1px solid var(--linie); border-radius: 10px; background: var(--flaeche); overflow-x: auto; }
.woche-innen { min-width: 720px; }
.woche-zeile { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.woche-tag { text-align: center; padding: 6px 0; border-left: 1px solid var(--linie); border-bottom: 1px solid var(--linie); }
.woche-zeile > div:first-child { border-bottom: 1px solid var(--linie); }
.woche-tag .wt-name { display: block; font-size: 12px; color: var(--leise); font-weight: 600; }
.woche-tag .wt-nr { font-size: 18px; font-weight: 600; }
.woche-tag.heute .wt-nr { background: var(--petrol); color: #fff; border-radius: 14px; padding: 0 8px; }
.woche-ganztag { border-bottom: 2px solid var(--linie); }
.woche-label { font-size: 11px; color: var(--leise); padding: 4px; text-align: right; }
.woche-zelle { border-left: 1px solid var(--linie); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 26px; }
.woche-raster { max-height: 72vh; overflow-y: auto; }
.woche-raster > .woche-zeile > div:first-child { border-bottom: 0; }
.woche-stunden div { font-size: 11px; color: var(--leise); text-align: right; padding-right: 6px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.woche-spalte {
  position: relative; border-left: 1px solid var(--linie);
  background-image: repeating-linear-gradient(to bottom, var(--linie) 0 1px, transparent 1px 44px);
}
.woche-spalte.heute { background-color: var(--akzent-hg); }
.termin {
  position: absolute; overflow: hidden; text-align: left; padding: 2px 5px; min-height: 0;
  border: 0; border-left: 3px solid var(--petrol-dunkel); border-radius: 4px;
  background: var(--petrol); color: #fff; font-size: 12px; line-height: 1.25; display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px var(--flaeche);
}
.termin:hover { z-index: 2; filter: brightness(1.08); }
.termin .uhr { font-variant-numeric: tabular-nums; opacity: .85; font-size: 11px; white-space: nowrap; }
.termin .was { font-weight: 600; overflow-wrap: anywhere; }
.termin .wo { opacity: .85; font-size: 11px; }
.termin.kurz { flex-direction: row; gap: 4px; white-space: nowrap; }
.jetzt { position: absolute; left: 0; right: 0; height: 2px; background: var(--geloescht); z-index: 3; pointer-events: none; }
.jetzt::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--geloescht); }

/* Liste */
.liste { display: flex; flex-direction: column; gap: 14px; }
.liste-tag h3 { margin: 0 0 6px; font-size: 14px; color: var(--leise); font-weight: 600; }
.liste-tag.heute h3 { color: var(--petrol); }
.eintrag {
  display: grid; grid-template-columns: 110px 1fr; gap: 10px; width: 100%; text-align: left;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 6px; box-shadow: var(--schatten);
}
.eintrag .uhr { color: var(--leise); font-variant-numeric: tabular-nums; font-size: 13px; }
.eintrag .was { font-weight: 600; }
.eintrag .wo { color: var(--leise); font-size: 13px; }
.leer { color: var(--leise); padding: 24px 0; }

/* Abonnieren */
.hinweis { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 4px 16px; margin-bottom: 18px; }
.gruppe h2 { font-size: 16px; margin: 22px 0 8px; }
.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 12px 14px;
  box-shadow: var(--schatten); display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.karte-kopf { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.karte h3 { margin: 0; font-size: 15px; }
.anzahl { color: var(--leise); font-size: 12px; white-space: nowrap; }
.url { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; color: var(--text); }
.knoepfe { display: flex; gap: 6px; flex-wrap: wrap; }
.knoepfe a, .knoepfe button { font-size: 13px; min-height: 34px; padding: 6px 10px; }
.knoepfe a {
  background: var(--petrol); color: #fff; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center;
}
.marke-alt { font-size: 11px; background: var(--akzent-hg); color: var(--petrol-dunkel); border-radius: 10px; padding: 1px 7px; margin-left: 6px; font-weight: 600; }
.epirent { font-size: 12px; color: var(--leise); overflow-wrap: anywhere; }
.epirent a { color: var(--leise); }
.warnung { color: var(--geloescht); font-size: 12px; }
.knoepfe a.zweit { background: var(--flaeche); color: var(--text); border: 1px solid var(--linie); }
.leise { color: var(--leise); }
.kanal-zeile { display: grid; grid-template-columns: 60px 1fr; gap: 8px; font-size: 13px; align-items: baseline; }
.anleitung { padding-left: 20px; }
.anleitung li { margin-bottom: 6px; }

/* Änderungslog */
.log-tag h3 { margin: 18px 0 8px; font-size: 14px; color: var(--leise); }
.log-eintrag {
  background: var(--flaeche); border: 1px solid var(--linie); border-left-width: 4px; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 6px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px;
}
.log-eintrag.neu { border-left-color: var(--neu); }
.log-eintrag.geaendert { border-left-color: var(--geaendert); }
.log-eintrag.geloescht { border-left-color: var(--geloescht); }
.log-art { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 8px; align-self: start; margin-top: 2px; }
.neu .log-art { background: var(--neu-hg); color: var(--neu); }
.geaendert .log-art { background: var(--geaendert-hg); color: var(--geaendert); }
.geloescht .log-art { background: var(--geloescht-hg); color: var(--geloescht); }
.log-was { font-weight: 600; }
.log-was .geloescht-titel { text-decoration: line-through; }
.log-meta { grid-column: 2; color: var(--leise); font-size: 13px; }
.log-details { grid-column: 2; margin: 2px 0 0; padding-left: 18px; font-size: 13px; }

dialog {
  border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche); color: var(--text);
  max-width: min(560px, calc(100vw - 32px)); width: 100%; padding: 18px;
}
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h3 { margin: 0 0 6px; }
.detail-zeit { margin: 0; font-weight: 600; }
.detail-ort { margin: 2px 0 10px; color: var(--leise); }
dialog pre { white-space: pre-wrap; font: inherit; font-size: 14px; background: var(--hg); padding: 10px; border-radius: 8px; }

@media (max-width: 720px) {
  .tag { min-height: 64px; padding: 2px; }
  .chip { font-size: 10.5px; padding: 1px 3px; border-left-width: 2px; line-height: 1.25; }
  .chip .uhr { display: block; margin-right: 0; white-space: normal; }
  .wt { font-size: 11px; padding: 4px 0; }
  .eintrag { grid-template-columns: 1fr; gap: 2px; }
  .karten { grid-template-columns: 1fr; }
  .unterzeile { display: none; }
}

/* Langzeitjobs */
.schalter[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.ohne-lang { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--linie); }
.ohne-lang .leise { font-size: 13px; margin-bottom: 4px; }
