:root{
  --bg:#f4f6f8; --card:#ffffff; --ink:#16202b; --muted:#5b6b7a;
  --line:#dce3ea; --brand:#0d3b66; --brand-ink:#ffffff;
  --typ:#8a5a00; --ueb:#0d5c63; --det:#3a4a5a;
  --ok:#1b7a3d; --warn:#b26a00; --crit:#b3261e; --queued:#5b6b7a;
  --radius:14px; --tap:52px;
}
*{box-sizing:border-box}
/* [hidden] muss auch dann greifen, wenn ein Element ein eigenes display setzt
   (z. B. #modal-root{display:flex}). Sonst liegt die Modal-Ebene unsichtbar
   über allem und fängt Klicks ab. */
[hidden]{display:none !important}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,system-ui,sans-serif;
  background:var(--bg); color:var(--ink);
  -webkit-text-size-adjust:100%; line-height:1.45;
  padding-bottom:env(safe-area-inset-bottom);
}
h1{font-size:1.5rem;margin:.2em 0 .3em}
h2{font-size:1.35rem;margin:.1em 0 .5em}
h3.section-h{font-size:1rem;color:var(--muted);margin:1.4em 0 .5em;
  border-bottom:1px solid var(--line);padding-bottom:.3em}
.lead,.hint{color:var(--muted);font-size:.92rem}
.hint{font-size:.82rem;margin-top:1.5em}

#topbar{
  position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:.5rem;
  background:var(--brand);color:var(--brand-ink);
  padding:calc(env(safe-area-inset-top) + .55rem) .8rem .55rem;
  box-shadow:0 1px 4px rgba(0,0,0,.15)
}
#topbar-title{flex:1;font-weight:600;font-size:1.05rem;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}
.icon-btn{background:transparent;border:0;color:inherit;font-size:1.8rem;
  line-height:1;padding:0 .3rem;cursor:pointer}
.badge{font-size:.72rem;font-weight:600;background:rgba(255,255,255,.18);
  padding:.28em .6em;border-radius:999px;white-space:nowrap}
.badge.off{background:#7a2018}
.badge.sync{background:#0a5}
.badge.idle{background:rgba(255,255,255,.18)}

#app{max-width:640px;margin:0 auto;padding:1rem .9rem 4rem}
.view{animation:fade .15s ease}
@keyframes fade{from{opacity:.4}to{opacity:1}}

button{font-family:inherit;font-size:1rem;cursor:pointer}
.primary{background:var(--brand);color:#fff;border:0;border-radius:var(--radius);
  padding:0 1.1rem;min-height:var(--tap);font-weight:600;width:100%}
.primary.big{min-height:60px;font-size:1.1rem;margin:.4rem 0}
.primary:active{filter:brightness(.92)}
.ghost{background:transparent;border:1px solid var(--line);color:var(--brand);
  border-radius:var(--radius);padding:0 1rem;min-height:var(--tap);width:100%;margin-top:.5rem}
.row-actions{display:flex;gap:.6rem}
.row-actions .primary,.row-actions .ghost{margin:0}
.row-actions .ghost{flex:0 0 auto;width:auto}
.footer-actions{margin-top:1.4rem}

.card-list{display:flex;flex-direction:column;gap:.6rem;margin:.8rem 0}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:.85rem 1rem;display:flex;align-items:center;gap:.8rem;cursor:pointer}
.card:active{background:#eef2f6}
.card .grow{flex:1;min-width:0}
.card .title{font-weight:600}
.card .sub{font-size:.82rem;color:var(--muted)}
.card .chev{color:var(--muted);font-size:1.4rem}
.pill{display:inline-block;font-size:.72rem;font-weight:600;padding:.15em .55em;
  border-radius:999px;margin-right:.3em;white-space:nowrap}
.pill.ok{background:#e4f4ea;color:var(--ok)}
.pill.warn{background:#fbedd8;color:var(--warn)}
.pill.crit{background:#fbe3e1;color:var(--crit)}
.pill.queued{background:#eceff2;color:var(--queued)}
.pill.state{background:#e7edf3;color:var(--brand)}

.meta-row{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:.7rem .9rem;margin-bottom:.9rem}
.meta-row .big{font-weight:700;font-size:1.15rem}
.meta-row .sub{font-size:.82rem;color:var(--muted);margin-top:.15em}

.capture-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:.55rem;margin:.4rem 0 1rem}
.capture{display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:.25rem;min-height:88px;border:0;border-radius:var(--radius);color:#fff;
  font-weight:600;text-align:center;padding:.4rem .2rem}
.capture small{font-weight:400;font-size:.66rem;opacity:.9;line-height:1.15}
.capture.typ{background:var(--typ)} .capture.ueb{background:var(--ueb)} .capture.det{background:var(--det)}
.capture:active{filter:brightness(.9)}

.audio-panel{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:.9rem;margin-bottom:.4rem}
.audio-status{font-weight:600;margin-bottom:.6rem;text-align:center}
.audio-status.recording{color:var(--crit)}
.audio-status.paused{color:var(--warn)}
.audio-controls{display:flex;gap:.5rem}
.audio-controls button{flex:1;min-height:var(--tap);border-radius:var(--radius);border:0}
.rec{background:var(--crit);color:#fff;font-weight:600}
.stop{background:#16202b;color:#fff;font-weight:600}
.audio-controls .ghost{color:var(--ink)}

.thumb-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:.5rem}
.thumb{position:relative;aspect-ratio:1;border-radius:10px;overflow:hidden;
  background:#dfe6ec;border:1px solid var(--line);display:flex;align-items:center;
  justify-content:center}
.thumb img{width:100%;height:100%;object-fit:cover}
.thumb .placeholder{font-size:.7rem;color:var(--muted);text-align:center;padding:.3rem}
.thumb .role-tag{position:absolute;top:4px;left:4px;font-size:.62rem;font-weight:700;
  color:#fff;background:rgba(0,0,0,.6);padding:.05em .4em;border-radius:5px}
.thumb .st{position:absolute;bottom:4px;right:4px;font-size:.62rem;padding:.05em .35em;
  border-radius:5px;font-weight:700}
.st.ok{background:var(--ok);color:#fff}
.st.queued{background:#fff;color:var(--queued);border:1px solid var(--line)}
.st.error{background:var(--crit);color:#fff}

.audio-list{display:flex;flex-direction:column;gap:.5rem}
.audio-item{background:var(--card);border:1px solid var(--line);border-radius:10px;
  padding:.55rem .7rem;display:flex;align-items:center;gap:.6rem}
.audio-item .grow{flex:1;min-width:0}
.audio-item audio{height:34px;max-width:150px}
.audio-item .nm{font-size:.85rem}

/* modal */
#modal-root{position:fixed;inset:0;z-index:40;display:flex;align-items:flex-end;justify-content:center}
#modal-backdrop{position:absolute;inset:0;background:rgba(10,20,30,.45)}
#modal-card{position:relative;background:var(--card);width:100%;max-width:640px;
  border-radius:18px 18px 0 0;padding:1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom));
  max-height:86vh;overflow:auto;box-shadow:0 -4px 24px rgba(0,0,0,.2)}
#modal-body h3{margin:.1em 0 .6em}
#modal-actions{display:flex;flex-direction:column;gap:.5rem;margin-top:1rem}
.field{margin:.6rem 0}
.field label{display:block;font-size:.85rem;color:var(--muted);margin-bottom:.25em}
.field input{width:100%;min-height:var(--tap);border:1px solid var(--line);
  border-radius:10px;padding:0 .7rem;font-size:1rem}
.befund{display:flex;gap:.55rem;padding:.5rem 0;border-bottom:1px solid var(--line)}
.befund .mk{font-weight:800;flex:0 0 auto}
.befund.kritisch .mk{color:var(--crit)} .befund.warnung .mk{color:var(--warn)} .befund.hinweis .mk{color:var(--muted)}
.befund .tx{font-size:.9rem}
.befund .po{font-size:.78rem;color:var(--muted);margin-top:.2em}
.verdict{font-weight:700;margin-top:.8rem;padding:.5rem .7rem;border-radius:10px;text-align:center}
.verdict.ja{background:#e4f4ea;color:var(--ok)}
.verdict.nein{background:#fbe3e1;color:var(--crit)}

#toast{position:fixed;left:50%;bottom:calc(1.2rem + env(safe-area-inset-bottom));
  transform:translateX(-50%);background:#16202b;color:#fff;padding:.6rem 1rem;
  border-radius:10px;font-size:.9rem;z-index:60;max-width:90%;text-align:center;
  box-shadow:0 4px 16px rgba(0,0,0,.3)}

.empty{color:var(--muted);font-size:.88rem;text-align:center;padding:1.2rem 0}

/* --- Ergaenzungen 18.08.2026: Ort, Vorschlaege, Fehlerhinweise ------------ */

/* Fehlermeldung am Feld statt Toast: bleibt stehen, bis das Problem behoben
   ist. Im Feldtest verschwand "Ungueltiger Name" nach zwei Sekunden, ohne zu
   sagen, was daran ungueltig war. */
.hint.fehler {
  color: #b3261e;
  font-weight: 500;
}

/* Vorschlaege antippen statt tippen — haelt Schreibweisen zusammen. */
.vorschlaege {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .5rem 0 .8rem;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: .45rem .8rem;
  font-size: .95rem;
  min-height: 40px;          /* Fingerziel, nicht Mausziel */
  cursor: pointer;
}
.chip:active { background: #eef2f7; }

/* Ort dauerhaft sichtbar: Wer eine Stunde erfasst, verliert sonst aus dem
   Blick, welchem Raum die Positionen gerade zugeordnet werden. */
.ortzeile { margin-top: .5rem; }
.ghost.klein {
  min-height: 40px;
  padding: .3rem .7rem;
  font-size: .95rem;
  width: auto;
}

/* Trenner zwischen lokalen und Serverprojekten — macht sichtbar, dass unten
   etwas steht, das noch nicht auf diesem Geraet liegt. */
.listentrenner {
  margin: 1.2rem 0 .5rem;
  font-size: .9rem;
  color: var(--muted, #667);
  text-transform: none;
  letter-spacing: .01em;
}

/* --- Vollbildansicht (18.08.2026) -----------------------------------------
   Auf Modalbreite laesst sich nicht beurteilen, ob ein Typenschild lesbar ist.
   Genau das ist aber die Frage, die im Termin zaehlt, solange man noch
   davorsteht. Zoom uebernimmt der Browser (Zwei-Finger-Geste) — im Ortstermin
   will niemand eine eigene Bediengeste lernen. */
.vollbild {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.vollbild img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.vollbild-zu {
  position: absolute;
  top: calc(env(safe-area-inset-top) + .6rem);
  right: .8rem;
  width: 48px;                 /* Fingerziel, auch mit Handschuhen */
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.85);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

/* Lupe auf der Bildkachel: trennt "gross ansehen" von "Menue oeffnen".
   .thumb hat bereits position:relative — hier nicht doppeln.
   Die Kachel ist nur 92 px breit, deshalb 30 px: gross genug zum Treffen,
   klein genug, dass vom Bild noch etwas zu erkennen ist. */
.thumb-zoom {
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

/* Gelbes Verdikt: keine kritischen Fehler, aber offene Hinweise.
   Ein grosses gruenes "ja" ueber vier Warnungen laedt zum Wegklicken ein. */
.verdict.warn {
  background: #fff8e1;
  color: #7a5c00;
  border: 1px solid #e8c964;
}

/* Vorschaubild in der Positionsliste.
   Bei hundert Positionen sagt "Position 47" nichts — ein Bild daneben
   beantwortet sofort, worum es geht, ohne die Position zu oeffnen. */
.posbild {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 8px;
  overflow: hidden;
  background: #dfe6ec;
  display: flex;
  align-items: center;
  justify-content: center;
}
.posbild img { width: 100%; height: 100%; object-fit: cover; }
.posbild-leer { color: var(--muted); font-size: 1.1rem; }

/* "Passwort vergessen?" — als Link, nicht als dritter Knopf: Es ist der
   Ausweg, nicht die Hauptsache. */
.linkknopf {
  background: none;
  border: none;
  color: #0d3b66;
  text-decoration: underline;
  font-size: .95rem;
  padding: .6rem 0;
  min-height: 44px;          /* Fingerziel */
  width: auto;
  cursor: pointer;
}

/* Geraeteliste in den Einstellungen. Der Sinn eigener Schluessel je Geraet ist,
   im Verlustfall genau eines zu sperren — ohne Anzeige weiss das niemand. */
.geraeteliste { margin: .8rem 0; }
.geraet {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: .35rem 0;
  background: #fff;
}
.geraet.gesperrt { opacity: .55; }
.gname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gkenn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85rem;
  color: var(--muted);
}
.gsperr {
  font-size: .78rem;
  background: #fbe3e1;
  color: #b3261e;
  padding: .1rem .45rem;
  border-radius: 4px;
}
