/* ============================================================
   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); }
.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; }
}
