/* Schütz Auftragsapp – ein Stylesheet für alle Ansichten (mobile-first) */
:root {
  --marine: #0f2f44;
  --marine-hell: #1a4a6b;
  --akzent: #1e6fa8;
  --hintergrund: #f2f4f7;
  --karte: #ffffff;
  --linie: #dde3ea;
  --text: #1c2733;
  --text-schwach: #5b6b7b;
  --gruen: #15803d;
  --rot: #b91c1c;
  --gelb: #b45309;
  --radius: 10px;
  --schatten: 0 1px 3px rgba(15, 47, 68, 0.10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--hintergrund);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}
h1 { font-size: 1.35rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
a { color: var(--akzent); text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--marine);
  color: #fff;
  padding: 0.55rem 0.9rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-marke { color: #fff; font-weight: 800; letter-spacing: 0.06em; font-size: 0.95rem; }
.topbar-nav { display: flex; gap: 0.15rem; flex: 1; overflow-x: auto; }
.topbar-nav a {
  color: #cfdbe6;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.95rem;
}
.topbar-nav a.aktiv { background: var(--marine-hell); color: #fff; }
.topbar-rechts { display: flex; align-items: center; gap: 0.5rem; }
.topbar-nutzer {
  background: var(--marine-hell);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-weight: 700;
  font-size: 0.85rem;
}
.topbar .link-knopf { color: #cfdbe6; }

/* ---------- Grundelemente ---------- */
main { padding: 0.9rem; max-width: 1200px; margin: 0 auto; }
.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 0.9rem;
  margin-bottom: 0.9rem;
}
.knopf {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--akzent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.knopf:disabled { opacity: 0.5; cursor: default; }
.knopf.sekundaer { background: #e8eef4; color: var(--marine); }
.knopf.gefahr { background: var(--rot); }
.knopf.gruen { background: var(--gruen); }
.link-knopf {
  background: none;
  border: none;
  color: var(--akzent);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.3rem;
}
.hinweis { color: var(--text-schwach); font-size: 0.85rem; }
.leer { color: var(--text-schwach); text-align: center; padding: 1.2rem 0; }

/* ---------- Formulare ---------- */
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-schwach); margin: 0.6rem 0 0.15rem; }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--linie);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; }
.formular-zeile { display: grid; gap: 0 0.8rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .formular-zeile { grid-template-columns: 1fr 1fr; }
  .formular-zeile.dreier { grid-template-columns: 1fr 1fr 1fr; }
}
.formular-aktionen { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Status-Chips ---------- */
.status-chip {
  display: inline-block;
  background: color-mix(in srgb, var(--chip) 12%, #fff);
  color: var(--chip);
  border: 1px solid color-mix(in srgb, var(--chip) 35%, #fff);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Filterchips / Werkzeugleiste ---------- */
.werkzeuge { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.9rem; }
.werkzeuge input[type='search'] { max-width: 260px; flex: 1; min-width: 150px; }
.chips { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.2rem; }
.chip {
  border: 1px solid var(--linie);
  background: #fff;
  color: var(--text-schwach);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.aktiv { background: var(--marine); border-color: var(--marine); color: #fff; }

/* ---------- Fall-Liste ---------- */
.fall-zeile {
  display: block;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.fall-zeile:active { background: #f6f9fc; }
.fall-zeile-kopf { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.fall-nummer { font-weight: 800; color: var(--marine); white-space: nowrap; }
.fall-titel { font-weight: 600; flex: 1; }
.fall-meta { color: var(--text-schwach); font-size: 0.85rem; margin-top: 0.15rem; }

/* ---------- Kanban-Board ---------- */
.board { display: flex; gap: 0.7rem; overflow-x: auto; align-items: flex-start; padding-bottom: 0.5rem; }
.board-spalte {
  min-width: 260px; width: 260px; flex-shrink: 0;
  background: #e9edf2; border-radius: 12px; padding: 0.5rem;
  transition: background 0.12s;
}
.board-spalte.beendet { opacity: 0.75; }
.board-spalte h3 {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-schwach); margin: 0 0 0.5rem 0.15rem;
}
.board-spalte h3::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  background: var(--chip, var(--linie)); flex-shrink: 0;
}
.board-anzahl {
  margin-left: auto; background: #fff; border-radius: 999px;
  padding: 0.05rem 0.45rem; font-size: 0.75rem; color: var(--text-schwach);
}
.board-karten { min-height: 44px; }
.board-karte {
  display: block;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: 8px;
  box-shadow: var(--schatten);
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.45rem;
  color: var(--text);
  font-size: 0.9rem;
}
.board-karte.dringend { border-left: 4px solid var(--rot); }
.board-karte-kopf { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.15rem; }
.board-karte-titel { font-weight: 600; line-height: 1.3; }
.board-schritt {
  margin-top: 0.4rem; font-size: 0.78rem; font-weight: 600;
  background: #e8eef4; color: var(--marine);
  border-radius: 999px; padding: 0.1rem 0.5rem; display: inline-block;
}
.board-schritt.dringend { background: #fde8e8; color: var(--rot); }

/* Ziehen und Ablegen */
.board-karte[draggable="true"] { cursor: grab; }
.board-karte.zieht { opacity: 0.4; cursor: grabbing; }
body.am-ziehen .board-spalte { background: #dfe6ee; }
body.am-ziehen .board-spalte.bereit {
  background: #d3e4f5; outline: 2px dashed var(--akzent); outline-offset: -3px;
}

/* ---------- Ablage-Zone (Datei hereinziehen) ---------- */
.ablage {
  border: 2px dashed var(--linie);
  border-radius: var(--radius);
  background: #fbfcfd;
  padding: 1rem 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 0.7rem;
}
.ablage:hover, .ablage:focus-visible { border-color: var(--akzent); background: #f4f8fc; }
.ablage.bereit { border-color: var(--akzent); background: #e6f0fa; border-style: solid; }
.ablage-symbol { font-size: 1.5rem; line-height: 1; }
.ablage-titel { font-weight: 700; margin-top: 0.25rem; }
.ablage-hinweis { font-size: 0.82rem; color: var(--text-schwach); margin-top: 0.15rem; }

.datei-liste { display: flex; flex-direction: column; gap: 0.35rem; }
.datei-eintrag {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.5rem; border: 1px solid var(--linie); border-radius: 8px;
  background: var(--karte); color: var(--text); font-size: 0.9rem;
}
.datei-eintrag img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.datei-symbol {
  width: 44px; height: 44px; border-radius: 6px; flex-shrink: 0;
  background: var(--marine); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.03em;
}
.datei-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei-marke {
  background: #e8f4ec; color: var(--gruen); border-radius: 999px;
  padding: 0.1rem 0.5rem; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}

/* ---------- Prüf-Dialog der KI ---------- */
.pruef-liste { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.6rem 0; }
.pruef-zeile {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.45rem 0.5rem; border: 1px solid var(--linie); border-radius: 8px;
  cursor: pointer;
}
.pruef-zeile.unsicher { border-color: #f0d9a8; background: #fdfaf3; }
.pruef-zeile input { margin-top: 0.2rem; flex-shrink: 0; }
.pruef-feld {
  font-size: 0.75rem; font-weight: 700; color: var(--text-schwach);
  text-transform: uppercase; letter-spacing: 0.03em;
  display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap;
}
.pruef-marke {
  background: #fdf1d8; color: var(--gelb); border-radius: 999px;
  padding: 0 0.4rem; font-size: 0.7rem; text-transform: none; letter-spacing: 0;
}
.pruef-marke.warn { background: #fde8e8; color: var(--rot); }
.pruef-wert { white-space: pre-wrap; }
.pruef-alt { font-size: 0.8rem; color: var(--text-schwach); text-decoration: line-through; }

/* ---------- Fall-Detail ---------- */
.fall-kopf { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.9rem; }
.fall-kopf h1 { flex: 1 1 100%; margin: 0; }
.feld-liste { display: grid; grid-template-columns: 1fr; gap: 0.35rem 1rem; margin: 0; }
@media (min-width: 640px) { .feld-liste { grid-template-columns: 1fr 1fr; } }
.feld-liste div { padding: 0.2rem 0; }
.feld-liste dt { font-size: 0.78rem; font-weight: 700; color: var(--text-schwach); text-transform: uppercase; letter-spacing: 0.03em; }
.feld-liste dd { margin: 0; white-space: pre-wrap; }
.aktionen-leiste { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }

.zeiten-tabelle { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.zeiten-tabelle td { padding: 0.35rem 0.4rem; border-top: 1px solid var(--linie); }

.foto-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.foto-raster a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--linie); }
.foto-raster img { width: 100%; height: 100%; object-fit: cover; display: block; }

.protokoll { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.protokoll li { padding: 0.4rem 0; border-top: 1px solid var(--linie); display: flex; gap: 0.6rem; }
.protokoll li:first-child { border-top: none; }
.protokoll .wann { color: var(--text-schwach); white-space: nowrap; }

/* ---------- Dispo-Planer ---------- */
.dispo-layout { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
@media (min-width: 960px) { .dispo-layout { grid-template-columns: 260px 1fr; } }
.dispo-seitenleiste .fall-zeile { padding: 0.5rem 0.7rem; cursor: pointer; }
.dispo-seitenleiste .fall-zeile.gewaehlt { outline: 2px solid var(--akzent); }
.dispo-kopf { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.7rem; flex-wrap: wrap; }
.dispo-kopf h1 { margin: 0; flex: 1; }
.dispo-raster-huelle { overflow-x: auto; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); }
.dispo-raster { display: grid; min-width: 760px; }
.dispo-zelle { border-left: 1px solid var(--linie); border-top: 1px solid var(--linie); position: relative; height: 150px; cursor: pointer; }
.dispo-zelle:hover { background: #f6f9fc; }
.dispo-tag-kopf, .dispo-ma-kopf {
  position: sticky;
  background: #f8fafc;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  border-left: 1px solid var(--linie);
  border-top: 1px solid var(--linie);
  z-index: 2;
}
.dispo-tag-kopf { top: 0; text-align: center; }
.dispo-tag-kopf.heute { color: var(--akzent); }
.dispo-ma-kopf { left: 0; display: flex; flex-direction: column; justify-content: center; }
.dispo-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  background: var(--akzent);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 0.15rem 0.3rem;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
}
.dispo-block.innendienst { background: #64748b; }
.dispo-block.sync-offen::after { content: '⟳'; position: absolute; top: 1px; right: 3px; }

/* ---------- Heute (Monteur mobil) ---------- */
.heute-kopf { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.8rem; }
.heute-kopf h1 { flex: 1; text-align: center; font-size: 1.05rem; }
.termin-karte { border-left: 5px solid var(--akzent); }
.termin-karte.innendienst { border-left-color: #64748b; }
.termin-zeit { font-weight: 800; font-size: 1.05rem; color: var(--marine); }
.termin-aktionen { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.termin-aktionen a, .termin-aktionen button { flex: 1; justify-content: center; text-align: center; min-width: 110px; }

.timer-leiste {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--marine);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.9rem calc(0.65rem + env(safe-area-inset-bottom));
  z-index: 60;
}
.timer-leiste .zeit { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; }
.timer-leiste .info { flex: 1; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.mit-timer main { padding-bottom: 5rem; }

/* ---------- Dialog & Toast ---------- */
.dialog {
  border: none;
  border-radius: 12px;
  padding: 1rem;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.dialog::backdrop { background: rgba(15, 47, 68, 0.45); }
.dialog-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.dialog-kopf h2 { margin: 0; }

#toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--marine);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: calc(100vw - 2rem);
}
#toast.sichtbar { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.fehler { background: var(--rot); }

/* ---------- Login ---------- */
.login-huelle { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--marine); }
.login-karte { background: #fff; border-radius: 14px; padding: 1.6rem; width: min(380px, 100%); }
.login-karte h1 { text-align: center; }
.login-karte .knopf { width: 100%; justify-content: center; margin-top: 1rem; }
.login-fehler { color: var(--rot); font-size: 0.9rem; min-height: 1.2rem; margin-top: 0.5rem; text-align: center; }

/* ---------- Nächster Schritt (Neubau 08/2026) ---------- */
.schritt-knopf {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  background: var(--akzent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 0.8rem 1rem;
  margin-bottom: 0.9rem;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.schritt-knopf.dringend { background: var(--rot); }
.schritt-knopf.ruhig { background: var(--marine-hell); cursor: default; }
div.schritt-knopf { cursor: default; }
.schritt-vorzeile { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.schritt-label { font-size: 1.1rem; font-weight: 700; }

.schritt-chip {
  margin-left: auto;
  background: #e8eef4;
  color: var(--marine);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.schritt-chip.dringend { background: #fde8e8; color: var(--rot); }

/* ---------- Cockpit ---------- */
.kennzahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.kennzahl {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.kennzahl-wert { font-size: 1.6rem; font-weight: 800; color: var(--marine); }
.kennzahl-label { font-size: 0.8rem; color: var(--text-schwach); }

/* Triage-Dialog: grosse, daumentaugliche Auswahl */
.triage { display: flex; flex-direction: column; gap: 0.6rem; }
.triage .knopf { justify-content: center; padding: 0.75rem 1rem; }
