/*
 * Zeitbuchung — Gestaltungssystem v2 (docs/gestaltung.md).
 *
 * Ruhig, sachlich, dicht: Struktur aus Haarlinien, Weißraum und Typografie.
 * Radius 4 px (Dialog/Panel/Sheet 8 px), Steuerelemente 32 px, fünf Schriftstufen,
 * ein Container (1320 px, Rand 24 px).
 *
 * Aufbau: 1 Tokens · 2 Basis · 3 Rahmen · 4 Knöpfe · 5 Felder · 6 Segment, Werkzeugleiste ·
 *         7 Tabellen · 8 Abschnitte, Kennzahlen · 9 Etiketten, Hinweise · 10 Dialog, Panel ·
 *         11 Kalender · 12 Erfassung · 13 Abrechnung · 14 Mobil
 * Pflege: Präfix `zb-`, Zustände `is-…`; keine Inline-Stile (CSP); Zustand nie nur Farbe.
 */

/* 1. Tokens ------------------------------------------------------------- */

:root {
  --ac: #43586a;
  --ac-d: #334759;
  --ac-dd: #21303c;
  --ac-tint: #edf5fb;
  --ac-line: #b7c6d4;
  --wn: #d7b174;
  --wn-t: #83592e;
  --wn-bg: #fef6e7;
  --er: #c25e53;
  --er-t: #994138;
  --er-bg: #fff2f1;
  --lk: #636a71;
  --lk-bg: #eef1f5;
  --fi: #416753;
  --fi-bg: #eaf7ef;
  --tx: #1b1b1b;
  --tx-2: #4d4d4d;
  --tx-3: #777777;
  --line: #e3e6e9;
  --line-strong: #c3c9cf;
  --fl: #f7f8f9;
  --bg: #ffffff;

  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;

  --r: 4px;
  --r-lg: 8px;

  --h-header: 48px;
  --h-ctl: 32px;
  --h-row: 36px;
  --h-tabbar: 62px;
  --touch: 44px;
  --container: 1320px;
  --gutter: 24px;

  --sh-panel: -10px 0 28px rgb(27 27 27 / 0.14);
  --sh-dialog: 0 12px 36px rgb(27 27 27 / 0.22);
  --sh-menu: 0 8px 24px rgb(27 27 27 / 0.16);

  --z-header: 20;
  --z-menu: 30;
  --z-backdrop: 100;
  --z-toast: 200;
}

/* 2. Basis und Typografie ----------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden],
[x-cloak] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font: 400 14px/20px var(--font-sans);
  font-variant-numeric: tabular-nums;
}
h1 {
  margin: 0;
  font: 500 28px/34px var(--font-serif);
  letter-spacing: -0.01em;
}
h2 {
  margin: 0;
  font: 600 17px/24px var(--font-sans);
}
h3 {
  margin: 0;
  font: 600 14px/20px var(--font-sans);
}
p {
  margin: 0;
}
p + p {
  margin-top: 8px;
}
a {
  color: var(--ac);
}
a:hover {
  color: var(--ac-dd);
}
:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.zb-muted {
  color: var(--tx-2);
}
.zb-small {
  font-size: 12px;
  line-height: 16px;
}
.zb-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.zb-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.zb-stack > * + * {
  margin-top: 16px;
}
.zb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.zb-grow {
  flex: 1;
}
.zb-inline {
  display: inline;
}
.zb-grid-2,
.zb-grid-3,
.zb-grid-4 {
  display: grid;
  gap: 16px 24px;
}
.zb-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.zb-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.zb-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.htmx-indicator {
  opacity: 0;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}
.zb-icon {
  display: inline-block;
  line-height: 1;
  font-style: normal;
}

/* 3. Anwendungsrahmen ---------------------------------------------------- */

.zb-skip {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: var(--z-toast);
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--ac-dd);
  color: #fff;
}
.zb-skip:focus {
  top: 8px;
}

/* Kopfzeile: 48 px, Haarlinie unten; Inhalt im selben Container wie die Seite */
.zb-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--h-header);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.zb-header__in {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.zb-brand {
  font: 500 18px/24px var(--font-serif);
  color: var(--tx);
  text-decoration: none;
  white-space: nowrap;
}
.zb-brand:hover {
  color: var(--tx);
}

/* Mandant: Textmenü ohne Rahmen */
.zb-tenant {
  position: relative;
}
.zb-tenant__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--tx);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.zb-tenant__btn:hover {
  color: var(--ac);
}
span.zb-tenant__btn {
  cursor: default;
}
span.zb-tenant__btn:hover {
  color: var(--tx);
}

/* Aufklappmenü (einzige Fläche mit Schatten neben Dialog und Panel) */
.zb-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: var(--z-menu);
  min-width: 260px;
  padding: 8px 0;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-menu);
}
.zb-menu--right {
  left: auto;
  right: 0;
}
.zb-menu--more {
  display: none;
}
.zb-menu__title {
  padding: 4px 16px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--tx-2);
}
.zb-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: var(--h-ctl);
  padding: 4px 16px;
  background: none;
  border: 0;
  color: var(--tx);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.zb-menu__item:hover {
  background: var(--fl);
}
.zb-menu__item.is-active {
  font-weight: 600;
}
.zb-menu__item small {
  color: var(--tx-2);
  font-size: 12px;
}
.zb-menu__item.is-pending {
  color: var(--tx-3);
  cursor: default;
}
.zb-menu__sep {
  height: 1px;
  margin: 8px 0;
  background: var(--line);
  border: 0;
}
.zb-menu__hint {
  padding: 4px 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--tx-2);
}
.zb-profile {
  position: relative;
}

/* Navigation: Textlinks, aktiv mit 2 px Unterstrich an der Unterkante der Kopfzeile */
.zb-nav {
  display: flex;
  align-self: stretch;
  gap: 20px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.zb-nav::-webkit-scrollbar {
  display: none;
}
.zb-nav__item {
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--tx-2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
a.zb-nav__item:hover {
  color: var(--tx);
}
.zb-nav__item.is-active {
  color: var(--tx);
  border-bottom-color: var(--ac);
}
.zb-nav__item.is-pending {
  color: var(--tx-3);
  cursor: default;
}

.zb-header__user {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tx);
  text-decoration: none;
  white-space: nowrap;
}
.zb-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ac);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.zb-header__title {
  display: none;
}

/* Inhalt */
.zb-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}
.zb-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 16px;
}
.zb-page-head__lead {
  color: var(--tx-2);
}
.zb-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.zb-messages {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.zb-tabbar {
  display: none;
}

/* 4. Knöpfe: Primär, Sekundär, Text --------------------------------------- */

.zb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h-ctl);
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--tx);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.zb-btn:hover {
  background: var(--fl);
  color: var(--tx);
}
.zb-btn[disabled],
.zb-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.zb-btn--primary {
  background: var(--ac);
  border-color: var(--ac);
  color: #fff;
}
.zb-btn--primary:hover {
  background: var(--ac-d);
  border-color: var(--ac-d);
  color: #fff;
}
.zb-btn--secondary {
  background: var(--bg);
}
.zb-btn--text {
  min-height: var(--h-ctl);
  padding: 0 8px;
  border-color: transparent;
  background: none;
  color: var(--ac);
}
.zb-btn--text:hover {
  background: none;
  color: var(--ac-dd);
  text-decoration: underline;
}
.zb-btn__key {
  color: var(--tx-3);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}
.zb-btn--primary .zb-btn__key {
  color: rgba(255, 255, 255, 0.65);
}
.zb-btn--block {
  display: flex;
  width: 100%;
}
.zb-btn--lg {
  min-height: var(--touch);
}

/* 5. Felder --------------------------------------------------------------- */

.zb-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.zb-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--tx-2);
}
.zb-label .zb-muted {
  font-weight: 400;
}
.zb-label--required::after {
  content: " *";
  color: var(--tx);
}
.zb-input,
.zb-select,
.zb-textarea {
  width: 100%;
  min-height: var(--h-ctl);
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--tx);
}
.zb-textarea {
  min-height: 72px;
  resize: vertical;
}
.zb-input::placeholder,
.zb-textarea::placeholder {
  color: var(--tx-3);
}
.zb-input:focus,
.zb-select:focus,
.zb-textarea:focus {
  outline: 2px solid var(--ac);
  outline-offset: 1px;
  border-color: var(--ac);
}
.zb-input[readonly],
.zb-input--readonly {
  background: var(--fl);
  color: var(--tx-2);
}
.zb-field.is-error .zb-input,
.zb-field.is-error .zb-select,
.zb-field.is-error .zb-textarea,
.zb-field:has(.zb-field__error) .zb-input,
.zb-field:has(.zb-field__error) .zb-select,
.zb-field:has(.zb-field__error) .zb-textarea,
.zb-input.is-error,
.zb-select.is-error {
  border-color: var(--er);
}
.zb-field__error {
  font-size: 12px;
  line-height: 16px;
  color: var(--er-t);
}
.zb-field__warning {
  font-size: 12px;
  line-height: 16px;
  color: var(--wn-t);
}
.zb-field.is-warning .zb-input,
.zb-field.is-warning .zb-select,
.zb-field.is-warning .zb-textarea {
  border-color: var(--wn);
}
.zb-hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--tx-2);
}
.zb-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--h-ctl);
}
.zb-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ac);
}
.zb-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.zb-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.zb-form-grid .is-wide {
  grid-column: 1 / -1;
}
.zb-stepper {
  display: flex;
}
.zb-stepper > * {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--h-ctl);
  border: 1px solid var(--line-strong);
  background: var(--bg);
}
.zb-stepper__step {
  width: 48px;
  cursor: pointer;
}
.zb-stepper__step:first-child {
  border-radius: var(--r) 0 0 var(--r);
}
.zb-stepper__step:last-child {
  border-radius: 0 var(--r) var(--r) 0;
}
.zb-stepper__step:disabled {
  color: var(--tx-3);
  cursor: not-allowed;
}
.zb-stepper__value {
  flex: 1;
  min-width: 72px;
  margin: 0 -1px;
  padding: 0;
  text-align: center;
  font-weight: 600;
  color: var(--tx);
}

/* 6. Segment, Werkzeugleiste, Unterreiter ------------------------------------ */

/* Verbundene Knöpfe: Zeitraum-Navigation, Status, Schnellwahl */
.zb-seg {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  overflow: hidden;
}
.zb-seg__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: calc(var(--h-ctl) - 2px);
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line-strong);
  background: none;
  color: var(--tx);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.zb-seg__item:first-child {
  border-left: 0;
}
.zb-seg__item:hover {
  background: var(--fl);
  color: var(--tx);
}
.zb-seg__item.is-on,
.zb-seg__item[aria-current="true"],
.zb-seg__item[aria-pressed="true"] {
  background: var(--ac-tint);
  font-weight: 600;
}
.zb-seg__item:focus-visible {
  outline-offset: -2px;
}

/* Werkzeugleiste unter der H1: eine Zeile, Aktionen rechts */
.zb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
form.zb-toolbar {
  margin-top: 0;
}

/* Filterfeld mit Beschriftung im Feld: „Kunde: alle ▾" */
.zb-ctl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--h-ctl);
  padding: 0 4px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
}
.zb-ctl:focus-within {
  outline: 2px solid var(--ac);
  outline-offset: 1px;
  border-color: var(--ac);
}
.zb-ctl__label {
  color: var(--tx-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.zb-ctl__input {
  min-width: 0;
  min-height: calc(var(--h-ctl) - 2px);
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--tx);
}
.zb-ctl__input:focus {
  outline: 0;
}
.zb-ctl .zb-select,
.zb-ctl .zb-input {
  width: auto;
  min-width: 0;
  min-height: calc(var(--h-ctl) - 2px);
  padding: 0 4px;
  border: 0;
  background: none;
}
.zb-ctl .zb-select:focus,
.zb-ctl .zb-input:focus {
  outline: 0;
}

/* Unterreiter: Textlinks mit Unterstrich wie die Hauptnavigation */
.zb-subnav {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.zb-subnav__item {
  margin-bottom: -1px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  color: var(--tx-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-decoration: none;
}
.zb-subnav__item:hover {
  color: var(--tx);
}
.zb-subnav__item.is-active {
  color: var(--tx);
  border-bottom-color: var(--ac);
}

/* 7. Tabellen --------------------------------------------------------------- */

.zb-table-wrap {
  overflow-x: auto;
}
.zb-table {
  width: 100%;
  border-collapse: collapse;
}
.zb-table th {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--tx-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.zb-table td {
  height: var(--h-row);
  padding: 4px 12px 4px 0;
  border-bottom: 1px solid var(--line);
}
.zb-table th:last-child,
.zb-table td:last-child {
  padding-right: 0;
}
.zb-table th.zb-num,
.zb-table td.zb-num {
  text-align: right;
}
.zb-table tbody tr:hover td {
  background: var(--fl);
}
.zb-table tr.is-selected td {
  background: var(--ac-tint);
}
.zb-table tr.is-locked td {
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--lk-bg) 6px 12px);
}
.zb-table tr.zb-table__day td {
  background: none;
  border-bottom-color: var(--line-strong);
  font-weight: 600;
}
.zb-table tr.zb-table__error td {
  height: auto;
  padding: 0 0 8px;
  border-bottom-color: var(--line);
  color: var(--er-t);
  font-size: 12px;
  line-height: 16px;
}
.zb-table tfoot td {
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 600;
}
.zb-table th[scope="row"] {
  height: var(--h-row);
  color: var(--tx);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  white-space: normal;
  border-bottom: 1px solid var(--line);
}
.zb-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.zb-sort:hover {
  color: var(--tx);
}
th[aria-sort="ascending"],
th[aria-sort="descending"] {
  color: var(--tx);
}
.zb-row-actions {
  text-align: right;
  white-space: nowrap;
}
/* Ganze Zeile verlinkt: der Link spannt über die Zeile, „Öffnen" entfällt */
.zb-table tr:has(.zb-rowlink) {
  position: relative;
}
.zb-rowlink {
  text-decoration: none;
}
.zb-table tr:hover .zb-rowlink {
  text-decoration: underline;
}
.zb-rowlink::after {
  content: "";
  position: absolute;
  inset: 0;
}
.zb-empty {
  padding: 16px 0;
  color: var(--tx-2);
}
.zb-empty__title {
  display: block;
  color: var(--tx);
  font-weight: 600;
}
.zb-empty p {
  max-width: 64ch;
}

/* 8. Abschnitte, Kennzahlen, Listen ------------------------------------------- */

.zb-section {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.zb-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.zb-section__lead {
  color: var(--tx-2);
}
.zb-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
}
.zb-dl dt {
  color: var(--tx-2);
}
.zb-dl dd {
  margin: 0;
}
.zb-keys {
  grid-template-columns: 96px 1fr;
}
.zb-keys dt {
  color: var(--tx);
  font-weight: 600;
}
.zb-dl .is-diff {
  font-weight: 600;
  text-decoration: underline;
}

/* 9. Etiketten und Hinweise ---------------------------------------------------- */

.zb-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--r);
  background: var(--fl);
  color: var(--tx-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.zb-tag--closed,
.zb-tag--current {
  background: var(--ac-tint);
  color: var(--ac-dd);
}
.zb-tag--locked {
  background: var(--lk-bg);
  color: var(--lk);
}
.zb-tag--final {
  background: var(--fi-bg);
  color: var(--fi);
}
.zb-tag--draft {
  background: var(--fl);
  color: var(--tx-2);
}
.zb-tag--superseded {
  background: var(--lk-bg);
  color: var(--lk);
  text-decoration: line-through;
}
.zb-tag--correction {
  background: var(--wn-bg);
  color: var(--wn-t);
}
.zb-tag--error {
  background: var(--er-bg);
  color: var(--er-t);
}

.zb-notice {
  padding: 8px 12px;
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--fl);
}
.zb-notice--warning {
  border-left-color: var(--wn);
  background: var(--wn-bg);
  color: var(--wn-t);
}
.zb-notice--error {
  border-left-color: var(--er);
  background: var(--er-bg);
  color: var(--er-t);
}
.zb-notice--info {
  border-left-color: var(--line-strong);
  background: var(--fl);
}
.zb-notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* 10. Dialog, Seitenpanel, Bottom-Sheet, Toast ----------------------------------- */

.zb-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(27 27 27 / 0.42);
}
.zb-backdrop--end {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}
.zb-backdrop--bottom {
  align-items: flex-end;
  padding: 0;
}
.zb-dialog {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--sh-dialog);
}
.zb-dialog--wide {
  max-width: 820px;
}
.zb-dialog--static {
  border: 1px solid var(--line);
}
.zb-dialog__title {
  margin-bottom: 8px;
}
.zb-dialog__body {
  margin-bottom: 16px;
}
.zb-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.zb-dialog__discard {
  margin-right: auto;
}
/* Seite, die einen Dialog trägt (Finalisieren, Korrektur, Sperren): ohne Kasten */
.zb-dialog-seite {
  max-width: 640px;
}

.zb-panel {
  display: flex;
  flex-direction: column;
  width: 460px;
  max-width: 100%;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--sh-panel);
}
.zb-panel--static {
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.zb-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
}
.zb-panel__body {
  flex: 1;
  padding: 16px 24px;
  overflow: auto;
}
.zb-panel__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
}
.zb-panel__form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.zb-sheet {
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--bg);
  box-shadow: var(--sh-dialog);
}
.zb-sheet--static {
  max-width: 390px;
  border: 1px solid var(--line);
}
.zb-sheet__title {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.zb-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}
.zb-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-lg);
  background: var(--ac-dd);
  color: #fff;
  box-shadow: var(--sh-dialog);
  pointer-events: auto;
}
.zb-toast--error {
  background: var(--er-t);
}
.zb-toast__undo {
  min-height: var(--h-ctl);
  padding: 0 8px;
  border: 1px solid rgb(255 255 255 / 0.5);
  border-radius: var(--r);
  background: none;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}
.zb-toast__close {
  min-height: var(--h-ctl);
  padding: 0 4px;
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
}

/* Konflikt: beide Versionen nebeneinander, getrennt durch Haarlinie */
.zb-conflict {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.zb-conflict__version {
  padding-top: 8px;
  border-top: 1px solid var(--line-strong);
}
.zb-conflict__version--mine {
  border-top-color: var(--ac);
}
.zb-conflict__title {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--tx-2);
}
.zb-conflict-cell.is-diff {
  font-weight: 600;
}

/* 11. Kalender ------------------------------------------------------------------- */

/* Eintrag: weiß, 3 px Akzentkante links, 1 px Haarlinie */
.zb-entry {
  display: block;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ac);
  border-radius: var(--r);
  background: var(--bg);
  font-size: 12px;
  line-height: 16px;
}
.zb-entry--locked {
  border-left-color: var(--lk);
  background: repeating-linear-gradient(135deg, var(--bg) 0 5px, var(--lk-bg) 5px 7px);
  color: var(--lk);
}
.zb-entry--final {
  border-left-color: var(--fi);
}
.zb-entry--closed {
  border-left-color: var(--ac-dd);
}
.zb-entry--new {
  border-color: var(--ac);
}

.zb-kal .fc {
  --fc-border-color: var(--line);
  --fc-page-bg-color: var(--bg);
  --fc-neutral-bg-color: var(--bg);
  --fc-today-bg-color: transparent;
  --fc-event-bg-color: var(--bg);
  --fc-event-border-color: var(--line);
  --fc-event-text-color: var(--tx);
  --fc-now-indicator-color: var(--er);
  --fc-small-font-size: 12px;
  font-size: 12px;
  line-height: 16px;
}
.zb-kal__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 16px;
}
.zb-kal__titel {
  font-weight: 600;
}
.zb-kal__summe {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.zb-kal .zb-notice {
  margin-bottom: 8px;
}
.zb-kal__raster {
  position: relative;
}
.zb-kal__leer {
  margin-bottom: 8px;
  color: var(--tx-2);
}
.zb-kal-tag {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
}
.zb-kal-tag__summe {
  color: var(--tx-2);
}
.zb-kal .fc .fc-col-header-cell {
  background: none;
  border-bottom: 1px solid var(--line-strong);
}
.zb-kal .fc .fc-col-header-cell-cushion {
  color: var(--tx);
  text-decoration: none;
}
.zb-kal .fc .fc-col-header-cell.fc-day-sat .fc-col-header-cell-cushion,
.zb-kal .fc .fc-col-header-cell.fc-day-sun .fc-col-header-cell-cushion {
  color: var(--tx-3);
}
.zb-kal .fc .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
  color: var(--ac);
  font-weight: 600;
}
.zb-kal .fc .fc-timegrid-slot {
  border-bottom-color: var(--line);
}
.zb-kal .fc .fc-timegrid-slot-minor {
  border-top-style: solid;
  border-top-color: transparent;
}
.zb-kal .fc .fc-timegrid-slot-lane {
  border-bottom-color: var(--line);
}
.zb-kal .fc .fc-timegrid-slot-label-cushion {
  color: var(--tx-2);
}
.zb-kal .fc-event.zb-entry {
  padding: 0;
  overflow: hidden;
  color: var(--tx);
}
.zb-kal .fc-event.zb-entry--locked {
  color: var(--lk);
}
.zb-kal-ev {
  padding: 2px 6px;
  overflow: hidden;
}
.zb-kal-ev__kopf {
  font-weight: 600;
}
.zb-kal-ev__unter {
  color: var(--tx-2);
}
.zb-wochenstreifen {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.zb-wochenstreifen__tag {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  min-height: var(--touch);
  padding: 4px 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--tx);
  font: inherit;
  cursor: pointer;
}
.zb-wochenstreifen__tag.is-on {
  background: var(--ac-tint);
  font-weight: 600;
}
.zb-wochenstreifen__tag small {
  color: var(--tx-2);
}
.zb-kal__tag {
  margin-bottom: 8px;
  font-weight: 600;
}
@media (min-width: 768px) {
  .zb-wochenstreifen,
  .zb-kal__tag {
    display: none;
  }
}

/* 12. Erfassung: Liste, Mobil, Meine Buchungen --------------------------------------- */

.zb-liste .zb-input,
.zb-liste .zb-select {
  min-height: 28px;
  padding: 0 4px;
}
.zb-liste input[type="date"] {
  min-width: 128px;
}
.zb-liste input[type="time"] {
  min-width: 84px;
}
.zb-liste input[name="dauer"] {
  width: 64px;
  text-align: right;
}
.zb-liste input[name="note"] {
  min-width: 180px;
}
.zb-liste td {
  vertical-align: middle;
}
.zb-liste .is-dirty td {
  background: var(--ac-tint);
}
.zb-liste .has-error td {
  background: var(--er-bg);
}
.zb-liste .zb-zeile__speichern {
  min-height: 28px;
}
.zb-liste tbody.zb-zeilengruppe:not([data-dirty]) .zb-zeile__speichern:not(.is-immer) {
  display: none;
}
.zb-mehr {
  display: inline-block;
  position: relative;
}
.zb-mehr > summary {
  list-style: none;
  cursor: pointer;
}
.zb-mehr > summary::-webkit-details-marker {
  display: none;
}
.zb-mehr__menu {
  position: absolute;
  right: 0;
  z-index: var(--z-menu);
  min-width: 180px;
  padding: 4px 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--sh-menu);
  text-align: left;
}
.zb-liste-mobil {
  display: none;
}
.zb-mtag {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
}
.zb-mzeile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.zb-mzeile__text {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.zb-meine__mobil,
.zb-meine__karten {
  display: none;
}
.zb-meine__leer {
  height: 96px;
  text-align: center;
}
.zb-meine__zeitraum {
  display: flex;
  flex: 1;
  align-items: center;
}

/* 13. Abrechnung, Dashboards, Audit ----------------------------------------------------- */

.zb-split {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}
.zb-split__side {
  flex: 0 0 380px;
  min-width: 0;
}
.zb-split__main {
  flex: 1 1 auto;
  min-width: 0;
}
.zb-split--doc {
  gap: 24px;
}
.zb-split--doc .zb-doc {
  flex: 1 1 auto;
  min-width: 0;
}
.zb-doc-actions {
  flex: 0 0 220px;
}
.zb-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  color: var(--tx-2);
}
.zb-step.is-current {
  color: var(--tx);
  font-weight: 600;
}
.zb-doc {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.zb-doc h3 {
  margin: 8px 0 4px;
  font: 600 17px/24px var(--font-sans);
}
.zb-kette {
  align-items: stretch;
}
.zb-kette > article {
  flex: 0 1 300px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}

/* 14. Mobil (schmale Breite) ------------------------------------------------------------- */

@media (max-width: 767.98px) {
  :root {
    --gutter: 16px;
  }
  body.zb-has-tabbar {
    padding-bottom: var(--h-tabbar);
  }
  .zb-header__in {
    gap: 12px;
  }
  .zb-brand,
  .zb-nav,
  .zb-header__newentry,
  .zb-header__user-name {
    display: none;
  }
  .zb-header--anon .zb-brand {
    display: block;
  }
  .zb-header__title {
    display: block;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .zb-avatar {
    width: var(--touch);
    height: var(--touch);
  }
  .zb-menu {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    min-width: 0;
    max-height: 85vh;
    overflow: auto;
    padding: 16px 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-width: 1px 0 0;
  }
  .zb-menu__item {
    min-height: var(--touch);
  }
  .zb-menu--more {
    display: block;
  }
  .zb-main {
    padding-top: 16px;
    padding-bottom: 24px;
  }
  .zb-btn,
  .zb-input,
  .zb-select,
  .zb-textarea,
  .zb-check,
  .zb-stepper > *,
  .zb-ctl {
    min-height: var(--touch);
  }
  .zb-seg__item {
    min-height: calc(var(--touch) - 2px);
  }
  .zb-ctl__input {
    min-height: calc(var(--touch) - 2px);
  }
  .zb-actionbar {
    position: sticky;
    bottom: 0;
    z-index: var(--z-header);
    padding: 8px 16px;
    margin: 16px -16px -24px;
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  body.zb-has-tabbar .zb-actionbar {
    bottom: var(--h-tabbar);
  }
  .zb-actionbar .zb-btn {
    display: flex;
    width: 100%;
  }
  /* Segment-Reihe: nicht umbrechen, seitlich wischen */
  .zb-seg--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .zb-seg--scroll::-webkit-scrollbar {
    display: none;
  }
  .zb-form-grid,
  .zb-grid-2,
  .zb-grid-3,
  .zb-grid-4,
  .zb-conflict {
    grid-template-columns: 1fr;
  }
  .zb-subnav {
    overflow-x: auto;
  }
  .zb-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-header);
    display: flex;
    align-items: stretch;
    height: var(--h-tabbar);
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .zb-tabbar__item {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-width: var(--touch);
    padding: 0 4px;
    background: none;
    border: 0;
    color: var(--tx-2);
    font-size: 12px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
  }
  .zb-tabbar__item.is-active {
    color: var(--tx);
    font-weight: 600;
    box-shadow: inset 0 2px 0 var(--ac);
  }
  .zb-tabbar__item.is-pending {
    color: var(--tx-3);
  }
  .zb-tabbar__plus {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
  }
  /* Das runde „+" ist mobil erlaubt (neben dem Initialen-Kreis) */
  .zb-tabbar__plus .zb-btn {
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 400;
  }
  .zb-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .zb-dialog {
    max-width: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .zb-panel {
    width: 100%;
  }
  .zb-panel__foot .zb-btn--primary {
    flex: 1;
  }
  .zb-toasts {
    bottom: calc(var(--h-tabbar) + 12px);
  }
  .zb-table th,
  .zb-table td {
    padding-right: 8px;
  }
  .zb-kal .fc .fc-col-header-cell-cushion {
    padding: 2px;
  }
  .zb-liste-desktop,
  .zb-liste__werkzeug {
    display: none;
  }
  .zb-liste-mobil {
    display: block;
  }
  .zb-meine__filter,
  .zb-meine__tabelle {
    display: none;
  }
  .zb-meine__mobil {
    display: flex;
  }
  .zb-meine__karten {
    display: block;
  }
  .zb-split,
  .zb-split--doc {
    flex-direction: column;
    gap: 16px;
  }
  .zb-split__side,
  .zb-doc-actions {
    flex: 1 1 auto;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .zb-header,
  .zb-tabbar,
  .zb-toasts,
  [data-noprint] {
    display: none !important;
  }
}
