/* Kalkubit (Webversion) – Farben wie in der Desktop-App (Styles/Theme.axaml), Handy zuerst, ab 900 px mit Seitenleiste. */
:root {
  --primary: #0F766E; --primary-press: #0A524D; --primary-text: #0B5E57; --primary-soft: #E6F4F1; --primary-border: #9FD3C9;
  --bg: #F4F6F6; --surface: #FFFFFF; --surface-sub: #F8FAFA; --sunken: #E9EEEE; --border: #E1E7E6; --input: #94A3A1;
  --text: #17282B; --text-2: #3B4D50; --muted: #5B6C6F; --on-primary: #FFFFFF;
  --ok: #137333; --ok-soft: #E7F6EC; --warn: #A15C07; --warn-soft: #FFF5E5; --bad: #B42318; --bad-soft: #FDEDEC;
  --info: #1D5FA8; --info-soft: #EAF2FC; --grey-zone: #D5DDDC; --sketch: #7F969B; --scrim: rgba(10, 20, 20, .45);
  --shadow: 0 1px 2px rgba(23, 40, 43, .06), 0 4px 14px rgba(23, 40, 43, .06);
  --plate-bg: #FFFFFF; --plate-fg: #111111; --plate-eu: #1F3E9C;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  color-scheme: light;
}
/* Augenschonend: warme Papierfarben, weniger Blauanteil, sanfterer Kontrast (Texte weiter mindestens WCAG AA) */
:root[data-theme="eye"] {
  --primary: #2E6A5D; --primary-press: #22534A; --primary-text: #275A4F; --primary-soft: #E3E5CF; --primary-border: #B9C4A4;
  --bg: #F3EAD7; --surface: #FBF5E8; --surface-sub: #F7F0E0; --sunken: #EBE1CB; --border: #DDD1B6; --input: #A39276;
  --text: #3A2E21; --text-2: #4E4130; --muted: #6A5B46; --on-primary: #FFFDF6;
  --ok: #3B6B2C; --ok-soft: #E6EBD3; --warn: #8A5310; --warn-soft: #F6E6C6; --bad: #9C3426; --bad-soft: #F5DED2;
  --info: #355C85; --info-soft: #E4E6DF; --grey-zone: #E0D5BD; --sketch: #8E7F66; --scrim: rgba(40, 28, 12, .40);
  --shadow: 0 1px 2px rgba(58, 46, 33, .07), 0 4px 14px rgba(58, 46, 33, .07);
  --plate-bg: #FFFDF6; --plate-fg: #111111; --plate-eu: #2D4A8C;
  color-scheme: light;
}
/* Dunkel: theme.js setzt data-theme nach Gerät oder eigener Wahl (Schalter oben rechts) */
:root[data-theme="dark"] {
  --primary: #2BA597; --primary-press: #3DBBAC; --primary-text: #6FD3C5; --primary-soft: #133A37; --primary-border: #23665E;
  --bg: #0F1717; --surface: #172222; --surface-sub: #1B2727; --sunken: #223030; --border: #2A3939; --input: #5E7270;
  --text: #E7EFEE; --text-2: #C3D0CE; --muted: #93A5A3; --on-primary: #06201D;
  --ok: #5CC27F; --ok-soft: #173325; --warn: #E2A24A; --warn-soft: #3A2A12; --bad: #F07A6E; --bad-soft: #3D1C19;
  --info: #7DB2EE; --info-soft: #172A40; --grey-zone: #3A4A49; --sketch: #93A5A3; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--primary-text); }

/* Rahmen: Seitenleiste (PC) bzw. Leiste unten (Handy) */
.shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); padding-top: max(10px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px; min-height: 60px; }
.top h1 { font-size: 19px; font-weight: 700; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.save-state { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.save-state.dirty { color: var(--warn); } .save-state.error { color: var(--bad); }
@media (max-width: 480px) { .save-state:not(.dirty):not(.error) { display: none; } .top .btn.small { padding: 6px 10px; } }
.content { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); }
.nav button, .side button { border: 0; background: transparent; color: var(--muted); font-weight: 600; }
.nav button { padding: 8px 2px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; min-height: 60px; }
.nav button.on, .side button.on { color: var(--primary-text); }
.nav .add .ic { background: var(--primary); color: var(--on-primary); border-radius: 12px; width: 44px; height: 30px; display: grid; place-items: center; }
svg.i { width: 22px; height: 22px; flex: none; }
@media (min-width: 900px) {
  .shell { grid-template-columns: 240px 1fr; }
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; }
  .side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 17px; }
  .side .brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
  .side button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; font-size: 15px; text-align: left; }
  .side button.on { background: var(--primary-soft); }
  .side button:hover { background: var(--sunken); }
  .side .spacer { flex: 1; }
  .nav { display: none; }
  .content { padding-bottom: 40px; }
}
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }

/* Bausteine */
h2 { font-size: 18px; margin: 8px 0 0; }
h3 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack.tight { gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid2 > *, .grid3 > * { min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: left; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--muted); }

.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; width: 100%; min-height: 60px; color: inherit; }
.item:last-child { border-bottom: 0; }
button.item:active, button.item:hover { background: var(--sunken); }
.item .t { font-weight: 600; display: block; overflow-wrap: anywhere; }
.item .m { font-size: 13px; color: var(--muted); display: block; overflow-wrap: anywhere; }
.chev { color: var(--muted); flex: none; }
.dot { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary-text); }
.dot.ok { background: var(--ok-soft); color: var(--ok); } .dot.todo { background: var(--warn-soft); color: var(--warn); }
.thumb { width: 56px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--sunken); flex: none; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--sunken); color: var(--text-2); white-space: nowrap; }
.pill.info { background: var(--info-soft); color: var(--info); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); }

.plate { display: inline-flex; align-items: stretch; border: 2px solid var(--plate-fg); border-radius: 5px; background: var(--plate-bg); color: var(--plate-fg); font-weight: 700; font-size: 15px; line-height: 1; overflow: hidden; flex: none; letter-spacing: .03em; font-family: "Arial Narrow", Arial, sans-serif; }
.plate i { background: var(--plate-eu); color: #FFFFFF; font-style: normal; font-size: 9px; padding: 0 4px 3px; display: grid; align-items: end; }
.plate span { padding: 5px 7px 4px; white-space: nowrap; }

.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 16px; font-weight: 600; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--text); text-decoration: none; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-press); }
.btn.soft { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-text); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-sub); display: grid; place-items: center; flex: none; color: var(--text); }

label.f { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: var(--text-2); min-width: 0; }
.in { width: 100%; border: 1.5px solid var(--input); border-radius: 12px; padding: 11px 12px; background: var(--surface); font-size: 16px; font-weight: 400; color: var(--text); min-height: 46px; }
textarea.in { min-height: 100px; resize: vertical; line-height: 1.4; }
.in:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.in.num { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { border: 1.5px solid var(--input); background: var(--surface); border-radius: 999px; padding: 9px 15px; font-weight: 600; min-height: 42px; color: var(--text); }
.choice.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); border-width: 2px; }
.bigchoices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .bigchoices { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bigchoice { border: 2px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 14px; text-align: left; min-height: 88px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.bigchoice b { font-size: 15.5px; } .bigchoice span { font-size: 13px; color: var(--muted); }
/* lange Wörter (Beweissicherungsgutachten) trennen statt die Seite zu verbreitern */
.bigchoice b, .bigchoice span { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.bigchoice.on { border-color: var(--primary); background: var(--primary-soft); }
.seg { display: flex; background: var(--sunken); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 9px 6px; font-weight: 600; color: var(--muted); min-height: 42px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#theme-choice { flex-wrap: wrap; }
#theme-choice button { min-width: calc(50% - 4px); }
@media (min-width: 600px) { #theme-choice button { min-width: 0; } }

.hint { border-radius: 14px; padding: 12px 14px; background: var(--info-soft); font-size: 14px; }
.hint.warn { background: var(--warn-soft); } .hint.ok { background: var(--ok-soft); } .hint.bad { background: var(--bad-soft); }
.hint b { display: block; margin-bottom: 2px; }
.hint ul { margin: 4px 0 0; padding-left: 18px; }
.linkbtn { border: 0; background: none; padding: 2px 0; color: inherit; text-decoration: underline; text-align: left; font-weight: 500; }

.sum { background: var(--primary-soft); border: 1px solid var(--primary-border); border-radius: var(--radius); padding: 14px; }
.sum .big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary-text); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.kv .r { text-align: right; } .kv .tot { font-weight: 700; border-top: 1px solid var(--primary-border); padding-top: 6px; }
.pos { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.pos:last-child { border-bottom: 0; }
.pos .t { font-weight: 600; overflow-wrap: anywhere; display: block; } .pos .m { font-size: 13px; color: var(--muted); display: block; }
.pos .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Katalog: Text links, schmales AW-/Preisfeld rechts */
.cat-row { align-items: center; padding: 10px 12px; }
.cat-row .grow { display: flex; flex-direction: column; gap: 2px; }
.cat-row input[type=checkbox] { width: 24px; height: 24px; flex: none; accent-color: var(--primary); }
.cat-row .in { width: 92px; flex: 0 0 92px; }
.code { font-family: var(--mono); font-size: 12px; background: var(--sunken); border-radius: 6px; padding: 1px 5px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t .r { text-align: right; }
.scroll-x { overflow-x: auto; }

/* Vorgang: Bereichsleiste links (PC), auf dem Handy eine Liste */
.case-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1100px) { .case-layout.open { grid-template-columns: 300px 1fr; } }
.case-layout .case-nav { min-width: 0; }
.case-layout .case-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1099px) { .case-layout.open .case-nav { display: none; } }
@media (min-width: 1100px) { .case-layout.open .back-only-mobile { display: none; } }
.section-item.on { background: var(--primary-soft); }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
@media (min-width: 700px) { .photos { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.ph { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); min-width: 0; }
.ph .img { border: 0; padding: 0; background: var(--sunken); aspect-ratio: 4 / 3; display: block; position: relative; width: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .no { position: absolute; left: 6px; top: 6px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 700; border-radius: 8px; padding: 2px 7px; }
.ph .cap { font-size: 13px; padding: 8px 10px 2px; overflow-wrap: anywhere; min-height: 2.4em; }
.ph .view { font-size: 12px; color: var(--muted); padding: 0 10px; }
.ph .acts { display: flex; gap: 6px; padding: 8px; }
.ph .acts button { flex: 1; border: 1px solid var(--border); background: var(--surface-sub); border-radius: 10px; min-height: 38px; font-size: 13px; font-weight: 600; padding: 4px; color: var(--text); }
.ph .acts button.mv { flex: 0 0 38px; }
.upload { border: 2px dashed var(--primary-border); background: var(--primary-soft); color: var(--primary-text); border-radius: 16px; padding: 18px; text-align: center; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.upload input { display: none; }
.pick-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; margin-top: 4px; }
.pick-buttons .btn { flex: 1 1 150px; cursor: pointer; }
label.pick input { display: none; }
.viewer-img { position: relative; user-select: none; touch-action: none; }
.viewer-img img { width: 100%; display: block; border-radius: 10px; }
.viewer-img .mark { position: absolute; border: 2px dashed var(--bad); background: rgba(0, 0, 0, .55); pointer-events: none; }

/* Skizzen */
.sketch-wrap { display: flex; justify-content: center; background: var(--surface-sub); border-radius: 14px; padding: 8px; }
svg.sketch { width: 100%; max-width: 300px; height: auto; }
svg.sketch .zone { cursor: pointer; stroke: var(--sketch); stroke-width: 1; }
svg.sketch .body { fill: var(--surface); stroke: var(--sketch); stroke-width: 1; }
svg.sketch .wheel { fill: var(--text-2); }
svg.sketch text { fill: var(--text-2); font-size: 8px; font-family: var(--font); pointer-events: none; }
svg.sketch text.val { font-weight: 700; font-size: 9px; fill: var(--text); }
svg.sketch .lv-none { fill: var(--sunken); } svg.sketch .lv-ok { fill: #BFE5D1; } svg.sketch .lv-warn { fill: #F7E3A1; } svg.sketch .lv-bad { fill: #F2B8B5; }
svg.sketch .dmg { fill: #F2B8B5; stroke: #B42318; stroke-width: 2; }
svg.sketch .arrow { stroke: #B42318; stroke-width: 4; stroke-linecap: round; }
svg.sketch .arrowhead { fill: #B42318; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }
.legend .lv-ok { background: #BFE5D1; } .legend .lv-warn { background: #F7E3A1; } .legend .lv-bad { background: #F2B8B5; } .legend .lv-none { background: var(--sunken); }
.val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 3px 9px; border-radius: 999px; font-size: 14px; }
.val.lv-ok { background: var(--ok-soft); color: var(--ok); } .val.lv-warn { background: var(--warn-soft); color: var(--warn); }
.val.lv-bad { background: var(--bad-soft); color: var(--bad); } .val.lv-none { background: var(--sunken); color: var(--muted); }

/* Untere Blätter (Dialoge) */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .scrim { align-items: center; padding: 24px; } }
.sheet { background: var(--surface); width: 100%; max-width: 680px; max-height: 92vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 700px) { .sheet { border-radius: 20px; } .sheet.wide { max-width: 980px; } }
.sheet-head { padding: 12px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sheet-head h3 { margin: 0; font-size: 18px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { padding: 10px 16px 14px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-foot .btn { flex: 1 1 140px; }
/* Rückfrage, wenn zwei Geräte dasselbe Feld geändert haben (liegt auch über der Sperranzeige) */
.scrim.front { z-index: 80; }
.conflict { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.conflict-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left;
  border: 1.5px solid var(--input); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.conflict-option .t { font-size: 13px; font-weight: 700; color: var(--muted); }
.conflict-option .v { font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.conflict-option.on { border: 2px solid var(--primary); background: var(--primary-soft); }
.conflict-option.on .t { color: var(--primary-text); }
.conflict-option.on .t::before { content: "✓ "; }
.sig { width: 100%; height: 200px; border: 1.5px dashed var(--input); border-radius: 12px; background: #FFFFFF; touch-action: none; display: block; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60; background: var(--text); color: var(--surface);
  padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: var(--shadow); white-space: pre-line; }
.toast.bad { background: var(--bad); color: #FFFFFF; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.busy { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: grid; place-items: center; color: #FFFFFF; font-weight: 700; }
.busy div { background: var(--text); color: var(--surface); padding: 16px 22px; border-radius: 14px; }
pre.text { white-space: pre-wrap; font-family: var(--font); font-size: 14px; margin: 0; background: var(--surface-sub); padding: 12px; border-radius: 10px; max-height: 300px; overflow: auto; }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 400px; padding: 26px; }
.login h1 { margin: 6px 0 4px; font-size: 22px; }
.login-version { margin: 0; text-align: center; }
/* Mehr: Programmname und Version, „Was ist neu“ */
.about { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 4px 0 0; }
.about b { color: var(--text); }
.changes h4 { margin: 14px 0 4px; font-size: 15px; } .changes h4:first-child { margin-top: 0; }
.changes h5 { margin: 10px 0 2px; font-size: 14px; color: var(--muted); }
.changes p { margin: 4px 0; font-size: 14px; } .changes ul { margin: 2px 0 6px; padding-left: 18px; font-size: 14px; } .changes li { margin: 3px 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Korrektur-Ansicht: Gutachtenseiten als Bild, darüber die änderbaren Werte */
.corr { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.corr-page { position: relative; width: 100%; max-width: 880px; margin: 0 auto; background: #FFFFFF; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; touch-action: manipulation; }
.corr-page img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.corr-hot { position: absolute; pointer-events: none; border-radius: 3px; background: rgba(29, 95, 168, .08); box-shadow: inset 0 0 0 1px rgba(29, 95, 168, .45); }
.corr-hot.sec { background: rgba(161, 92, 7, .07); box-shadow: inset 0 0 0 1px rgba(161, 92, 7, .45); }
.corr.marks-off .corr-hot { display: none; }
.corr-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; height: auto; padding: 10px 14px; }

/* Schnittstellen: Kalender-Abo-Link, vCard-Vorschau, WhatsApp/SMS und Zentralruf */
.linkbox { font-family: var(--mono); font-size: 13px; }
details.howto { border-top: 1px solid var(--border); padding-top: 4px; }
details.howto summary { font-weight: 600; cursor: pointer; padding: 8px 0; min-height: 40px; }
details.howto ol { margin: 0 0 8px; padding-left: 22px; font-size: 14px; }
details.howto li { margin-bottom: 4px; }
.vc-row { align-items: flex-start; }
.vc-row input[type=checkbox] { width: 24px; height: 24px; flex: none; margin-top: 2px; accent-color: var(--primary); }
.vc-row select.in { width: auto; max-width: 100%; min-height: 38px; padding: 5px 10px; margin-top: 6px; font-size: 14px; }
.row.end { align-items: flex-end; }
a.btn[aria-disabled=true] { opacity: .55; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
#cal h3 { display: flex; align-items: center; gap: 8px; }

/* Kundenseite (Kunden-Links ohne Anmeldung, k.html) */
.kpage { width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.kpage h1 { font-size: 22px; margin: 0; line-height: 1.25; }
.kpage h2 { font-size: 17px; margin: 6px 0 0; }
.kpage p { margin: 0; }
.khead { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.khead .logo { width: 44px; height: 44px; font-size: 17px; }
.khead b { display: block; font-size: 18px; overflow-wrap: anywhere; }
.klist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.kpick .btn { min-height: 58px; font-size: 17px; }
.pick.off { opacity: .5; pointer-events: none; }
.kbig { min-height: 58px; font-size: 17px; }
.kpage progress { width: 100%; height: 12px; accent-color: var(--primary); }
.kthumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.kthumbs:empty { display: none; }
.kthumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--sunken); }
.ktext { gap: 8px; }
.ktext h3 { margin-top: 4px; }
.ktext details { border-top: 1px solid var(--border); padding-top: 8px; }
.ktext details p { margin-top: 6px; }
.ktext summary { font-weight: 600; cursor: pointer; min-height: 32px; }
.kcheck { align-items: flex-start; font-size: 14px; }
.kcheck input { margin-top: 2px; }
#k-foot a { color: inherit; }
.kkinds { grid-template-columns: 1fr; }
@media (min-width: 700px) { .kkinds { grid-template-columns: repeat(3, 1fr); } }
/* Eigene Schnittstelle (API): Beispiele zum Kopieren; lange Zeilen scrollen im Kasten, nicht die Seite */
pre.codeblock { font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--sunken); color: var(--text); padding: 10px 12px; border-radius: 10px; margin: 0; overflow-x: auto; white-space: pre; max-width: 100%; }
details.howto .stack { min-width: 0; padding-bottom: 8px; }
details.howto ul { margin: 0 0 8px; padding-left: 20px; }
.flabel { font-size: 14px; font-weight: 600; color: var(--text-2); }

/* Benutzer: Kürzel oben (→ Mein Konto), Name in der Seitenleiste, Einladung mit QR-Code, Notfallcodes, Rechte je Bereich */
.me-chip { width: 40px; height: 40px; border-radius: 999px; border: 0; background: var(--primary-soft); color: var(--primary-text); font-weight: 800; font-size: 14px;
  display: grid; place-items: center; flex: none; letter-spacing: .02em; text-transform: uppercase; }
button.me-chip:hover { background: var(--primary-border); }
.me-chip.big { width: 42px; height: 42px; }
@media (min-width: 900px) { .top .me-chip { display: none; } }
/* Schalter hell/dunkel oben rechts: rund und etwas kleiner, damit er neben Speichern und Kürzel passt */
.top .theme-btn { width: 40px; height: 40px; border-radius: 999px; color: var(--muted); }
.top .theme-btn:hover { color: var(--text); }
/* Auswahlmenü der Darstellung (theme.js) */
.theme-menu { position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow), 0 12px 32px rgba(0, 0, 0, .14); padding: 6px; display: grid; gap: 2px; }
.theme-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--text); }
.theme-menu button:hover, .theme-menu button:focus-visible { background: var(--surface-sub); }
.theme-menu button.on { background: var(--primary-soft); color: var(--primary-text); }
.theme-menu button span { display: grid; }
.theme-menu small { color: var(--muted); font-size: 12px; }
.theme-menu .i { width: 22px; height: 22px; flex: none; }
.side .side-me { align-items: center; }
.side .side-me .me-chip { width: 34px; height: 34px; font-size: 13px; }
.side .side-me b { display: block; color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .side-me small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.qr-box { display: flex; justify-content: center; }
img.qr { width: 220px; max-width: 70vw; height: auto; image-rendering: pixelated; background: #FFFFFF; padding: 8px; border-radius: 12px; border: 1px solid var(--border); }
.secret-text { font-family: var(--mono); font-size: 16px; letter-spacing: .05em; background: var(--sunken); padding: 10px 12px; border-radius: 10px; margin: 0; overflow-wrap: anywhere; user-select: all; }
ol.codes { font-family: var(--mono); font-size: 17px; columns: 2; column-gap: 24px; margin: 0; padding-left: 28px; }
ol.codes li { padding: 3px 0; break-inside: avoid; }
fieldset.rights { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px 8px; margin: 0; min-width: 0; }
fieldset.rights legend { font-weight: 700; padding: 0 6px; }
fieldset.rights .check { align-items: flex-start; padding: 6px 0; }
fieldset.rights .check input { margin-top: 1px; }
.login .linkbtn { align-self: center; }
@media print {
  body * { visibility: hidden; }
  .sheet, .sheet * { visibility: visible; }
  .sheet { position: absolute; left: 0; top: 0; max-height: none; box-shadow: none; }
  .sheet-foot, .sheet-head button { display: none; }
}
/* Fernwartung: Meldung oberhalb der Kopfzeile (Code für den Support, laufende Fernwartung) – Farben nur über Variablen (hell/dunkel/augenschonend) */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--info-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.4; }
.banner.warn { background: var(--warn-soft); } .banner.ok { background: var(--ok-soft); }
.banner .grow { min-width: 0; overflow-wrap: anywhere; }
.banner .code { display: inline-block; font-family: var(--mono); font-size: 24px; font-weight: 800; letter-spacing: .14em; line-height: 1.2; padding: 2px 10px; border-radius: 10px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); white-space: nowrap; vertical-align: middle; font-variant-numeric: tabular-nums; }
.banner .btn { flex: none; }
.support-code { font-family: var(--mono); font-size: 40px; font-weight: 800; letter-spacing: .16em; text-align: center; margin: 0; padding: 10px 12px; border-radius: var(--radius);
  background: var(--sunken); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.z-kv { grid-template-columns: auto minmax(0, 1fr); } .z-kv span { min-width: 0; overflow-wrap: anywhere; } .z-kv span:nth-child(odd) { color: var(--muted); }
.z-kv .code { font-size: 12px; }

/* E-Mail-Eingang: Text nur als Text, lange Zeilen umbrechen; Einträge im Posteingang untereinander */
pre.mail-text { max-height: 55vh; overflow-wrap: anywhere; }
.item.mail-entry { flex-direction: column; align-items: stretch; gap: 8px; }
.item.mail-entry .btns { margin: 0; }
.kv.mail-head { grid-template-columns: auto minmax(0, 1fr); } .kv.mail-head span { min-width: 0; overflow-wrap: anywhere; } .kv.mail-head span:nth-child(odd) { color: var(--muted); }
