/* WerkOS Mitarbeiter-App (Kap. 12).
   Baustellentauglich: 16 px Mindestgröße, 56 px Touchziele, hoher Kontrast,
   Dark Mode folgt dem System. CSP verbietet Inline-Styles. */

:root {
  color-scheme: dark light;

  /* Dunkel ist die Voreinstellung: Die App liegt im Baucontainer und wird
     draußen gelesen. Farbwerte und Radius folgen dem Cockpit — ein System.

     Zwei Akzentfamilien mit fester Arbeitsteilung:
     Blau (--brand, branding.css)  = bedienbar — Knöpfe, aktiver Tab, Verweise.
     Orange (--accent)             = NUR das Warnband. Es markiert Verbindliches
                                     (Oberkante, Siegel, Anmeldung), sonst nichts.
     Grün/Gelb/Rot bleiben reine Statusfarben. */
  --ground: #14181c;
  --surface: #1e252b;
  /* Durchscheinendes Neutralgrau statt eines festen Dunkelwerts (10.08.2026).
     marke.css liegt als letztes Blatt über dieser Datei und macht die Flächen
     hell, ohne diese Stellschraube mitzunehmen — bei „dunkel" am Gerät standen
     dann dunkle Knöpfe mit dunkler Schrift da (Kontrast 1:1, unlesbar). Ein
     durchscheinender Ton sitzt auf jedem Grund richtig; auf #1e252b ergibt er
     dieselbe Stufe wie zuvor #29323a. */
  --surface-hoch: rgba(125, 133, 141, 0.16);
  --ink: #f3f6f8;
  --ink-soft: #9db0bd;
  --rule: #37424b;

  /* Bedienblau auf dunklem Grund — das Markenblau selbst wäre hier zu dunkel. */
  --brand-hell: #4aa3d8;

  --gruen: #4bb87a;
  --gruen-flaeche: #16311f;
  --gelb: #e0a020;
  --gelb-flaeche: #362a10;
  --rot: #ef6a5f;
  --rot-flaeche: #3a1a17;

  --tabs: 62px;
  --radius: 10px;

  /* Schildschrift: kondensierte Versalien wie auf Bauschild und Plankopf.
     Avenir Next Condensed liegt auf jedem iPhone, Roboto Condensed auf
     Android, Arial Narrow fängt den Rest. Nur für Titel und Stempel —
     Fließtext bleibt Systemschrift (acht Sprachen). */
  --schrift-schild: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow",
    system-ui, sans-serif;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Das Warnband — die eine Signatur der App. */
  --band: repeating-linear-gradient(
    135deg,
    var(--accent, #e2551d) 0 12px,
    #242b2f 12px 24px
  );
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #eef1f3;
    --surface: #ffffff;
    --surface-hoch: #f5f8f9;
    --ink: #1b2226;
    --ink-soft: #5d6a72;
    --rule: #dde4e7;
    --brand-hell: var(--brand, #0b5d8a);
    --gruen: #146c37;
    --gruen-flaeche: #dff3e6;
    --gelb: #96650a;
    --gelb-flaeche: #fdf0d8;
    --rot: #a3231b;
    --rot-flaeche: #fbe2e0;
    --band: repeating-linear-gradient(
      135deg,
      var(--accent, #e2551d) 0 12px,
      #242b2f 12px 24px
    );
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--schrift);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.zahl,
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

:focus-visible {
  outline: 3px solid var(--brand, #4aa3d8);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Verbindungsanzeige -------------------------------------------------- */

.verbindung {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  background: var(--gelb);
  color: #10161c;
}

.verbindung[hidden] { display: none; }

/* --- Kopf ---------------------------------------------------------------- */

.kopf {
  padding: 14px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Der Titel benennt, er ruft nicht: gemischte Schreibweise in der Titelschrift.
   Der versale Plankopf (26 px, gesperrt) war auf dem Handy eine Ansage — bei
   Adressen wie „Linzer Straße 66" brach er regelmäßig auf zwei Zeilen. */
.kopf h1 {
  font-family: var(--titel-schrift, var(--schrift-schild));
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
  /* Beides ausdrücklich: marke.css setzt jedes h1 versal und gesperrt — das
     Weglassen genügt hier nicht, es holt die Ansage zurück. */
  text-transform: none;
  letter-spacing: 0;
}
.kopf .datum { color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.kopf .rechts { margin-left: auto; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand, #0b5d8a);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 15px;
}

/* --- Inhalt -------------------------------------------------------------- */

main {
  padding: 0 16px calc(var(--tabs) + env(safe-area-inset-bottom) + 24px);
}

.karte {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 10px;
}

/* Kartentitel als Planbeschriftung: klein, versal, gesperrt — der Inhalt
   darunter ist die Hauptsache, nicht die Überschrift. */
.karte h2 {
  font-family: var(--titel-schrift, var(--schrift-schild));
  font-size: 11.5px;
  font-weight: 600;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

/* Versiegeltes Blatt: Das Warnband liegt als Siegel oben auf (Stelle 1 von 2).
   Die Klasse setzt bau.js, sobald ein Tagesblatt abgezeichnet ist. */
.karte.gesiegelt {
  position: relative;
  overflow: hidden;
  padding-top: 22px;
}
.karte.gesiegelt::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--band);
}

.zeile {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}

.zeile:last-child { border-bottom: 0; }
.zeile span { color: var(--ink-soft); font-size: 14px; }
.zeile b { text-align: right; font-weight: 600; }

.leer {
  text-align: center;
  color: var(--ink-soft);
  padding: 48px 20px;
}

.leer b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

/* Verweise in Karten (z. B. auf Werkzeug- und Baustellen-App). */
.zeile a {
  color: var(--brand, #4aa3d8);
  font-weight: 600;
  text-decoration: none;
}

/* --- Bedienelemente ------------------------------------------------------ */

button,
.knopf {
  font: inherit;
  font-size: 16px;
  min-height: 56px;
  padding: 0 20px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface-hoch);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

button.primaer {
  background: var(--brand, #0b5d8a);
  border-color: var(--brand, #0b5d8a);
  color: #fff;
  font-weight: 600;
}

button.gefahr { color: var(--rot); }
button:disabled { opacity: 0.5; }
button:active:not(:disabled) { transform: scale(0.98); }

/* Verweise in Knopfform und Sekundärknöpfe heben sich beim Druck spürbar ab. */
button:not(:disabled),
.knopf { transition: transform 80ms ease, background-color 120ms ease; }

input,
select,
textarea {
  font: inherit;
  font-size: 17px;
  min-height: 56px;
  padding: 0 14px;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

textarea {
  padding: 14px;
  resize: vertical;
}

label {
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.feld { margin-bottom: 16px; }

.meldung {
  padding: 13px 15px;
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 16px;
}

.meldung.fehler { color: var(--rot); background: var(--rot-flaeche); }
.meldung.gut { color: var(--gruen); background: var(--gruen-flaeche); }
.meldung[hidden] { display: none; }

/* --- Anmeldung ----------------------------------------------------------- */

.anmeldung {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  max-width: 420px;
  margin: 0 auto;
}

.anmeldung .marke {
  text-align: center;
  margin-bottom: 32px;
}

.anmeldung .marke b {
  font-family: var(--titel-schrift, var(--schrift-schild));
  font-size: 34px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
}

/* Warnband unter dem Namenszug (Stelle 2 von 2): Ab hier wird es verbindlich. */
.anmeldung .marke b::after {
  content: "";
  display: block;
  width: 84px;
  height: 5px;
  margin: 10px auto 0;
  background: var(--band);
}

.anmeldung .marke span { color: var(--ink-soft); font-size: 15px; }

/* PIN-Feld: Ziffern groß und weit gesperrt — auch mit Handschuh lesbar. */
.pin {
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: 0.4em;
  text-align: center;
  padding-left: 0.4em;
}

.sprachwahl {
  margin-top: 24px;
  text-align: center;
}

.sprachwahl select {
  min-height: 44px;
  font-size: 15px;
  width: auto;
  display: inline-block;
  background: none;
  border-color: transparent;
  color: var(--ink-soft);
}

/* --- Tableiste ----------------------------------------------------------- */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--tabs) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  /* So viele Spalten wie Tabs — die Hauptapp hat drei, die Baustellen-App zwei. */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}

.tabs button {
  min-height: auto;
  height: 100%;
  width: 100%;
  flex-direction: column;
  gap: 3px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 0;
}

.tabs button {
  font-family: var(--titel-schrift, var(--schrift-schild));
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tabs button[aria-current="page"] { color: var(--brand, #4aa3d8); font-weight: 600; }
.tabs button .punkt {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: transparent;
}
.tabs button[aria-current="page"] .punkt { background: var(--brand, #4aa3d8); }

@media (prefers-reduced-motion: reduce) {
  /* Auch die Verzögerungen auf null: Mit `fill: both` bliebe ein verzögertes
     Element sonst erst unsichtbar und ploppte dann auf — das Gegenteil von
     „Bewegung reduzieren". */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0.01ms !important;
  }
  button:active:not(:disabled) { transform: none; }
}

/* --- Anmeldung über Microsoft ------------------------------------------- */
/* Stehen beide Wege nebeneinander, trennt ein schlichtes „oder" sie — damit
   niemand glaubt, er muesse beides ausfuellen. */
.anmeldung .oder {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 14px;
  margin: 4px 0;
}
.anmeldung .oder::before,
.anmeldung .oder::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* Das Formular ist jetzt ein Teil des Blattes, nicht mehr das Blatt selbst. */
.anmeldung form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ms-knopf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-decoration: none;
  min-height: 3.2rem;   /* Handschuhgerecht wie die übrigen Knöpfe. */
}
.hinweis {
  text-align: center;
  opacity: 0.7;
  font-size: 0.85rem;
  margin-top: 0.8rem;
}
