/* Arbeit -- minimalistisch, Handy zuerst. Hell/Dunkel folgt dem System.
   Keine Inline-Stile (CSP): dynamische Werte kommen ueber CSS-Variablen. */
:root {
  --bg: #f5f4f0;
  --flaeche: #ffffff;
  --flaeche-2: #efeee9;
  --text: #1b1c1e;
  --leise: #6b6c70;
  --sehr-leise: #9c9da1;
  --linie: rgba(20, 20, 25, .08);
  --akzent: #17695a;
  --akzent-hell: #e3f0ec;
  --akzent-text: #ffffff;
  --warn: #a8640f;
  --warn-hell: #fbf0de;
  --schlecht: #b9381c;
  --schlecht-hell: #fbe7e1;
  --gut: #1f7a3f;
  --schatten: 0 1px 2px rgba(20, 20, 25, .04), 0 4px 18px rgba(20, 20, 25, .05);
  --radius: 20px;
  --radius-k: 13px;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --flaeche: #1a1b1e;
    --flaeche-2: #24252a;
    --text: #f1f1f2;
    --leise: #a0a1a7;
    --sehr-leise: #6f7076;
    --linie: rgba(255, 255, 255, .08);
    --akzent: #4cc0a0;
    --akzent-hell: #17322b;
    --akzent-text: #06201a;
    --warn: #e2a24a;
    --warn-hell: #33270f;
    --schlecht: #f0795c;
    --schlecht-hell: #3a1c14;
    --gut: #5bc985;
    --schatten: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--akzent); text-decoration: none; }
.versteckt { display: none !important; }
.zahl { font-variant-numeric: tabular-nums; }
.leise { color: var(--leise); }
.klein { font-size: 13px; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.k { width: 18px; height: 18px; }

/* ------------------------------------------------------------- Rahmen */
#app { max-width: 640px; margin: 0 auto; padding: calc(var(--oben) + 18px) 16px calc(var(--unten) + 110px); }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 4px 18px; min-height: 44px; }
.kopf h1 { font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.kopf .unterzeile { color: var(--leise); font-size: 14px; margin-top: 2px; }
.kopf .zurueck { display: inline-flex; align-items: center; gap: 2px; color: var(--akzent); font-weight: 500;
                 background: none; border: 0; padding: 8px 8px 8px 0; cursor: pointer; }
.rund { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--flaeche); color: var(--text);
        display: grid; place-items: center; box-shadow: var(--schatten); cursor: pointer; flex: none; }

/* ------------------------------------------------------------- Tab-Leiste */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 6px 10px calc(var(--unten) + 6px);
  background: color-mix(in srgb, var(--flaeche) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--linie);
}
.tabs nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: none;
       color: var(--sehr-leise); font-size: 11px; font-weight: 500; cursor: pointer; }
.tab.aktiv { color: var(--akzent); }
.tab-kamera { justify-self: center; width: 58px; height: 58px; border-radius: 50%; border: 0; margin-top: -26px;
              background: var(--akzent); color: var(--akzent-text); display: grid; place-items: center; cursor: pointer;
              box-shadow: 0 6px 20px color-mix(in srgb, var(--akzent) 40%, transparent); }
.tab-kamera svg.i { width: 26px; height: 26px; }

/* ------------------------------------------------------------- Karten */
.karte { background: var(--flaeche); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--schatten); }
.karte.flach { box-shadow: none; background: var(--flaeche-2); }
.karte h2 { font-size: 13px; font-weight: 600; color: var(--leise); text-transform: uppercase; letter-spacing: .06em;
            margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.karte h2 a, .karte h2 button.link { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; }
.abschnitt-titel { font-size: 13px; font-weight: 600; color: var(--leise); text-transform: uppercase; letter-spacing: .06em; margin: 22px 6px 10px; }

/* Arbeitszeit-Karte */
.uhr-zustand { display: flex; align-items: center; gap: 8px; color: var(--leise); font-size: 15px; }
.punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--sehr-leise); flex: none; }
.punkt.laeuft { background: var(--akzent); animation: puls 2s infinite; }
.punkt.pause { background: var(--warn); }
@keyframes puls { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--akzent) 45%, transparent); }
                  70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.uhr { font-size: 60px; font-weight: 650; letter-spacing: -.035em; line-height: 1.05; margin: 8px 0 4px;
       font-variant-numeric: tabular-nums; }
.uhr small { font-size: 26px; font-weight: 500; color: var(--sehr-leise); letter-spacing: -.01em; }
.uhr-zeile { display: flex; gap: 16px; color: var(--leise); font-size: 14px; flex-wrap: wrap; }
.knopfreihe { display: flex; gap: 10px; margin-top: 18px; }
.knopfreihe > * { flex: 1; }

/* ------------------------------------------------------------- Knoepfe */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px;
         border-radius: var(--radius-k); border: 0; background: var(--flaeche-2); color: var(--text);
         font-weight: 600; font-size: 16px; cursor: pointer; transition: transform .08s, opacity .15s; text-align: center; }
.knopf:active { transform: scale(.98); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.primaer { background: var(--akzent); color: var(--akzent-text); }
.knopf.zart { background: var(--akzent-hell); color: var(--akzent); }
.knopf.gefahr { background: var(--schlecht-hell); color: var(--schlecht); }
.knopf.klein { min-height: 38px; font-size: 14px; padding: 0 14px; border-radius: 11px; }
.knopf.breit { width: 100%; }
button.link { background: none; border: 0; padding: 0; color: var(--akzent); cursor: pointer; font-weight: 500; }

.segment { display: flex; background: var(--flaeche-2); border-radius: 12px; padding: 3px; gap: 2px; }
.segment button { flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 10px; font-size: 14px;
                  font-weight: 500; color: var(--leise); cursor: pointer; }
.segment button.an { background: var(--flaeche); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--linie); background: var(--flaeche); border-radius: 999px; padding: 7px 13px;
        font-size: 14px; cursor: pointer; color: var(--text); }
.chip.an { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------- Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--linie); }
.liste > li:first-child { border-top: 0; }
.liste > li.klickbar { cursor: pointer; }
.liste .haupt { flex: 1; min-width: 0; }
.liste .titel { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .unter { color: var(--leise); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .wert { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.symbol { width: 40px; height: 40px; border-radius: 12px; background: var(--akzent-hell); color: var(--akzent);
          display: grid; place-items: center; flex: none; }
.symbol.grau { background: var(--flaeche-2); color: var(--leise); }
.vorschaubild { width: 46px; height: 58px; border-radius: 9px; object-fit: cover; background: var(--flaeche-2); flex: none;
                border: 1px solid var(--linie); }
.vorschaubild.pdf { display: grid; place-items: center; color: var(--leise); font-size: 11px; font-weight: 700; }

.marke { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
         border-radius: 999px; background: var(--flaeche-2); color: var(--leise); white-space: nowrap; }
.marke.akzent { background: var(--akzent-hell); color: var(--akzent); }
.marke.warn { background: var(--warn-hell); color: var(--warn); }
.marke.schlecht { background: var(--schlecht-hell); color: var(--schlecht); }
.marken { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }

.leer { text-align: center; color: var(--leise); padding: 26px 10px; font-size: 15px; }
.leer svg.i { width: 34px; height: 34px; color: var(--sehr-leise); margin-bottom: 6px; }

.hinweis { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14px;
           background: var(--warn-hell); color: var(--warn); margin-top: 12px; }
.hinweis.akzent { background: var(--akzent-hell); color: var(--akzent); }
.hinweis.schlecht { background: var(--schlecht-hell); color: var(--schlecht); }
.hinweis .haupt { flex: 1; }

/* Kennzahlen */
.zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.zahlen.zwei { grid-template-columns: repeat(2, 1fr); }
.kennzahl { background: var(--flaeche); border-radius: 16px; padding: 13px 14px; box-shadow: var(--schatten); min-width: 0; }
.kennzahl .w { font-size: 20px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kennzahl .l { font-size: 12px; color: var(--leise); margin-top: 1px; }
.kennzahl.akzent .w { color: var(--akzent); }

/* ------------------------------------------------------------- Formular */
.feld { margin-bottom: 14px; }
.feld label, .feld .label { display: block; font-size: 13px; color: var(--leise); margin: 0 0 6px 2px; font-weight: 500; }
.feld input, .feld select, .feld textarea {
  width: 100%; min-height: 48px; padding: 11px 13px; border-radius: var(--radius-k); border: 1px solid var(--linie);
  background: var(--flaeche-2); font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
}
.feld textarea { min-height: 80px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus { border-color: var(--akzent); background: var(--flaeche); }
.feld .betrag { font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-height: 58px; }
.feldreihe { display: flex; gap: 10px; }
.feldreihe > .feld { flex: 1; min-width: 0; }
.schalter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; }
.schalter input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px;
                  background: var(--flaeche-2); border: 1px solid var(--linie); position: relative; flex: none; cursor: pointer;
                  transition: background .15s; }
.schalter input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
                         background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.schalter input:checked { background: var(--akzent); border-color: var(--akzent); }
.schalter input:checked::after { transform: translateX(20px); }

/* ------------------------------------------------------------- Blatt (Dialog) */
dialog.blatt {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh;
  background: var(--bg); color: var(--text); border-radius: 24px 24px 0 0; overflow: hidden;
  display: flex; flex-direction: column;
}
dialog.blatt:not([open]) { display: none; }
dialog.blatt::backdrop { background: rgba(0, 0, 0, .38); }
dialog.blatt[open] { animation: hoch .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes hoch { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 8px; }
.blatt-kopf h3 { margin: 0; font-size: 19px; font-weight: 650; }
.blatt-griff { width: 38px; height: 5px; border-radius: 3px; background: var(--sehr-leise); opacity: .5; margin: 8px auto 0; }
.blatt-inhalt { overflow-y: auto; padding: 8px 18px calc(var(--unten) + 22px); -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) {
  dialog.blatt { margin: auto; border-radius: 24px; max-height: 86vh; }
}

/* ------------------------------------------------------------- Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--unten) + 96px); transform: translateX(-50%) translateY(20px);
         background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 500;
         opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: calc(100vw - 32px); text-align: center; }
.toast.an { opacity: 1; transform: translateX(-50%); }

/* ------------------------------------------------------------- Kalender */
.kal-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kal-kopf b { font-size: 17px; }
.kal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kal .wt { text-align: center; font-size: 11px; color: var(--sehr-leise); font-weight: 600; padding-bottom: 4px; }
.kal .t { aspect-ratio: 1 / 1.15; border-radius: 12px; border: 0; background: none; padding: 5px 2px 4px; cursor: pointer;
          display: flex; flex-direction: column; align-items: center; justify-content: space-between; color: var(--text); min-width: 0; }
.kal .t.anders { visibility: hidden; }
.kal .t.heute .n { background: var(--akzent); color: var(--akzent-text); }
.kal .t.wochenende .n { color: var(--leise); }
.kal .t.reise { background: var(--akzent-hell); }
.kal .t .n { font-size: 14px; font-weight: 600; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.kal .t .h { font-size: 10.5px; color: var(--leise); font-variant-numeric: tabular-nums; }
.kal .t .p { display: flex; gap: 3px; height: 6px; }
.kal .t .p i { width: 5px; height: 5px; border-radius: 50%; background: var(--akzent); }
.kal .t .p i.b { background: var(--warn); }

/* Tagesbalken */
.balken { height: 6px; border-radius: 3px; background: var(--flaeche-2); overflow: hidden; margin-top: 10px; }
.balken i { display: block; height: 100%; width: var(--fuell, 0%); background: var(--akzent); border-radius: 3px; }

/* ------------------------------------------------------------- Scanner */
.scanner { position: fixed; inset: 0; z-index: 50; background: #0b0b0c; color: #fff; display: flex; flex-direction: column;
           padding-top: var(--oben); }
.scanner-kopf { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; gap: 10px; }
.scanner-kopf b { font-size: 16px; }
.scanner-kopf button { background: none; border: 0; color: #fff; font-size: 16px; padding: 8px; cursor: pointer; }
.scanner-flaeche { flex: 1; position: relative; overflow: hidden; touch-action: none; display: grid; place-items: center; }
.scanner-flaeche canvas { max-width: 100%; max-height: 100%; display: block; }
.ecke { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; touch-action: none;
        left: var(--x); top: var(--y); display: grid; place-items: center; cursor: grab; }
.ecke::after { content: ""; width: 20px; height: 20px; border-radius: 50%; background: rgba(76, 192, 160, .35);
               border: 2.5px solid #4cc0a0; }
.scanner-fuss { padding: 12px 14px calc(var(--unten) + 14px); display: flex; gap: 10px; align-items: center; }
.scanner-fuss .knopf { flex: 1; background: rgba(255, 255, 255, .12); color: #fff; }
.scanner-fuss .knopf.primaer { background: #4cc0a0; color: #06201a; }
.scanner-hinweis { text-align: center; font-size: 13px; color: rgba(255, 255, 255, .6); padding: 0 16px 4px; }
.seitenleiste { display: flex; gap: 8px; padding: 0 14px 8px; overflow-x: auto; }
.seitenleiste img { height: 56px; border-radius: 6px; border: 2px solid rgba(255, 255, 255, .25); }
.scanner .segment { background: rgba(255, 255, 255, .1); }
.scanner .segment button { color: rgba(255, 255, 255, .7); }
.scanner .segment button.an { background: rgba(255, 255, 255, .22); color: #fff; }

/* Beleg-Detail */
.beleg-bild { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 16px; background: var(--flaeche-2); display: block; }
.beleg-seiten { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; }
.beleg-seiten img { height: 64px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.beleg-seiten img.an { border-color: var(--akzent); }
.pdf-flaeche { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--flaeche-2); }
.laden { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent;
         border-radius: 50%; animation: dreh .8s linear infinite; vertical-align: -3px; }
@keyframes dreh { to { transform: rotate(360deg); } }

/* Reisetage */
.reisetag { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--linie); }
.reisetag:first-child { border-top: 0; }
.reisetag .haupt { flex: 1; min-width: 0; }
.mahlzeiten { display: flex; gap: 5px; }
.mahlzeiten button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--linie); background: var(--flaeche);
                     font-weight: 650; font-size: 13px; color: var(--sehr-leise); cursor: pointer; }
.mahlzeiten button.an { background: var(--warn-hell); color: var(--warn); border-color: transparent; }
.mahlzeiten button:disabled { opacity: .5; cursor: default; }

/* Anmeldung */
.anmeldung { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.anmeldekarte { width: 100%; max-width: 360px; }
.anmeldekarte .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.anmeldekarte .logo img { width: 52px; height: 52px; border-radius: 14px; }
.anmeldekarte .logo b { display: block; font-size: 22px; letter-spacing: -.01em; }
.anmeldekarte .logo small { color: var(--leise); }

.fortschritt { height: 4px; background: var(--flaeche-2); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.fortschritt i { display: block; height: 100%; width: var(--fuell, 0%); background: var(--akzent); transition: width .2s; }
.trenner { height: 1px; background: var(--linie); margin: 14px 0; }
.rechts { text-align: right; }
.zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.zeile.gross { font-size: 18px; font-weight: 650; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.scanner-vorschau { max-width: calc(100% - 24px); max-height: calc(100% - 24px); border-radius: 6px; }
.scanner-flaeche .fortschritt { width: 200px; }
body.scannt { overflow: hidden; }
.erstattung-text, .feld .leise.klein { margin-top: 6px; padding-left: 2px; }
.art-wahl { margin-top: 14px; }
.feldreihe.oben { align-items: flex-end; margin-top: 12px; }
.reiter { margin: -4px 0 14px; }
.kopf-pfeile { display: flex; gap: 8px; }
.abstand { margin-top: 10px; }
.legende { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.leg-punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--akzent); display: inline-block; }
.leg-punkt.b { background: var(--warn); }
.leg-reise { width: 14px; height: 10px; border-radius: 3px; background: var(--akzent-hell); display: inline-block; }
.minus { color: var(--schlecht); }
.plus { color: var(--gut); }
.erklaerung { margin: -4px 6px 14px; }
/* Kennzahlen innerhalb einer Karte: flach, Zahl darf nicht abgeschnitten werden */
.karte .zahlen { gap: 8px; }
.karte .kennzahl { background: var(--flaeche-2); box-shadow: none; padding: 11px 12px; }
.kennzahl .w { font-size: clamp(15px, 4.4vw, 20px); text-overflow: clip; }
.knopfreihe > * { min-width: 0; }
.knopf { line-height: 1.2; }
.legende-klein { font-size: 12.5px; color: var(--leise); margin: -6px 0 6px; }
.chip { white-space: nowrap; }
.kennzahl .l { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
