/* ============================================================
   zk-design — Komponenten. Generische, framework-freie Klassen.
   Setzt tokens.css voraus (Token-Scope .ds / .ds.dark).
   Farb-/Text-/Akzentregeln lesen mit Fallback auf --section-*
   (siehe contrast.css + contrast.php) -> Autocontrast greift
   automatisch in Sections mit gewaehltem Hintergrund, sonst
   gelten die Basis-Tokens.
   ============================================================ */

/* ---------- layout (App-Shell, optional) ---------- */
.scr { height: 100%; display: flex; flex-direction: column; position: relative; }
.scr-body { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.scr-body::-webkit-scrollbar { width: 0; height: 0; }
.pad { padding: 0 20px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 32px; }
.wrap { max-width: 680px; margin-inline: auto; }
.wrap-wide { max-width: 1180px; margin-inline: auto; }
.safe-top { height: 58px; flex: none; }

/* ---------- typography ---------- */
.kicker {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0;
  color: var(--section-muted, var(--ink-2));
  font-weight: 500;
}
.h-display {
  font-size: 32px; line-height: 1.1; font-weight: 600;
  letter-spacing: -.02em; color: var(--section-text, var(--ink)); margin: 0;
}
.h-lg { font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.h-md { font-size: 18px; line-height: 1.25; font-weight: 600; letter-spacing: 0; margin: 0; }
.h-sm { font-size: 15px; line-height: 1.3; font-weight: 600; letter-spacing: 0; margin: 0; }
.lede { font-size: 15px; line-height: 1.5; color: var(--section-muted, var(--ink-2)); margin: 0; }
.body { font-size: 15px; line-height: 1.55; color: var(--section-text, var(--ink)); margin: 0; }
.small { font-size: 13px; line-height: 1.45; color: var(--section-muted, var(--ink-2)); }
.muted { color: var(--section-muted, var(--ink-3)); }
.num { font-family: var(--font); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* ---------- tags / chips ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font); font-size: 12px; letter-spacing: 0;
  font-weight: 500;
  padding: 4px 8px; border-radius: 8px; white-space: nowrap;
}
.tag-soft { background: var(--surface-2); color: var(--ink-2); }
.tag-line { border: 1px solid var(--line); color: var(--ink-2); }
.tag-accent { background: var(--section-accent, var(--accent)); color: var(--section-on-accent, var(--on-accent)); }
.tag-accent-soft { background: var(--section-accent-bg, var(--accent-soft)); color: var(--section-accent, var(--accent-ink)); }
.ds.dark .tag-accent-soft { color: var(--section-accent, var(--accent)); }
.tag-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; display: inline-block; flex: none;
}

/* selectable filter chips; 44 px Tippziel (0.4.1), Schrift und Rundung unveraendert */
.chip {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  cursor: pointer; white-space: nowrap; transition: all .14s ease; flex: none;
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ds.dark .chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 18px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card { display: block; color: inherit; text-decoration: none; }
.card-tap { cursor: pointer; }
.card-tap:active { transform: scale(.985); }
.card-tap:hover { box-shadow: var(--shadow); border-color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font); font-size: 14px; font-weight: 600;
  border-radius: var(--r-el); padding: 12px 16px; cursor: pointer;
  border: 1px solid transparent; transition: all .13s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--section-accent, var(--accent)); color: var(--section-on-accent, var(--on-accent)); }
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { background: transparent; color: var(--section-text, var(--ink)); border-color: var(--section-muted, var(--line)); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-soft { background: var(--surface-2); color: var(--ink); }
.btn-soft:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 13px; font-size: 13px; }
.btn-lg { padding: 15px 20px; font-size: 15px; }

/* icon button */
.iconbtn {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  cursor: pointer; transition: all .13s ease;
}
.iconbtn:hover { color: var(--accent-ink); border-color: var(--ink-3); }
.iconbtn:active { transform: scale(.93); }
.iconbtn .ms { font-size: 21px; }

/* ---------- app bar ---------- */
.appbar {
  flex: none; padding: 54px 16px 12px;
  background: var(--bg);
  position: relative; z-index: 10;
}
.appbar-row { display: flex; align-items: center; gap: 10px; }
.appbar-line { height: 1px; background: var(--line); margin: 0 -16px; }

/* ---------- bottom tab bar ---------- */
.tabbar {
  flex: none; display: flex; align-items: stretch;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
  padding-bottom: 30px;
  background: var(--surface); border-top: 1px solid var(--line);
  position: relative; z-index: 10;
}
.tabbar-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer; padding: 6px 0;
  color: var(--ink-3); font-family: var(--font);
}
.tabbar-btn .ms { font-size: 25px; transition: transform .15s ease; }
.tabbar-btn .lbl { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; }
.tabbar-btn.on { color: var(--accent-ink); }
.ds.dark .tabbar-btn.on { color: var(--accent); }
.tabbar-btn.on .ms { transform: translateY(-1px); }

/* ---------- meters ---------- */
.meter { height: 8px; border-radius: 999px; background: var(--bar-track); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--section-accent, var(--accent)); transition: width .6s cubic-bezier(.3,.7,.2,1); }
.meter-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }

/* ---------- chat ---------- */
.thread { padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 14px; }
.turn { display: flex; flex-direction: column; max-width: 84%; }
.turn-owner { align-self: flex-start; align-items: flex-start; }
.turn-you { align-self: flex-end; align-items: flex-end; }
.turn-name {
  font-family: var(--font); font-size: 12px; font-weight: 500;
  color: var(--ink-3); margin: 0 0 4px 4px;
  display: flex; align-items: center; gap: 6px;
}
.bubble {
  padding: 13px 15px; font-size: 15px; line-height: 1.5;
  border-radius: 18px; white-space: pre-wrap; word-break: break-word;
}
.bubble-owner {
  background: var(--owner-bg); color: var(--owner-ink);
  border: 1px solid var(--owner-line); border-bottom-left-radius: 6px;
}
.bubble-you {
  background: var(--you-bg); color: var(--you-ink);
  border-bottom-right-radius: 6px;
}
.turn-you .turn-name { margin: 0 3px 5px 0; }

/* coach note — clearly separated from the conversation */
.coach {
  align-self: stretch; margin: 2px 0;
  background: var(--coach-bg); border-radius: 14px;
  padding: 13px 15px 13px 14px; position: relative;
  border: 1px solid var(--line-soft);
}
.ds.dark .coach { border: 1px dashed transparent; }
.coach-head {
  display: flex; align-items: center; gap: 7px; margin-bottom: 6px;
}
.coach-head .ms { font-size: 17px; color: var(--accent-ink); }
.ds.dark .coach-head .ms { color: var(--accent); }
.coach-label {
  font-family: var(--font); font-size: 12px;
  color: var(--accent-ink); font-weight: 500;
}
.ds.dark .coach-label { color: var(--accent); }
.coach-body { font-size: 13.5px; line-height: 1.5; color: var(--coach-ink); }

/* composer */
.composer {
  flex: none; padding: 10px 14px calc(12px + env(safe-area-inset-bottom,0px));
  padding-bottom: 30px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.composer-field {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 6px 6px 16px;
}
.composer-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--font); font-size: 15px; color: var(--ink);
  padding: 8px 0;
}
.composer-input::placeholder { color: var(--ink-3); }
.composer-send {
  width: 40px; height: 40px; border-radius: 999px; flex: none; border: none;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .13s ease;
}
.composer-send:active { transform: scale(.92); }
.composer-send .ms { font-size: 22px; }

/* segmented toggle */
.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px;
}
.seg-btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 999px; border: none; cursor: pointer;
  background: transparent; color: var(--ink-2); transition: all .13s ease;
}
.seg-btn.on { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow); }
.ds.dark .seg-btn.on { color: var(--accent); }

/* ---------- forms ---------- */
.field { margin-bottom: 20px; }
.field-label {
  display: block; margin: 0 2px 8px;
  font-family: var(--font); font-size: 13px;
  color: var(--ink-2); font-weight: 500;
}
.field-label .hint {
  font-family: var(--font); font-size: 11.5px; letter-spacing: 0;
  text-transform: none; color: var(--ink-3); margin-left: 6px;
}
.input, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-el); padding: 13px 15px;
  font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink);
  outline: none; transition: border-color .13s ease, box-shadow .13s ease;
  -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: none; min-height: 96px; display: block; }

/* toggle switch */
.setrow {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
}
.setrow + .setrow { border-top: 1px solid var(--line-soft); }
.switch {
  width: 46px; height: 28px; border-radius: 999px; flex: none;
  background: var(--bar-track); position: relative; cursor: pointer;
  transition: background .15s ease; border: none;
}
.switch.on { background: var(--accent); }
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 999px; background: #fff; transition: transform .15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on .knob { transform: translateX(18px); }

/* avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 999px; flex: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-ink);
  font-family: var(--font); font-weight: 600; font-size: 15px;
  border: 1px solid transparent; transition: all .13s ease;
}
.ds.dark .avatar { color: var(--accent); }
.avatar:hover { box-shadow: var(--shadow); }
.avatar:active { transform: scale(.93); }

/* toast */
.toast {
  position: absolute; left: 16px; right: 16px; bottom: 96px; z-index: 70;
  background: var(--ink); color: var(--bg);
  border-radius: var(--r-el); padding: 13px 16px;
  display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: toast-in .25s cubic-bezier(.2,.8,.2,1) both;
}
.ds.dark .toast { background: var(--accent); color: var(--on-accent); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* sticky footer */
.footer-bar {
  flex: none; padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px));
  padding-bottom: 30px;
  background: var(--surface); border-top: 1px solid var(--line);
}

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line); }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.gap6 { gap: 6px; } .gap10 { gap: 10px; } /* veraltet: nicht im 4-px-Raster */
.grow { flex: 1; }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

.fade-in { }
@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fade-in .35s ease both; }
}
@keyframes fade-in { from { transform: translateY(8px); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ds * { animation: none !important; transition: none !important; }
}

/* typing indicator */
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 999px; background: var(--ink-3); display: block; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* recording pulse */
.rec-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--accent); animation: rec 1.1s infinite ease-in-out; }
@keyframes rec { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }

/* voice overlay */
.voice-ov { position: absolute; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 40px; animation: fade-in .25s ease both; }
.voice-wave { display: flex; gap: 5px; align-items: center; height: 64px; }
.voice-wave i { width: 5px; border-radius: 999px; background: var(--accent); animation: wave 1s infinite ease-in-out; }
@keyframes wave { 0%,100% { height: 14px; } 50% { height: 56px; } }
.voice-mic { width: 96px; height: 96px; border-radius: 999px; background: var(--accent); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 0 var(--accent-soft); animation: ring 1.8s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 var(--accent-soft); } 70% { box-shadow: 0 0 0 26px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* start sheet */
.sheet-scrim { position: absolute; inset: 0; z-index: 45; background: rgba(8,16,12,.5); backdrop-filter: blur(2px); animation: fade-in .2s ease both; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(28px + env(safe-area-inset-bottom,0px)); box-shadow: var(--shadow-lg); animation: sheet-up .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grab { width: 38px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 14px; }
.mode-opt { display: flex; align-items: center; gap: 13px; padding: 14px; border-radius: var(--r-el); border: 1.5px solid var(--line); cursor: pointer; transition: all .13s ease; background: var(--surface); color: var(--ink); }
.mode-opt:hover { border-color: var(--ink-3); }
.mode-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.radio { width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; }
.mode-opt.on .radio { border-color: var(--accent); }
.mode-opt.on .radio::after { content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--accent); }

/* ---------- 0.2: Bausteine aus werkbefund (allgemein) ---------- */
/* Zuordnung alter Namen: MIGRATION-0.2.md */

/* Tags fuer Prioritaet */
.tag-danger { background: var(--danger); color: var(--on-danger); }
.tag-warn   { background: var(--warn); color: var(--on-warn); }
.tag-ok     { background: var(--ok); color: var(--on-ok); }
.tag-info   { background: var(--info); color: var(--on-info); }

/* Kennzahl-Kacheln */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-el);
  padding: 16px;
}
button.kpi, a.kpi { cursor: pointer; text-decoration: none; }
button.kpi:hover, a.kpi:hover { border-color: var(--accent); }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.kpi-top .ms { font-size: 18px; color: var(--ink-3); }
.kpi-label { font-size: 13px; font-weight: 500; }
.kpi-val { font-size: 22px; line-height: 1.15; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Balkendiagramm (eine Reihe, Hoehe per style="height:NN%") */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 140px; padding-top: 8px; }
.bars-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars-bar { width: 100%; max-width: 48px; min-height: 2px; background: var(--accent); border-radius: 6px 6px 0 0; }
.bars-x { font-size: 12px; color: var(--ink-3); }

/* Spalten-Board (z. B. Pipeline) */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col {
  flex: 0 0 220px; min-width: 220px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-el); padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.board-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.board-sum { margin-top: -4px; }
.board-card {
  display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
button.board-card, a.board-card { cursor: pointer; text-decoration: none; }
button.board-card:hover, a.board-card:hover { border-color: var(--accent); }
.board-card.on { border-color: var(--accent); background: var(--accent-soft); }
.board-amount { font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Positionstabelle: Hauptzeile + Beschreibungszeile bilden eine Karte */
.ptable-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; }
.ptable th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 8px 12px; white-space: nowrap; }
.ptable td { padding: 8px 12px; vertical-align: middle; }
.ptable .ta-r { text-align: right; font-variant-numeric: tabular-nums; }
.ptable input.input, .ptable textarea.input { width: 100%; }
.ptable-group > td { background: var(--surface-2); font-weight: 600; }
.ptable-row > td { background: var(--surface); border-top: 1px solid var(--line); padding-top: 12px; }
.ptable-row > td:first-child { border-left: 1px solid var(--line); border-top-left-radius: 12px; }
.ptable-row > td:last-child { border-right: 1px solid var(--line); border-top-right-radius: 12px; }
.ptable-desc > td { background: var(--surface); border-bottom: 1px solid var(--line); padding-top: 0; padding-bottom: 12px; }
.ptable-desc > td:first-child { border-left: 1px solid var(--line); border-bottom-left-radius: 12px; }
.ptable-desc > td:last-child { border-right: 1px solid var(--line); border-bottom-right-radius: 12px; }
.ptable-row.solo > td { border-bottom: 1px solid var(--line); }
.ptable-row.solo > td:first-child { border-bottom-left-radius: 12px; }
.ptable-row.solo > td:last-child { border-bottom-right-radius: 12px; }
.ptable-sum { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.ptable-sum-row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ptable-sum-total { display: flex; justify-content: space-between; gap: 16px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ptable-gap > td { height: 12px; border: 0; background: transparent; padding: 0; }
.ptable-no {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 24px; height: 24px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600;
}

/* Prioritaetsliste mit Filter (Verhalten: zk.js, data-zk="prio") */
.prio-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.prio-pill {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.prio-pill.is-on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.prio-item { padding: 12px 0 12px 12px; border-top: 1px solid var(--line); border-left: 4px solid transparent; }
.prio-item.is-crit   { border-left-color: var(--danger); }
.prio-item.is-high   { border-left-color: var(--warn); }
.prio-item.is-normal { border-left-color: var(--line); }
.prio-item[hidden] { display: none; }

/* Schwebende Abschnitts-Navigation (Verhalten: zk.js, data-zk="secnav") */
.secnav {
  position: fixed; right: 16px; z-index: 60;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  max-height: calc(100dvh - 120px);
}
.secnav-fab {
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
}
.secnav-fab .ms { font-size: 26px; }
.secnav-fab:active { transform: scale(.96); }
.secnav-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; overflow-y: auto; }
.secnav-menu[hidden] { display: none; }
.secnav-pill {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-decoration: none;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap; font: inherit; font-size: 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.secnav-pill .ms { font-size: 18px; }
.secnav-pill.active { border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ds.dark .secnav-pill.active { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .secnav-menu:not([hidden]) { animation: fade-in .12s ease-out; } }

/* ---------- 0.2.5: Kategorien, kompakte Listen, Links, Hinweise ---------- */
.ds { overflow-wrap: anywhere; }
.ds a:not([class]) { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.ds.dark a:not([class]) { color: var(--accent); }
.ds a:not([class]):hover { text-decoration-thickness: 2px; }

.tag-cat-1 { background: var(--cat-1-soft); color: var(--cat-1); }
.tag-cat-2 { background: var(--cat-2-soft); color: var(--cat-2); }
.tag-cat-3 { background: var(--cat-3-soft); color: var(--cat-3); }
.tag-cat-4 { background: var(--cat-4-soft); color: var(--cat-4); }
.tag-cat-5 { background: var(--cat-5-soft); color: var(--cat-5); }
.tag-cat-6 { background: var(--cat-6-soft); color: var(--cat-6); }

/* kompakte Karte und Zeilenliste fuer dichte Arbeitslisten */
.card-compact { padding: 12px; }
.list-rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-el); }
.list-rows > * { padding: 12px 16px; }
.list-rows > * + * { border-top: 1px solid var(--line); }

/* Hinweis-Zeilen (z. B. "Daten veraltet") */
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-el); background: var(--surface-2); color: var(--ink); font-size: 14px; line-height: 1.45; }
.notice .ms { font-size: 20px; flex: none; }
.notice-warn { background: var(--warn-soft); }
.notice-warn .ms { color: var(--warn); }
.notice-danger { background: var(--danger-soft); }
.notice-danger .ms { color: var(--danger); }
.notice-info { background: var(--info-soft); }
.notice-info .ms { color: var(--info); }
.notice[hidden] { display: none; }
.list-rows > [hidden] { display: none; }

/* ---------- 0.2.7: Aufklappen, mehrteiliger Balken, Code, Scroll-Hinweis ---------- */
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold-icon { flex: none; font-size: 20px; color: var(--ink-3); transition: transform .15s ease; }
.fold[open] > summary .fold-icon { transform: rotate(90deg); }

.meter-multi { display: flex; height: 8px; border-radius: 999px; background: var(--bar-track); overflow: hidden; }
.meter-multi > .m-ok { background: var(--ok); }
.meter-multi > .m-info { background: var(--info); }
.meter-multi > .m-warn { background: var(--warn); }

.ds code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border-radius: 4px; padding: 0 4px; }

.scroll-x.scroll-hint { scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding-bottom: 8px; }
.scroll-x.scroll-hint::-webkit-scrollbar { display: block; height: 6px; }
.scroll-x.scroll-hint::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.scroll-x.scroll-hint[data-overflow="rechts"] { mask-image: linear-gradient(to right, black calc(100% - 48px), transparent); -webkit-mask-image: linear-gradient(to right, black calc(100% - 48px), transparent); }

/* ---------- 0.3.1: Balken mit Zustand, kleiner Verlauf ---------- */
/* Zustand am Balken: Fuellung und Spur aus derselben Farbe (Spur heller), nie Farbe allein: Zahl und Wort daneben */
.meter.is-warn { background: var(--warn-soft); }
.meter.is-warn > .meter-fill { background: var(--warn); }
.meter.is-danger { background: var(--danger-soft); }
.meter.is-danger > .meter-fill { background: var(--danger); }
/* Verlauf (Sparkline): SVG mit viewBox 0 0 100 24 und preserveAspectRatio="none"; Striche skalieren nicht mit */
.spark { display: block; width: 100%; height: 32px; overflow: visible; }
.spark-line { fill: none; stroke: var(--ink-3); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-limit { stroke: var(--warn); stroke-width: 1px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark-now { stroke: var(--accent); stroke-width: 8px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-hit { fill: transparent; pointer-events: all; }
.spark-hit:hover { fill: var(--line-soft); }

/* ---------- 0.6.0: Hauptnavigation fuer Arbeitsoberflaechen (Verhalten: zk.js, data-zk="topnav") ---------- */
/* Eine Zeile oben. Ohne zk.js bricht die Liste um (alles erreichbar); mit zk.js bleibt sie einzeilig,
   was nicht passt, wandert unter "Mehr" (Badges dort summiert), Reihenfolge per Ziehen oder Alt+Pfeil. */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 4px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  font-family: var(--font);
}
/* Leiste bis an den Rand: der Standardrand des body faellt nur auf Seiten mit .topnav weg */
body:has(> .topnav) { margin: 0; }
.topnav a { text-decoration: none; }
.topnav-brand {
  flex: 0 1 auto; min-width: 0; display: block; min-height: 44px; line-height: 44px; padding-right: 8px;
  font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.topnav-list {
  flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  margin: 0; padding: 0; list-style: none;
}
.topnav.is-ready .topnav-list { flex-wrap: nowrap; }
/* ganz eng (Telefon): die Liste schrumpft nicht mehr, die Marke kuerzt mit Auslassungspunkten */
.topnav.is-tight .topnav-list { flex: none; }
.topnav-item, .topnav-more { flex: none; position: relative; }
.topnav-more[hidden] { display: none; }
.topnav-sub > summary { list-style: none; }
.topnav-sub > summary::-webkit-details-marker { display: none; }
.topnav-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: var(--r-el); background: transparent; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.topnav-link:hover { color: var(--ink); background: var(--surface-2); }
.topnav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topnav-link.on, .topnav-link[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
.ds.dark .topnav-link.on, .ds.dark .topnav-link[aria-current="page"] { color: var(--accent); }
.topnav-caret { font-size: 18px; margin-right: -4px; color: var(--ink-3); transition: transform .14s ease; }
.topnav-sub[open] > summary .topnav-caret { transform: rotate(180deg); }
svg.topnav-caret { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; }
.topnav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--ink-2); color: var(--surface);
}
.topnav-badge.is-alert { background: var(--danger); color: var(--on-danger); }
/* 0.9.1: orange fuer "wartet auf Dich" (Handlung noetig, nicht dringend); rot bleibt Dringendem vorbehalten */
.topnav-badge.is-warn { background: var(--warn); color: var(--on-warn); }
.topnav-badge[hidden] { display: none; }
/* Bedeutung der Zahl fuer Screenreader ("offen", "dringend"), unsichtbar */
.topnav-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.topnav-reset { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.topnav-reset .topnav-link { width: 100%; color: var(--ink-3); font-size: 13px; }
.topnav-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 220px; max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-el); box-shadow: var(--shadow-lg);
}
.topnav-more .topnav-menu { left: auto; right: 0; }
.topnav-menu .topnav-item, .topnav-menu .topnav-sub, .topnav-menu .topnav-link { width: 100%; }
.topnav-menu .topnav-badge { margin-left: auto; }
/* Untermenue innerhalb von "Mehr": eingerueckt statt schwebend */
.topnav-menu .topnav-menu { position: static; min-width: 0; max-height: none; padding: 0 0 4px 12px; border: 0; box-shadow: none; }
.topnav-end { flex: none; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topnav-end .small { white-space: nowrap; }
.topnav.is-tight .topnav-end { display: none; }
.topnav-endmenu { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 4px; padding: 8px; border-top: 1px solid var(--line); }
/* Umsortieren */
.topnav-item.is-drag { opacity: .4; }
.topnav-item.is-drop-before { box-shadow: -2px 0 0 0 var(--accent); }
.topnav-item.is-drop-after { box-shadow: 2px 0 0 0 var(--accent); }
.topnav-menu .topnav-item.is-drop-before { box-shadow: 0 -2px 0 0 var(--accent); }
.topnav-menu .topnav-item.is-drop-after { box-shadow: 0 2px 0 0 var(--accent); }
@media (max-width: 719px) {
  .topnav { padding: 4px 12px; gap: 4px; }
  .topnav-end .small { display: none; }
}

/* ---------- 0.7: Fenster ueber der Seite (dialog) und Auswahlliste (select) ----------
   <dialog class="dialog" data-zk="dialog" id="..."> mit .dialog-head, .dialog-body, .dialog-foot.
   Ab 720 px mittig und hoechstens 720 px breit, darunter die ganze Seite. Oeffnen ueber zk.js
   (data-zk-open="#id", Verweis auf #id oder Adresse mit #id), Schliessen: Esc, data-zk-close, Klick daneben. */
.dialog {
  width: min(720px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 64px);
  margin: auto; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.dialog[open] { display: flex; flex-direction: column; }
/* showModal() legt den Fokus aufs Fenster, wenn darin nichts fokussierbar ist: kein Ring um das ganze Fenster */
.dialog:focus { outline: none; }
.dialog::backdrop { background: var(--scrim); }
.dialog-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.dialog-title { min-width: 0; margin: 0; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 32px; }
.dialog-foot {
  flex: none; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--line);
}
:root:has(.dialog[open]) { overflow: hidden; }
@media (max-width: 719px) {
  .dialog { width: 100%; height: 100%; max-height: none; margin: 0; border: none; border-radius: 0; }
  .dialog-head { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .dialog-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* Zeile, die umbricht, wenn der Platz nicht reicht (zu .row oder .between) */
.flex-wrap { flex-wrap: wrap; }

/* Auswahlliste: <select class="input select">, in Zeilen und Leisten zusaetzlich .select-sm.
   Der Pfeil ist aus zwei Flaechen in --ink-2 gebaut (kein Bild, folgt hell und dunkel). */
.select {
  appearance: none; cursor: pointer; padding-right: 40px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 21px) 50%, calc(100% - 16px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.select-sm {
  width: auto; max-width: 100%; min-height: 44px; padding: 8px 36px 8px 12px;
  font-size: 14px; line-height: 1.4;
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
}
.select:disabled { cursor: default; color: var(--ink-3); }

/* 0.7.1 (Anlass ticketbot#D6) */
/* Zeile, die unter 720 px zur Spalte wird: erstes Kind (Text) nimmt den Platz, das letzte (Knoepfe,
   Auswahl) steht am Rechner rechts daneben, am Telefon darunter. */
.row-split { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.row-split > :first-child { min-width: 0; max-width: 100%; }
@media (min-width: 720px) {
  .row-split { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .row-split > :first-child { flex: 1; }
  .row-split > :last-child { flex: none; }
}
/* Aufklapp-Zeile: die ganze Zeile ist Tippziel (44 px) */
.fold > summary { min-height: 44px; }
/* Hinweis mit Knopf (z. B. Rueckgaengig): Text und Knopf auf einer Linie, der Knopf macht ihn kaum hoeher */
.notice:has(> .btn) { align-items: center; }
.notice > .btn { flex: none; margin: -8px -4px -8px 0; }

/* ---------- 0.10.0: Arbeitsflaeche, schwebendes Fenster, Seitennavigation, Reiter, Ablaufbild, Schleier ----------
   Anlass machbar#B1. Verhalten von .float und .tabs in zk.js (data-zk="float", data-zk="tabs").
   Breiten: ab 1100 px .work-nav mit .sidenav und schwebendes .float; 720 bis 1099 px .topnav.is-mid oben und
   .float als Blatt (wie .sheet); darunter .appbar der Seite und ebenfalls Blatt. Eine Komponente zeigt nie beides. */

/* --- .work: Arbeitsflaeche --- */
.work {
  --work-top: 0px;
  display: block; min-width: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
}
.work-nav { display: none; }
.work-main { min-width: 0; display: flex; flex-direction: column; }
.work-main-head {
  position: sticky; top: var(--work-top); z-index: 30;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.work-main-head .coach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0; }
.work-main-head .coach-head { margin: 0; }
.work-main-head .coach-body { flex: 1 1 16rem; min-width: 0; }
.work-main-head .coach-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.work-main-body { display: flex; flex-direction: column; gap: 20px; padding: 20px 16px 120px; min-width: 0; }
@media (min-width: 720px) and (max-width: 1099px) { .work { --work-top: 57px; } }
@media (min-width: 720px) {
  .work-main-head { padding: 12px 28px; }
  .work-main-body { padding: 20px 28px 120px; }
}
@media (min-width: 1100px) {
  .work { display: grid; grid-template-columns: 220px minmax(0, 1fr); height: calc(100dvh - var(--work-top)); }
  .work-nav { display: block; min-height: 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
  .work-main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
.topnav.is-mid { display: none; }
@media (min-width: 720px) and (max-width: 1099px) { .topnav.is-mid { display: flex; } }

/* --- .sidenav: senkrechte Hauptnavigation (ab 1100 px) --- */
.sidenav { display: flex; flex-direction: column; gap: 4px; min-height: 100%; padding: 16px 12px; font-family: var(--font); }
.sidenav-brand { padding: 8px 12px 16px; font-size: 18px; font-weight: 600; color: var(--ink); }
.sidenav-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sidenav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 8px 12px; border-radius: var(--r-el);
  color: var(--ink-2); font-size: 14px; text-decoration: none;
}
.sidenav-link:hover { color: var(--ink); background: var(--surface-2); }
.sidenav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidenav-link.on, .sidenav-link[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
.ds.dark .sidenav-link.on, .ds.dark .sidenav-link[aria-current="page"] { color: var(--accent); }
.sidenav-badge {
  flex: none; min-width: 20px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.sidenav-badge.is-warn { background: var(--warn); color: var(--on-warn); }
.sidenav-end { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; font-size: 13px; color: var(--ink-3); }

/* --- .tabs: Reiter (Pfeiltasten in zk.js) --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; font-family: var(--font); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 44px; padding: 8px 16px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-el); }
.tab.on, .tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tabs.is-fill .tab { flex: 1 1 0; padding-left: 4px; padding-right: 4px; text-align: center; }
.tab-panel[hidden] { display: none; }
.tab-panel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- .float: schwebendes Fenster (Verhalten: zk.js) ---
   Ab 1100 px fest im Fenster (fixed), Lage und Groesse setzt zk.js per CSSOM. Darunter dieselbe Struktur als Blatt. */
.float {
  position: fixed; z-index: 40; right: 24px; bottom: 24px; width: 400px; height: 520px; min-width: 280px; min-height: 200px;
  max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px);
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; overflow-wrap: anywhere;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-lg); overflow: hidden; font-family: var(--font);
}
.float[hidden] { display: none; }
.float-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: move; touch-action: none; user-select: none;
}
.float-head > .small { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 0.11.1 (machbar#L2): die eine Spalte des Fensters ist minmax(0, 1fr). Vorher (auto) weitete ein langer, nicht umbrechender Text im Kopf
   die Spalte ueber die Fensterbreite, alles darunter wurde am rechten Rand abgeschnitten statt umgebrochen. overflow-wrap: anywhere
   gilt fuer den ganzen Inhalt; breite Tabellen und Vorschauen bekommen .float-scroll (eigener Rahmen, waagerecht scrollbar). */
.float-scroll { max-width: 100%; overflow-x: auto; }
.float-head .btn, .float-head .iconbtn { cursor: pointer; }
.float-grip { flex: none; width: 28px; height: 4px; border-radius: var(--r-pill); background: var(--line); }
.float-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.float-foot { border-top: 1px solid var(--line); }
/* 0.12: Raender 10 px, Ecken 28 px (vorher 8 und 24); zusaetzlich der sichtbare Griff .float-handle oben links (data-zk-handle) */
.float-edge { position: absolute; z-index: 2; touch-action: none; }
.float-edge[data-edge="n"], .float-edge[data-edge="s"] { left: 28px; right: 28px; height: 10px; cursor: ns-resize; }
.float-edge[data-edge="e"], .float-edge[data-edge="w"] { top: 28px; bottom: 28px; width: 10px; cursor: ew-resize; }
.float-edge[data-edge="n"] { top: 0; } .float-edge[data-edge="s"] { bottom: 0; }
.float-edge[data-edge="e"] { right: 0; } .float-edge[data-edge="w"] { left: 0; }
.float-edge[data-edge="ne"], .float-edge[data-edge="nw"], .float-edge[data-edge="se"], .float-edge[data-edge="sw"] { width: 28px; height: 28px; }
.float-edge[data-edge="ne"] { top: 0; right: 0; cursor: nesw-resize; } .float-edge[data-edge="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }
.float-edge[data-edge="nw"] { top: 0; left: 0; cursor: nwse-resize; } .float-edge[data-edge="se"] { bottom: 0; right: 0; cursor: nwse-resize; }
.float-handle {
  --m: var(--ink-2);
  position: absolute; z-index: 3; top: 0; left: 0; width: 32px; height: 32px; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: nwse-resize; touch-action: none;
  border-radius: var(--r-card) 0 10px 0;
}
.float-handle-mark {
  width: 14px; height: 14px; pointer-events: none;
  background: linear-gradient(135deg, transparent 0 8%, var(--m) 8% 20%, transparent 20% 34%, var(--m) 34% 46%, transparent 46% 60%, var(--m) 60% 72%, transparent 72%);
}
.float-handle:hover { background: var(--accent-soft, var(--surface-2)); }
.float-handle:hover, .float-handle:focus-visible { --m: var(--accent-ink); }
.float-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.float.has-handle .float-head { padding: 12px 12px 8px 36px; }
.float-head .iconbtn { width: 32px; height: 32px; border-radius: 9px; }
.float-head .iconbtn .ms { font-size: 19px; }
.float-head { flex-wrap: nowrap; gap: 4px; }
.float-head > .float-title { flex: none; font-weight: 600; margin-right: 4px; }
/* Ziehen: halbdurchsichtig, nimmt keine Ablage an */
.float.is-drag { opacity: .6; user-select: none; }
.float.is-drag .float-body, .float.is-drag .float-foot { pointer-events: none; }
/* Bandform: nur Kopf und letzter Eintrag am unteren Rand (zk.js nimmt dafuer die eigene Lage zurueck) */
.float.is-band { left: auto; top: auto; right: 24px; bottom: 24px; width: 400px; height: 140px; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
.float.is-band .float-body > :not(:last-child), .float.is-band .float-foot, .float.is-band .float-edge, .float.is-band .float-handle { display: none; }
.float.is-band.has-handle .float-head { padding-left: 16px; }
/* Runder Knopf, wenn eingeklappt */
.float-fab {
  position: fixed; z-index: 40; right: 24px; bottom: 24px; width: 56px; height: 56px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow-lg); cursor: pointer;
}
.float-fab:hover { background: var(--accent-press); }
.float-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.float-fab[hidden] { display: none; }
.float-fab .ms { font-size: 26px; }
.float-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--warn); color: var(--on-warn); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.float-badge[hidden] { display: none; }
/* Unter 1100 px: Blatt von unten, hoechstens bis --float-top unter dem Fensterrand (Seite setzt den Wert) */
@media (max-width: 1099px) {
  .float {
    --float-top: 72px;
    left: 0; right: 0; top: auto; bottom: 0; width: auto; height: auto; min-height: 0; max-height: calc(100dvh - var(--float-top));
    border-radius: 26px 26px 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); max-width: none;
  }
  .float:not(.is-band) { height: calc(100dvh - var(--float-top)); }
  .float.is-band { left: 0; right: 0; width: auto; max-width: none; height: 140px; }
  .float-head { cursor: default; flex-wrap: wrap; }
  .float-edge, .float-handle { display: none; }
  .float.has-handle .float-head { padding-left: 16px; }
  .float-fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 1099px) and (prefers-reduced-motion: no-preference) { .float:not([hidden]) { animation: sheet-up .28s cubic-bezier(.2,.8,.2,1) both; } }

/* --- .flow: Ablaufbild, nur Aussehen (Layout, Linien und Ziehen macht die Seite, web/ablaufbild.js) --- */
.flow-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; position: relative; }
.flow {
  position: relative; display: flex; align-items: flex-start; gap: 0; min-width: 0; min-height: 200px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; font-family: var(--font);
}
.flow-layer { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; flex: none; }
.flow-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.flow-edge { fill: none; stroke: var(--ink-3); stroke-width: 2; }
.flow-edge.is-warn { stroke: var(--warn); stroke-dasharray: 6 5; }
.flow-link {
  flex: none; width: 72px; min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-2); font-size: 12px; line-height: 1.25; text-align: center;
}
.flow-link > i { display: block; width: 100%; height: 2px; background: var(--ink-3); }
.flow-link.is-warn { color: var(--ink-2); } /* Text bleibt neutral (Kontrast), die gestrichelte Linie traegt die Warnfarbe */
.flow-link.is-warn > i { background: repeating-linear-gradient(90deg, var(--warn) 0 6px, transparent 6px 12px); }
.flow-hint { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }

.flow-node {
  position: relative; z-index: 1; flex: none; width: 176px; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 16px; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-el); cursor: pointer;
}
.flow-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flow-node[aria-current="true"], .flow-node[aria-current="step"] { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.flow-kind { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); }
.flow-kind .ms { font-size: 16px; }
.flow-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.flow-state { display: flex; align-items: flex-start; gap: 4px; font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.flow-state .ms { flex: none; font-size: 18px; }
/* Hilfsknoten (Datenquelle, Ergebnis): kein Zustand, nicht waehlbar */
.flow-aux { background: var(--surface-2); cursor: default; }
/* Zustaende: Farbe nie allein, Symbol und Wort stehen im Markup (.flow-state) */
.flow-node.is-ok { border-color: var(--ok); }
.flow-node.is-ok .flow-state { color: var(--ok); }
.flow-node.is-warn-ok { border-color: var(--warn); }
.flow-node.is-warn-ok .flow-state { color: var(--ink-2); }
.flow-node.is-warn-ok .flow-state .ms { color: var(--warn); }
.flow-node.is-new .flow-state { color: var(--ink-2); }
.flow-node.is-unsure { border-color: var(--warn); }
.flow-node.is-unsure .flow-state .ms { color: var(--warn); }
.flow-node.is-redo { border-color: var(--info); }
.flow-node.is-redo .flow-state .ms { color: var(--info); }
.flow-node.is-missing, .flow-node.is-failed { border-color: var(--danger); }
/* 0.10.2: Text in --ink (Danger-Rot als Text hat im Dunkelmodus nur 4,4:1), das Symbol traegt die Farbe */
.flow-node.is-missing .flow-state, .flow-node.is-failed .flow-state { color: var(--ink); }
.flow-node.is-missing .flow-state .ms, .flow-node.is-failed .flow-state .ms { color: var(--danger); }
.flow-node.is-building { border-style: dashed; border-color: var(--warn); }
.flow-node.is-building .flow-state .ms { color: var(--warn); }
.flow-node.is-build-failed { border-style: dashed; border-color: var(--danger); }
.flow-node.is-build-failed .flow-state { color: var(--ink); }
.flow-node.is-build-failed .flow-state .ms { color: var(--danger); }
.flow-node.is-running, .flow-node.is-starting { border-color: var(--info); }
.flow-node.is-running .flow-state .ms, .flow-node.is-starting .flow-state .ms { color: var(--info); }
@media (prefers-reduced-motion: no-preference) {
  .flow-node.is-running .flow-state .ms, .flow-node.is-starting .flow-state .ms { animation: flow-spin 1.2s linear infinite; }
}
@keyframes flow-spin { to { transform: rotate(360deg); } }
/* Kreise: Zeile am unteren Rand des Knotens, Kreis auf der Kante, Text immer sichtbar */
.flow-ports { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.flow-port {
  position: relative; display: inline-flex; align-items: flex-start; gap: 4px; max-width: 100%; padding: 0;
  background: none; border: 0; font: inherit; font-size: 12px; line-height: 1.3; color: var(--ink-2); text-align: left;
}
.flow-port::before {
  content: ""; flex: none; width: 12px; height: 12px; margin-top: 2px; border-radius: var(--r-pill);
  background: var(--surface); border: 2px solid var(--ink-3);
}
.flow-port-in { align-self: flex-start; margin-left: -23px; }
.flow-port-out { align-self: flex-end; flex-direction: row-reverse; margin-right: -23px; text-align: right; }
.flow-port.is-open::before { border-color: var(--warn); background: var(--warn-soft); }
.flow-port.is-droptarget { color: var(--ok); font-weight: 600; }
.flow-port.is-droptarget::before { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 0 0 4px var(--ok-soft); }
.flow-port.is-nodrop { color: var(--ink-3); }
.flow-port.is-nodrop::before { border-color: var(--line); background: var(--surface-2); }
.flow-port:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Katalogleiste und ihre Karten */
.flow-catalog {
  display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); font-family: var(--font);
}
.flow-item {
  display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; text-align: left; font: inherit; font-size: 13px; line-height: 1.35;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-el);
  cursor: grab; touch-action: none; user-select: none;
}
.flow-item strong { font-size: 14px; color: var(--ink); }
.flow-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flow-item.is-dragging { opacity: .5; border-style: dashed; }
@media (min-width: 1100px) { .flow-wrap.has-catalog { grid-template-columns: 200px minmax(0, 1fr); } }
/* Telefon: senkrechte Kette, nie waagerecht */
.flow.is-column { flex-direction: column; align-items: stretch; overflow-x: visible; min-height: 0; padding: 4px 0 20px; background: none; border: 0; }
.flow.is-column .flow-layer { flex-direction: column; }
.flow.is-column .flow-node { width: auto; }
.flow.is-column .flow-link { width: auto; min-height: 0; padding: 8px 0; }
.flow.is-column .flow-link > i { width: 2px; height: 16px; }
.flow.is-column .flow-link.is-warn > i { background: repeating-linear-gradient(180deg, var(--warn) 0 6px, transparent 6px 12px); }
.flow.is-column .flow-port-in { margin-left: 0; }
.flow.is-column .flow-port-out { margin-right: 0; }
.flow.is-column.has-fab { padding-right: 72px; }

/* --- .ctxmenu (0.10.1, machbar#B4): Kontextmenue am Ablaufbild. Lage per CSSOM (position: fixed, left/top), Verhalten in der Seite:
   <div class="ctxmenu" role="menu" aria-label="..."><button class="ctxmenu-item" role="menuitem">Text</button>
   <button class="ctxmenu-item" role="menuitem" aria-disabled="true">Text<span class="ctxmenu-note">Grund</span></button></div>
   Ein nicht moegliches Element bleibt fokussierbar und nennt den Grund als Text (nie nur Farbe). --- */
.ctxmenu {
  position: fixed; z-index: 90; display: flex; flex-direction: column; gap: 2px; min-width: 220px; max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow-y: auto; margin: 0; padding: 4px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-el); box-shadow: var(--shadow-lg); font-family: var(--font);
}
.ctxmenu[hidden] { display: none; }
.ctxmenu-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 12px; text-align: left;
  font: inherit; font-size: 14px; line-height: 1.35; color: var(--ink); background: none; border: 0; border-radius: var(--r-el); cursor: pointer;
}
.ctxmenu-item:hover, .ctxmenu-item:focus-visible { background: var(--surface-2); }
.ctxmenu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctxmenu-item[aria-disabled="true"] { color: var(--ink-2); cursor: default; }
.ctxmenu-note { font-size: 12px; color: var(--ink-2); }
.ctxmenu-sep { height: 1px; margin: 4px 0; background: var(--line); border: 0; }

/* --- .veil: Schleier ueber einem Bereich (Text und aria-busy am Bereich) ---
   <div aria-busy="true" style position: relative> ... <div class="veil" role="status"><span class="ms">progress_activity</span><p class="veil-text">...</p></div> */
.veil {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 85%, transparent); border-radius: inherit; font-family: var(--font);
}
.veil[hidden] { display: none; }
.veil .ms { font-size: 32px; color: var(--accent); }
.veil-text { max-width: 32rem; margin: 0; font-size: 15px; line-height: 1.45; }
@media (prefers-reduced-motion: no-preference) { .veil .ms { animation: flow-spin 1.2s linear infinite; } }
[aria-busy="true"]:has(> .veil) { position: relative; }

/* --- Leitsystem (0.11, Anlass machbar#L1): sagt, wo auf dem Bildschirm es jetzt weitergeht ---
   Textmarker:  <mark class="mark">Klicke auf „Daten stimmen“</mark>   (wichtiger Text, auch fett: nie nur Farbe)
   Markierte Zeile:  <div class="mark-row">Der Probelauf hat bestanden</div>   (eine Zeile in Listen und Reitern)
   Leitrahmen:  <section class="lead"><span class="lead-tag"><span class="ms" aria-hidden="true">flag</span>Hier geht es weiter</span> ...</section>
     Genau ein Ort der Seite traegt den Rahmen. Das Etikett steht immer im Text daneben (nie nur Farbe, Screenreader lesen es).
     .is-pulse setzt die Seite beim Wechsel des Ortes und nimmt sie nach animationend wieder weg: zwei kurze Pulse, danach ruhig.
   Handlungsflaeche:  <div class="coach is-action"> <div class="coach-head">...</div> <div class="coach-body"><div class="coach-do">Klicke auf <mark class="mark">Daten stimmen</mark></div> ... </div> ... </div> */
.mark {
  background: linear-gradient(transparent 10%, var(--mark) 10%, var(--mark) 94%, transparent 94%);
  color: var(--mark-ink); font-weight: 600; padding: 0 .2em; border-radius: 4px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.mark-row {
  background: var(--mark); color: var(--mark-ink); border-radius: var(--r-el); padding: 8px 12px 8px 16px;
  box-shadow: inset 4px 0 0 var(--accent-ink);
}
.ds .mark-row :is(.small, .muted, .body, a, span, div, p, strong, h3) { color: var(--mark-ink); }
.ds.dark .mark-row { box-shadow: inset 4px 0 0 var(--accent); }
.lead { outline: 3px solid var(--accent); outline-offset: 3px; }   /* der Rahmen folgt der Rundung des Elements (Knopf, Fenster, Karte) */
.lead-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px;
  background: var(--accent); color: var(--on-accent); font-family: var(--font); font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: .01em;
}
.lead-tag .ms { font-size: 15px; }
.ds .lead-tag .ms, .ds.dark .lead-tag .ms { color: inherit; }   /* auch im .coach-head, wo Symbole sonst --accent-ink tragen */
.lead-tag[hidden] { display: none; }
@keyframes lead-pulse {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  to { box-shadow: 0 0 0 16px transparent; }
}
@media (prefers-reduced-motion: no-preference) { .lead.is-pulse { animation: lead-pulse .9s ease-out 2; } }
@media (forced-colors: active) {
  .mark, .mark-row { background: Mark; color: MarkText; }
  .lead { outline-color: Highlight; }
  .lead-tag { background: Highlight; color: HighlightText; }
}
/* Handlungsflaeche: "Das ist jetzt dran" mit getoenter Flaeche, kraeftigem Rand und dem Hauptsatz gross */
.coach.is-action { background: var(--accent-soft); border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.ds.dark .coach.is-action { border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.coach.is-action .coach-label { font-size: 13px; font-weight: 600; }
.coach.is-action .coach-body { font-size: 14.5px; color: var(--ink); }
.coach-do { font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.work-main-head .coach.is-action .coach-head { flex: 1 1 100%; flex-wrap: wrap; }
/* Rueckmeldung mitten in der Seite (statt im Telefon-Mockup): unten am Fensterrand, Link im Text */
.toast.is-page { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 34rem; z-index: 80; font-weight: 500; line-height: 1.4; align-items: flex-start; }
.toast.is-page > .ms { flex: none; }
.ds .toast.is-page a:not([class]), .ds.dark .toast.is-page a:not([class]) { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.toast.is-page .iconbtn { flex: none; margin: -4px -8px -4px auto; background: transparent; color: inherit; border-color: transparent; }
.toast.is-page .iconbtn:hover { color: inherit; border-color: currentColor; }
@media (min-width: 1100px) { .toast.is-page { left: 244px; right: auto; bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .toast.is-page { animation: none; } }

/* ---------- 0.13.0: Marke (.brandmark) ----------
   Logo-Slot je Projekt mit Rueckfall auf ein typografisches Monogramm. Das Logo liefert der Inhaber
   (brand/logo.svg, optional brand/logo-dark.svg); zk-design zeichnet keine Logos. Ohne Logo: Initialen
   in Inter 600, --on-accent auf --accent, Ecken --r-el. Favicon aus demselben Monogramm: tools/monogramm.py.
   <a class="brandmark" href="/"><span class="brandmark-mono" aria-hidden="true">ZL</span><span class="brandmark-name">Zimmerei Lindner</span></a> */
.brandmark { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; vertical-align: middle;
  font-family: var(--font); font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--ink); text-decoration: none; }
a.brandmark:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-el); }
.brandmark-logo { display: block; height: 28px; width: auto; max-width: 200px; }
.brandmark-logo.is-dark { display: none; }
.ds.dark .brandmark-logo.is-light { display: none; }
.ds.dark .brandmark-logo.is-dark { display: block; }
@media (prefers-color-scheme: dark) {
  .ds:not(.light):not(.dark):not(.editorial) .brandmark-logo.is-light { display: none; }
  .ds:not(.light):not(.dark):not(.editorial) .brandmark-logo.is-dark { display: block; }
}
.brandmark-mono { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: var(--r-el); background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 600; line-height: 1; }
.brandmark-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brandmark.is-lg { gap: 12px; font-size: 18px; }
.brandmark.is-lg .brandmark-logo { height: 40px; }
.brandmark.is-lg .brandmark-mono { width: 48px; height: 48px; font-size: 22px; }
.topnav-brand .brandmark, .sidenav-brand .brandmark { color: inherit; }

/* ---------- 0.14.0: Datentabelle (.dtable) ----------
   Liste mit Zahlenspalten. Ab 768 px Breite des Elternelements (@container) eine Tabelle mit ausgerichteten Spalten, darunter wird jede Zeile ein
   Block: die Kopfzeile bleibt nur fuer Screenreader, Zellen mit data-label tragen ihre Beschriftung vor dem Wert.
   <div class="dtable-wrap"><table class="dtable"><thead><tr><th>Projekt</th><th class="ta-r">Gesamt</th></tr></thead>
   <tbody><tr><td><a href="#">machbar</a></td><td class="ta-r" data-label="Gesamt">87 h</td></tr></tbody></table></div> */
.dtable-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-el); overflow-x: auto; container-type: inline-size; }   /* Umbruch nach der Breite des Elternelements, nicht des Fensters */
.dtable { width: 100%; border-collapse: collapse; overflow-wrap: normal; }   /* ohne: .ds { anywhere } quetscht die Spalten, Woerter brechen mitten im Wort */
.dtable th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 12px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.dtable td { padding: 12px 16px; vertical-align: middle; }
.dtable td:first-child { overflow-wrap: anywhere; }   /* nur der Titel darf mitten im Wort brechen (langer Name ohne Leerzeichen), Zahlen nie */
.dtable tbody tr + tr > td { border-top: 1px solid var(--line); }
.dtable .ta-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable td.is-muted { color: var(--ink-3); white-space: nowrap; }
/* Gruppenzeile: <tbody><tr class="dtable-group"><th colspan="6" scope="rowgroup">Kunden <span class="small muted">2 Projekte</span></th></tr>...</tbody>
   Mehrere tbody in einer Tabelle halten die Spalten ueber alle Gruppen ausgerichtet. */
.dtable-group > th { background: var(--surface-2); color: var(--ink); font-size: 14px; font-weight: 600; white-space: normal; padding: 12px 16px; }
.dtable tbody + tbody > .dtable-group > th { border-top: 1px solid var(--line); }
.dtable-group .muted { color: var(--ink-2); }   /* Zahl in der Gruppenzeile: --ink-3 auf --surface-2 reicht nicht (4,3:1) */
@container (max-width: 767px) {
  .dtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .dtable, .dtable tbody, .dtable tr, .dtable td { display: block; }
  .dtable tr { padding: 12px 16px; }
  .dtable tbody tr + tr { border-top: 1px solid var(--line); }
  .dtable tbody tr + tr > td { border-top: 0; }
  .dtable td { padding: 4px 0; }
  .dtable td[data-label] { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .dtable td[data-label]::before { content: attr(data-label); flex: none; font-size: 12px; color: var(--ink-3); }
  .dtable tr.dtable-group { padding: 0; }
  .dtable-group > th { display: block; }
  .dtable .dtable-group > th, .dtable tbody + tbody > .dtable-group > th { border: 0; }   /* Linien unter 768 px nur am tr, sonst doppelt (Zeilen sind block, kein border-collapse) */
  .dtable tbody + tbody > tr.dtable-group { border-top: 1px solid var(--line); }
  .dtable td:empty { display: none; }   /* leere Zelle (z. B. keine Hinweise) zeigt keine einsame Beschriftung */
}
