:root {
  --bg: #f2f2f7; --card: #fff; --text: #1c1c1e; --sub: #8e8e93; --line: rgba(60,60,67,.14);
  --blue: #007aff; --green: #34c759; --orange: #ff9500; --red: #ff3b30; --yellow: #ffcc00; --teal: #30b0c7;
  --fill: rgba(118,118,128,.12); --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f2f2f7; --sub: #8e8e93; --line: rgba(84,84,88,.5); --fill: rgba(118,118,128,.24); --blue: #0a84ff; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; }
body { padding-top: var(--safe-t); }
main { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(96px + var(--safe-b)); }
h1 { font-size: 34px; font-weight: 700; letter-spacing: .3px; margin: 12px 4px 14px; }
h2 { font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--sub); margin: 24px 16px 7px; letter-spacing: .2px; }
h3 { font-size: 20px; margin: 0 0 4px; }
a { color: var(--blue); text-decoration: none; }
.sub { color: var(--sub); font-size: 14px; }
.small { font-size: 13px; }
.muted { color: var(--sub); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.back { display: inline-flex; align-items: center; gap: 2px; color: var(--blue); font-size: 17px; padding: 10px 0 0; background: none; border: 0; cursor: pointer; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 44px; position: relative; cursor: default; }
.item + .item::before { content: ""; position: absolute; top: 0; right: 0; left: 60px; border-top: .5px solid var(--line); }
.list.plain .item + .item::before { left: 16px; }
.item.link { cursor: pointer; }
.item.link::after { content: "›"; color: #c4c4c7; font-size: 22px; margin-left: 4px; }
.item .t { font-size: 17px; }
.item .s { font-size: 13px; color: var(--sub); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .v { font-variant-numeric: tabular-nums; text-align: right; }
.item .v .u { color: var(--sub); font-size: 14px; }

.ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 17px; flex: none; }
.ico.strom { background: #fff4cc; } .ico.wasser { background: #dcefff; } .ico.gas { background: #ffe8cc; } .ico.heizung { background: #ffe0dd; } .ico.sonstiges { background: var(--fill); }
@media (prefers-color-scheme: dark) { .ico.strom { background: #4a3f10; } .ico.wasser { background: #10324f; } .ico.gas { background: #4f3210; } .ico.heizung { background: #4f1c18; } }

.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px 16px; font: 600 17px/1.2 inherit; font-family: inherit; background: var(--blue); color: #fff; cursor: pointer; text-align: center; }
.btn.secondary { background: var(--fill); color: var(--blue); }
.btn.danger { background: var(--fill); color: var(--red); }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 15px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn + .btn { margin-top: 10px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns .btn { flex: 1; margin: 0; }
.linkbtn { background: none; border: 0; color: var(--blue); font: inherit; padding: 6px 0; cursor: pointer; }
.linkbtn.red { color: var(--red); }

.field { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 48px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.field label { width: 42%; max-width: 190px; flex: none; color: var(--text); font-size: 16px; }
.field input, .field select, .field textarea { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--text); text-align: right; padding: 12px 0; outline: none; }
.field textarea { text-align: left; resize: vertical; min-height: 60px; }
.field select { direction: rtl; }
.field select option { direction: ltr; }
.field.stack { flex-direction: column; align-items: stretch; gap: 4px; padding-top: 10px; padding-bottom: 10px; }
.field.stack label { width: auto; max-width: none; color: var(--sub); font-size: 13px; }
.field.stack input, .field.stack select { text-align: left; padding: 4px 0; }
.field.stack select { direction: ltr; }
.field .unit { color: var(--sub); }
input.big { font-size: 28px !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }

.hero { text-align: center; padding: 24px 16px 18px; }
.hero .cam { width: 88px; height: 88px; border-radius: 26px; background: var(--blue); display: grid; place-items: center; margin: 4px auto 16px; box-shadow: 0 8px 24px rgba(0,122,255,.3); }
.hero .cam svg { width: 46px; height: 46px; fill: #fff; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 200px; }

.photo { width: 100%; max-height: 46vh; object-fit: contain; border-radius: var(--radius); background: #000; display: block; margin-bottom: 12px; cursor: zoom-in; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; cursor: zoom-in; background: var(--fill); }

.chip { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--sub); vertical-align: middle; }
.chip.green { background: rgba(52,199,89,.16); color: #1f9d45; }
.chip.orange { background: rgba(255,149,0,.16); color: #c76f00; }
.chip.blue { background: rgba(0,122,255,.14); color: var(--blue); }
.chip.red { background: rgba(255,59,48,.14); color: var(--red); }

.note { border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; font-size: 15px; }
.note.warn { background: rgba(255,149,0,.13); color: #9a5600; }
.note.info { background: rgba(0,122,255,.1); color: var(--text); }
.note.ok { background: rgba(52,199,89,.13); color: #18753a; }
.note.err { background: rgba(255,59,48,.12); color: #b3261e; }
@media (prefers-color-scheme: dark) { .note.warn { color: #ffb340; } .note.ok { color: #4cd964; } .note.err { color: #ff6961; } }

.choices { display: grid; gap: 10px; margin-bottom: 12px; }
.choice { background: var(--card); border: 2px solid transparent; border-radius: var(--radius); padding: 14px 16px; text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.choice .e { font-size: 24px; line-height: 1; }
.choice b { display: block; margin-bottom: 2px; }
.choice.on { border-color: var(--blue); }

.calc { background: var(--fill); border-radius: 12px; padding: 12px 14px; font-size: 15px; margin-bottom: 12px; }
.calc .line { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.calc .line.total { border-top: .5px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 600; }

.chain { display: flex; flex-direction: column; gap: 0; }
.chain .m { display: flex; gap: 12px; padding: 12px 16px; position: relative; }
.chain .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sub); margin-top: 5px; flex: none; position: relative; z-index: 1; }
.chain .m.active .dot { background: var(--green); }
.chain .m:not(:last-child)::after { content: ""; position: absolute; left: 21.5px; top: 22px; bottom: -6px; border-left: 2px dashed var(--line); }

.chart { width: 100%; height: 190px; display: block; }
.chart text { font-size: 11px; fill: var(--sub); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(249,249,249,.86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--line); display: flex; justify-content: center; padding-bottom: var(--safe-b); z-index: 20; }
@media (prefers-color-scheme: dark) { .tabbar { background: rgba(22,22,24,.86); } }
.tabbar a { flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; color: var(--sub); font-size: 10.5px; font-weight: 500; }
.tabbar a svg { width: 26px; height: 26px; fill: currentColor; }
.tabbar a.on { color: var(--blue); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 14px 14px 0 0; padding: 16px 16px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 16px; } }
.modal .mh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal .mh b { font-size: 17px; }
.lightbox { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .x { position: absolute; top: calc(12px + var(--safe-t)); right: 14px; color: #fff; background: rgba(255,255,255,.18); border: 0; border-radius: 99px; width: 36px; height: 36px; font-size: 20px; cursor: pointer; }
.lightbox .cap { position: absolute; top: calc(18px + var(--safe-t)); left: 16px; right: 60px; color: #fff; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.lightbox a.dl { position: absolute; bottom: calc(18px + var(--safe-b)); color: #fff; background: rgba(255,255,255,.18); padding: 8px 16px; border-radius: 99px; font-size: 15px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }

.spinner { width: 34px; height: 34px; border: 3px solid var(--fill); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: rgba(30,30,30,.92); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 15px; z-index: 70; max-width: 90vw; animation: fade .2s; }

.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px; display: block; }

table.bill { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.bill th { text-align: left; font-weight: 500; color: var(--sub); font-size: 12px; padding: 6px 4px; border-bottom: .5px solid var(--line); }
table.bill td { padding: 8px 4px; border-bottom: .5px solid var(--line); vertical-align: top; }
table.bill td.n, table.bill th.n { text-align: right; white-space: nowrap; }
table.bill tr:last-child td { border-bottom: 0; }
table.bill tr.has-sub td { border-bottom: 0; padding-bottom: 2px; }
table.bill td.subrow { font-size: 12px; color: var(--sub); padding-top: 0; }
.scroll-x { overflow-x: auto; }

@media print {
  .tabbar, .noprint, .back { display: none !important; }
  body, html { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .card, .list { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* Hilfe / Support */
.tabbar a { position: relative; }
.tabdot { position: absolute; top: 5px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.bubble { border-radius: 16px; padding: 10px 14px; margin: 0 0 10px; font-size: 15.5px; line-height: 1.42; max-width: 92%; word-wrap: break-word; }
.bubble.me { background: var(--blue); color: #fff; margin-left: auto; border-bottom-right-radius: 5px; }
.bubble.agent { background: var(--card); border-bottom-left-radius: 5px; }
.bubble.err { background: rgba(255,59,48,.12); }
.bubble.sys { background: var(--fill); color: var(--sub); font-size: 13px; margin: 0 auto 10px; text-align: center; }
.bubble .meta { font-size: 11.5px; opacity: .7; margin-bottom: 3px; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 4px 0 6px; padding-left: 20px; }
.bubble code { background: rgba(127,127,127,.18); border-radius: 4px; padding: 0 4px; font-size: 13px; }
.bubble pre { background: rgba(127,127,127,.14); border-radius: 8px; padding: 8px; overflow-x: auto; font-size: 12px; }
.bubble h4 { margin: 8px 0 4px; font-size: 15px; }
pre.diff { font: 11.5px/1.45 ui-monospace, Menlo, monospace; overflow-x: auto; background: var(--card); border-radius: 10px; padding: 8px 0; margin: 8px 0 0; max-height: 60vh; }
pre.diff span { display: block; padding: 0 10px; white-space: pre; }
pre.diff .a { background: rgba(52,199,89,.16); } pre.diff .d { background: rgba(255,59,48,.14); } pre.diff .h { color: var(--blue); } pre.diff .f { font-weight: 700; margin-top: 6px; }
details summary { cursor: pointer; color: var(--blue); padding: 6px 0; }
.health .item .lvl { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lvl.ok { background: var(--green); } .lvl.warn { background: var(--orange); } .lvl.fail { background: var(--red); }
textarea.msg { width: 100%; min-height: 96px; border: 0; border-radius: 12px; padding: 12px 14px; font: inherit; background: var(--card); color: var(--text); resize: vertical; outline: none; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: middle; }

/* ---------- Schulung ---------- */
.train-card { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; margin-bottom: 12px; }
.train-card .e { font-size: 30px; }
.train-card .grow { display: flex; flex-direction: column; gap: 2px; }
.train-card .chev { color: var(--sub, #8e8e93); font-size: 22px; }
.prog { display: block; height: 6px; border-radius: 3px; background: rgba(120,120,128,.18); overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; background: var(--green, #34c759); border-radius: 3px; transition: width .4s; }
.stepper { display: flex; gap: 6px; margin: 4px 0 12px; }
.stepper button { flex: 1; font: inherit; font-size: 13px; padding: 8px 4px; border-radius: 10px; border: 0; background: rgba(120,120,128,.14); color: inherit; }
.stepper button.cur { background: var(--blue, #007aff); color: #fff; font-weight: 600; }
.stepper button.ok:not(.cur)::after { content: ' ✓'; color: var(--green, #34c759); font-weight: 700; }
.tv { margin: 0 auto; max-width: 420px; }
.tv-screen { position: relative; aspect-ratio: 390 / 844; max-height: 62vh; margin: 0 auto; border-radius: 22px; overflow: hidden; background: #111;
  box-shadow: 0 0 0 7px #1c1c1e, 0 10px 30px rgba(0,0,0,.25); cursor: pointer; -webkit-user-select: none; user-select: none; }
.tv-cam { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.tv-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
.tv-img.on { opacity: 1; }
.tv-spot { position: absolute; border-radius: 12px; box-shadow: 0 0 0 3px #ff9f0a, 0 0 0 9999px rgba(0,0,0,.38); transition: opacity .35s; pointer-events: none; animation: tvpulse 1.6s ease-in-out infinite; }
.tv-spot.ok { box-shadow: 0 0 0 3px #34c759, 0 0 0 9999px rgba(0,0,0,.25); animation: none; }
.tv-spot.hidden, .tv-tap.hidden { opacity: 0; }
@keyframes tvpulse { 50% { box-shadow: 0 0 0 6px rgba(255,159,10,.75), 0 0 0 9999px rgba(0,0,0,.38); } }
.tv-tap { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,.55); border: 3px solid #fff; box-shadow: 0 2px 12px rgba(0,0,0,.4); pointer-events: none; }
.tv-tap.go { animation: tvtap .9s ease-out forwards; }
@keyframes tvtap { 0% { transform: scale(1.6); opacity: 0; } 35% { transform: scale(.85); opacity: 1; } 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
.tv-big { position: absolute; inset: 0; margin: auto; width: 150px; height: 150px; border-radius: 50%; border: 0; background: rgba(0,122,255,.92); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-weight: 600; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.tv-big svg { width: 54px; height: 54px; fill: #fff; margin-left: 6px; }
.tv-end { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 14px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(transparent, rgba(0,0,0,.75) 35%); }
.tv-cap { margin: 14px 4px 0; padding: 12px 14px; border-radius: 14px; background: var(--card, #fff); font-size: 16px; line-height: 1.4; min-height: 3.2em; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tv-bar { display: flex; gap: 4px; margin: 12px 4px 0; }
.tv-seg { flex: 1; height: 16px; padding: 5px 0; border: 0; background: none; cursor: pointer; }
.tv-seg::before { content: ''; display: block; height: 6px; border-radius: 3px; background: rgba(120,120,128,.25); }
.tv-seg { position: relative; }
.tv-seg i { position: absolute; left: 0; top: 5px; height: 6px; width: 0; border-radius: 3px; background: var(--blue, #007aff); transition-property: width; transition-timing-function: linear; }
.tv-seg.done i { width: 100%; }
.tv-ctrl { display: flex; align-items: center; gap: 4px; margin: 6px 0 0; }
.tv-ctrl button { font: inherit; font-size: 18px; min-width: 44px; height: 40px; border-radius: 10px; border: 0; background: rgba(120,120,128,.12); color: inherit; }
.tv-ctrl .tv-pp { background: var(--blue, #007aff); color: #fff; min-width: 56px; }
.tv-ctrl [data-rate], .tv-ctrl [data-subs] { font-size: 14px; font-weight: 600; }
.tv-ctrl [data-subs].on { background: var(--blue, #007aff); color: #fff; }
.ex-q { display: flex; gap: 10px; align-items: flex-start; margin: 4px 4px 12px; font-size: 17px; line-height: 1.35; }
.ex-q span:first-child { font-size: 24px; }
.ex-q b { flex: 1; }
.ex-screen { cursor: crosshair; }
.ex-dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); pointer-events: none; }
.ex-dot.bad { background: rgba(255,59,48,.85); animation: shake .35s; }
.ex-dot.ok { background: rgba(52,199,89,.9); }
.ex-dot.hidden { display: none; }
.ex-fb { margin: 12px 4px; font-size: 15px; }
.ex-fb.good { color: var(--green, #34c759); font-weight: 600; }
.ex-fb.bad { color: var(--red, #ff3b30); }
.ex-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(120,120,128,.16); font-weight: 700; font-size: 14px; margin-right: 10px; }
.ex-num.ok { background: var(--green, #34c759); color: #fff; }
.ex-pool { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ex-item { text-align: left; }
.shake { animation: shake .35s; border-color: var(--red, #ff3b30) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.qa.right { border: 2px solid var(--green, #34c759) !important; background: rgba(52,199,89,.1) !important; }
.qa.wrong { border: 2px solid var(--red, #ff3b30) !important; background: rgba(255,59,48,.08) !important; }
.quiz-fb { margin: 12px 4px; padding: 12px 14px; border-radius: 14px; font-size: 15px; line-height: 1.4; }
.quiz-fb.good { background: rgba(52,199,89,.12); }
.quiz-fb.bad { background: rgba(255,59,48,.08); }
.quiz-h { margin: 0 4px 4px; }
.lesson .ex-num { margin-top: 2px; }
.tv-end .btn.secondary { background: rgba(255,255,255,.92); color: var(--blue, #007aff); }
/* Abnahmetest */
.abn .row { gap: 8px; }
.abn-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.abn-row { display: flex; gap: 8px; align-items: flex-start; line-height: 1.35; }
.abn-row > span:first-child { flex: none; width: 16px; font-weight: 700; text-align: center; }
