/* zitro.works App-Inhalte: verbindlicher Hauptframe für alle nativen Apps (docs/UI-HAUPTFRAME.md).
   Farben nur über die Tokens unten – nie hart im App-CSS. Hell/Dunkel schaltet data-theme am <html>. */

:root {
  color-scheme: light;
  /* Flächen */
  --c-canvas: #f2f4f6;          /* Hintergrund des Hauptframes */
  --c-surface: #ffffff;         /* Gruppen, Karten, Tabellen, Dialoge */
  --c-raised: #f8fafb;          /* Tabellenkopf, Dialogfuß, ruhige Zonen */
  --c-subtle: #eaeef2;          /* Segmente, Leerzustand-Icons, Hover auf Flächen */
  --c-hover: #f0f5f8;           /* Zeilen-Hover */
  --c-input: #ffffff;
  --c-side: #e8edf1;            /* Baumnavigation */
  /* Text */
  --c-ink: #14212c;
  --c-ink-2: #3c4f5f;           /* Beschriftungen, Navigation */
  --c-muted: #66768a;
  /* Linien */
  --c-line: #dfe5ea;
  --c-line-soft: #ebeff3;       /* Trenner zwischen Zeilen */
  --c-line-strong: #c4ced7;     /* Eingabefelder */
  /* Akzent (zitro-Petrol) und Zustände */
  --c-accent: #1a6f8f;
  --c-accent-hover: #155d78;
  --c-accent-soft: #e2eff5;
  --c-on-accent: #ffffff;
  --c-focus: #2c7da0;
  --c-good: #1f7a55;
  --c-good-soft: #e3f2ea;
  --c-warn: #8f5d1c;
  --c-warn-soft: #f7eedd;
  --c-bad: #b23b46;
  --c-bad-hover: #9a2f39;
  --c-bad-soft: #f8e6e8;
  --c-notice-ink: #164e63;
  --c-warn-ink: #6b4614;
  --c-bad-ink: #6d2a31;
  --c-good-ink: #165a3f;
  /* Fenster */
  --c-window: #f2f4f6;
  --c-header: #fbfcfd;
  --c-header-idle: #eef1f4;
  --c-header-line: #dfe5eb;
  --c-header-ink: #14212c;
  --c-header-muted: #7a8996;
  --c-backdrop: rgba(15, 28, 42, .38);
  --c-shadow: 0 1px 2px rgba(15, 33, 52, .07);
  --c-shadow-pop: 0 24px 70px rgba(0, 10, 25, .3);
  --c-track: #c4ced7;
  --c-knob: #ffffff;
  --c-code: #0f1d2b;
  --c-code-ink: #d6e3ee;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --c-canvas: #10161b;
  --c-surface: #171f26;
  --c-raised: #1b242c;
  --c-subtle: #222c35;
  --c-hover: #1e2932;
  --c-input: #11181e;
  --c-side: #131a20;
  --c-ink: #e3eaf0;
  --c-ink-2: #b9c6d1;
  --c-muted: #8a9aa8;
  --c-line: #27323c;
  --c-line-soft: #212b34;
  --c-line-strong: #36434f;
  --c-accent: #58b0d1;
  --c-accent-hover: #72c0dc;
  --c-accent-soft: rgba(88, 176, 209, .15);
  --c-on-accent: #062230;
  --c-focus: #64bbdc;
  --c-good: #5cc394;
  --c-good-soft: rgba(92, 195, 148, .14);
  --c-warn: #e3b366;
  --c-warn-soft: rgba(227, 179, 102, .14);
  --c-bad: #f0868e;
  --c-bad-hover: #f59ca3;
  --c-bad-soft: rgba(240, 134, 142, .14);
  --c-notice-ink: #b5dcea;
  --c-warn-ink: #f0d3a2;
  --c-bad-ink: #f6c3c7;
  --c-good-ink: #b6e6cf;
  --c-window: #10161b;
  --c-header: #171f26;
  --c-header-idle: #131a20;
  --c-header-line: #26313b;
  --c-header-ink: #e3eaf0;
  --c-header-muted: #8a9aa8;
  --c-backdrop: rgba(0, 0, 0, .55);
  --c-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --c-shadow-pop: 0 24px 70px rgba(0, 0, 0, .6);
  --c-track: #3a4753;
  --c-knob: #e9eef2;
  --c-code: #0b1116;
  --c-code-ink: #cfdce6;
}

.zw-win-body, .zw-detached, .zw-overlay, .zw-login-card { color: var(--c-ink); font-size: 13px; }

.zw-muted { color: var(--c-muted); }
.zw-kicker { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.zw-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zw-grow { flex: 1; }
.zw-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 680; }
h3 { font-size: 14px; font-weight: 660; }

/* ------------------------------------------------------------------ Buttons */
.zw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid var(--c-line-strong); border-radius: 8px; background: var(--c-surface); color: var(--c-ink); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.zw-btn:hover:not(:disabled) { background: var(--c-subtle); }
.zw-btn:disabled { opacity: .45; cursor: not-allowed; }
.zw-btn.primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
.zw-btn.primary:hover:not(:disabled) { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }
.zw-btn.danger { background: var(--c-bad); border-color: var(--c-bad); color: var(--c-on-accent); }
.zw-btn.danger:hover:not(:disabled) { background: var(--c-bad-hover); }
.zw-btn.quiet, .zw-btn.ghost { border-color: transparent; background: transparent; color: var(--c-muted); }
.zw-btn.quiet:hover:not(:disabled), .zw-btn.ghost:hover:not(:disabled) { background: var(--c-subtle); color: var(--c-ink); }
.zw-btn.small { height: 28px; padding: 0 9px; font-size: 12px; }
.zw-btn.wide { width: 100%; height: 42px; font-size: 14px; }
.zw-icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--c-muted); cursor: pointer; }
.zw-icon-btn:hover { background: var(--c-subtle); color: var(--c-ink); }
.zw-link { border: 0; padding: 0; background: none; color: var(--c-accent); font-weight: 600; cursor: pointer; font-size: 12.5px; }
.zw-link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ Badges & Meter */
.zw-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--c-subtle); color: var(--c-muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.zw-badge.good { background: var(--c-good-soft); color: var(--c-good); }
.zw-badge.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.zw-badge.bad { background: var(--c-bad-soft); color: var(--c-bad); }
.zw-badge.info { background: var(--c-accent-soft); color: var(--c-accent); }
.zw-meter { height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--c-muted) 22%, transparent); overflow: hidden; }
.zw-meter span { display: block; height: 100%; border-radius: inherit; background: var(--c-good); transition: width .4s; }
.zw-meter.tone-warn span { background: var(--c-warn); }
.zw-meter.tone-bad span { background: var(--c-bad); }
.zw-meter.tone-info span { background: var(--c-accent); }

/* ------------------------------------------------------------------ Hauptframe: Baum + Inhalt */
.zw-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; background: var(--c-canvas); }
.zw-side { display: flex; flex-direction: column; gap: 1px; padding: 12px 8px; background: var(--c-side); border-right: 1px solid var(--c-line); overflow-y: auto; }
.zw-side-title { padding: 12px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--c-muted); }
.zw-side-title:first-child { padding-top: 2px; }
.zw-side-btn { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--c-ink-2); text-align: left; cursor: pointer; font-size: 13px; }
.zw-side-btn:hover { background: color-mix(in srgb, var(--c-surface) 60%, transparent); }
.zw-side-btn.active { background: var(--c-surface); color: var(--c-accent); font-weight: 620; box-shadow: var(--c-shadow); }
.zw-side-btn span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zw-side-btn > svg { flex: none; }
.zw-side-badge { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--c-accent); color: var(--c-on-accent); font-size: 11px; text-align: center; }
.zw-main { position: relative; min-width: 0; min-height: 0; overflow-y: auto; padding: 0 28px 32px; background: var(--c-canvas); }

/* Kopf: Abschnitts-Icon, Titel, Untertitel, Aktionen. Bleibt beim Scrollen stehen. */
.zw-page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.zw-main > .zw-page-head, .zw-main > :first-child > .zw-page-head:first-child { position: sticky; top: 0; z-index: 6; margin: 0 -28px 18px; padding: 20px 28px 14px; background: color-mix(in srgb, var(--c-canvas) 92%, transparent); backdrop-filter: blur(10px); }
.zw-page-head.scrolled { box-shadow: 0 1px 0 var(--c-line); }
.zw-page-head > .zw-page-title { flex: 1; min-width: 0; }
.zw-page-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.018em; line-height: 1.25; }
.zw-page-head p { margin: 3px 0 0; font-size: 13px; line-height: 1.45; max-width: 72ch; }
.zw-page-head > .zw-row { flex: none; justify-content: flex-end; }
.zw-page-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--zw-section, #2f7fb5) 62%, #fff), var(--zw-section, #2f7fb5) 52%, color-mix(in srgb, var(--zw-section, #2f7fb5) 72%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 3px 10px color-mix(in srgb, var(--zw-section, #2f7fb5) 28%, transparent); }
.zw-page-icon svg { stroke-width: 2; }
.zw-page-head + .zw-tabs-wrap > .zw-tabs, .zw-page-head + .zw-tabs { margin-top: -4px; }
.zw-section { margin-top: 26px; }
.zw-section > h3 { margin-bottom: 10px; }
.zw-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--c-surface); border-bottom: 1px solid var(--c-line); flex-wrap: wrap; }

/* Segmente statt Unterstrich-Tabs */
.zw-tabs { display: inline-flex; align-items: center; align-self: flex-start; justify-self: start; gap: 2px; max-width: 100%; margin-bottom: 20px; padding: 3px; border-radius: 10px; background: var(--c-subtle); overflow-x: auto; scrollbar-width: none; }
.zw-tabs button { flex: none; height: 28px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent; color: var(--c-ink-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; cursor: pointer; transition: background .12s, color .12s; }
.zw-tabs button:hover { color: var(--c-ink); }
.zw-tabs button.active { background: var(--c-surface); color: var(--c-ink); box-shadow: 0 1px 2px rgba(15, 33, 52, .12), 0 0 0 1px color-mix(in srgb, var(--c-ink) 4%, transparent); }
.zw-tabs-wrap { min-width: 0; }

/* ------------------------------------------------------------------ Karten und Kennzahlen */
.zw-card { padding: 16px 18px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); }
.zw-card + .zw-card { margin-top: 12px; }
.zw-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.zw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.zw-stat { padding: 14px 16px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); }
.zw-stat small { display: block; color: var(--c-muted); font-size: 12px; }
.zw-stat strong { display: block; margin-top: 4px; font-size: 20px; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.zw-stat .zw-meter { margin-top: 10px; }

/* ------------------------------------------------------------------ Tabellen */
.zw-table-wrap { border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); overflow: auto; }
.zw-table { width: 100%; border-collapse: collapse; }
.zw-table th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 14px; background: var(--c-raised); border-bottom: 1px solid var(--c-line); color: var(--c-muted); font-size: 12px; font-weight: 620; text-align: left; white-space: nowrap; }
.zw-table td { height: 44px; padding: 6px 14px; border-bottom: 1px solid var(--c-line-soft); vertical-align: middle; }
.zw-table tr:last-child td { border-bottom: 0; }
.zw-table tr.clickable { cursor: pointer; }
.zw-table tbody tr:hover td { background: var(--c-hover); }
.zw-table tr.selected td { background: var(--c-accent-soft); }
.zw-kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
.zw-kv dt { color: var(--c-muted); }
.zw-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Formulare (Dialoge: gestapelt) */
.zw-form-grid { display: grid; gap: 14px; }
.zw-form-grid.two { grid-template-columns: 1fr 1fr; }
.zw-field { display: grid; gap: 5px; min-width: 0; }
.zw-field > label { font-size: 12px; font-weight: 600; color: var(--c-ink-2); }
.zw-field > small { color: var(--c-muted); font-size: 11.5px; line-height: 1.4; }
.zw-input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--c-line-strong); border-radius: 8px; background: var(--c-input); color: var(--c-ink); outline: none; font-size: 13px; transition: border-color .12s, box-shadow .12s; }
select.zw-input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a9aa8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
textarea.zw-input { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.zw-input:focus { border-color: var(--c-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 18%, transparent); }
.zw-input::placeholder { color: var(--c-muted); opacity: .8; }
.zw-input-short { max-width: 140px; }
.zw-search { height: 32px; padding: 0 10px 0 32px; border: 1px solid var(--c-line-strong); border-radius: 8px; background: var(--c-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a9aa8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 10px center no-repeat; color: var(--c-ink); outline: none; min-width: 200px; }
.zw-search:focus { border-color: var(--c-focus); }
.zw-form-message { margin: 0; padding: 9px 11px; border-radius: 8px; font-size: 12.5px; background: var(--c-bad-soft); color: var(--c-bad); }
.zw-form-message.info { background: var(--c-accent-soft); color: var(--c-accent); }
.zw-form-message.good { background: var(--c-good-soft); color: var(--c-good); }
.zw-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.zw-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.zw-toggle-track { position: relative; width: 36px; height: 20px; border-radius: 99px; background: var(--c-track); transition: background .15s; flex: none; }
.zw-toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--c-knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.zw-toggle input:checked + .zw-toggle-track { background: var(--c-accent); }
.zw-toggle input:checked + .zw-toggle-track::after { transform: translateX(16px); }
.zw-toggle input:focus-visible + .zw-toggle-track { outline: 2px solid var(--c-focus); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--c-accent); }

/* ------------------------------------------------------------------ Einstellungen: Gruppen mit Zeilen
   Gruppentitel über einer ruhigen Fläche; jede Zeile: Beschriftung + Hinweis links, Bedienelement rechts. */
.zw-settings { display: grid; gap: 24px; max-width: 880px; }
.zw-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.zw-group > legend { float: left; width: 100%; margin: 0 0 3px; padding: 0 2px; font-size: 13.5px; font-weight: 700; color: var(--c-ink); }
.zw-group > legend + * { clear: both; }
.zw-group > .zw-group-text { margin: 0 2px 8px; color: var(--c-muted); font-size: 12.5px; line-height: 1.45; max-width: 76ch; }
.zw-group-card { display: grid; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); overflow: hidden; }
.zw-group-card > * { margin: 0; padding: 12px 16px; }
.zw-group-card > * + * { border-top: 1px solid var(--c-line-soft); }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 340px); grid-template-areas: "label control" "hint control"; column-gap: 28px; row-gap: 2px; align-items: center; min-height: 52px; }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > label:first-child { grid-area: label; align-self: end; font-size: 13px; font-weight: 600; color: var(--c-ink); }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > small { grid-area: hint; align-self: start; font-size: 12px; }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field):not(:has(> small)) > label:first-child { grid-row: 1 / span 2; align-self: center; }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > :not(label:first-child):not(small) { grid-area: control; grid-row: 1 / span 2; justify-self: stretch; }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > :is(.zw-input-short, input[type=number]):not(label:first-child):not(small) { justify-self: end; width: 140px; }
:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > .zw-toggle:not(label:first-child) { justify-self: end; }
/* Textfelder und ausdrücklich breite Felder: untereinander */
:where(:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field).wide, :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field):has(> textarea)) { grid-template-columns: 1fr; grid-template-areas: "label" "control" "hint"; }
:where(:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field).wide, :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field):has(> textarea)) > :not(label:first-child):not(small) { grid-row: auto; }
:where(:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field).wide, :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field):has(> textarea)) > label:first-child { grid-row: auto; margin-bottom: 4px; }
:where(:where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field).wide, :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field):has(> textarea)) > small { margin-top: 4px; }
/* Raster in Gruppen werden zu Zeilen; Schalterlisten zu einzelnen Zeilen */
.zw-group-card.zw-group-card > :is(.zw-form-grid, .zw-form-row) { display: grid; grid-template-columns: 1fr; gap: 0; padding: 0; }
.zw-group-card > :is(.zw-form-grid, .zw-form-row) > * { padding: 12px 16px; }
.zw-group-card > :is(.zw-form-grid, .zw-form-row) > * + * { border-top: 1px solid var(--c-line-soft); }
.zw-group-card > .zw-toggle, .zw-group-card > .zw-check-list > .zw-toggle { display: flex; justify-content: space-between; flex-direction: row-reverse; gap: 24px; min-height: 48px; font-weight: 600; }
.zw-group-card > .zw-check-list { display: grid; gap: 0; padding: 0; }
.zw-group-card > .zw-check-list > * { padding: 12px 16px; }
.zw-group-card > .zw-check-list > * + * { border-top: 1px solid var(--c-line-soft); }
.zw-group-card > .zw-radio-list { gap: 12px; padding: 14px 16px; }
.zw-group-card > .zw-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); gap: 0; padding: 0; }
.zw-group-card > .zw-split > .zw-form-grid { gap: 0; }
.zw-group-card > .zw-split > .zw-form-grid > * { padding: 12px 16px; }
.zw-group-card > .zw-split > .zw-form-grid > * + * { border-top: 1px solid var(--c-line-soft); }
.zw-group-card > .zw-split > :last-child { margin: 12px 16px 12px 0; }
.zw-group-card > .zw-table-wrap { padding: 0; border: 0; border-radius: 0; }
.zw-group-card > .zw-table-wrap + *, .zw-group-card > * + .zw-table-wrap { border-top: 1px solid var(--c-line-soft); }
/* Ältere Gruppen ohne Zeilenfläche (z. B. in Dialogen): als ruhige Fläche mit Abstand */
.zw-group:not(:has(> .zw-group-card)) { display: grid; gap: 10px; padding: 12px 16px 14px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); }
.zw-group:not(:has(> .zw-group-card)) > legend { float: none; padding: 0 4px; margin: 0 0 0 -4px; width: auto; }
.zw-group:not(:has(> .zw-group-card)) > p { margin: 0; }
.zw-dialog .zw-group:not(:has(> .zw-group-card)) { background: var(--c-raised); }
.zw-settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.zw-settings-actions > .zw-muted { margin-right: auto; }
/* Speicherleiste: erscheint erst bei Änderungen */
.zw-savebar { position: sticky; bottom: 14px; z-index: 5; display: none; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border: 1px solid var(--c-line); border-radius: 12px; background: color-mix(in srgb, var(--c-surface) 94%, transparent); box-shadow: 0 10px 30px rgba(0, 10, 25, .14); backdrop-filter: blur(10px); }
.zw-savebar.dirty, .zw-savebar.busy { display: flex; animation: zw-savebar-in .18s ease-out; }
@keyframes zw-savebar-in { from { opacity: 0; transform: translateY(8px); } }
.zw-savebar > .zw-savebar-text { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.zw-savebar > .zw-savebar-text::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-warn); }
.zw-settings-status { color: var(--c-muted); font-size: 12px; margin: -12px 2px 0; }

/* ------------------------------------------------------------------ Zustände */
.zw-empty { display: grid; justify-items: center; gap: 6px; padding: 42px 20px; color: var(--c-muted); text-align: center; }
.zw-empty strong { color: var(--c-ink); font-size: 14px; }
.zw-empty p { margin: 0; max-width: 420px; }
.zw-empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 6px; border-radius: 16px; background: var(--c-subtle); color: var(--c-muted); }
.zw-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--c-muted); }
.zw-spinner { width: 20px; height: 20px; border: 2.5px solid color-mix(in srgb, var(--c-muted) 25%, transparent); border-top-color: var(--c-focus); border-radius: 50%; animation: zw-spin .8s linear infinite; }
.zw-spinner.small { width: 14px; height: 14px; border-width: 2px; border-top-color: var(--zw-brand, #ffcf3f); }
@keyframes zw-spin { to { transform: rotate(360deg); } }
.zw-error-box { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; padding: 14px 16px; border-radius: 12px; background: var(--c-bad-soft); color: var(--c-bad); }
.zw-error-box p { margin: 3px 0 0; color: var(--c-bad-ink); }
.zw-error-box .zw-btn { margin-left: auto; }
.zw-notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; background: var(--c-accent-soft); color: var(--c-notice-ink); margin-bottom: 14px; }
.zw-notice.warn { background: var(--c-warn-soft); color: var(--c-warn-ink); }
.zw-notice.bad { background: var(--c-bad-soft); color: var(--c-bad-ink); }
.zw-notice.good { background: var(--c-good-soft); color: var(--c-good-ink); }
.zw-notice p { margin: 0; }

/* ------------------------------------------------------------------ Dialoge */
.zw-overlay { position: absolute; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--c-backdrop); animation: zw-fade .12s ease-out; }
@keyframes zw-fade { from { opacity: 0; } }
.zw-dialog { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-surface); color: var(--c-ink); box-shadow: var(--c-shadow-pop); overflow: hidden; }
.zw-dialog header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px 20px; }
.zw-dialog-body { padding: 4px 20px 16px; overflow-y: auto; display: grid; gap: 12px; }
.zw-dialog-body > p { margin: 0; line-height: 1.55; }
.zw-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; background: var(--c-raised); border-top: 1px solid var(--c-line); }

/* Log-Ausgaben */
.zw-log { margin: 0; padding: 12px 14px; max-height: 320px; overflow: auto; border-radius: 10px; background: var(--c-code); color: var(--c-code-ink); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }

a { color: var(--c-accent); }
.zw-cards .zw-card + .zw-card { margin-top: 0; }

@container (max-width: 640px) {
  .zw-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .zw-side { flex-direction: row; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 1px solid var(--c-line); }
  .zw-side-title { display: none; }
  .zw-side-btn { white-space: nowrap; }
  .zw-main { padding: 0 14px 20px; }
  .zw-page-head { flex-wrap: wrap; }
  .zw-main > .zw-page-head { margin: 0 -14px 14px; padding: 14px 14px 10px; }
  .zw-page-icon { display: none; }
  .zw-form-grid.two { grid-template-columns: 1fr; }
  :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) { grid-template-columns: 1fr; grid-template-areas: "label" "control" "hint"; }
  :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > :not(label:first-child):not(small) { grid-row: auto; justify-self: stretch; }
  :where(.zw-group-card > .zw-field, .zw-group-card > .zw-form-grid > .zw-field, .zw-group-card > .zw-split > .zw-form-grid > .zw-field, .zw-group-card > .zw-form-row > .zw-field) > label:first-child { grid-row: auto; }
  .zw-group-card > .zw-split { grid-template-columns: 1fr; }
}

/* zitro-Wortmarke wie auf zitro.cloud und im Kundencenter: Blatt, „zitro“, ®, Endung (.cloud …).
   Open Sans nur als kleine Teilmenge (assets/fonts/opensans-wordmark.woff, OFL). Größe über font-size. */
@font-face {
  font-family: "ZITRO Wordmark";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("/assets/fonts/opensans-wordmark.woff") format("woff");
}
.zw-wordmark {
  --zitro-ci: #ffc700;
  display: inline-flex;
  align-items: baseline;
  font-family: "ZITRO Wordmark", "Open Sans", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  white-space: nowrap;
  color: var(--zitro-ci);
  vertical-align: baseline;
}
.zw-wordmark > .zw-wordmark-leaf:not(.tiles) { display: inline-block; flex: none; width: 1ex; height: 1ex; margin-right: .26em; background: var(--zitro-ci); border-radius: 0 50% 0 50%; }
.zw-wordmark > .zw-wordmark-name { font-weight: 700; }
.zw-wordmark > .zw-wordmark-registered { align-self: flex-start; position: relative; top: -.1em; margin-left: .08em; margin-right: .16em; font-size: .32em; line-height: 1; font-weight: 300; }
.zw-wordmark > .zw-wordmark-suffix { font-weight: 300; color: var(--zitro-wordmark-suffix, var(--c-ink)); }
:root[data-theme="dark"] .zw-wordmark > .zw-wordmark-suffix { color: var(--zitro-wordmark-suffix, #eee); }
/* Hintergrund transparent; die Endung folgt dem Design (hell: dunkle Schrift, dunkel: #eee wie auf zitro.cloud). */
/* Helles Design: feine dunkle Kontur um Blatt und Gelb, damit es auf hellem Grund lesbar bleibt. */
:root:not([data-theme="dark"]) .zw-wordmark > .zw-wordmark-name,
:root:not([data-theme="dark"]) .zw-wordmark > .zw-wordmark-registered { -webkit-text-stroke: .022em var(--zw-mark-outline, rgba(20, 33, 44, .55)); }
:root:not([data-theme="dark"]) .zw-wordmark > .zw-wordmark-leaf:not(.tiles) { box-shadow: 0 0 0 .02em var(--zw-mark-outline, rgba(20, 33, 44, .55)); }

/* Logo von zitro.works: Blatt aus vier App-Kacheln. Größe über --s. Auf dunklem Grund (Leiste, Anmeldung)
   --zw-mark-outline: transparent setzen; im hellen Design sonst feine dunkle Kontur wie bei der Wortmarke. */
.zw-works-mark { --s: 32px; display: inline-grid; flex: none; grid-template: 1fr 1fr / 1fr 1fr; gap: calc(var(--s) * .078); width: var(--s); height: var(--s); vertical-align: middle; }
.zw-works-mark > i { display: block; background: #ffc700; }
.zw-works-mark > i:nth-child(2) { border-top-right-radius: 100%; }
.zw-works-mark > i:nth-child(3) { border-bottom-left-radius: 100%; }
:root:not([data-theme="dark"]) .zw-works-mark { filter: drop-shadow(0 0 .6px var(--zw-mark-outline, rgba(20, 33, 44, .7))); }
/* In der Wortmarke als eine Fläche mit Maske (Grundlinie wie beim einfachen Blatt). */
.zw-wordmark > .zw-wordmark-leaf.tiles { display: inline-block; flex: none; width: 1.12ex; height: 1.12ex; margin-right: .26em; background: var(--zitro-ci);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='14.75' height='14.75'/%3E%3Cpath d='M17.25 0A14.75 14.75 0 0 1 32 14.75H17.25Z'/%3E%3Cpath d='M14.75 32A14.75 14.75 0 0 1 0 17.25H14.75Z'/%3E%3Crect x='17.25' y='17.25' width='14.75' height='14.75'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='14.75' height='14.75'/%3E%3Cpath d='M17.25 0A14.75 14.75 0 0 1 32 14.75H17.25Z'/%3E%3Cpath d='M14.75 32A14.75 14.75 0 0 1 0 17.25H14.75Z'/%3E%3Crect x='17.25' y='17.25' width='14.75' height='14.75'/%3E%3C/svg%3E") center / contain no-repeat; }
:root:not([data-theme="dark"]) .zw-wordmark > .zw-wordmark-leaf.tiles { filter: drop-shadow(0 0 .02em var(--zw-mark-outline, rgba(20, 33, 44, .7))); }

/* ------------------------------------------------------------------ Zustand, Zeilen mit Aktionen, Aufklappen, Leiste rechts
   (docs/UI-HAUPTFRAME.md → „Zustand zuerst“). line() und statusLine() sind Zeilen in einer group(). */
.zw-line, .zw-status-item { display: flex; align-items: center; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.zw-line-text { flex: 1; min-width: 180px; display: grid; gap: 1px; }
.zw-line-text > strong { font-size: 13px; font-weight: 620; color: var(--c-ink); }
.zw-line-text > small { color: var(--c-muted); font-size: 12px; line-height: 1.45; }
.zw-line-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.zw-status-dot { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--c-subtle); color: var(--c-muted); }
.zw-status-dot svg { stroke-width: 2.6; }
:is(.zw-status-item, .zw-banner).ok > .zw-status-dot { background: var(--c-good-soft); color: var(--c-good); }
:is(.zw-status-item, .zw-banner).warn > .zw-status-dot { background: var(--c-warn-soft); color: var(--c-warn); }
:is(.zw-status-item, .zw-banner).bad > .zw-status-dot { background: var(--c-bad-soft); color: var(--c-bad); }
:is(.zw-status-item, .zw-banner).info > .zw-status-dot { background: var(--c-accent-soft); color: var(--c-accent); }
.zw-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 880px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--c-good) 28%, var(--c-line)); background: color-mix(in srgb, var(--c-good) 8%, var(--c-surface)); }
.zw-banner.warn { border-color: color-mix(in srgb, var(--c-warn) 30%, var(--c-line)); background: color-mix(in srgb, var(--c-warn) 9%, var(--c-surface)); }
.zw-banner.bad { border-color: color-mix(in srgb, var(--c-bad) 30%, var(--c-line)); background: color-mix(in srgb, var(--c-bad) 8%, var(--c-surface)); }
.zw-banner.info { border-color: color-mix(in srgb, var(--c-accent) 26%, var(--c-line)); background: color-mix(in srgb, var(--c-accent) 7%, var(--c-surface)); }
.zw-banner > .zw-line-text > strong { font-size: 13.5px; }
.zw-banner > .zw-line-text > small { color: var(--c-ink-2); }
.zw-banner + * { margin-top: 0; }
details.zw-more { max-width: 880px; border: 1px dashed var(--c-line-strong); border-radius: 12px; }
details.zw-more[open] { border-style: solid; border-color: var(--c-line); background: color-mix(in srgb, var(--c-surface) 45%, transparent); }
details.zw-more > summary { display: flex; align-items: center; gap: 8px; padding: 11px 16px; list-style: none; cursor: pointer; color: var(--c-muted); font-size: 12.5px; border-radius: 12px; }
details.zw-more > summary::-webkit-details-marker { display: none; }
details.zw-more > summary::before { content: ""; flex: none; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
details.zw-more[open] > summary::before { transform: rotate(45deg); }
details.zw-more > summary > strong { color: var(--c-ink); font-weight: 650; }
details.zw-more > summary:hover > strong { color: var(--c-accent); }
.zw-more-body { display: grid; gap: 18px; padding: 4px 16px 16px; }
.zw-more-body > .zw-settings { max-width: none; }
.zw-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.zw-filter-chips .zw-chip { height: 28px; padding: 0 11px; }
.zw-chip-count { color: var(--c-muted); font-variant-numeric: tabular-nums; }
.zw-chip.active .zw-chip-count { color: inherit; }
.zw-list-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.zw-list-toolbar .zw-search { flex: 1; min-width: 180px; max-width: 320px; }
.zw-table tr.zw-table-group td { height: auto; padding: 9px 14px 5px; background: var(--c-raised); color: var(--c-muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.zw-table tbody tr.zw-table-group:hover td { background: var(--c-raised); }
.zw-drawer-overlay { position: absolute; inset: 0; z-index: 90; display: flex; justify-content: flex-end; background: var(--c-backdrop); animation: zw-fade .12s ease-out; }
.zw-drawer { height: 100%; display: flex; flex-direction: column; background: var(--c-canvas); border-left: 1px solid var(--c-line); box-shadow: var(--c-shadow-pop); animation: zw-drawer-in .18s ease-out; }
@keyframes zw-drawer-in { from { transform: translateX(28px); opacity: .5; } }
.zw-drawer > header { display: flex; align-items: center; gap: 12px; padding: 16px 14px 14px 20px; border-bottom: 1px solid var(--c-line); background: var(--c-surface); }
.zw-drawer > header .zw-page-title { flex: 1; min-width: 0; }
.zw-drawer > header h3 { font-size: 16px; font-weight: 700; letter-spacing: -.012em; }
.zw-drawer > header p { margin: 2px 0 0; font-size: 12.5px; }
.zw-drawer-body { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 20px; padding: 18px 20px 28px; }
.zw-drawer-body > .zw-settings { max-width: none; }
@media (prefers-reduced-motion: reduce) { .zw-drawer, .zw-drawer-overlay { animation: none; } }
@container (max-width: 640px) {
  .zw-line, .zw-status-item { align-items: flex-start; }
  .zw-line-actions { justify-content: flex-start; }
}
/* Zeilen mit Schalter: der Schalter braucht keine breite Spalte, der Hinweis darf die Zeile nutzen. */
:where(.zw-group-card > .zw-field):has(> .zw-toggle) { grid-template-columns: minmax(0, 1fr) auto; }
/* In der Leiste rechts sind Zeilen schmaler: Bedienelement höchstens halb so breit. */
.zw-drawer-body :where(.zw-group-card > .zw-field) { grid-template-columns: minmax(110px, 1fr) minmax(150px, 230px); }
.zw-drawer-body :where(.zw-group-card > .zw-field):has(> .zw-toggle) { grid-template-columns: minmax(0, 1fr) auto; }
@container (max-width: 640px) {
  .zw-group-card > .zw-field:has(> .zw-toggle) { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label control" "hint control"; }
}

/* Benachrichtigungen: Ereignisauswahl im Profil, Matrix der eigenen Mitteilungen */
.zw-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; margin-top: 8px; }
.zw-check-grid[hidden] { display: none; }
.zw-notice-matrix td:not(:first-child), .zw-notice-matrix th:not(:first-child) { width: 90px; text-align: center; }
.zw-notice-matrix td .zw-muted { font-size: 12px; margin-top: 2px; }
.zw-notice-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.zw-notice-inline.spaced { margin-top: 10px; }
.zw-notice-inline .zw-input { width: auto; min-width: 0; }
.zw-list-toolbar > select.zw-input { width: auto; min-width: 140px; }
.zw-activity-table td { vertical-align: top; }
.zw-activity-path { max-width: 360px; word-break: break-word; }
.zw-activity-path small { display: inline; }
.zw-nowrap { white-space: nowrap; }
.zw-approval { width: min(420px, calc(100vw - 24px)); max-width: calc(100vw - 24px); min-width: 0; }
.zw-approval .zw-approval-numbers .zw-btn { min-width: 0; flex: 1; max-width: 96px; }
.zw-approval-numbers { display: flex; gap: 12px; justify-content: center; margin: 14px 0 4px; }
.zw-approval-numbers .zw-btn { min-width: 76px; height: 64px; font-size: 26px; font-weight: 700; }
.zw-login-approval { text-align: center; padding: 8px 0; }
.zw-login-approval .zw-approval-number { font-size: 44px; font-weight: 750; letter-spacing: .04em; margin: 6px 0; }
.zw-approval-overlay { position: fixed; z-index: 9500; }
