:root {
  --bg: #f4f6f8; --card: #ffffff; --text: #16222c; --muted: #5a6b78; --line: #dde3e8;
  --brand: #0b3d5c; --brand-text: #ffffff; --accent: #1b7f5c; --warn: #b45309; --bad: #b42318; --ok: #1b7f5c;
  --in: #1b7f5c; --out: #b42318; --focus: #1d6fd8; --shadow: 0 1px 3px rgba(0,0,0,.12);
  --radius: 16px;
}
:root[data-theme="dark"] {
  --bg: #0f171d; --card: #18232b; --text: #e8eef2; --muted: #9db0bd; --line: #2b3a45;
  --brand: #1d6a99; --brand-text: #ffffff; --accent: #36b98a; --warn: #f0a24b; --bad: #ff7a6b; --ok: #36b98a;
  --in: #36b98a; --out: #ff7a6b; --focus: #6ab0ff; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f171d; --card: #18232b; --text: #e8eef2; --muted: #9db0bd; --line: #2b3a45;
    --brand: #1d6a99; --brand-text: #ffffff; --accent: #36b98a; --warn: #f0a24b; --bad: #ff7a6b; --ok: #36b98a;
    --in: #36b98a; --out: #ff7a6b; --focus: #6ab0ff; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom); }
h1 { font-size: 1.45rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
a { color: var(--focus); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 90px; }
.top { position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--brand-text); padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 10px; }
.top .title { font-weight: 700; flex: 1; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top button, .top select { background: rgba(255,255,255,.16); color: var(--brand-text); border: 0; border-radius: 12px; padding: 8px 12px; font: inherit; min-height: 44px; }
.top select option { color: #000; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; margin: 12px 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.bigbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 118px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  font: inherit; font-weight: 600; padding: 12px 8px; cursor: pointer; text-decoration: none; }
.bigbtn .ico { font-size: 2.2rem; line-height: 1; }
.bigbtn.in { border-color: var(--in); } .bigbtn.in .ico { color: var(--in); }
.bigbtn.out { border-color: var(--out); } .bigbtn.out .ico { color: var(--out); }
.bigbtn:active { transform: scale(.98); }
.badge { display: inline-block; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 9px; font-size: .8rem; font-weight: 700; min-width: 22px; text-align: center; }
.badge.ok { background: var(--ok); } .badge.warn { background: var(--warn); } .badge.muted { background: var(--muted); }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px; }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; min-height: 0; vertical-align: middle; margin-right: 8px; }
textarea { min-height: 80px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 14px; border: 0;
  background: var(--brand); color: var(--brand-text); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.block { display: flex; width: 100%; margin: 10px 0; }
.btn.sec { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.good { background: var(--accent); color: #fff; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .92rem; }
.btn:disabled { opacity: .55; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; }
.row.nogrow > * { flex: none; }
.muted { color: var(--muted); } .small { font-size: .88rem; }
.right { text-align: right; } .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.in { color: var(--in); } .out { color: var(--out); }
.seg { display: flex; gap: 6px; background: var(--line); padding: 4px; border-radius: 14px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; border-radius: 11px; }
.seg button[aria-pressed=true] { background: var(--card); box-shadow: var(--shadow); color: var(--brand); }
:root[data-theme="dark"] .seg button[aria-pressed=true] { color: var(--text); }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
ul.list li:last-child { border-bottom: 0; }
ul.list .main { flex: 1; min-width: 0; }
ul.list .main > div { overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: .75rem; border-radius: 999px; padding: 2px 8px; background: var(--line); color: var(--text); white-space: nowrap; }
.pill.bad { background: var(--bad); color: #fff; } .pill.warn { background: var(--warn); color: #fff; } .pill.ok { background: var(--ok); color: #fff; }
.alert { border-left: 5px solid var(--warn); background: var(--card); border-radius: 10px; padding: 10px 14px; margin: 10px 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.alert.bad { border-left-color: var(--bad); } .alert.ok { border-left-color: var(--ok); }
table.t { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.t th, table.t td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.r, table.t th.r { text-align: right; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.kv .big { font-size: 1.25rem; font-weight: 700; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch; }
.tabs button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; }
.tabs button[aria-selected=true] { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumb { position: relative; width: 84px; height: 110px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--line); display: flex; align-items: center; justify-content: center; font-size: .75rem; padding: 4px; text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 2px; right: 2px; min-height: 28px; width: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 1rem; }
.viewer { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
iframe.viewer { height: 70vh; }
.field { display: grid; grid-template-columns: 1fr; gap: 2px; }
.conf { font-size: .72rem; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.conf.hoch { background: var(--ok); color: #fff; } .conf.mittel { background: var(--warn); color: #fff; } .conf.niedrig, .conf.fehlt { background: var(--bad); color: #fff; }
.conf.manuell { background: var(--brand); color: #fff; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 6; }
.nav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .72rem; padding: 4px 2px; min-height: 48px; }
.nav a .ico { display: block; font-size: 1.35rem; line-height: 1.2; }
.nav a[aria-current=page] { color: var(--brand); font-weight: 700; }
:root[data-theme="dark"] .nav a[aria-current=page] { color: var(--text); }
#toast { position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; background: #1f2d37; color: #fff; padding: 12px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
#toast.show { opacity: 1; } #toast.bad { background: var(--bad); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.modal > .sheet { background: var(--bg); width: 100%; max-width: 760px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.loading { text-align: center; padding: 60px 0; color: var(--muted); }
.center { max-width: 460px; margin: 0 auto; padding: 24px 16px; }
.logo { text-align: center; font-size: 3rem; color: var(--brand); }
.hide { display: none !important; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(4, 1fr); } .modal { align-items: center; } .modal > .sheet { border-radius: 20px; } }
@media print { .top, .nav, .btn { display: none; } body { background: #fff; } }
