/* =================================================================
   Zeiterfassung – Oberfläche
   -----------------------------------------------------------------
   Entworfen für ein Handy in einer Arbeitshand: große Flächen,
   kräftiger Kontrast für helles Tageslicht, Hauptaktion unten
   im Daumenbereich.

   Schriften kommen bewusst vom Gerät. Keine Google Fonts:
   das erspart eine Datenübermittlung in die USA und damit
   ein Datenschutzproblem, und die App lädt auf schlechtem
   Baustellennetz spürbar schneller.

   Die Hausfarben stehen alle in diesem einen Block.
   ================================================================= */

:root {
  /* --- Hausfarben: Rot, Schwarz, Weiss -------------------------------
     Rot ist in dieser Oberflaeche kein Schmuck, sondern Bedeutung:
     es markiert genau eine Sache pro Bildschirm - die Aktion, die
     jetzt ansteht, oder den Punkt, der Aufmerksamkeit braucht.
     Wird Rot fuer alles benutzt, sieht man es nirgends mehr.
     ------------------------------------------------------------------ */
  --tief:     #101010;   /* Schwarz: Kopfzeile, Flaechen, Text */
  --tief-hell:#1e1e1e;
  --stahl:    #6b6b6b;   /* Nebentext */
  --linie:    #dcdcdc;
  --papier:   #f4f4f4;
  --flaeche:  #ffffff;

  --signal:   #c8102e;   /* Rot: Hauptaktion und Warnung */
  --signal-d: #a00c24;
  --signal-hell: #fdeced;

  --laeuft:   #101010;   /* laufende Zeit: schwarz, nicht bunt */
  --pause:    #6b6b6b;   /* Pause: grau, bewusst zurueckhaltend */
  --stop:     #c8102e;

  --radius:   10px;
  --schatten: 0 1px 2px rgba(16,16,16,.16);
  --schrift:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
              "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--schrift);
  font-size: 17px;              /* auf iOS verhindert 16px+ das Zoomen bei Eingaben */
  line-height: 1.5;
  color: var(--tief);
  background: var(--papier);
  padding-bottom: 76px;         /* Platz für die Fußnavigation */
  overscroll-behavior-y: contain;
}

body.schmal { padding-bottom: 0; }

/* ---------------------------------------------------------------- */
/* Kopfzeile                                                        */
/* ---------------------------------------------------------------- */

.kopf {
  background: var(--tief);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.kopf .marke {
  font-weight: 700;
  letter-spacing: .01em;
  font-size: 16px;
  text-decoration: none;
  color: #fff;
}
.kopf .marke span { display: block; font-weight: 400; font-size: 12px; color: #9fb0c0; }
.kopf a { color: #cfd8e0; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
p  { margin: 0 0 12px; }

.leise { color: var(--stahl); font-size: 14px; }

/* ---------------------------------------------------------------- */
/* Die Stempeluhr – das Herzstück                                    */
/* ---------------------------------------------------------------- */

.uhr {
  background: var(--tief);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  text-align: center;
}
.uhr.aus { background: var(--tief-hell); }

.uhr .zustand {
  font-size: 14px;
  color: #9fb0c0;
  margin-bottom: 6px;
}
.uhr .zustand b { color: #fff; font-weight: 600; }

.uhr .zaehler {
  font-size: 56px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1.05;
  letter-spacing: -.02em;
}
.uhr .zaehler.pausiert { color: #9a9a9a; }

.uhr .baustelle {
  margin-top: 8px;
  font-size: 15px;
  color: #cfd8e0;
}

.punkt {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--laeuft);
  margin-right: 6px;
  vertical-align: baseline;
}
.punkt.pause { background: #b4b4b4; }
.punkt.aus   { background: var(--stahl); }

@media (prefers-reduced-motion: no-preference) {
  .punkt:not(.aus):not(.pause) { animation: puls 2.4s ease-in-out infinite; }
  @keyframes puls { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
}

/* ---------------------------------------------------------------- */
/* Schaltflächen                                                     */
/* ---------------------------------------------------------------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--tief);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.knopf:active { transform: translateY(1px); }
.knopf:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

.knopf.gross   { width: 100%; min-height: 62px; font-size: 19px; }
.knopf.signal  { background: var(--signal); }
.knopf.signal:hover { background: var(--signal-d); }
.knopf.stop    { background: var(--stop); }
.knopf.pause   { background: #fff; color: var(--tief); border: 2px solid var(--tief); }
.knopf.stumm   { background: #fff; color: var(--tief); border: 1px solid var(--linie); }
.knopf.klein   { min-height: 40px; padding: 0 12px; font-size: 15px; font-weight: 500; }
.knopf[disabled] { opacity: .5; cursor: not-allowed; }

.knopfreihe { display: flex; gap: 10px; margin-top: 14px; }
.knopfreihe .knopf { flex: 1; }

/* ---------------------------------------------------------------- */
/* Karten und Listen                                                 */
/* ---------------------------------------------------------------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--schatten);
}
.karte.eng { padding: 10px 14px; }

.kennzahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.kennzahl {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}
.kennzahl .wert {
  font-size: 22px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: block;
}
.kennzahl .titel { font-size: 12px; color: var(--stahl); }
.kennzahl .wert.plus  { color: var(--tief); }
.kennzahl .wert.minus { color: var(--stop); }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.liste .haupt { flex: 1; min-width: 0; }
.liste .zeit {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.liste .tag {
  width: 44px;
  flex: 0 0 44px;
  text-align: center;
  color: var(--stahl);
  font-size: 13px;
  line-height: 1.2;
}
.liste .tag b { display: block; font-size: 17px; color: var(--tief); }
.liste li.feiertag { background: #fafafa; }

/* Ein farbiger Streifen links zeigt den Bearbeitungsstand ohne Text */
.liste li[data-status="erfasst"]     { border-left: 4px solid #b4b4b4; }
.liste li[data-status="freigegeben"] { border-left: 4px solid var(--tief); }
.liste li[data-status="abgelehnt"]   { border-left: 4px solid var(--stop); }
.liste li[data-status="laeuft"]      { border-left: 4px solid var(--signal); }

.marke-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--papier);
  color: var(--stahl);
}
.marke-status.offen       { background: #efefef; color: #3d3d3d; }
.marke-status.genehmigt   { background: #101010; color: #fff; }
.marke-status.abgelehnt   { background: var(--signal-hell); color: var(--signal-d); }
.marke-status.storniert   { background: var(--papier); color: var(--stahl); }

/* ---------------------------------------------------------------- */
/* Formulare                                                         */
/* ---------------------------------------------------------------- */

label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--stahl); font-weight: 500; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=tel], input[type=file],
select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 13px 12px;
  font: inherit;
  color: var(--tief);
  background: #fff;
  border: 1px solid var(--linie);
  border-radius: 8px;
  min-height: 50px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--stahl) 50%),
                                             linear-gradient(135deg, var(--stahl) 50%, transparent 50%);
         background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
         background-size: 6px 6px; background-repeat: no-repeat; }
textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--signal);
  outline-offset: 1px;
  border-color: var(--signal);
}

fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-size: 14px; color: var(--stahl); font-weight: 500; padding: 0 0 6px; }

.wahl { display: flex; gap: 8px; flex-wrap: wrap; }
.wahl input { position: absolute; opacity: 0; pointer-events: none; }
.wahl label {
  margin: 0;
  border: 1px solid var(--linie);
  background: #fff;
  border-radius: 8px;
  padding: 11px 16px;
  color: var(--tief);
  cursor: pointer;
  font-weight: 500;
}
.wahl input:checked + label { background: var(--tief); color: #fff; border-color: var(--tief); }
.wahl input:focus-visible + label { outline: 3px solid var(--signal); }

.zeile { display: flex; gap: 10px; }
.zeile > * { flex: 1; }

/* ---------------------------------------------------------------- */
/* Meldungen                                                         */
/* ---------------------------------------------------------------- */

.hinweis {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  border-left: 4px solid var(--stahl);
  background: #fff;
  font-size: 15px;
}
.hinweis.ok     { border-color: var(--tief);   background: #f0f0f0; }
.hinweis.fehler { border-color: var(--signal); background: var(--signal-hell); }
.hinweis.warn   { border-color: var(--signal); background: #fff8f8; }
.hinweis h2 { margin-top: 0; }

.leer {
  text-align: center;
  color: var(--stahl);
  padding: 34px 16px;
  border: 1px dashed var(--linie);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- */
/* Fußnavigation                                                     */
/* ---------------------------------------------------------------- */

.fussnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--linie);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.fussnav a {
  flex: 1;
  text-align: center;
  padding: 9px 2px 8px;
  font-size: 11px;
  color: var(--stahl);
  text-decoration: none;
  min-height: 58px;
}
.fussnav a .zeichen { display: block; font-size: 21px; line-height: 1.2; }
.fussnav a.aktiv { color: var(--signal); font-weight: 600; }

/* ---------------------------------------------------------------- */
/* Anmeldung und Einrichtung                                         */
/* ---------------------------------------------------------------- */

.anmeldung, .einrichtung {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 20px;
}
.anmeldung .logo {
  text-align: center;
  margin-bottom: 26px;
}
.anmeldung .logo b { display: block; font-size: 21px; }
.anmeldung .logo span { color: var(--stahl); font-size: 14px; }

/* ---------------------------------------------------------------- */
/* Tabellen im Verwaltungsbereich                                    */
/* ---------------------------------------------------------------- */

.tabelle-huelle { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.daten {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 15px;
}
table.daten th, table.daten td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}
table.daten th { background: var(--papier); font-size: 13px; color: var(--stahl); font-weight: 600; }
table.daten td.zahl { text-align: right; font-variant-numeric: tabular-nums; }
table.daten tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------- */
/* Unterschriftenfeld                                                */
/* ---------------------------------------------------------------- */

.unterschrift-feld {
  border: 2px dashed var(--linie);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
  width: 100%;
  height: 190px;
  display: block;
}

@media print {
  .fussnav, .kopf, .knopf { display: none; }
  body { background: #fff; padding: 0; }
}

/* ---------------------------------------------------------------- */
/* Nachbesserungen Mobilbedienung                                    */
/* ---------------------------------------------------------------- */

/* Keine Doppeltipp-Verzögerung auf dem Handy */
html { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Zurück-Pfeil in der Kopfzeile */
.kopf .zurueck {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: -6px 0 -6px -8px;
  font-size: 34px; line-height: 1; color: #fff; text-decoration: none;
  border-radius: 8px; flex: 0 0 auto;
}
.kopf .zurueck:active { background: rgba(255,255,255,.12); }
.kopf .marke { margin-right: auto; }

/* Ganze Listenzeile antippbar (ein Tipp genügt) */
.liste li.klickbar { position: relative; cursor: pointer; }
.liste li.klickbar .ganze-zeile::after { content: ""; position: absolute; inset: 0; }
.liste li.klickbar:active { background: #f7f7f7; }

/* Datumsfelder dürfen auf dem iPhone nicht über den Rand ragen */
.zeile > * { min-width: 0; }
input[type=date], input[type=time] {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%; text-align: left;
}
input[type=date]::-webkit-date-and-time-value,
input[type=time]::-webkit-date-and-time-value { text-align: left; }

/* Ladebalken: sofortige Rückmeldung beim Antippen */
#ladebalken {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--signal); z-index: 100; opacity: 0;
  transition: width 8s cubic-bezier(.1,.7,.2,1), opacity .2s;
}
#ladebalken.laeuft { width: 85%; opacity: 1; }
.knopf.wartet, button.wartet { opacity: .6; pointer-events: none; }

@media print { #ladebalken, .kopf .zurueck { display: none; } }

/* Schnellwechsel der Tätigkeit auf der Stempelseite */
.schnellwechsel .art-knopf {
  border: 1px solid var(--linie); background: #fff; color: var(--tief);
  border-radius: 8px; padding: 11px 16px; font: inherit; font-weight: 500;
  cursor: pointer; touch-action: manipulation; min-height: 46px;
}
.schnellwechsel .art-knopf.aktuell { background: var(--tief); color: #fff; border-color: var(--tief); opacity: 1; }
.schnellwechsel .art-knopf:active { background: #eee; }

/* Baustellen nach Status gruppiert */
.status-gruppe { margin-top: 22px; }
.status-gruppe > summary { cursor: pointer; font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.anzahl { display: inline-block; min-width: 24px; padding: 1px 8px; margin-left: 6px; border-radius: 12px;
          background: var(--linie); color: var(--tief); font-size: 13px; font-weight: 600; text-align: center; }
.knopf.gefahr { background: #fff; color: var(--signal); border: 1px solid var(--signal); }
