* { margin: 0; padding: 0; box-sizing: border-box; border-radius: 0 !important; }

:root {
  --bg: #000000;
  --panel: #0d0d0d;
  --line: #262626;
  --deep: #1a1a1a;
  --feld: #111111;
  --accent: #1e73be;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --ok: #2e9e5b;
  --warn: #c9a227;
  --err: #c0392b;
}

/* Heller Modus (Ansage Konstantin 2026-08-18: Tablet-Lesbarkeit in der
   Werkstatt). Dark bleibt Standard, Umschalter im Kopfbalken. */
:root[data-theme="light"] {
  --bg: #ececec;
  --panel: #ffffff;
  --line: #b9b9b9;
  --deep: #dddddd;
  --feld: #fbfbfb;
  --accent: #135a9c;
  --text: #17191d;
  --muted: #565656;
  --ok: #1e7a41;
  --warn: #7d6300;
  --err: #a52a1e;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, #brand { font-family: "Orbitron", sans-serif; letter-spacing: 0.04em; }
h1 { font-size: 1.3rem; margin-bottom: 1rem; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 0.6rem; }

#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
#brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
#brand span { color: var(--accent); }
#theme-toggle {
  margin-left: auto; margin-right: 0.9rem; padding: 0.15rem 0.5rem;
  background: none; border: 1px solid var(--line); color: var(--muted);
  font-size: 0.7rem; text-transform: uppercase; cursor: pointer;
  font-family: "JetBrains Mono", monospace;
}
#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
#nav a {
  color: var(--muted); text-decoration: none; margin-left: 0.9rem;
  font-size: 0.8rem; text-transform: uppercase;
}
#nav a.active, #nav a:hover { color: var(--accent); }

#main { max-width: 900px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  padding: 1rem; margin-bottom: 0.8rem;
}
.card.link { cursor: pointer; }
.card.link:hover { border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.8rem; }

button, .btn {
  background: var(--accent); color: #fff; border: none;
  font-family: "JetBrains Mono", monospace; font-size: 0.9rem;
  padding: 0.7rem 1.2rem; cursor: pointer; text-transform: uppercase;
  letter-spacing: 0.05em;
}
button:hover { filter: brightness(1.15); }
button:disabled { background: var(--deep); color: var(--muted); cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.ghost:hover { border-color: var(--accent); }
button.danger { background: var(--err); }
button.big { width: 100%; padding: 1rem; font-size: 1rem; }

input, textarea, select {
  width: 100%; background: var(--feld); border: 1px solid var(--line);
  color: var(--text); font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem; padding: 0.6rem; margin: 0.25rem 0 0.8rem;
}
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); }
label { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }
textarea { min-height: 90px; resize: vertical; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { border: 1px solid var(--line); padding: 0.5rem; text-align: left; }
th { color: var(--muted); text-transform: uppercase; font-size: 0.7rem; }

.muted { color: var(--muted); font-size: 0.8rem; }
.tag {
  display: inline-block; font-size: 0.7rem; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border: 1px solid var(--line); color: var(--muted);
}
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.err { color: var(--err); border-color: var(--err); }
.tag.accent { color: var(--accent); border-color: var(--accent); }

.msg-err { color: var(--err); margin: 0.5rem 0; font-size: 0.85rem; white-space: pre-wrap; }

.stepphoto { width: 100%; max-height: 45vh; object-fit: contain; background: var(--deep); border: 1px solid var(--line); cursor: zoom-in; }
.thumb { cursor: zoom-in; }

/* Lightbox: Foto in gross, Klick zoomt */
#lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.94); display: flex; flex-direction: column; }
#lightbox[hidden] { display: none; }
#lb-bar { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.5rem 0.7rem; }
#lb-scroll { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; }
#lb-scroll.zoomed { display: block; }
#lb-img { max-width: 96%; max-height: 96%; object-fit: contain; cursor: zoom-in; }
#lb-img.zoomed { max-width: none; max-height: none; cursor: zoom-out; }

/* Angeheftetes Foto: App links, Foto rechts (mobil: oben), Kante ziehbar */
#fotopanel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--fp-w, 48vw); z-index: 60; background: var(--panel); border-left: 2px solid var(--accent); display: flex; flex-direction: column; }
#fotopanel[hidden] { display: none; }
#fp-handle { position: absolute; left: -6px; top: 0; bottom: 0; width: 14px; cursor: ew-resize; touch-action: none; z-index: 61; }
#fp-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }
#fp-scroll { flex: 1; overflow: auto; }
#fp-img { width: 100%; display: block; cursor: zoom-in; }
#fp-img.zoomed { width: auto; max-width: none; cursor: zoom-out; }
body.foto-pinned #main { margin-right: calc(var(--fp-w, 48vw) + 1vw); max-width: none; }
@media (max-width: 699.98px) {
  #fotopanel { left: 0; right: 0; bottom: auto; width: auto; height: var(--fp-h, 40vh); border-left: none; border-bottom: 2px solid var(--accent); }
  #fp-handle { left: 0; right: 0; top: auto; bottom: -8px; width: auto; height: 20px; cursor: ns-resize; }
  body.foto-pinned #main { margin-right: auto; padding-top: calc(var(--fp-h, 40vh) + 2vh); }
}
.placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 180px; border: 1px dashed var(--line); color: var(--muted);
  font-size: 0.8rem; text-transform: uppercase;
}
.thumb { width: 90px; height: 90px; object-fit: cover; border: 1px solid var(--line); }
.thumbrow { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.thumbwrap { position: relative; }
.thumbwrap button {
  position: absolute; top: 0; right: 0; padding: 0.1rem 0.45rem; font-size: 0.8rem;
}

.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row > * { margin: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.progress { height: 8px; background: var(--deep); border: 1px solid var(--line); }
.progress div { height: 100%; background: var(--accent); }

.checkline { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; font-size: 0.85rem; }
.material-fehlt { color: var(--err); }

/* Abschnitts-Editor am Handy: Textfeld bricht auf volle Breite um,
   die Knoepfe werden zur Reihe (Befund Konstantin: Eingeben war schwer) */
@media (max-width: 699.98px) {
  .abschnitt-knoepfe { flex-direction: row !important; flex-wrap: wrap; }
}

.login-box { max-width: 360px; margin: 14vh auto 0; }

#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0.5rem 0 0.45rem; color: var(--muted); text-decoration: none;
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.02em;
}
#tabbar a svg { width: 22px; height: 22px; }
#tabbar a.active { color: var(--accent); }

@media (min-width: 700px) {
  #tabbar { display: none; }
}
@media (max-width: 699.98px) {
  #nav { display: none; }
  #main { padding: 0.8rem 0.7rem 6.5rem; }
  button, .btn { padding: 0.8rem 1.1rem; }
}

/* Foto-Zuschnitt-Overlay */
#crop-overlay{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:60;display:flex;flex-direction:column}
#crop-overlay[hidden]{display:none}
#crop-bar{display:flex;justify-content:space-between;align-items:center;gap:.5rem;padding:.5rem .8rem;background:#111;flex-wrap:wrap;color:#e8e8e8}
#crop-flaeche{position:relative;flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;margin:12px}
#crop-img{max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;touch-action:none}
#crop-rahmen{position:absolute;border:2px solid var(--accent);box-shadow:0 0 0 9999px rgba(0,0,0,.55);cursor:move;touch-action:none}
#crop-griff{position:absolute;right:-16px;bottom:-16px;width:32px;height:32px;background:var(--accent);cursor:nwse-resize;touch-action:none}
#crop-flaeche{touch-action:none}
#meldung{position:fixed;left:50%;bottom:76px;transform:translateX(-50%);background:var(--panel);border:1px solid var(--ok);color:var(--ok);padding:0.5rem 1.1rem;z-index:120;font-size:0.9rem;letter-spacing:1px}
#meldung[hidden]{display:none}
