:root {
  color-scheme: light;
  /* Semantische Tokens (QA-Workbench) */
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-subtle: #f1f5f9;
  --border: #d8dee6;
  --border-strong: #cbd5e1;
  --border-soft: #e2e8f0;
  --text: #1a2332;
  --text-strong: #0f172a;
  --muted: #5c6b7a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --sidebar: #2a3a4d;
  --sidebar-text: #e2eaf2;
  --sidebar-active: #33485e;
  --sidebar-line: #3a4e64;
  --sidebar-muted: #9aafc0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #3b82f6;
  --accent-tint: #60a5fa;
  --accent-wash: #eff6ff;
  --warn-wash: #fff7ed;
  --fail-wash: #fef2f2;
  --ok-wash: #ecfdf5;
  --info-wash: #e0f2fe;
  --text-on-accent: #ffffff;
  --ok: #15803d;
  --fail: #b91c1c;
  --warn: #b45309;
  --info: #0369a1;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --font: "Segoe UI", "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
  --text-display: 1.55rem;
  --text-title: 1.15rem;
  --text-body: 0.9rem;
  --text-caption: 0.78rem;
  --text-label: 0.72rem;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --z-topbar: 40;
  --z-drawer: 200;
  --z-scrim: 190;
  --z-menu: 220;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); font-size: var(--text-body); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
html.nav-drawer-open, html.nav-drawer-open body { overflow: hidden; }

.app-shell {
  display: flex; min-height: 100vh; height: 100vh; overflow: hidden;
  position: relative;
}
.nav-scrim {
  display: none;
  position: fixed; inset: 0; z-index: var(--z-scrim);
  background: rgba(15, 23, 42, 0.45);
}
.sidebar {
  width: 240px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; flex-shrink: 0;
  height: 100%; min-height: 0; z-index: var(--z-drawer);
  border-right: 1px solid var(--border-soft);
}
.sidebar .brand {
  padding: var(--space-4) 1.1rem; font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.02em; border-bottom: 1px solid var(--sidebar-line); flex-shrink: 0;
}
.sidebar .brand--logo {
  display: flex; align-items: center; justify-content: center;
  padding: 0.85rem 1rem;
}
.sidebar .brand__logo {
  max-height: 40px; max-width: 100%; width: auto; height: auto; object-fit: contain;
}
.initials {
  display: inline-flex; width: 28px; height: 28px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--user-accent, var(--accent-soft)); color: var(--text-on-accent);
  font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.initials--sm { width: 26px; height: 26px; font-size: 0.65rem; }
.initials--md { width: 36px; height: 36px; font-size: 0.8rem; }
.initials--lg { width: 96px; height: 96px; font-size: 1.6rem; }
.user-avatar {
  display: inline-block; border-radius: 50%; object-fit: cover;
  flex-shrink: 0; background: var(--border-soft); vertical-align: middle;
}
.user-avatar--sm { width: 26px; height: 26px; }
.user-avatar--md { width: 36px; height: 36px; }
.user-avatar--lg { width: 96px; height: 96px; }
.avatar-preview-wrap { display: flex; align-items: center; min-height: 96px; }
.avatar-preview {
  width: 128px; height: 128px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border-soft);
}
.avatar-crop-box {
  max-width: 100%; max-height: 360px; background: var(--text-strong);
  border-radius: 8px; overflow: hidden;
}
.avatar-crop-box img { display: block; max-width: 100%; }
.sidebar nav { padding: 0.6rem 0; overflow-y: auto; flex: 1; min-height: 0; }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.45rem 1.1rem; color: var(--sidebar-text); text-decoration: none;
  font-size: 0.9rem; border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--sidebar-active); }
.sidebar nav a.active {
  background: color-mix(in srgb, var(--accent) 22%, var(--sidebar-active));
  border-left-color: var(--accent-tint);
  color: var(--text-on-accent);
}
.sidebar nav .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav .nav-badge {
  flex: 0 0 auto; min-width: 1.25rem; padding: 0.05rem 0.4rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--text-on-accent); font-size: 0.68rem; font-weight: 700; text-align: center; line-height: 1.35;
}
.sidebar nav a.active .nav-badge { background: var(--accent-tint); color: var(--text-strong); }
.sidebar nav .nav-group {
  margin-top: 0.7rem; padding: 0.3rem 1.1rem; font-size: var(--text-label);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--sidebar-muted);
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.main > .content { flex: 1; min-height: 0; overflow-y: auto; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border-soft);
  padding: 0.45rem var(--space-5); display: flex; align-items: center; gap: var(--space-3);
  flex-shrink: 0; z-index: var(--z-topbar); min-height: 3rem;
}
.topbar__context { flex: 1; min-width: 0; }
.topbar__module {
  display: block; margin: 0; font-size: 0.95rem; font-weight: 650;
  color: var(--text-strong); letter-spacing: 0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__meta { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.topbar__version {
  font-size: var(--text-caption);
  text-decoration: none;
  color: var(--text-faint);
}
.topbar__version:hover { color: var(--accent-hover); text-decoration: underline; }
.sidebar-toggle {
  display: none; width: 2.15rem; height: 2.15rem; padding: 0;
  align-items: center; justify-content: center;
}
.sidebar-toggle__bars,
.sidebar-toggle__bars::before,
.sidebar-toggle__bars::after {
  display: block; width: 1rem; height: 2px; background: var(--text);
  border-radius: 1px; position: relative;
}
.sidebar-toggle__bars::before,
.sidebar-toggle__bars::after {
  content: ""; position: absolute; left: 0;
}
.sidebar-toggle__bars::before { top: -5px; }
.sidebar-toggle__bars::after { top: 5px; }

.topbar-user { position: relative; }
.topbar-user__btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--border-soft); background: var(--surface);
  border-radius: var(--radius); padding: 0.2rem 0.55rem 0.2rem 0.25rem;
  cursor: pointer; color: var(--text); font: inherit; font-size: 0.85rem;
}
.topbar-user__btn:hover { background: var(--surface-muted); }
.topbar-user__name {
  max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ui-overflow, .topbar-user, [data-ui-menu] { position: relative; display: inline-flex; }
.ui-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: var(--z-menu);
  min-width: 12rem; padding: 0.35rem;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.ui-menu__meta {
  display: flex; flex-direction: row; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.55rem 0.55rem; border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.25rem; font-size: 0.85rem;
}
.ui-menu__meta > div { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.ui-menu__item {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--text);
  padding: 0.45rem 0.55rem; border-radius: var(--radius-sm);
  font: inherit; font-size: 0.875rem; cursor: pointer; text-decoration: none;
}
.ui-menu__item:hover { background: var(--surface-muted); text-decoration: none; }
.ui-menu__item--quiet { color: var(--text-faint); font-size: 0.8rem; }
.ui-menu__sep {
  height: 1px; margin: 0.35rem 0.4rem; background: var(--border-soft); border: 0;
}
.ui-menu form { margin: 0; }

.about-card { max-width: 40rem; }
.about-dl { margin: 0 0 1.1rem; }
.about-legal p { margin: 0 0 0.75rem; line-height: 1.5; }
.about-legal__fine { font-size: 0.88rem; }
.about-hint {
  margin: 1.25rem 0 0;
  font-size: 0.78rem;
  opacity: 0.72;
  font-style: italic;
}

.setup-body { margin: 0; min-height: 100vh; background: var(--bg); }
.setup-wrap {
  max-width: 40rem; margin: 0 auto; padding: 2rem 1rem 3rem;
}
.setup-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem 1.5rem;
}
.setup-card__title { margin: 0 0 0.25rem; font-size: 1.35rem; }
.setup-steps {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem;
  list-style: none; margin: 1rem 0 0; padding: 0; font-size: 0.78rem;
}
.setup-steps__item { color: var(--text-faint); }
.setup-steps__item.is-done { color: var(--text); }
.setup-steps__item.is-current { color: var(--accent); font-weight: 600; }
.setup-section__title { margin: 0 0 0.5rem; font-size: 1.05rem; }
.setup-license {
  max-height: 14rem; overflow: auto; margin: 0.75rem 0 1rem;
  padding: 0.75rem; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--surface-muted);
}
.setup-check {
  display: flex; gap: 0.55rem; align-items: flex-start;
  margin: 0.75rem 0 1rem; font-size: 0.92rem; cursor: pointer;
}
.setup-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.setup-actions--inline { margin-top: 0.5rem; }
.setup-req-list { list-style: none; margin: 0.75rem 0; padding: 0; }
.setup-req {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.55rem 0.65rem; margin-bottom: 0.35rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border-soft);
}
.setup-req.is-ok { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-soft)); }
.setup-req.is-bad { border-color: color-mix(in srgb, #c0392b 45%, var(--border-soft)); }
.setup-fieldset {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  margin: 0 0 1rem; padding: 0.75rem 0.9rem 0.9rem;
}
.setup-fieldset legend { padding: 0 0.35rem; font-weight: 600; font-size: 0.9rem; }
.setup-note { font-size: 0.85rem; line-height: 1.45; }
.setup-form .form-row { margin-bottom: 0.65rem; }

.content { padding: 1.1rem var(--space-5) 2rem; background: var(--bg); color: var(--text); }

.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  box-shadow: var(--shadow); padding: var(--space-4) 1.15rem;
}
.card + .card { margin-top: var(--space-4); }
.card h3 { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 700; color: var(--text-strong); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) {
  .sidebar-toggle { display: inline-flex; }
  .nav-scrim { display: block; }
  .nav-scrim[hidden] { display: none !important; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: min(280px, 86vw); height: 100%;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: none;
  }
  .app-shell.is-nav-open .sidebar { transform: translateX(0); }
  .topbar-user__name { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td {
  border-bottom: 1px solid var(--border-soft); padding: 0.75rem 1rem; text-align: left; vertical-align: middle;
}
table.data th {
  background: var(--surface-subtle); font-weight: 600; color: var(--muted); white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}
table.data tr:hover td { background: var(--surface-muted); }
table.data thead th:first-child { border-top-left-radius: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 0.4rem 0.75rem; font-size: 0.875rem; cursor: pointer;
}
.btn:hover { background: var(--surface-subtle); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--fail); border-color: var(--fail); color: var(--text-on-accent); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: var(--text-on-accent); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-lg { padding: 0.65rem 1.25rem; font-size: 1rem; font-weight: 650; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-subtle); color: var(--text); }
.btn-pause {
  background: var(--warn-wash);
  border-color: var(--warn);
  color: var(--warn);
}
.btn-pause:hover { background: var(--warn-wash); border-color: var(--warn); color: var(--warn); text-decoration: none; }

.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 42, 58, 0.68);
  backdrop-filter: blur(2px);
  padding: 1.5rem;
}
.pause-overlay__panel {
  text-align: center;
  color: var(--text-on-accent);
  max-width: 24rem;
}
.pause-overlay__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pause-overlay__sub {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  opacity: 0.9;
}
.pause-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.toolbar-session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.toolbar-session__left,
.toolbar-session__right {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  align-items: center;
}
.toolbar-session__spacer {
  width: 0.85rem;
  flex-shrink: 0;
}
.icon {
  display: block;
  flex-shrink: 0;
}
.btn-icon {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}
.btn-icon.btn-emphasis {
  width: 2.15rem;
  height: 2.15rem;
}
.actions-primary { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0.65rem 0 0.15rem; }

.inline-form { display: inline-flex; gap: 0.25rem; align-items: center; margin: 0; vertical-align: middle; }

/* —— Gemeinsamer UI-Stil (Planung-Referenz) —— */
.btn-outline, .btn-outline-primary {
  background: var(--surface); border: 1px solid #3b82f6; color: var(--accent);
}
.btn-outline:hover, .btn-outline-primary:hover { background: var(--accent-wash); text-decoration: none; }
.btn-outline-danger {
  background: var(--surface); border: 1px solid #f87171; color: var(--fail);
}
.btn-outline-danger:hover { background: var(--fail-wash); text-decoration: none; }
.btn-outline-muted {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.btn-outline-muted:hover { background: var(--surface-muted); text-decoration: none; }

.ui-page__header, .plan-page__header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.ui-page__title, .plan-page__title {
  margin: 0 0 0.25rem; font-size: var(--text-display); font-weight: 700; color: var(--text-strong);
}
.ui-page__sub, .plan-page__sub {
  margin: 0; color: var(--muted); font-size: 0.92rem; max-width: 42rem;
}
.ui-page__actions, .plan-page__actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
}
.ui-page__filters {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.85rem;
}
.ui-page__filters .form-inline { flex: 1; min-width: 0; }
.ui-page__filters #adhoc-q {
  min-height: 2.15rem; padding: 0.4rem 0.65rem;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
}

/* Explorativ Live-Suche */
.ex-search {
  align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.7rem; border: 1px solid transparent; border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ex-search.is-active {
  background: var(--warn-wash); border-color: var(--warn);
  box-shadow: 0 0 0 1px rgba(234, 88, 12, 0.12);
}
.ex-search__field {
  display: flex; align-items: center; gap: 0.45rem; flex: 1; min-width: 0;
}
.ex-search__field input[type=search] {
  flex: 1; min-width: 0; margin: 0;
}
.ex-search.is-active .ex-search__field input[type=search] {
  border-color: var(--warn); background: var(--surface);
}
.ex-search__badge,
.ex-search__clear { display: none !important; flex-shrink: 0; }
.ex-search.is-active .ex-search__badge {
  display: inline-flex !important;
  background: var(--warn-wash); color: var(--warn);
}
.ex-search.is-active .ex-search__clear { display: inline-flex !important; }
/* Past-Pläne / Bugs: Clear nur bei Textsuche, Badge auch bei anderen Filtern */
.tp-past-filters.is-active:not(.has-query) .ex-search__clear,
.bug-filters.is-active:not(.has-query) .ex-search__clear { display: none !important; }

/* Testpläne: Vergangen-Filter */
.tp-past-filters { flex-wrap: wrap; }
.tp-past-filters__year {
  display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; margin: 0; font-weight: 400;
}
.tp-past-filters__year select {
  min-width: 8rem; margin: 0;
}
.tp-past-filters__year select.is-filtered {
  border-color: var(--warn); background: var(--surface);
}
.tp-past-filters__summarize {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0; font-weight: 400; white-space: nowrap; flex-shrink: 0;
}

/* Listen-Aufklappen nutzt dasselbe Dreieck wie Trees */
.tp-expand-btn .struct-tree__twist,
.td-row__toggle .struct-tree__twist {
  /* Basis-Styles von .struct-tree__twist; Rotation über Expanded-State */
  text-indent: 0; overflow: visible;
}
.tp-row.is-expanded .tp-expand-btn .struct-tree__twist,
.td-row.is-open .td-row__toggle .struct-tree__twist {
  transform: rotate(90deg);
}
.tp-expand-btn { margin: 0; }
.tp-detail > td {
  padding: 0 !important;
  background: var(--surface-muted);
  border-top: none;
}
.tp-detail__inner {
  padding: 0.85rem 1rem 1rem 2.75rem;
  border-top: 1px solid var(--border-soft);
}
.tp-detail__est {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem; font-size: 0.92rem;
}
.tp-detail__cases { margin: 0; background: var(--surface); }
.tp-detail__cases th, .tp-detail__cases td { font-size: 0.88rem; }

/* Bugtracker-Filter */
.bug-filters { flex-wrap: wrap; }
.bug-filters__sel {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0; font-weight: 400; flex-shrink: 0;
}
.bug-filters__sel select { min-width: 7.5rem; margin: 0; }
.bug-filters__sel select.is-filtered {
  border-color: var(--warn); background: var(--surface);
}
.bug-filters__check {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0; font-weight: 400; white-space: nowrap; flex-shrink: 0;
}
.bug-group__head {
  padding: 0.65rem 1rem; font-weight: 600; font-size: 0.9rem;
  border-bottom: 1px solid var(--border-soft); background: var(--surface-muted);
}
.bug-dl { display: grid; grid-template-columns: 7rem 1fr; gap: 0.35rem 0.75rem; margin: 0 0 1rem; }
.bug-dl dt { color: var(--muted); font-size: 0.85rem; }
.bug-dl dd { margin: 0; }
.bug-steps { margin: 0.35rem 0 0; padding-left: 1.2rem; }
.bug-version { min-height: 4.5rem; font-family: var(--mono); font-size: 0.88rem; }
.bug-version-view { white-space: pre-wrap; font-family: var(--mono); font-size: 0.88rem; }
.bug-repro-steps {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.bug-repro-steps__row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.bug-repro-steps__input {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.bug-repro-steps__remove {
  flex: 0 0 auto;
  min-width: 2rem;
  line-height: 1;
  font-size: 1.1rem;
  padding: 0.25rem 0.45rem;
}
.bug-attach-list { display: flex; flex-direction: column; gap: 0.85rem; }
.bug-attach { border: 1px solid var(--border-soft); border-radius: 8px; padding: 0.65rem; background: var(--surface); }
.bug-attach__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.bug-attach__preview { display: block; }
.bug-attach__preview img {
  max-width: 100%; max-height: 220px; border-radius: 6px; border: 1px solid var(--border-soft); object-fit: contain;
}
.bug-attach__pdf {
  width: 100%; height: 260px; border: 1px solid var(--border-soft); border-radius: 6px; background: var(--surface-muted);
}
.bug-attach__text {
  margin: 0; max-height: 180px; overflow: auto; padding: 0.55rem 0.65rem;
  background: var(--text-strong); color: var(--border-soft); border-radius: 6px; font-size: 0.78rem; white-space: pre-wrap;
}
.bug-comment { padding: 0.5rem 0; border-bottom: 1px solid var(--border-soft); }
.bug-comment__head {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.15rem;
}
.bug-comment__head .muted { margin-left: 0.35rem; }
.bug-history { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.bug-mention-menu {
  position: relative; z-index: 20; margin: 0.35rem 0;
  border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08); max-height: 220px; overflow: auto;
}
.bug-mention-item {
  display: flex; gap: 0.5rem; align-items: baseline; width: 100%;
  border: 0; background: transparent; text-align: left; padding: 0.45rem 0.65rem; cursor: pointer;
}
.bug-mention-item:hover, .bug-mention-item.is-active { background: var(--warn-wash); }

.ui-panel, .plan-panel {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow);
}
.ui-panel--pad { padding: var(--space-4) 1.15rem; overflow: visible; }
.ui-panel + .ui-panel, .ui-panel + .card, .card + .ui-panel { margin-top: var(--space-4); }

.ui-table, .plan-table { width: 100%; border-collapse: collapse; font-size: var(--text-body); }
.ui-table th, .plan-table th {
  text-align: left; padding: 0.7rem 1rem; background: var(--surface-subtle); color: var(--muted);
  font-weight: 600; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
.ui-table td, .plan-table td {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle;
}
.ui-table tr:hover td, .plan-table tr:hover td { background: var(--surface-muted); }
.ui-table__name, .plan-table__name { font-weight: 600; color: var(--text-strong); margin-right: 0.4rem; }
.ui-table__ops, .plan-table__ops {
  display: flex; gap: 0.4rem; justify-content: flex-end; align-items: center; white-space: nowrap;
}

/* Einheitliche Tags: .ui-chip / .badge / Legacy .plan-chip */
.ui-chip, .plan-chip, .badge {
  display: inline-block; font-size: 0.7rem; font-weight: 650; padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm); background: var(--border-soft); color: var(--muted); vertical-align: middle;
}
.ui-chip--quiet, .plan-chip--quiet { background: var(--surface-subtle); color: var(--text-faint); font-weight: 500; }
.ui-chip--warn, .badge-warn { background: var(--warn-wash); color: var(--warn); }
.ui-chip--alert, .badge-fail { background: var(--fail-wash); color: var(--fail); }
.ui-chip--ok, .badge-ok { background: var(--ok-wash); color: var(--ok); }
.ui-chip--info, .badge-info { background: var(--info-wash); color: var(--info); }
.ui-chip--dynamic {
  background: color-mix(in srgb, var(--status-color, var(--text-faint)) 22%, var(--surface));
  color: var(--text-strong);
  border: 1px solid color-mix(in srgb, var(--status-color, var(--text-faint)) 32%, var(--surface));
}

.ui-status, .plan-status {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 650; color: var(--text-on-accent);
}
.ui-status--open, .plan-status--open { background: var(--accent-soft); }
.ui-status--done, .ui-status--pass, .plan-status--done { background: var(--ok); }
.ui-status--warn { background: var(--warn); }
.ui-status--muted { background: var(--text-faint); }
.ui-status--fail { background: var(--fail); }

.struct-tree__label {
  font-size: var(--text-label); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); margin-right: auto; font-weight: 700;
}

.ui-seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.ui-seg a, .ui-seg button {
  border: 0; background: var(--surface-subtle); color: var(--muted); padding: 0.45rem 0.85rem;
  font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer;
  box-shadow: inset -1px 0 0 var(--border-strong);
}
.ui-seg > :last-child { box-shadow: none; }
.ui-seg a.is-active, .ui-seg button.is-active,
.ui-seg a.btn-primary, .ui-seg .btn-primary {
  background: var(--accent); color: var(--text-on-accent); box-shadow: none; border: 0;
}
.ui-seg a .ui-chip {
  margin-left: 0.25rem; vertical-align: middle;
}
.ui-seg a.is-active .ui-chip, .ui-seg a.btn-primary .ui-chip {
  background: rgba(255,255,255,0.22); color: var(--text-on-accent);
}
.ui-seg a:hover:not(.is-active):not(.btn-primary),
.ui-seg button:hover:not(.is-active) { background: var(--border-soft); text-decoration: none; }

.ui-stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem; margin-bottom: 1rem;
}
.ui-stat {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 0.85rem 1rem; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ui-stat__label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.ui-stat__value { font-size: 1.45rem; font-weight: 700; color: var(--text-strong); line-height: 1.1; }

.ui-empty {
  padding: 2rem 1.25rem; text-align: center; color: var(--muted);
  background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: 6px; font-size: 0.92rem;
}

.plan-wizard__top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.plan-wizard__top-left { display: flex; align-items: center; gap: 0.75rem; }
.plan-wizard__top-right { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
.plan-wizard__title { margin: 0; font-size: 1.2rem; font-weight: 700; }
.ui-back, .plan-back {
  display: inline-flex; align-items: center; gap: 0.3rem;
  color: var(--muted); font-size: 0.9rem; text-decoration: none;
}
.ui-back:hover, .plan-back:hover { color: var(--accent); }

.plan-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 0.85rem;
}
.plan-tabs__form { display: contents; }
.plan-tab {
  width: 100%; border: 0; background: var(--surface-subtle);
  color: var(--muted); padding: 0.7rem 0.5rem; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  box-shadow: inset -1px 0 0 var(--border-strong);
}
.plan-tabs > :last-child .plan-tab,
.plan-tabs > .plan-tab:last-child { box-shadow: none; }
.plan-tab.is-active { background: var(--accent); color: var(--text-on-accent); box-shadow: none; }
.plan-tab.is-done { background: var(--accent-wash); color: var(--accent-hover); }
.plan-tab:hover:not(.is-active) { background: var(--border-soft); }

.plan-split {
  display: grid; grid-template-columns: minmax(240px, 34%) 1fr; gap: 0;
  border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; background: var(--surface);
  min-height: 420px;
}
@media (max-width: 900px) { .plan-split { grid-template-columns: 1fr; } }

.plan-struct { border-right: 1px solid var(--border-soft); background: var(--surface); display: flex; flex-direction: column; }
.plan-struct__head {
  padding: 0.65rem 0.9rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--border-soft);
}
.plan-struct__body { padding: 0.5rem 0.4rem; flex: 1; overflow: auto; }
.plan-struct__hint { margin: 0; padding: 0.65rem 0.9rem; font-size: 0.78rem; color: var(--text-faint); border-top: 1px solid var(--border-soft); }

.plan-main { padding: 1rem 1.15rem 1.25rem; position: relative; background: var(--surface); }
.plan-main__next { position: absolute; top: 0.85rem; right: 1rem; }
.plan-main__intro { color: var(--muted); font-size: 0.92rem; margin: 0 0 1rem; max-width: 36rem; padding-right: 9rem; }
.plan-main__selected { margin: 0 0 0.85rem; font-size: 0.95rem; }
.plan-main__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.plan-empty, .ui-empty {
  margin-top: 0; padding: 2rem 1.25rem; text-align: center; color: var(--muted);
  background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: 6px; font-size: 0.92rem;
}
.plan-fill-block { margin-bottom: 1.25rem; }
.plan-fill-block h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.plan-main__heading {
  margin: 0 0 0.85rem; font-size: 1.05rem; font-weight: 700; color: var(--text-strong);
  padding-right: 9rem;
}
.plan-main__footer-actions {
  display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 1.1rem; padding-top: 0.85rem;
  border-top: 1px solid var(--border-soft);
}
.plan-case-list {
  list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden;
}
.plan-case-list__item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-soft); font-size: 0.9rem;
}
.plan-case-list__item:last-child { border-bottom: 0; }
.plan-case-list__title { flex: 1; min-width: 0; color: var(--text-strong); font-weight: 500; }
.plan-case-list__ops { display: inline-flex; gap: 0.15rem; margin-left: auto; }
.plan-case-list__empty { padding: 1.25rem 0.85rem; list-style: none; }

.plan-badge {
  flex: 0 0 auto; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 0.12rem 0.35rem; border-radius: 3px; line-height: 1.2;
}
.plan-badge--new { background: var(--warn-wash); color: var(--warn); }
.plan-badge--exist { background: var(--surface-subtle); color: var(--muted); }

.plan-done-btn {
  width: 1.15rem; height: 1.15rem; flex: 0 0 auto; padding: 0; margin: 0;
  border: 1.5px solid #86efac; border-radius: 3px; background: var(--surface);
  color: var(--text-on-accent); font-size: 0.72rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.plan-done-btn:hover { border-color: var(--ok); background: var(--ok-wash); }
.plan-done-btn.is-checked {
  background: #22c55e; border-color: var(--ok); color: var(--text-on-accent);
}

.struct-tree__trail {
  display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto; flex-shrink: 0;
}
.struct-tree__count {
  min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem;
  border-radius: 999px; background: var(--surface-subtle); color: var(--muted);
  font-size: 0.7rem; font-weight: 650; display: inline-flex; align-items: center; justify-content: center;
}
.struct-case__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Planung: grüne Auswahl / erledigt (Twist-Design ist Basis für alle Trees) */
.struct-tree--plan .struct-tree__item.is-selected > .struct-tree__row {
  background: var(--ok-wash);
}
.struct-tree--plan .struct-tree__item.is-done > .struct-tree__row .struct-tree__title {
  color: var(--muted);
}
.struct-tree--plan .struct-tree--cases { padding-left: 1.15rem; margin: 0.05rem 0 0.2rem; }
.struct-tree--plan .struct-case {
  padding: 0.18rem 0.25rem; gap: 0.4rem; font-size: 0.82rem;
}

.modal--pick { width: min(640px, 96vw); max-height: min(88vh, 780px); display: flex; flex-direction: column; }
.modal--pick .modal-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.plan-pick-search { width: 100%; margin-bottom: 0.45rem; }
.plan-pick-toolbar { display: flex; gap: 0.85rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.btn-link {
  border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 0.85rem;
  font-weight: 600; cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.plan-pick-tree {
  flex: 1; overflow: auto; max-height: min(48vh, 420px); padding: 0.45rem 0.5rem;
}
.plan-pick-case__lab {
  display: flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 400; cursor: pointer; min-width: 0;
}
.plan-pick-case__lab input { flex: 0 0 auto; margin: 0; accent-color: var(--accent); }
.plan-pick-case.is-linked { opacity: 0.55; }
.plan-pick-case.is-filtered-out { display: none; }
.plan-pick-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.plan-pick-footer__btns { display: inline-flex; gap: 0.45rem; }

.plan-desc-panel {
  margin: 0 0 0.85rem; border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--surface); overflow: hidden;
}
.plan-desc-panel__head {
  padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--border-soft);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-faint);
}
.plan-desc-view {
  min-height: auto; padding: 0.75rem 0.9rem; border: 0; background: transparent;
  box-shadow: none; line-height: 1.5; color: var(--text);
}
.plan-desc-view p { margin: 0 0 0.55rem; }
.plan-desc-view p:last-child { margin-bottom: 0; }
.plan-desc-modes { margin-bottom: 0.75rem; }
.plan-desc-pane[hidden] { display: none !important; }
.plan-desc-pane .rte-toolbar { margin-bottom: 0.35rem; }

.plan-target-tree { max-height: min(420px, 55vh); overflow: auto; }
.plan-target-pick {
  display: flex; align-items: center; gap: 0.4rem; min-width: 0; cursor: pointer;
  margin: 0; font-weight: inherit; flex: 1 1 auto;
}
.plan-target-pick input[type=radio] {
  position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}
.plan-target-tree .struct-tree__item:has(> .struct-tree__row .plan-target-pick input:checked) > .struct-tree__row,
.plan-target-tree .struct-tree__item.is-selected > .struct-tree__row {
  background: var(--ok-wash);
}
.plan-tc-preview__meta { margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--muted); }
.plan-tc-preview__block { margin: 0 0 0.85rem; }
.plan-tc-preview__block h4 {
  margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-faint);
}
.plan-tc-preview__block .rte-box,
.plan-tc-preview__text {
  padding: 0.55rem 0.7rem; border: 1px solid var(--border-soft); border-radius: 6px;
  background: var(--surface-muted); font-size: 0.9rem; color: var(--text); line-height: 1.45;
}
.plan-tc-preview__steps { margin: 0; padding: 0; list-style: none; }
.plan-tc-preview__steps li {
  padding: 0.55rem 0.7rem; border: 1px solid var(--border-soft); border-radius: 6px;
  background: var(--surface); margin-bottom: 0.4rem; font-size: 0.88rem;
}
.plan-tc-preview__steps .muted { font-size: 0.8rem; }
.plan-checklist {
  max-height: 220px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 6px; padding: 0.5rem 0.65rem;
}
.plan-checklist label { font-weight: 400; display: block; margin: 0.2rem 0; }

.struct-tree { list-style: none; margin: 0; padding: 0 0 0 0.7rem; }
.struct-tree--root { padding-left: 0; }
.struct-tree--cases { padding-left: 1.15rem; margin: 0.05rem 0 0.2rem; }
.struct-tree__item { margin: 0; }
.struct-tree__row {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.22rem 0.35rem; border-radius: 3px; width: 100%;
}
.struct-tree__item.is-selected > .struct-tree__row { background: var(--accent-wash); }
.struct-tree__item.is-collapsed > .struct-tree__kids { display: none; }
.struct-tree__link {
  display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text-strong);
  text-decoration: none; min-width: 0; max-width: none; font-size: 0.86rem;
  flex: 1 1 auto;
}
.struct-tree__twist-btn {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  width: 1.1rem; height: 1.1rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; flex-shrink: 0;
}
.struct-tree__twist-btn:hover { background: var(--border-soft); }
/* Dreieck-Chevron (Planungs-Design) für alle Trees */
.struct-tree__twist {
  width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent var(--text-faint);
  display: inline-block; transition: transform 0.12s ease;
  font-size: 0; line-height: 0; text-indent: -9999px; overflow: hidden;
}
.struct-tree__item:not(.is-collapsed) > .struct-tree__row .struct-tree__twist:not(.struct-tree__twist--leaf) {
  transform: rotate(90deg);
}
.struct-tree__twist--leaf {
  width: 0.55rem; height: 0.55rem; border: 0; border-radius: 50%;
  background: var(--border-strong); transform: none !important;
  text-indent: 0; overflow: hidden;
}
.struct-tree__title { font-weight: 500; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.struct-tree__ops {
  display: inline-flex; gap: 0.1rem; align-items: center; justify-content: flex-start;
  flex-shrink: 0; opacity: 1;
}
.struct-tree__toolbar {
  display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center;
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-soft); background: var(--surface-muted);
}

.tc-layout, .ka-layout {
  display: grid; grid-template-columns: minmax(240px, 32%) 1fr; gap: 0.85rem; align-items: start;
}
@media (max-width: 900px) { .tc-layout, .ka-layout { grid-template-columns: 1fr; } }
.ka-tree { max-height: calc(100vh - 12rem); overflow: auto; }
.ka-tree__body { padding: 0.65rem 0.75rem; min-height: 280px; }
.ka-tree__empty { padding: 0.5rem; margin: 0; }
.ka-detail { min-height: 280px; }
.ka-detail__meta { margin: 0.2rem 0 0; }
.ui-empty-cell { padding: 1.5rem !important; }
.ka-detail__empty {
  padding: 2rem 1.25rem; text-align: center; color: var(--text-muted);
  font-size: 0.92rem;
}
.ka-detail__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-soft);
  background: var(--surface-muted);
}
.ka-detail__title { margin: 0; font-size: var(--text-title); font-weight: 700; color: var(--text-strong); }
.ka-detail__body { padding: 1rem 1.15rem; }
.ka-detail__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border-soft); }
.tc-cats { max-height: calc(100vh - 12rem); overflow: auto; }
.tc-cat-count {
  margin-left: auto; font-size: 0.75rem; font-weight: 650; color: var(--text-faint);
  min-width: 1.5rem; text-align: right; flex-shrink: 0;
}
.tc-main__meta {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.55rem;
}
.tc-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem;
  padding: 0.65rem 0.85rem; margin-bottom: 0.55rem;
}
.tc-filters__search {
  flex: 1 1 14rem; min-width: 12rem; margin: 0;
}
.tc-filters__check {
  display: inline-flex; align-items: center; gap: 0.4rem; margin: 0;
  font-weight: 600; font-size: 0.88rem; color: var(--text); cursor: pointer;
  white-space: nowrap;
}
.tc-filters__check input { margin: 0; accent-color: var(--accent); }
.tc-case-row.is-filtered-out { display: none; }
.tc-filter-empty[hidden] { display: none !important; }
.struct-op {
  border: 0; background: transparent; color: var(--muted); width: 1.5rem; height: 1.5rem;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; padding: 0;
}
.struct-op:hover { background: var(--border-soft); color: var(--text-strong); }
.struct-op--danger:hover { background: var(--fail-wash); color: var(--fail); }
.struct-case { font-size: 0.82rem; color: var(--muted); padding: 0.12rem 0; display: flex; align-items: center; gap: 0.35rem; }
.struct-case__mark { font-size: 0.68rem; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.04em; }
.fi-file { padding: 0.2rem 0.35rem; border-radius: 4px; align-items: flex-start; }
.fi-file:hover { background: var(--surface-muted); }
.fi-file__main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.1rem; }
.fi-file__name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-strong); text-decoration: none; font-weight: 500;
}
.fi-file__name:hover { color: var(--accent); text-decoration: underline; }
.fi-file__desc {
  font-size: 0.78rem; color: var(--muted); line-height: 1.35; white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fi-file__ops { margin-left: 0.15rem; flex-shrink: 0; align-self: center; }
.fi-cat-pick {
  max-height: 220px; overflow: auto; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.35rem 0.45rem; background: var(--surface-muted);
}
.fi-cat-pick__btn {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0.15rem 0.2rem;
  cursor: pointer; color: inherit; border-radius: 4px; font: inherit;
}
.fi-cat-pick__btn:hover { color: var(--accent); }
.fi-cat-pick__btn.is-active .struct-tree__title { color: var(--accent-hover); font-weight: 650; }

label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--text); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.45rem 0.55rem; font: inherit; background: var(--surface);
}
textarea { min-height: 90px; resize: vertical; }
.form-row { margin-bottom: 0.8rem; }
.form-inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.form-inline > * { flex: 1; min-width: 140px; }

.toast-host {
  position: fixed; top: 1rem; left: 50%; right: auto; z-index: 60;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
  max-width: min(420px, calc(100vw - 2rem));
  width: max-content;
  pointer-events: none;
}
.flash {
  padding: 0.7rem 0.95rem; border-radius: 8px; border: 1px solid;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14); pointer-events: auto;
  animation: toast-in 0.22s ease-out;
}
.flash.toast-out { animation: toast-out 0.2s ease-in forwards; }
.flash-success { background: var(--ok-wash); border-color: var(--ok); color: var(--ok); }
.flash-error { background: var(--fail-wash); border-color: var(--fail); color: var(--fail); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}

.stat { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--text-strong); }
.muted { color: var(--muted); font-size: 0.85rem; }
.toolbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem;
}

.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  z-index: 40; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 8px; width: min(720px, 100%); max-height: 90vh;
  overflow: auto; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.modal--md { width: min(560px, 100%); }
.modal--lg { width: min(880px, 100%); }
.modal--lg .plan-target-tree { max-height: min(360px, 50vh); }
.modal header, .modal footer { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal footer { border-bottom: 0; border-top: 1px solid var(--border); }
.modal .modal-body { padding: 1rem; }

.kanban {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem;
}
@media (max-width: 720px) {
  .kanban {
    display: flex; overflow-x: auto; gap: 0.75rem;
    padding-bottom: 0.35rem; scroll-snap-type: x proximity;
  }
  .kanban-col {
    flex: 0 0 min(78vw, 260px); scroll-snap-align: start;
  }
}
.kanban-col {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: 0.75rem; min-height: 180px; box-shadow: var(--shadow);
}
.kanban-col h3 {
  margin: 0 0 0.65rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-faint);
}
.kanban-col__body { min-height: 4rem; }
.kanban-col.is-drop-target {
  border-color: var(--accent-tint); background: var(--accent-wash);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.kanban-card__title {
  display: block; font-weight: 700; color: var(--text-strong); text-decoration: none; margin-bottom: 0.2rem;
}
.kanban-card__title:hover { color: var(--accent-hover); text-decoration: underline; }
.kanban-card {
  background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: 6px;
  padding: 0.65rem 0.75rem; margin-bottom: 0.5rem; cursor: grab;
}
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-card:hover { border-color: var(--border); background: var(--surface); }
.kanban-card.is-dragging { opacity: 0.45; }

.task-archive {
  margin-top: 1.25rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.task-archive__summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
  font-weight: 650;
  color: var(--text);
  background: var(--surface-muted);
  user-select: none;
}
.task-archive__summary::-webkit-details-marker { display: none; }
.task-archive__summary::before {
  content: '▸';
  display: inline-block;
  width: 1rem;
  color: var(--text-faint);
  transition: transform 0.12s ease;
}
.task-archive[open] > .task-archive__summary {
  border-bottom: 1px solid var(--border-soft);
}
.task-archive[open] > .task-archive__summary::before {
  transform: rotate(90deg);
}
.task-archive__empty {
  margin: 0;
  padding: 0.85rem;
}
.task-archive__toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0.55rem 0.85rem 0.25rem;
  border-bottom: 1px solid var(--border-soft);
}
.task-archive__toolbar form { margin: 0; }
.task-archive__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}
.task-archive__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.85rem;
  padding: 0.45rem 0.85rem;
  border-top: 1px solid var(--surface-subtle);
}
.task-archive__item:first-child { border-top: 0; }
.task-archive__main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  min-width: 0;
  flex: 1 1 12rem;
}
.task-archive__item a {
  font-weight: 650;
  color: var(--text-strong);
  text-decoration: none;
}
.task-archive__item a:hover { color: var(--accent-hover); text-decoration: underline; }
.task-archive__delete { margin: 0; }

.tile { cursor: grab; }
.tile.dragging { opacity: 0.5; }
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--sidebar);
}
.login-card {
  width: min(400px, 92vw); background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); padding: 1.5rem; box-shadow: var(--shadow);
}
.login-card__brand {
  display: flex; justify-content: center; margin: 0 0 0.85rem;
}
.login-card__logo {
  max-height: 64px; max-width: 220px; width: auto; height: auto; object-fit: contain;
}
.login-card__title {
  margin: 0 0 0.25rem; font-size: 1.35rem; font-weight: 700; color: var(--text-strong);
}

.rte-toolbar { display: inline-flex; flex-wrap: wrap; gap: 0.2rem; margin: 0; align-items: center; }
.rte-toolbar__sep {
  width: 1px; height: 1.1rem; background: var(--border-soft); margin: 0 0.15rem; flex: 0 0 auto;
}
.rte-toolbar [data-cmd].is-active,
.rte-toolbar [data-cmd][aria-pressed="true"] {
  background: var(--accent-wash);
  border-color: var(--accent-tint);
  color: var(--accent-hover);
  box-shadow: inset 0 0 0 1px #93c5fd;
}
.rte-toolbar--shared {
  padding: 0.25rem 0.35rem; border: 1px solid var(--border-soft); border-radius: 6px;
  background: var(--surface-muted); opacity: 0.55; transition: opacity 0.15s ease;
}
.rte-toolbar--shared.is-active { opacity: 1; background: var(--surface); border-color: #bfdbfe; }
.rte-box {
  width: 100%; min-height: 52px; border: 1px solid var(--border-soft); border-radius: 6px;
  padding: 0.4rem 0.55rem; background: var(--surface); font: inherit; line-height: 1.4;
  font-size: 0.9rem;
}
.rte-box:focus { outline: 2px solid #bfdbfe; outline-offset: 1px; min-height: 72px; }
.rte-box--meta { min-height: 64px; }
.rte-box h1,
.rte-view h1 { font-size: 1.35rem; font-weight: 700; margin: 0.35rem 0; line-height: 1.25; }
.rte-box h2,
.rte-view h2 { font-size: 1.15rem; font-weight: 700; margin: 0.3rem 0; line-height: 1.3; }
.rte-view p { margin: 0.35rem 0; }
.rte-view ul, .rte-view ol { margin: 0.35rem 0 0.35rem 1.25rem; }
.rte-view li { margin: 0.15rem 0; }
.rte-box s, .rte-box strike, .rte-box del { text-decoration: line-through; }
.rte-box[data-placeholder]:empty::before,
.rte-box[data-placeholder]:has(> br:only-child)::before {
  content: attr(data-placeholder); color: var(--text-faint); pointer-events: none;
}
.rte-box--doc { min-height: 180px; }
.rte-box table,
.rte-view table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
  table-layout: fixed;
}
.rte-box th,
.rte-box td,
.rte-view th,
.rte-view td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  vertical-align: top;
  word-break: break-word;
}
.rte-box th,
.rte-view th {
  background: var(--surface-subtle);
  font-weight: 600;
}
.rte-box img,
.rte-view img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem 0;
}
.rte-box img.is-rte-img-selected {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  cursor: default;
}
.rte-img-resize-handle {
  position: fixed;
  z-index: 80;
  width: 12px;
  height: 12px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 1px #1d4ed8;
  cursor: nwse-resize;
  touch-action: none;
}
.rte-img-resize-handle[hidden] { display: none !important; }
.btn-outline-warn {
  background: var(--surface); border: 1px solid #f59e0b; color: var(--warn);
}
.btn-outline-warn:hover { background: var(--warn-wash); text-decoration: none; }

/* —— Editor shell (test case / block forms) —— */
.editor {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); overflow: hidden;
}
.editor__top {
  display: grid; gap: 0.65rem; padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-soft); background: var(--surface);
}
.editor__title-row {
  display: grid; grid-template-columns: 1fr minmax(160px, 220px) auto;
  gap: 0.65rem; align-items: end;
}
@media (max-width: 720px) {
  .editor__title-row { grid-template-columns: 1fr; }
}
.editor__title-row label { margin-bottom: 0.15rem; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.editor__title-row input[name="title"] {
  font-size: 1.15rem; font-weight: 650; padding: 0.5rem 0.65rem; border-color: var(--border);
}
.editor__chip {
  display: inline-flex; align-items: center; height: 2.1rem; padding: 0 0.55rem;
  border-radius: 6px; background: var(--surface-subtle); color: var(--muted); font-size: 0.78rem; font-weight: 650;
  white-space: nowrap;
}
.editor__complete {
  display: inline-flex; align-items: center; gap: 0.45rem; margin: 0;
  font-weight: 600; color: var(--text); font-size: 0.9rem; cursor: pointer;
}
.editor__complete input { margin: 0; accent-color: var(--ok); }
.editor__complete.is-readonly { cursor: default; opacity: 0.85; }
.editor-section {
  border-bottom: 1px solid var(--border-soft);
}
.editor-section > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem; font-size: 0.78rem; font-weight: 650;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-muted);
}
.editor-section > summary::-webkit-details-marker { display: none; }
.editor-section > summary::before {
  content: '▸'; display: inline-block; width: 0.85rem; color: var(--text-faint);
  transition: transform 0.12s ease;
}
.editor-section[open] > summary::before { transform: rotate(90deg); }
.editor-section__body {
  padding: 0.75rem 1rem 0.9rem; display: grid; gap: 0.65rem;
}
.editor-section__body .form-row { margin-bottom: 0; }
.editor-section__body textarea { min-height: 64px; }
.editor-links {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
@media (max-width: 720px) { .editor-links { grid-template-columns: 1fr; } }
.editor-links__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  flex-wrap: wrap; margin-bottom: 0.35rem;
}
.editor-links__head label { margin: 0; }
.editor-links__tree {
  max-height: 220px; overflow: auto;
  padding: 0.35rem 0.4rem; border: 1px solid var(--border-soft); border-radius: 6px; background: var(--surface-muted);
}
.editor-link-check {
  display: inline-flex !important; align-items: center; gap: 0.4rem;
  font-weight: 400; cursor: pointer; margin: 0; min-width: 0;
}
.editor-link-check input { width: auto; margin: 0; flex: 0 0 auto; }
.editor-link-check .struct-tree__title { font-weight: 500; }
.editor__steps {
  padding: 0.65rem 1rem 1rem;
}
.editor__steps-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.65rem;
  flex-wrap: wrap; margin-bottom: 0.55rem;
}
.editor__steps-head h3,
.editor__steps-foot h3 {
  margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.editor__steps-tools { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.editor__steps-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.65rem;
  flex-wrap: wrap; margin-top: 0.65rem; padding-top: 0.65rem;
  border-top: 1px solid var(--border-soft);
}
.editor__bar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.65rem 1rem; margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.97); border: 1px solid var(--border-soft); border-radius: 8px;
  backdrop-filter: blur(6px); box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}
.editor__bar-left, .editor__bar-right { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.tc-steps { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0; }
.tc-step {
  border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface);
  overflow: hidden; transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.tc-step:hover, .tc-step:focus-within {
  border-color: var(--border); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.tc-step.is-active {
  border-color: var(--accent-tint); box-shadow: 0 0 0 1px #bfdbfe;
}
.tc-step__head {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0.5rem 0.35rem 0.4rem;
  background: var(--surface-muted); border-bottom: 1px solid transparent;
  min-height: 2.1rem;
}
.tc-step:not(.is-collapsed) .tc-step__head { border-bottom-color: var(--surface-subtle); }
.tc-step__twist {
  flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border: 0; background: transparent;
  color: var(--text-faint); cursor: pointer; border-radius: 4px; font-size: 0.7rem; line-height: 1;
  padding: 0;
}
.tc-step__twist:hover { background: var(--border-soft); color: var(--muted); }
.tc-step__label {
  flex: 0 0 auto; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-faint); min-width: 3.6rem;
}
.tc-step__preview {
  display: none; flex: 1; min-width: 0; font-size: 0.85rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-step.is-collapsed .tc-step__preview { display: block; }
.tc-step.is-collapsed .tc-step__body { display: none; }
.tc-step__actions {
  display: inline-flex; gap: 0.15rem; flex-wrap: nowrap; align-items: center;
  margin-left: auto; opacity: 0; pointer-events: none;
  transition: opacity 0.12s ease;
}
.tc-step:hover .tc-step__actions,
.tc-step:focus-within .tc-step__actions,
.tc-step.is-active .tc-step__actions { opacity: 1; pointer-events: auto; }
@media (hover: none) {
  .tc-step__actions { opacity: 1; pointer-events: auto; }
}
.tc-step__body { padding: 0.55rem 0.65rem 0.65rem; }
.tc-step__cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem;
}
@media (max-width: 900px) {
  .tc-step__cols { grid-template-columns: 1fr; }
}
.tc-step__col { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.tc-step__col > label {
  margin: 0; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--text-faint);
}
.tc-step__field-label {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  flex-wrap: wrap; margin-bottom: 0.35rem;
}
.tc-step__field-label label { margin: 0; }

.ver-list { list-style: none; margin: 0; padding: 0; }
.ver-list__item a {
  display: block; padding: 0.55rem 0.65rem; border-radius: 6px;
  color: inherit; text-decoration: none;
}
.ver-list__item a:hover { background: var(--surface-subtle); }
.ver-list__item.is-selected a { background: var(--accent-wash); }
.ver-list__note { font-size: 0.85rem; margin-top: 0.15rem; color: var(--text); }
.diff-old { background: var(--fail-wash); border-radius: 6px; }
.diff-new { background: var(--ok-wash); border-radius: 6px; }
.diff-step { margin-bottom: 0.85rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-soft); }
.diff-step--removed { border-left: 3px solid var(--fail); padding-left: 0.65rem; }
.diff-step--added { border-left: 3px solid var(--ok); padding-left: 0.65rem; }
.diff-step--changed { border-left: 3px solid var(--warn); padding-left: 0.65rem; }
.diff-empty {
  padding: 0.65rem 0.55rem; color: var(--muted); font-size: 0.85rem; font-style: italic;
  border: 1px dashed var(--border-strong); border-radius: 6px; background: var(--surface-muted); margin-top: 0.25rem;
}
.text-diff {
  border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; font-size: 0.9rem; line-height: 1.45;
}
.text-diff__row {
  display: flex; gap: 0.55rem; padding: 0.35rem 0.65rem;
  border-bottom: 1px solid var(--border-soft); align-items: flex-start;
}
.text-diff__row:last-child { border-bottom: 0; }
.text-diff__sign {
  flex: 0 0 1rem; font-weight: 700; font-family: ui-monospace, monospace; text-align: center;
  line-height: 1.45; padding-top: 0.15rem;
}
.text-diff__body {
  flex: 1 1 auto; min-width: 0; word-break: break-word;
}
.text-diff__body.rte-view > :first-child { margin-top: 0; }
.text-diff__body.rte-view > :last-child { margin-bottom: 0; }
.text-diff__row--del { background: var(--fail-wash); }
.text-diff__row--del .text-diff__sign { color: var(--fail); }
.text-diff__row--add { background: var(--ok-wash); }
.text-diff__row--add .text-diff__sign { color: var(--ok); }
.text-diff__row--eq { background: var(--surface); color: var(--text); }
.text-diff-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.5rem;
}
.diff-layout-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-muted);
}
.diff-layout-toggle__btn {
  padding: 0.3rem 0.7rem; font-size: 0.8rem; color: var(--muted); text-decoration: none; border-right: 1px solid var(--border-strong);
}
.diff-layout-toggle__btn:last-child { border-right: 0; }
.diff-layout-toggle__btn:hover { background: var(--border-soft); color: var(--text-strong); }
.diff-layout-toggle__btn.is-active {
  background: var(--surface); color: var(--text-strong); font-weight: 600; box-shadow: inset 0 0 0 1px var(--text-faint);
}
.text-diff--side { overflow-x: auto; }
.text-diff__side-head,
.text-diff__pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-bottom: 1px solid var(--border-soft);
}
.text-diff__side-head { background: var(--surface-muted); border-bottom: 1px solid var(--border-soft); }
.text-diff__side-label {
  padding: 0.4rem 0.65rem; font-size: 0.8rem; font-weight: 600; color: var(--muted);
}
.text-diff__side-label + .text-diff__side-label { border-left: 1px solid var(--border-soft); }
.text-diff__pair:last-child { border-bottom: 0; }
.text-diff__cell {
  padding: 0.35rem 0.65rem; min-width: 0; word-break: break-word;
}
.text-diff__cell + .text-diff__cell { border-left: 1px solid var(--border-soft); }
.text-diff__cell--del { background: var(--fail-wash); }
.text-diff__cell--add { background: var(--ok-wash); }
.text-diff__cell--empty {
  background: var(--surface-muted); display: flex; align-items: flex-start; color: var(--text-faint);
}
.text-diff__pair--eq .text-diff__cell { background: var(--surface); color: var(--text); }
@media (max-width: 720px) {
  .text-diff__side-head,
  .text-diff__pair { grid-template-columns: 1fr; }
  .text-diff__cell + .text-diff__cell,
  .text-diff__side-label + .text-diff__side-label { border-left: 0; border-top: 1px solid var(--border-soft); }
}
.diff-mark {
  border-radius: 3px; padding: 0 0.15em; font-weight: 650;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.diff-mark--del {
  background: #fca5a5; color: #7f1d1d; text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.diff-mark--add {
  background: #86efac; color: #14532d; box-shadow: inset 0 -2px 0 #16a34a;
}
.text-diff__pair--chg {
  outline: 2px solid #f59e0b; outline-offset: -2px;
  background: var(--warn-wash);
}
.text-diff__pair--chg .text-diff__cell--del { background: var(--fail-wash); }
.text-diff__pair--chg .text-diff__cell--add { background: var(--ok-wash); }
.diff-fields { display: flex; flex-direction: column; gap: 0.85rem; }
.diff-field__label { font-weight: 600; margin-bottom: 0.35rem; color: var(--text-strong); }
.block-pick-tree { max-height: 360px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 6px; padding: 0.35rem; }
button.struct-tree__link.block-pick {
  border: 0; background: transparent; cursor: pointer; text-align: left; padding: 0; font: inherit;
}
button.struct-tree__link.block-pick:hover .struct-tree__title { color: var(--accent); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 0.35rem; }

.workflow-viz { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.workflow-node {
  border: 1px solid var(--border-soft); padding: 0.35rem 0.65rem; border-radius: 999px;
  background: var(--surface-muted); font-size: 0.85rem; font-weight: 600; color: var(--text);
}

/* Settings Shell (2-Spalten) */
.settings-shell {
  display: grid;
  grid-template-columns: minmax(200px, 15rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}
@media (max-width: 900px) {
  .settings-shell { grid-template-columns: 1fr; }
}
.settings-nav {
  padding: 0;
  position: sticky;
  top: 0.75rem;
  overflow: hidden;
}
.settings-nav__head {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.settings-nav__list {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0;
  max-height: calc(100vh - 8rem);
  overflow: auto;
}
@media (max-width: 900px) {
  .settings-nav { position: static; }
  .settings-nav__list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-height: none;
    padding: 0.35rem;
    gap: 0.25rem;
  }
}
.settings-nav__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.settings-nav__item:hover { background: var(--surface-muted); }
.settings-nav__item.is-active {
  background: var(--accent-wash);
  border-left-color: var(--accent);
  color: var(--accent-hover);
}
@media (max-width: 900px) {
  .settings-nav__item {
    flex: 0 0 auto;
    width: auto;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
  }
  .settings-nav__item.is-active {
    border-bottom-color: var(--accent);
  }
  .settings-nav__hint { display: none; }
}
.settings-nav__label { font-size: 0.9rem; font-weight: 600; }
.settings-nav__hint { font-size: 0.75rem; color: var(--text-faint); font-weight: 400; }
.settings-nav__item.is-active .settings-nav__hint { color: var(--muted); }
a.settings-nav__item--link {
  text-decoration: none; color: inherit; box-sizing: border-box;
}
a.settings-nav__item--link:hover { text-decoration: none; }
.settings-main { min-width: 0; }
.settings-panel[hidden] { display: none !important; }
.settings-panel.is-active { display: block; }

/* Settings Branding */
.settings-brand__sep {
  border: 0; border-top: 1px solid var(--border-soft); margin: 1.25rem 0 1rem;
}
.settings-brand__title { margin: 0 0 0.35rem; font-size: 1rem; }
.settings-brand__preview {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 0.75rem; background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: 8px;
}
.settings-brand__preview img {
  max-height: 72px; max-width: 240px; width: auto; height: auto; object-fit: contain;
}

/* Task checklist */
.task-checklist { margin-top: 1.25rem; }
.task-checklist__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.task-checklist__item {
  display: flex; align-items: flex-start; gap: 0.35rem;
  padding: 0.35rem 0.4rem; border-radius: 6px; background: var(--surface-muted);
}
.task-checklist__item.is-done .task-checklist__label {
  text-decoration: line-through; color: var(--muted);
}
.task-checklist__toggle { flex: 1; min-width: 0; }
.task-checklist__check {
  display: flex; align-items: flex-start; gap: 0.5rem; width: 100%;
  border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; font: inherit;
}
.task-checklist__box {
  flex: 0 0 1.15rem; width: 1.15rem; height: 1.15rem; margin-top: 0.1rem;
  border: 1.5px solid var(--text-faint); border-radius: 4px; background: var(--surface);
  display: inline-grid; place-items: center; font-size: 0.75rem; color: #0f766e; font-weight: 700;
}
.task-checklist__item.is-done .task-checklist__box {
  border-color: var(--ok); background: var(--ok-wash);
}
.task-checklist__label { flex: 1; min-width: 0; line-height: 1.35; word-break: break-word; }
.task-checklist__add {
  display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.65rem; align-items: center;
}
.task-checklist__add input[type="text"] { flex: 1; min-width: 10rem; }

/* Settings Allgemein */
.settings-general__nums {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem;
}
@media (max-width: 640px) { .settings-general__nums { grid-template-columns: 1fr; } }
.settings-biz-hours {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: end; margin-bottom: 0.55rem;
}
.settings-biz-hours__time {
  display: flex; flex-direction: column; gap: 0.25rem; font-weight: 650; font-size: 0.85rem; color: var(--muted);
}
.settings-biz-hours__time input { font-weight: 500; min-width: 8rem; }
.settings-biz-days {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.settings-biz-days__opt {
  display: inline-flex; align-items: center; gap: 0.3rem; margin: 0;
  padding: 0.25rem 0.55rem; border: 1px solid var(--border-soft); border-radius: 6px;
  background: var(--surface-muted); font-weight: 650; font-size: 0.82rem; cursor: pointer;
}
.settings-biz-days__opt:has(input:checked) {
  background: var(--accent-wash); border-color: var(--accent-tint); color: var(--accent-hover);
}
.settings-choice { display: inline-flex; }
.settings-choice__opt {
  display: inline-flex; align-items: center; margin: 0; cursor: pointer;
  border: 0; background: var(--surface-subtle); color: var(--muted); padding: 0.45rem 0.85rem;
  font-size: 0.85rem; font-weight: 600; box-shadow: inset -1px 0 0 var(--border-strong);
}
.settings-choice__opt:last-child { box-shadow: none; }
.settings-choice__opt input { position: absolute; opacity: 0; pointer-events: none; }
.settings-choice__opt:hover { background: var(--border-soft); }
.settings-choice__opt.is-active {
  background: var(--accent); color: var(--text-on-accent); box-shadow: none;
}

/* Rollen */
.role-color {
  display: inline-flex; align-items: center; gap: 0.45rem;
}
.role-color__swatch {
  width: 1.35rem; height: 1.35rem; flex: 0 0 auto; border-radius: 50%;
  background: var(--role-color, var(--muted)); border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.role-color__value {
  color: var(--muted); font-family: var(--mono); font-size: 0.78rem;
}
.role-form__main {
  display: grid; grid-template-columns: minmax(0, 1fr) 5rem; gap: 0.85rem;
  align-items: end;
}
.role-color-picker {
  width: 100%; height: 2.25rem; padding: 0.15rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.role-color-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.role-color-picker::-webkit-color-swatch { border: 0; border-radius: 4px; }
.role-color-picker::-moz-color-swatch { border: 0; border-radius: 4px; }
.role-permissions {
  margin: 0.25rem 0 0; padding: 0.75rem 0.85rem 0.85rem;
  border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface-muted);
}
.role-permissions legend {
  padding: 0 0.3rem; color: var(--muted); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.role-permissions__grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem;
}
.role-permissions__group { min-width: 0; }
.role-permissions__group strong {
  display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--text-strong);
}
.role-permissions__group label {
  display: flex; align-items: flex-start; gap: 0.35rem; margin: 0.25rem 0;
  font-weight: 400; line-height: 1.35;
}
.role-permissions__group input { flex: 0 0 auto; margin-top: 0.15rem; }
@media (max-width: 720px) {
  .role-permissions__grid { grid-template-columns: 1fr; }
}

/* Rechte-Preview-Matrix */
.rights-matrix__head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 0.75rem 1rem; margin-bottom: 0.85rem;
}
.rights-matrix__title { margin: 0; font-size: 1.05rem; }
.rights-matrix__filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  max-width: 100%;
}
.rights-matrix__chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin: 0; padding: 0.28rem 0.55rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 0.78rem; font-weight: 600; color: var(--text); cursor: pointer;
  user-select: none;
}
.rights-matrix__chip input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.rights-matrix__chip:hover { border-color: var(--text-faint); }
.rights-matrix__chip.is-active {
  border-color: var(--accent-tint); background: var(--accent-wash); color: var(--accent-hover);
}
button.rights-matrix__chip { font: inherit; }
.rights-matrix__chip-swatch {
  width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--role-color, var(--text-faint)); flex: 0 0 auto;
}
.rights-matrix__scroll {
  overflow: auto; max-height: min(70vh, 42rem);
  border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--surface);
}
.rights-matrix__table {
  border-collapse: separate; border-spacing: 0;
  width: max-content; /* nicht 100% — sonst bläht die Recht-Spalte auf */
  font-size: 0.82rem;
  table-layout: fixed;
}
.rights-matrix__table th,
.rights-matrix__table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
  box-sizing: border-box;
}
.rights-matrix__table [data-role-col].is-col-off {
  display: none !important;
}
.rights-matrix__perm {
  position: sticky; left: 0; z-index: 2;
  width: 13rem; min-width: 13rem; max-width: 13rem;
  background: var(--surface); text-align: left; font-weight: 500;
  box-shadow: 4px 0 8px -6px rgba(15, 23, 42, 0.25);
}
.rights-matrix__table thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface-muted); font-weight: 650;
}
.rights-matrix__table thead th.rights-matrix__perm { z-index: 4; background: var(--surface-muted); }
.rights-matrix__role {
  text-align: center;
  width: 6.25rem; min-width: 6.25rem; max-width: 6.25rem;
}
.rights-matrix__role.is-focus,
.rights-matrix__cell.is-focus { background: var(--accent-wash); }
.rights-matrix__role-name {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 5.5rem; margin: 0 auto;
}
.rights-matrix__swatch {
  display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 999px;
  background: var(--role-color, var(--text-faint)); margin-bottom: 0.15rem;
}
.rights-matrix__badge {
  display: inline-block; margin-top: 0.15rem; font-size: 0.68rem; font-weight: 650;
  color: var(--accent-hover); background: var(--accent-wash); border-radius: 4px; padding: 0.05rem 0.3rem;
}
.rights-matrix__mod th,
.rights-matrix__mod-label {
  background: var(--surface-subtle); text-align: left; font-size: 0.75rem; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--muted); position: sticky; left: 0; z-index: 1;
}
.rights-matrix__label {
  display: block; white-space: normal; overflow-wrap: anywhere; line-height: 1.25;
}
.rights-matrix__code {
  display: block; font-size: 0.72rem; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rights-matrix__cell {
  text-align: center;
  border-left: 1px solid var(--border-soft);
}
.rights-matrix__cell.is-on { color: var(--ok); font-weight: 700; }
.rights-matrix__cell.is-off { color: var(--text-faint); }
.rights-matrix__mark { font-size: 0.95rem; line-height: 1; }
/* Zeilenführung: Hover über ganze Datenzeile */
.rights-matrix__table tbody tr:not(.rights-matrix__mod):hover > .rights-matrix__perm,
.rights-matrix__table tbody tr:not(.rights-matrix__mod):hover > .rights-matrix__cell:not(.is-col-off) {
  background: var(--surface-subtle);
}
.rights-matrix__table tbody tr:not(.rights-matrix__mod):hover > .rights-matrix__cell.is-focus:not(.is-col-off) {
  background: var(--accent-wash);
}

/* Bug-Workflow Settings */
.wf-card h3 { margin-bottom: 0.35rem; }
.wf-layout {
  display: grid; grid-template-columns: minmax(240px, 32%) 1fr; gap: 0.85rem; margin-top: 0.75rem;
}
@media (max-width: 900px) { .wf-layout { grid-template-columns: 1fr; } }
.wf-panel {
  border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-muted); padding: 0.75rem 0.85rem;
}
.wf-panel--matrix { background: linear-gradient(165deg, var(--surface-muted) 0%, var(--border-soft) 100%); }
.wf-panel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  margin-bottom: 0.55rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border-soft);
}
.wf-status-list, .wf-trans-list, .wf-trans-group__tos { list-style: none; margin: 0; padding: 0; }
.wf-status {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.45rem 0.4rem; margin: 0.2rem 0; border-radius: 8px;
  border: 1px solid transparent; background: var(--surface); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.wf-status-list.is-sortable .wf-status { cursor: grab; }
.wf-status.is-dragging {
  opacity: 0.55; cursor: grabbing; border-color: var(--accent-tint);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18); transform: scale(1.01);
}
.wf-status.is-drop-target { border-color: #bfdbfe; background: var(--accent-wash); }
.wf-status__grip {
  flex: 0 0 auto; width: 1rem; color: var(--text-faint); font-size: 0.7rem; letter-spacing: -0.12em;
  line-height: 1; user-select: none; cursor: grab;
}
.wf-status__name { font-weight: 600; color: var(--text-strong); }
.wf-status__del { margin-left: auto; }
.wf-status__color-form {
  display: inline-flex; align-items: center; flex: 0 0 auto; margin: 0;
}
.wf-status__color {
  width: 1.65rem; height: 1.65rem; padding: 0; border: 1px solid var(--border);
  border-radius: 999px; background: transparent; cursor: pointer;
  flex: 0 0 auto;
}
.wf-status__color::-webkit-color-swatch-wrapper { padding: 2px; }
.wf-status__color::-webkit-color-swatch { border: none; border-radius: 999px; }
.wf-status__color::-moz-color-swatch { border: none; border-radius: 999px; }
.wf-add { margin-top: 0.75rem; padding-top: 0.65rem; border-top: 1px dashed var(--border-soft); align-items: center; }
.wf-add > * { flex: 1 1 auto; min-width: 0; }
.wf-add .btn { flex: 0 0 auto; }
.wf-hint { margin: 0 0 0.65rem; font-size: 0.82rem; line-height: 1.4; }

.wf-matrix-wrap {
  overflow: auto; max-width: 100%;
  border: 1px solid var(--border); border-radius: 12px;
  background:
    radial-gradient(circle at 12% 0%, rgba(59, 130, 246, 0.07), transparent 42%),
    radial-gradient(circle at 88% 100%, rgba(14, 165, 233, 0.06), transparent 40%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 24px rgba(15, 23, 42, 0.05);
}
.wf-matrix {
  border-collapse: separate; border-spacing: 0.35rem;
  min-width: 100%; font-size: 0.78rem; padding: 0.35rem;
}
.wf-matrix th, .wf-matrix td { padding: 0; vertical-align: middle; }
.wf-matrix__corner {
  position: sticky; left: 0; z-index: 2;
  background: transparent; min-width: 6.5rem; height: 3.4rem;
}
.wf-matrix__axes {
  position: relative; display: block; width: 4.6rem; height: 2.6rem; margin: 0.35rem auto 0 0.35rem;
}
.wf-matrix__axis {
  position: absolute; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.wf-matrix__axis--to { top: 0; right: 0; }
.wf-matrix__axis--from { bottom: 0; left: 0; }
.wf-matrix__axes::after {
  content: ""; position: absolute; left: 0.15rem; top: 0.35rem; right: 0.55rem; bottom: 0.55rem;
  border-top: 1.5px solid var(--border-strong); border-left: 1.5px solid var(--border-strong);
  border-radius: 2px 0 0 0;
}
.wf-matrix__col, .wf-matrix__row {
  background: transparent; font-weight: 600; color: var(--text);
}
.wf-matrix__col { text-align: center; min-width: 4.6rem; max-width: 6.2rem; }
.wf-matrix__row {
  position: sticky; left: 0; z-index: 1; text-align: left; white-space: nowrap;
  min-width: 7.5rem; background: linear-gradient(90deg, var(--surface) 70%, rgba(255, 255, 255, 0));
}
.wf-matrix__pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  max-width: 100%; padding: 0.28rem 0.45rem; border-radius: 999px;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--st, var(--text-faint)) 35%, var(--border-soft));
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.wf-matrix__col .wf-matrix__pill {
  flex-direction: column; gap: 0.2rem; border-radius: 10px; padding: 0.4rem 0.35rem;
  border-top: 3px solid var(--st, var(--text-faint));
}
.wf-matrix__row .wf-matrix__pill { border-left: 3px solid var(--st, var(--text-faint)); }
.wf-matrix__label {
  display: inline-block; max-width: 5.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.wf-matrix__col .wf-matrix__label { max-width: 4.4rem; font-size: 0.72rem; }
.wf-matrix__cell {
  text-align: center; width: 3.1rem; height: 3.1rem;
  border-radius: 10px; background: rgba(248, 250, 252, 0.9);
  border: 1px dashed var(--border-soft);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.wf-matrix__cell.is-self {
  background:
    repeating-linear-gradient(-45deg, var(--surface-subtle), var(--surface-subtle) 3px, var(--border-soft) 3px, var(--border-soft) 6px);
  border-style: solid; border-color: var(--border-soft); opacity: 0.7;
}
.wf-matrix__cell.is-on {
  background: color-mix(in srgb, var(--from, #3b82f6) 10%, var(--surface));
  border-style: solid;
  border-color: color-mix(in srgb, var(--to, #2563eb) 45%, #bfdbfe);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--from, #3b82f6) 18%, transparent),
              0 4px 10px color-mix(in srgb, var(--to, #2563eb) 16%, transparent);
}
.wf-matrix__na { display: block; width: 100%; height: 3.1rem; }
.wf-matrix__btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 3.1rem; margin: 0; padding: 0; border: 0;
  background: transparent; cursor: pointer; color: var(--text-faint);
  border-radius: 9px; transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.wf-matrix__plus {
  opacity: 0; font-size: 1rem; font-weight: 600; color: var(--muted);
  transition: opacity 0.12s ease;
}
.wf-matrix__btn:hover { background: rgba(59, 130, 246, 0.08); color: var(--accent-hover); }
.wf-matrix__btn:hover .wf-matrix__plus { opacity: 1; }
.wf-matrix__btn.is-on { color: var(--accent-hover); }
.wf-matrix__btn.is-on:hover {
  background: color-mix(in srgb, #ef4444 12%, transparent);
}
.wf-matrix__btn.is-on:hover .wf-matrix__edge {
  filter: grayscale(0.2) brightness(0.95);
  transform: scale(0.92);
}
.wf-matrix__edge {
  display: block; width: 1.55rem; height: 1.55rem; border-radius: 50%;
  background:
    linear-gradient(135deg, var(--from, #3b82f6), var(--to, #0ea5e9));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 2px 6px rgba(15, 23, 42, 0.18);
  position: relative; transition: transform 0.12s ease, filter 0.12s ease;
}
.wf-matrix__edge::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 0.42rem; height: 0.42rem; border-top: 2px solid var(--surface); border-right: 2px solid var(--surface);
  transform: translate(-65%, -50%) rotate(45deg);
}
.wf-matrix form { margin: 0; display: block; height: 100%; }
.tree ul { list-style: none; padding-left: 1rem; margin: 0.35rem 0; }
.tree > ul { padding-left: 0; }
.tree li { padding: 0.25rem 0; }

/* —— Test-Dashboard —— */
.td-layout {
  display: grid; grid-template-columns: minmax(220px, 28%) 1fr; gap: 0.85rem; align-items: start;
}
@media (max-width: 960px) { .td-layout { grid-template-columns: 1fr; } }
.td-sidebar { overflow: hidden; }
.td-sidebar__search { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border-soft); }
.td-sidebar__search input { width: 100%; }
.td-sidebar__nav { max-height: calc(100vh - 14rem); overflow: auto; padding: 0.35rem 0; }
.td-sidebar__row {
  display: flex; align-items: stretch; border-left: 3px solid transparent;
}
/* display:flex überschreibt sonst UA-[hidden] → Livesuche wirkte nicht */
.td-sidebar__row[hidden] { display: none !important; }
.td-sidebar__row:hover { background: var(--surface-muted); }
.td-sidebar__row.is-active {
  background: var(--accent-wash); border-left-color: var(--accent); color: var(--accent-hover); font-weight: 600;
}
.td-sidebar__item {
  display: flex; align-items: center; gap: 0.5rem; justify-content: space-between;
  flex: 1; min-width: 0; padding: 0.55rem 0.35rem 0.55rem 0.85rem; color: inherit; text-decoration: none;
}
.td-sidebar__item:hover { text-decoration: none; }
.td-sidebar__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sidebar__badges { display: inline-flex; gap: 0.25rem; flex-shrink: 0; }
.td-info-btn {
  flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; margin: 0 0.45rem 0 0; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.td-info-btn:hover { background: var(--border-soft); color: var(--accent-hover); }
.td-plan__title-row {
  display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0;
}
.td-plan__title-row .td-info-btn { margin: 0; }
.td-plan-modal__title { margin: 0 0 0.85rem; font-size: 1.1rem; color: var(--text-strong); }
.td-plan-modal__label {
  margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-faint);
}
.td-briefing { width: 100%; }
.td-briefing__block { margin-bottom: 1.15rem; }
.td-briefing__label {
  margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-faint);
}
.td-briefing__title { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text-strong); }
.td-briefing__actions { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); }
.td-badge {
  display: inline-flex; min-width: 1.35rem; justify-content: center; align-items: center;
  padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; color: var(--text-on-accent);
}
.td-badge--open { background: var(--accent-soft); }
.td-badge--fail { background: var(--fail); }
.td-badge--done { background: var(--ok); }

.td-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 0.85rem;
}
@media (max-width: 720px) { .td-stats { grid-template-columns: 1fr; } }
.td-stat {
  display: block; padding: 0.85rem 1rem; border-radius: 8px; border: 1px solid transparent;
  text-decoration: none; color: inherit; transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.td-stat:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); }
.td-stat.is-active { box-shadow: 0 0 0 2px currentColor; }
.td-stat--open { background: var(--accent-wash); color: var(--accent-hover); border-color: #bfdbfe; }
.td-stat--fail { background: var(--fail-wash); color: var(--fail); border-color: var(--fail); }
.td-stat--done { background: var(--ok-wash); color: var(--ok); border-color: var(--ok); }
.td-stat__value { font-size: 1.85rem; font-weight: 750; line-height: 1.1; }
.td-stat__label {
  margin-top: 0.2rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.td-stat__meta { margin-top: 0.35rem; font-size: 0.78rem; opacity: 0.85; color: inherit; }

.td-plan { margin-bottom: 0.85rem; overflow: hidden; }
.td-plan__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 1rem 0.45rem;
}
.td-plan__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text-strong); }
.td-progress {
  display: flex; height: 4px; margin: 0 1rem 0.35rem; border-radius: 999px; overflow: hidden;
  background: var(--border-soft);
}
.td-progress__done { background: var(--ok); }
.td-progress__fail { background: var(--fail); }
.td-progress__open { background: var(--border-strong); }

.td-list { list-style: none; margin: 0; padding: 0; }
.td-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 0.75rem 0.75rem; align-items: center;
  padding: 0.7rem 1rem; border-top: 1px solid var(--border-soft);
}
.td-row--expandable.is-open { background: var(--surface-muted); }
@media (max-width: 720px) {
  .td-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .td-row__actions { justify-content: flex-start; }
}
.td-row:hover { background: var(--surface-muted); }
.td-row__main { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.td-row__toggle {
  flex: 0 0 auto;
}
.td-row__title { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-row__unlock {
  font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem;
}
.td-row__status { font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.td-row__status--open { color: var(--accent); }
.td-row__status--fail { color: var(--fail); }
.td-row__status--done { color: var(--ok); }
.td-row__status--warn { color: var(--warn); }
.td-row__status--muted { color: var(--text-faint); }
.td-row__actions { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.td-row__detail {
  grid-column: 1 / -1; margin-top: 0.15rem; padding: 0.65rem 0.75rem 0.15rem;
  border-top: 1px dashed var(--border-soft); font-size: 0.9rem; color: var(--text);
}
.td-row__fail p { margin: 0.35rem 0 0.65rem; white-space: pre-wrap; }
.td-row__files strong, .td-row__fail strong {
  display: block; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 0.25rem;
}
.td-evidence-gallery {
  display: flex; flex-direction: column; gap: 0.65rem;
}
.td-ev-thumb {
  margin: 0; max-width: 28rem;
}
.td-ev-thumb img {
  display: block; max-width: 100%; max-height: 220px; width: auto; height: auto;
  border-radius: 6px; border: 1px solid var(--border-soft); background: var(--surface-subtle); object-fit: contain;
}
.td-ev-thumb figcaption {
  margin-top: 0.3rem; font-size: 0.8rem;
}
.td-ev-log {
  border: 1px solid var(--border-soft); border-radius: 6px; overflow: hidden; background: var(--text-strong);
}
.td-ev-log__head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.4rem 0.65rem; background: #1e293b; color: var(--border-soft); font-size: 0.8rem;
}
.td-ev-log__head a { color: #93c5fd; }
.td-ev-log__body {
  margin: 0; padding: 0.65rem 0.75rem; max-height: 240px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem; line-height: 1.45; color: var(--border-soft); white-space: pre-wrap; word-break: break-word;
}
.td-ev-log__more { margin: 0; padding: 0.35rem 0.65rem 0.5rem; background: #1e293b; font-size: 0.75rem; }
.td-ev-file { font-size: 0.9rem; }

.td-run {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 28%); gap: 0.85rem; align-items: start;
}
@media (max-width: 960px) { .td-run { grid-template-columns: 1fr; } }
.td-run__steps { display: flex; flex-direction: column; gap: 0.65rem; }
.td-step {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden;
  opacity: 0.72;
}
.td-step.is-current, .td-step--current {
  opacity: 1; border-color: var(--accent-tint); box-shadow: 0 0 0 1px #bfdbfe;
}
.td-step--prev, .td-step--next { opacity: 0.85; }
.td-step__head {
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
  padding: 0.55rem 0.85rem; background: var(--surface-muted); border-bottom: 1px solid var(--border-soft);
}
.td-step__num {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.td-step__badge {
  margin-left: auto; font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 4px;
}
.td-step__badge--open { background: var(--border-soft); color: var(--muted); }
.td-step__badge--pass { background: var(--ok-wash); color: var(--ok); }
.td-step__badge--fail { background: var(--fail-wash); color: var(--fail); }
.td-step__body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 0.75rem 0.85rem;
}
@media (max-width: 720px) { .td-step__body { grid-template-columns: 1fr; } }
.td-step__col label {
  margin: 0 0 0.25rem; font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint);
}
.td-step__text {
  font-size: 0.92rem; line-height: 1.45; color: var(--text-strong); min-height: 1.2em;
}
.td-step__note {
  padding: 0 0.85rem 0.65rem;
}
.td-step__note label {
  margin: 0 0 0.25rem; font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint);
  display: block;
}
.td-step__note-input {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 2.4rem;
  border: 1px solid var(--border-soft); border-radius: 6px; padding: 0.45rem 0.55rem;
  font: inherit; font-size: 0.9rem; line-height: 1.4; color: var(--text-strong); background: var(--surface);
}
.td-step__note-input:focus {
  outline: none; border-color: var(--accent-tint); box-shadow: 0 0 0 2px #dbeafe;
}
.td-step__note-text {
  font-size: 0.9rem; line-height: 1.4; color: var(--text); white-space: pre-wrap;
  padding: 0.4rem 0.5rem; background: var(--surface-muted); border-radius: 6px; border: 1px solid var(--border-soft);
}
.td-step__actions {
  display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap;
  padding: 0.65rem 0.85rem 0.85rem; border-top: 1px solid var(--border-soft); background: var(--surface);
}
.td-run__finish { margin-top: 0.25rem; }
.td-run__finish-title { margin: 0 0 0.35rem; font-size: 0.95rem; }
.td-evidence { list-style: none; margin: 0 0 0.65rem; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.td-evidence__item {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.35rem 0.5rem; background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: 6px;
}
.td-evidence--compact { margin: 0; gap: 0.2rem; }
.td-evidence--compact li { margin: 0; }
.td-evidence__upload {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
}

/* Testplan editor */
.tp-comps-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-bottom: 0.65rem;
}
.tp-comps { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.tp-comps__row {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.4rem; align-items: center;
}
@media (max-width: 640px) { .tp-comps__row { grid-template-columns: 1fr; } }

.tp-assign { margin-top: 0.85rem; }
.tp-assign__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.55rem;
}
.tp-assign__head-left { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.tp-assign__head-right { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tp-assign__stat {
  display: inline-flex; align-items: center; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent-hover); font-size: 0.75rem; font-weight: 600;
}
.tp-assign__mode {
  display: inline-flex; align-items: center; padding: 0.2rem 0.55rem; border-radius: 999px;
  background: var(--warn-wash); color: var(--warn); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.02em;
}
.tp-assign__mode[hidden] { display: none !important; }
.tp-assign__filter-btn.is-active,
.tp-assign__filter-btn[aria-pressed="true"] {
  border-color: var(--warn); background: var(--warn-wash); color: var(--warn); font-weight: 650;
  box-shadow: inset 0 0 0 1px #fcd34d;
}
.tp-assign--filtered .tp-assign__list-panel {
  box-shadow: inset 3px 0 0 #f59e0b;
}
.tp-assign--filtered .tc-main__meta #tp-assign-visible-meta::after {
  content: " · gefiltert";
  color: var(--warn); font-weight: 650;
}
.tp-assign__layout { margin-top: 0; }
.tp-assign .tc-main__meta {
  flex-wrap: wrap; align-items: center; gap: 0.65rem;
}
.tp-assign__meta-left {
  display: flex; align-items: baseline; gap: 0.65rem; min-width: 0;
}
.tp-assign__bulk {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-left: auto;
}
.tp-assign__bulk-label {
  margin: 0; font-size: 0.78rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tp-assign__bulk-select {
  width: auto; min-width: 140px; max-width: 200px; margin: 0; font-size: 0.85rem;
  padding: 0.3rem 0.45rem;
}
.tp-assign__search-wrap { padding: 0.55rem 0.65rem 0; }
.tp-assign__search-wrap input { width: 100%; box-sizing: border-box; }
.tp-cat__row { gap: 0.25rem; }
.tp-cat__pick {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0.15rem 0.2rem;
  cursor: pointer; color: inherit; border-radius: 4px; font: inherit;
}
.tp-cat__pick:hover { color: var(--accent); }
.tp-cat.is-selected > .tp-cat__row .tp-cat__pick .struct-tree__title,
.tp-cat__pick.is-active .struct-tree__title { color: var(--accent-hover); font-weight: 650; }
.tp-cat-badge {
  flex: 0 0 auto; margin-left: auto; font-size: 0.7rem; font-weight: 700;
  padding: 0.05rem 0.35rem; border-radius: 4px; background: var(--border-soft); color: var(--muted);
}
.tp-cat-badge--on { background: var(--accent-wash); color: var(--accent-hover); }
/* Wissen / Dateien: Badge + Ops direkt neben dem Namen */
.ka-tree .struct-tree__link,
.fi-tree .struct-tree__link { max-width: none; flex: 0 1 auto; }
.ka-tree .tp-cat-badge,
.fi-tree .tp-cat-badge { margin-left: 0.35rem; }
.ka-tree .struct-tree__ops,
.fi-tree .struct-tree__ops { margin-left: 0.15rem; }
.tp-assign__list-panel { overflow: hidden; }
.tp-case-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 16rem); overflow: auto; }
.tp-case {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 180px); gap: 0.5rem; align-items: center;
  padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--border-soft);
}
/* display:grid überschreibt sonst das UA-[hidden] → Liste wirkte „nicht gefiltert“ */
.tp-case[hidden] { display: none !important; }
.tp-case:last-child { border-bottom: 0; }
.tp-case:hover { background: var(--surface-muted); }
.tp-case__check {
  display: flex; align-items: center; gap: 0.5rem; min-width: 0; margin: 0; font-weight: 500; cursor: pointer;
}
.tp-case__check input { width: auto; margin: 0; flex: 0 0 auto; }
.tp-case__text { display: flex; flex-direction: column; min-width: 0; gap: 0.1rem; }
.tp-case__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-case__path { font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-case__pred { font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-case__assignee { margin: 0; font-size: 0.85rem; }

.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { display: block; height: auto !important; overflow: visible !important; }
  .print-only { display: block; }
  .content { padding: 0; overflow: visible !important; }
  .app-shell { display: block; height: auto !important; overflow: visible !important; }
  .report-page__header, .ui-page__header { display: none !important; }
  .report { box-shadow: none; border: none; }
  .report-section { break-inside: avoid; }
  .report-case { break-inside: avoid; }
}

/* —— Berichte —— */
.report {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 1.25rem 1.5rem 1.5rem;
}
.report__head { border-bottom: 1px solid var(--border-soft); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.report__brand-row {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.report__logo {
  max-height: 40px; max-width: 160px; width: auto; height: auto; object-fit: contain;
}
.report__brand {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 650;
}
.report__title { margin: 0.25rem 0 0.15rem; font-size: 1.45rem; color: var(--text-strong); }
.report__meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.report__foot {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 1.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-soft);
  font-size: 0.78rem; color: var(--text-faint);
}
.report-section { margin: 1.15rem 0 1.35rem; }
.report-section h2 {
  margin: 0 0 0.55rem; font-size: 1.05rem; color: var(--text-strong);
  border-bottom: 1px solid var(--border-soft); padding-bottom: 0.25rem;
}
.report-section h3 { margin: 0.75rem 0 0.4rem; font-size: 0.92rem; color: var(--text); }
.report-section--split {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1.25rem; align-items: start;
}
@media (max-width: 860px) {
  .report-section--split { grid-template-columns: 1fr; }
}
.report-lead { margin: 0 0 0.75rem; color: var(--text); line-height: 1.45; }
.report-verdict {
  margin: 0 0 0.85rem; padding: 0.65rem 0.85rem;
  background: var(--surface-muted); border-left: 3px solid #0369a1; border-radius: 0 6px 6px 0;
  color: var(--text-strong); font-weight: 600; line-height: 1.4;
}
.report-alert {
  padding: 0.85rem 1rem; background: var(--warn-wash); border: 1px solid #fdba74;
  border-radius: 6px; color: var(--warn);
}
.report-kpis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.55rem; margin: 0.5rem 0 0.85rem;
}
.report-kpi {
  background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: 6px;
  padding: 0.55rem 0.65rem;
}
.report-kpi__value { font-size: 1.25rem; font-weight: 700; color: var(--text-strong); line-height: 1.2; }
.report-kpi__label { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.report-kpi__hint { font-size: 0.68rem; color: var(--text-faint); margin-top: 0.1rem; }
.report-dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.25rem 0.75rem; margin: 0; }
.report-dl dt { color: var(--muted); font-size: 0.82rem; }
.report-dl dd { margin: 0; color: var(--text-strong); }
.report-dl--inline {
  grid-template-columns: auto 1fr auto 1fr; gap: 0.25rem 0.65rem; margin-bottom: 0.65rem;
}
.report-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.report-table th, .report-table td {
  border: 1px solid var(--border-soft); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top;
}
.report-table th { background: var(--surface-muted); font-weight: 650; color: var(--text); }
.report-table tr:nth-child(even) td { background: var(--surface-muted); }
.report-pill {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--muted)) 18%, var(--surface));
  color: var(--c, var(--text)); font-size: 0.78rem; font-weight: 650;
}
.report-rich { font-size: 0.88rem; line-height: 1.45; color: var(--text-strong); }
.report-rich p { margin: 0 0 0.35rem; }
.report-list { margin: 0.35rem 0 0; padding-left: 1.2rem; color: var(--text); line-height: 1.45; }
.report-case {
  border: 1px solid var(--border-soft); border-radius: 6px; padding: 0.75rem 0.9rem; background: var(--surface);
}
.report-case--fail { border-color: var(--fail); background: var(--fail-wash); }
.report-case + .report-case { margin-top: 0.75rem; }
.report-chart { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; }
.report-chart--bars { display: block; overflow-x: auto; }
.report-chart--empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 0.85rem; background: var(--surface-muted); border-radius: 6px;
}
.report-chart__legend { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.report-chart__legend li {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 0.4rem; align-items: center;
  margin: 0.2rem 0;
}
.report-chart__swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.report-chart__leg-label { color: var(--text); }
.report-chart__leg-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.report-chart__bar-label { font-size: 11px; fill: var(--text); }
.report-chart__bar-val { font-size: 11px; fill: var(--muted); }
.report-hint {
  margin: 0 0 0.75rem; padding: 0.55rem 0.75rem;
  background: var(--accent-wash); border: 1px solid #bfdbfe; border-radius: 6px;
  color: var(--accent-hover); font-size: 0.88rem; line-height: 1.4;
}
.report-version { white-space: pre-wrap; font-family: var(--mono); font-size: 0.8rem; }
.report-acc { display: flex; flex-direction: column; gap: 0.4rem; }
.report-acc__item {
  border: 1px solid var(--border-soft); border-radius: 6px; background: var(--surface); overflow: hidden;
}
.report-acc__item.is-fail { border-color: var(--fail); }
.report-acc__item > summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.65rem;
  padding: 0.5rem 0.7rem; cursor: pointer; list-style: none;
  background: var(--surface-muted);
}
.report-acc__item > summary::-webkit-details-marker { display: none; }
.report-acc__item[open] > summary { border-bottom: 1px solid var(--border-soft); }
.report-acc__num { font-weight: 700; color: var(--muted); min-width: 1.5rem; }
.report-acc__title { font-weight: 650; color: var(--text-strong); flex: 1 1 12rem; }
.report-acc__who { font-size: 0.82rem; }
.report-acc__body { padding: 0.65rem 0.75rem 0.85rem; }
@media print {
  .report-acc__item { break-inside: avoid; }
  .report-acc__item > summary { background: var(--surface); }
  .report-bug { break-before: page; page-break-before: always; }
  .report-bug:first-of-type { break-before: auto; page-break-before: auto; }
}
.report-bug {
  border: 1px solid var(--border-soft); border-radius: 8px; padding: 1rem 1.15rem 1.1rem;
  margin: 1rem 0 1.35rem; background: var(--surface);
}
.report-bug__head { margin-bottom: 0.75rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--border-soft); }
.report-bug__title { margin: 0 0 0.25rem; font-size: 1.2rem; color: var(--text-strong); }
.report-bug__sub { margin: 0; color: var(--muted); font-size: 0.88rem; }
.report-bug h3 {
  margin: 0.85rem 0 0.35rem; font-size: 0.92rem; color: var(--text);
  border-bottom: 1px solid var(--border-soft); padding-bottom: 0.15rem;
}
.report-bug__steps { margin: 0.25rem 0 0; padding-left: 1.25rem; line-height: 1.45; }
.report-bug__steps li { margin: 0.2rem 0; }
.report-bug__foot {
  margin-top: 0.85rem; padding-top: 0.45rem; border-top: 1px dashed var(--border-soft);
  font-size: 0.75rem;
}

/* —— Nachrichten / Kanäle —— */
.msg-layout {
  display: grid;
  grid-template-columns: minmax(240px, 30%) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}
@media (max-width: 960px) {
  .msg-layout { grid-template-columns: 1fr; }
}
.msg-sidebar { overflow: hidden; padding: 0; }
.msg-sidebar__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border-soft);
}
.msg-sidebar__search { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-soft); }
.msg-sidebar__search input { width: 100%; }
.msg-sidebar__nav {
  max-height: calc(100vh - 14rem); overflow: auto; padding: 0.35rem 0;
}
.msg-sidebar__empty { padding: 0.75rem 0.85rem; margin: 0; font-size: 0.9rem; }
.msg-sidebar__section {
  margin-top: 0.35rem; padding: 0.45rem 0.85rem 0.25rem;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint);
}
.msg-channel {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.55rem 0.85rem; color: var(--text); text-decoration: none;
  border-left: 3px solid transparent;
}
.msg-channel:hover { background: var(--surface-muted); text-decoration: none; }
.msg-channel.is-active {
  background: var(--accent-wash); border-left-color: var(--accent); color: var(--accent-hover);
}
.msg-channel.is-closed { opacity: 0.72; }
.msg-channel__avatar {
  flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--border-soft); color: var(--text); font-size: 0.85rem; font-weight: 700;
}
.msg-channel.is-active .msg-channel__avatar { background: var(--accent-wash); color: var(--accent-hover); }
.msg-channel__avatar--notif { background: var(--warn-wash); color: var(--warn); }
.msg-channel--notif.is-active .msg-channel__avatar--notif { background: var(--warn-wash); color: var(--warn); }
.msg-channel__badge {
  flex-shrink: 0; min-width: 1.35rem; padding: 0.05rem 0.4rem;
  border-radius: 999px; background: var(--fail); color: var(--text-on-accent);
  font-size: 0.7rem; font-weight: 700; text-align: center; line-height: 1.35;
}
.msg-channel__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.msg-channel__title {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-channel.is-active .msg-channel__title { font-weight: 700; }
.msg-channel__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; color: var(--muted);
}
.msg-channel__time {
  flex-shrink: 0; font-size: 0.72rem; color: var(--text-faint); padding-top: 0.15rem;
}
.msg-main { display: flex; flex-direction: column; gap: 0.85rem; min-width: 0; }
.msg-thread__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
  padding-bottom: 0.65rem; border-bottom: 1px solid var(--border-soft);
}
.msg-thread__title { margin: 0; font-size: 1.1rem; color: var(--text-strong); }
.msg-thread__sub { margin: 0.25rem 0 0; font-size: 0.88rem; }
.msg-thread__actions { flex-shrink: 0; }
.msg-thread__messages {
  max-height: min(420px, 50vh); overflow: auto;
  border: 1px solid var(--border-soft); border-radius: 8px; padding: 0.75rem;
  background: var(--surface-muted); margin-bottom: 0.75rem;
}
.msg-bubble { margin-bottom: 0.85rem; }
.msg-bubble:last-child { margin-bottom: 0; }
.msg-bubble__head {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem;
}
.msg-bubble__meta { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.msg-poll {
  margin-top: 0.35rem; padding: 0.6rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface);
}
.msg-poll-question { font-weight: 600; margin-bottom: 0.35rem; }
.msg-notif-list { list-style: none; margin: 0; padding: 0; }
.msg-notif-list li {
  margin: 0; padding: 0.55rem 0; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.msg-notif-list li.is-unread { font-weight: 700; }
.msg-notif-list__main { flex: 1 1 14rem; min-width: 0; }
.msg-notif-list__actions {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; flex-shrink: 0;
}
.msg-notif-list__read { margin: 0; display: inline; }


/* —— Kalender (Monat / Woche / Tag) —— */
.cal-page > .ui-page__header { align-items: center; }
.cal-page__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.cal-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem; margin-bottom: 1rem; align-items: stretch;
}
.cal-stat {
  text-align: center; display: flex; flex-direction: column; justify-content: center;
  min-height: 5.25rem; box-sizing: border-box;
}
.cal-stat__value { font-size: 1.65rem; font-weight: 750; color: var(--text-strong); line-height: 1.1; }
.cal-stat__label { margin-top: 0.35rem; font-size: 0.82rem; color: var(--muted); }

.cal-split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1rem; align-items: start;
}
.cal-page--list-hidden .cal-split { grid-template-columns: 1fr; }
.cal-page--list-hidden .cal-split__list { display: none; }
.cal-split__cal, .cal-split__list { overflow: hidden; }
.cal-split__toolbar,
.cal-list__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.55rem 0.85rem; min-height: 3.25rem; padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-soft); box-sizing: border-box;
}
.cal-split__nav {
  display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0;
}
.cal-split__nav .cal-nav__label { margin-left: 0; white-space: nowrap; }
.cal-split__views { flex: 0 0 auto; }
.cal-team { padding: 0.65rem 0.75rem 0.85rem; }
.cal-team__hint { margin: 0 0 0.65rem; font-size: 0.85rem; }
.cal-team__scroll { overflow: auto; max-height: calc(100vh - 18rem); border: 1px solid var(--border-soft); border-radius: 8px; }
.cal-team__table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 52rem; }
.cal-team__table th, .cal-team__table td {
  border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--surface-subtle);
  vertical-align: top; padding: 0.4rem 0.45rem;
}
.cal-team__table th:last-child, .cal-team__table td:last-child { border-right: 0; }
.cal-team__user-col { width: 9.5rem; position: sticky; left: 0; z-index: 2; background: var(--surface-muted); }
.cal-team__day-col { text-align: center; background: var(--surface-muted); min-width: 6.5rem; }
.cal-team__day-col.is-today, .cal-team__cell.is-today { background: var(--accent-wash); }
.cal-team__dow { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.04em; }
.cal-team__date { display: block; font-weight: 700; color: var(--text-strong); }
.cal-team__user {
  position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left;
  font-weight: 600; color: var(--text-strong); white-space: nowrap;
}
.cal-team__row--me .cal-team__user { background: var(--accent-wash); }
.cal-team__cell { min-height: 2.5rem; }
.cal-team__empty { font-size: 0.8rem; }
.cal-team__cell .cal-pill--team {
  display: block; margin: 0 0 0.25rem; white-space: normal; line-height: 1.25; cursor: default;
}
.cal-team__cell .cal-pill--team:last-child { margin-bottom: 0; }
.cal-vacation { padding: 0.65rem 0.75rem 0.85rem; }
.cal-vacation__hint { margin: 0 0 0.65rem; font-size: 0.85rem; }
.cal-month--vacation .cal-month__cell { min-height: 5.5rem; }
.cal-event.cal-event--vacation {
  border-left: 3px solid currentColor;
}
.cal-pill.cal-pill--vacation {
  display: block; margin: 0 0 0.2rem; border: 1px solid transparent;
  font-size: 0.72rem; line-height: 1.25; white-space: normal;
}
.cal-pill.cal-pill--vacation.is-mine {
  font-weight: 650; box-shadow: inset 0 0 0 1px currentColor;
}
.cal-user-swatch {
  display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 999px;
  margin-right: 0.35rem; vertical-align: middle; flex-shrink: 0;
}
.cal-team__user { display: flex; align-items: center; }
.cal-vac-list__title { margin: 1.1rem 0 0.5rem; font-size: 1rem; }
.cal-vac-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.cal-vac-list__item {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.65rem; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface-muted);
}
.cal-vac-list__ops { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.modal--wide { max-width: 40rem; width: calc(100vw - 2rem); }
.cal-split__clock {
  display: inline-flex; margin: 0; margin-left: auto;
}
.cal-list__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text-strong); }
.cal-list__table { margin: 0; }
.cal-list__table thead th { background: var(--surface-muted); }
.cal-collision-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.cal-collision-list__item {
  border: 1px solid var(--border-soft); border-radius: 8px; padding: 0.75rem 0.85rem;
  display: grid; gap: 0.35rem; background: var(--surface);
}
.cal-collision-list__item a { font-weight: 650; color: var(--text-strong); text-decoration: none; }
.cal-collision-list__item a:hover { color: var(--accent-hover); text-decoration: underline; }
.cal-collision-list__item .muted { display: block; font-size: 0.82rem; margin-top: 0.1rem; }
.cal-collision-list__vs { font-size: 0.78rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }

.cal-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}
.cal-nav { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.cal-nav__label { font-size: 1.05rem; color: var(--text-strong); margin-left: 0.35rem; }
.cal-now-clock {
  margin-left: auto; font-variant-numeric: tabular-nums;
  font-size: 0.88rem; font-weight: 700; color: var(--fail);
  background: var(--fail-wash); border: 1px solid #fecaca; border-radius: 999px;
  padding: 0.25rem 0.7rem; white-space: nowrap;
}
.cal-feed code { font-size: 0.78rem; word-break: break-all; }

.cal-month { overflow: hidden; }
.cal-month__head, .cal-month__grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-month__dow {
  padding: 0.45rem 0.35rem; text-align: center; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint);
  border-bottom: 1px solid var(--border-soft); background: var(--surface-muted);
}
.cal-month__cell {
  min-height: 6.5rem; border-right: 1px solid var(--surface-subtle); border-bottom: 1px solid var(--border-soft);
  padding: 0.35rem 0.4rem 0.45rem; background: var(--surface);
}
.cal-month__cell:nth-child(7n) { border-right: 0; }
.cal-month__cell.is-out { background: var(--surface-muted); }
.cal-month__cell.is-out .cal-month__daynum { color: var(--border-strong); }
.cal-month__cell.is-today { background: var(--accent-wash); }
.cal-month__cell.is-focus { background: var(--accent-wash); }
.cal-month__cell.is-focus.is-today { background: var(--accent-wash); }
.cal-week__col.is-focus { outline: 2px solid #93c5fd; outline-offset: -2px; }
.cal-month__daynum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; color: var(--text); text-decoration: none;
}
.cal-month__cell.is-today .cal-month__daynum { background: var(--accent); color: var(--text-on-accent); }
.cal-month__daynum:hover { background: var(--border-soft); }
.cal-month__cell.is-today .cal-month__daynum:hover { background: var(--accent-hover); }
.cal-split .cal-month__cell { min-height: 5.25rem; }
.cal-month__events { margin-top: 0.2rem; display: flex; flex-direction: column; gap: 0.15rem; }
.cal-pill {
  display: block; font-size: 0.7rem; line-height: 1.25; padding: 0.15rem 0.35rem; border-radius: 3px;
  background: var(--border-soft); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; border-left: 3px solid var(--text-faint);
}
.cal-pill:hover { filter: brightness(0.97); text-decoration: none; }
/* Nach Basis-Regel: Hintergrundfarbe (Text bleibt dunkel lesbar) */
.cal-pill.cal-pill--allday {
  background: var(--ok-wash); color: var(--ok); border-left-color: #0d9488;
}
.cal-pill.cal-pill--termin {
  background: var(--warn-wash); color: var(--warn); border-left-color: #ea580c;
}
.cal-pill.cal-pill--meeting {
  background: var(--accent-wash); color: var(--accent-hover); border-left-color: var(--accent);
}
.cal-event--allday {
  background: var(--ok-wash); border-color: var(--ok); border-left: 3px solid var(--ok);
}
.cal-event--allday .cal-event__title { color: var(--ok); }
.cal-event--termin {
  background: var(--warn-wash); border-color: var(--warn); border-left: 3px solid #ea580c;
}
.cal-event--termin .cal-event__title { color: var(--warn); }
.cal-event--meeting {
  background: var(--accent-wash); border-color: var(--accent-tint); border-left: 3px solid #2563eb;
}
.cal-event--meeting .cal-event__title { color: var(--accent-hover); }
.cal-pill--declined,
.cal-event--declined .cal-event__title,
.cal-title--declined {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.cal-pill.cal-pill--declined {
  opacity: 0.72; color: var(--muted); background: var(--surface-subtle); border-left-color: var(--border-strong);
}
.cal-event--declined {
  opacity: 0.78; background: var(--surface-muted); border-style: dashed;
}
.cal-event--declined .cal-event__title { color: var(--muted); }
.cal-row--declined td { color: var(--muted); }
.cal-pill__time { font-weight: 700; margin-right: 0.2rem; }
.cal-month__more { font-size: 0.7rem; color: var(--accent); text-decoration: none; }

.cal-week__grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 22rem;
}
.cal-week__col { border-right: 1px solid var(--surface-subtle); display: flex; flex-direction: column; min-width: 0; }
.cal-week__col:last-child { border-right: 0; }
.cal-week__col.is-today { background: var(--accent-wash); }
.cal-week__head {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  padding: 0.55rem 0.35rem; text-decoration: none; border-bottom: 1px solid var(--border-soft);
  background: var(--surface-muted);
}
.cal-week__col.is-today .cal-week__head { background: var(--accent-wash); }
.cal-week__dow { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.04em; }
.cal-week__date { font-size: 0.95rem; font-weight: 700; color: var(--text-strong); }
.cal-week__body { padding: 0.4rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.cal-empty { margin: 0.5rem 0; text-align: center; font-size: 0.85rem; }

.cal-day__timeline { display: flex; flex-direction: column; }
.cal-day__row {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr);
  border-bottom: 1px solid var(--border-soft); min-height: 3.25rem; position: relative;
}
.cal-day__row.is-now { background: var(--fail-wash); }
.cal-day__hour {
  padding: 0.45rem 0.5rem; font-size: 0.75rem; font-weight: 650; color: var(--text-faint);
  text-align: right; border-right: 1px solid var(--surface-subtle); background: var(--surface-muted);
}
.cal-day__row.is-now .cal-day__hour { color: var(--fail); background: var(--fail-wash); }
.cal-day__slot {
  padding: 0.35rem 0.55rem; display: flex; flex-direction: column; gap: 0.35rem;
  position: relative;
}
.cal-now-line {
  position: absolute; left: 0; right: 0; top: var(--cal-now-pct, 0%);
  z-index: 2; pointer-events: none;
  border-top: 2px solid var(--fail);
  transform: translateY(-1px);
}
.cal-now-line__label {
  position: absolute; left: 0.35rem; top: -0.7rem;
  background: var(--fail); color: var(--text-on-accent); font-size: 0.68rem; font-weight: 700;
  line-height: 1; padding: 0.12rem 0.35rem; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.cal-day__outside { padding: 0.85rem; border-top: 1px solid var(--border-soft); }

.cal-event {
  background: var(--surface-subtle); border: 1px solid var(--border-soft); border-radius: 6px;
  padding: 0.4rem 0.5rem; font-size: 0.82rem;
}
.cal-event__time { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.cal-event__title { font-weight: 650; color: var(--text-strong); margin: 0.1rem 0 0.25rem; }
.cal-event__actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.25rem; }
.cal-event__actions form, .cal-event__del { margin: 0; }
.cal-participants-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 14rem; overflow: auto; }
.cal-participant-row {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 0.75rem; margin: 0; cursor: pointer;
}
.cal-participant-row__main { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.cal-participant-row__status {
  font-size: 0.75rem; line-height: 1.3; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-participant-row__status.is-free { color: var(--ok); font-weight: 650; }
.cal-participant-row__status.is-busy { color: var(--warn); font-weight: 650; }
.cal-meeting-toggle { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.35rem 0 0.75rem; }

@media (max-width: 1100px) {
  .cal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .cal-week__grid { grid-template-columns: 1fr; }
  .cal-week__col { border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .cal-month__cell { min-height: 4.5rem; }
  .cal-pill__time { display: none; }
  .cal-stats { grid-template-columns: 1fr; }
}

.cal-day__allday {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr);
  border-bottom: 1px solid var(--ok); background: var(--ok-wash);
}
.cal-day__allday-label {
  padding: 0.55rem 0.5rem; border-right: 1px solid var(--ok);
  background: var(--ok-wash);
}
.cal-day__allday-list {
  padding: 0.45rem 0.55rem; display: flex; flex-direction: column; gap: 0.35rem;
}

.cal-event__title {
  display: block; font-weight: 650; color: var(--text-strong); text-decoration: none; margin: 0.1rem 0 0.25rem;
}
.cal-event__title:hover { color: var(--accent-hover); text-decoration: underline; }
.cal-detail { display: grid; gap: 0.65rem 1rem; margin: 0; }
.cal-detail > div { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0.5rem; }
.cal-detail dt { margin: 0; color: var(--muted); font-size: 0.85rem; }
.cal-detail dd { margin: 0; color: var(--text-strong); }
.cal-detail__desc { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--border-soft); }
.cal-detail__desc strong { display: block; margin-bottom: 0.35rem; }
.cal-detail__people { list-style: none; margin: 0; padding: 0.5rem 0.85rem; }
.cal-detail__people li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0; border-top: 1px solid var(--surface-subtle);
}
.cal-detail__people li:first-child { border-top: 0; }
.cal-detail__rsvp { display: flex; flex-wrap: wrap; gap: 0.35rem; }

a.struct-op { text-decoration: none; }
.struct-case.is-selected { background: var(--accent-wash); border-radius: 4px; padding-left: 0.25rem; }

/* Zwischenablage → Datei-Input */
.clipboard-paste-btn { white-space: nowrap; }
.clipboard-paste__status {
  display: inline-block; margin-left: 0.35rem; font-size: 0.78rem; vertical-align: middle;
}
.clipboard-paste__status.is-error { color: var(--fail); }

/* Passwort ändern — Live-Prüfung */
.pw-checks {
  list-style: none; margin: 0.45rem 0 0; padding: 0;
  display: grid; gap: 0.28rem; font-size: 0.85rem;
}
.pw-checks li {
  display: flex; align-items: flex-start; gap: 0.45rem;
  color: var(--muted); font-weight: 500;
}
.pw-check-icon {
  flex: 0 0 1rem; width: 1rem; text-align: center;
  font-weight: 700; line-height: 1.35;
}
.pw-checks li.is-ok { color: var(--ok); }
.pw-checks li.is-bad { color: var(--fail); }
.pw-checks li.is-pending { color: var(--text-faint); font-weight: 400; }
.pw-field-msg { margin: 0.3rem 0 0; font-size: 0.82rem; min-height: 1.1em; }
.pw-field-msg.is-ok { color: var(--ok); }
.pw-field-msg.is-bad { color: var(--fail); }
.pw-form input.is-valid,
.pw-policy .pw-policy-input.is-valid {
  border-color: var(--ok); box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.12);
}
.pw-form input.is-invalid,
.pw-policy .pw-policy-input.is-invalid {
  border-color: #fca5a5; box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.12);
}
.pw-form #pw-submit:disabled,
.pw-form [type="submit"]:disabled {
  opacity: 0.55; cursor: not-allowed;
}
.pw-policy .pw-policy-input { width: 100%; }

/* Angemeldete Geräte */
.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.session-list__item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border-soft);
}
.session-list__item:last-child { border-bottom: 0; }
.session-list__item.is-current { background: var(--surface-muted); margin: 0 -0.75rem; padding-left: 0.75rem; padding-right: 0.75rem; border-radius: 6px; }
.session-list__main { min-width: 0; flex: 1; }



/* —— Dark / System theme (user preference) —— */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419;
  --surface: #1a222d;
  --surface-muted: #151c26;
  --surface-subtle: #212a36;
  --border: #334155;
  --border-strong: #475569;
  --border-soft: #2a3544;
  --text: #e8eef4;
  --text-strong: #f8fafc;
  --muted: #9aafc0;
  --text-muted: #94a3b8;
  --text-faint: #7a90a4;
  --sidebar: #121820;
  --sidebar-text: #e2eaf2;
  --sidebar-active: #1e293b;
  --sidebar-line: #243041;
  --sidebar-muted: #7a90a4;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: #2563eb;
  --accent-tint: #93c5fd;
  --ok: #22c55e;
  --fail: #f87171;
  --warn: #fbbf24;
  --info: #38bdf8;

  --accent-wash: #1e3a5f;
  --warn-wash: #422006;
  --fail-wash: #450a0a;
  --ok-wash: #052e16;
  --info-wash: #0c4a6e;
  --text-on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #0f1419;
    --surface: #1a222d;
    --surface-muted: #151c26;
    --surface-subtle: #212a36;
    --border: #334155;
    --border-strong: #475569;
    --border-soft: #2a3544;
    --text: #e8eef4;
    --text-strong: #f8fafc;
    --muted: #9aafc0;
    --text-muted: #94a3b8;
    --text-faint: #7a90a4;
    --sidebar: #121820;
    --sidebar-text: #e2eaf2;
    --sidebar-active: #1e293b;
    --sidebar-line: #243041;
    --sidebar-muted: #7a90a4;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-soft: #2563eb;
    --accent-tint: #93c5fd;
    --ok: #22c55e;
    --fail: #f87171;
    --warn: #fbbf24;
    --info: #38bdf8;
  
  --accent-wash: #1e3a5f;
  --warn-wash: #422006;
  --fail-wash: #450a0a;
  --ok-wash: #052e16;
  --info-wash: #0c4a6e;
  --text-on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}

/* Dark: remaining components (token-backed base + tweaks) */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-ok,
html[data-theme="dark"] .ui-status,
html[data-theme="dark"] .ui-seg button.is-active,
html[data-theme="dark"] .plan-tab.is-active {
  color: var(--text-on-accent);
}
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal__dialog,
html[data-theme="dark"] .ui-menu,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .rte-toolbar {
  background: var(--surface);
  border-color: var(--border-soft);
  color: var(--text);
}
html[data-theme="dark"] .content,
html[data-theme="dark"] .main-wrap,
html[data-theme="dark"] .topbar {
  background: var(--bg);
  color: var(--text);
}
html[data-theme="dark"] .topbar {
  border-bottom-color: var(--border-soft);
}
html[data-theme="dark"] .muted { color: var(--muted); }

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .btn-primary,
  html[data-theme="system"] .btn-danger,
  html[data-theme="system"] .btn-ok,
  html[data-theme="system"] .ui-status,
  html[data-theme="system"] .ui-seg button.is-active,
  html[data-theme="system"] .plan-tab.is-active {
    color: var(--text-on-accent);
  }
  html[data-theme="system"] .login-card,
  html[data-theme="system"] .card,
  html[data-theme="system"] .modal__dialog,
  html[data-theme="system"] .ui-menu,
  html[data-theme="system"] .toast,
  html[data-theme="system"] .rte-toolbar {
    background: var(--surface);
    border-color: var(--border-soft);
    color: var(--text);
  }
  html[data-theme="system"] .content,
  html[data-theme="system"] .main-wrap,
  html[data-theme="system"] .topbar {
    background: var(--bg);
    color: var(--text);
  }
  html[data-theme="system"] .topbar { border-bottom-color: var(--border-soft); }
  html[data-theme="system"] .muted { color: var(--muted); }
}

html[data-theme="dark"] .editor,
html[data-theme="dark"] .editor__bar,
html[data-theme="dark"] .tc-layout,
html[data-theme="dark"] .ka-layout,
html[data-theme="dark"] .plan-layout,
html[data-theme="dark"] .ui-panel,
html[data-theme="dark"] .ui-table,
html[data-theme="dark"] .plan-table,
html[data-theme="dark"] .report-table,
html[data-theme="dark"] .kanban-card,
html[data-theme="dark"] .cal-month__cell,
html[data-theme="dark"] .cal-event,
html[data-theme="dark"] .msg-channel,
html[data-theme="dark"] .tp-detail,
html[data-theme="dark"] .bug-attach,
html[data-theme="dark"] .rights-matrix,
html[data-theme="dark"] .struct-tree__toolbar {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border-soft);
}
html[data-theme="dark"] .ui-page__title,
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3 {
  color: var(--text-strong);
}
html[data-theme="dark"] .report-table tr:nth-child(even) td,
html[data-theme="dark"] .cal-month__cell.is-today,
html[data-theme="dark"] .cal-day__row.is-now {
  background: var(--surface-muted);
}
html[data-theme="dark"] .struct-tree__item.is-selected > .struct-tree__row {
  background: var(--accent-wash);
}
html[data-theme="dark"] .diff-mark--del,
html[data-theme="dark"] .text-diff__mark--del {
  background: var(--fail-wash);
  color: var(--fail);
}
html[data-theme="dark"] .diff-mark--add,
html[data-theme="dark"] .text-diff__mark--add {
  background: var(--ok-wash);
  color: var(--ok);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .editor,
  html[data-theme="system"] .editor__bar,
  html[data-theme="system"] .tc-layout,
  html[data-theme="system"] .ka-layout,
  html[data-theme="system"] .plan-layout,
  html[data-theme="system"] .ui-panel,
  html[data-theme="system"] .ui-table,
  html[data-theme="system"] .plan-table,
  html[data-theme="system"] .report-table,
  html[data-theme="system"] .kanban-card,
  html[data-theme="system"] .cal-month__cell,
  html[data-theme="system"] .cal-event,
  html[data-theme="system"] .msg-channel,
  html[data-theme="system"] .tp-detail,
  html[data-theme="system"] .bug-attach,
  html[data-theme="system"] .rights-matrix,
  html[data-theme="system"] .struct-tree__toolbar {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border-soft);
  }
  html[data-theme="system"] .ui-page__title,
  html[data-theme="system"] h1, html[data-theme="system"] h2, html[data-theme="system"] h3 {
    color: var(--text-strong);
  }
  html[data-theme="system"] .report-table tr:nth-child(even) td,
  html[data-theme="system"] .cal-month__cell.is-today,
  html[data-theme="system"] .cal-day__row.is-now {
    background: var(--surface-muted);
  }
  html[data-theme="system"] .struct-tree__item.is-selected > .struct-tree__row {
    background: var(--accent-wash);
  }
}

/* —— Easteregg: 8-Bit Bugs (Dashboard) —— */
body.ee-bug-lock {
  overflow: hidden !important;
}
.ee-bug-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 23, 42, 0.42);
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
.ee-bug-overlay__crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.12) 0,
      rgba(0, 0, 0, 0.12) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.35) 100%);
  animation: ee-crt-flicker 2.4s steps(2, end) infinite;
  mix-blend-mode: multiply;
}
.ee-bug-overlay__stains {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.ee-bug-stain {
  position: absolute;
  width: 28px;
  height: 14px;
  image-rendering: pixelated;
  box-shadow:
    4px 0 0 currentColor,
    8px 2px 0 currentColor,
    0 4px 0 currentColor,
    12px 4px 0 currentColor,
    4px 6px 0 currentColor,
    8px 8px 0 currentColor;
  color: #7f1d1d;
  opacity: 0.85;
  transform: translate(-50%, -50%);
}
.ee-bug-stain--fly { color: #14532d; }
.ee-bug-stain--spider { color: #4c1d95; }
.ee-bug-stain--blocker { color: #991b1b; width: 34px; height: 18px; }
.ee-bug-overlay__hud {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  max-width: min(92vw, 36rem);
  padding: 0.45rem 0.9rem;
  border-radius: 0;
  background: #0f172a;
  color: #f8fafc;
  font-family: ui-monospace, "Courier New", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 2px #22c55e, 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  text-align: center;
}
.ee-bug-overlay__line { color: #fde68a; }
.ee-bug-overlay__count { color: #86efac; }
.ee-bug {
  position: absolute;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
  transform: rotate(var(--ee-rot, 0deg));
  animation: ee-bug-wiggle 0.28s steps(2, end) infinite;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
}
.ee-bug--blocker { width: 52px; height: 52px; }
.ee-bug--fly { animation-duration: 0.18s; }
.ee-bug--spider { animation-duration: 0.36s; }
.ee-bug:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}
.ee-bug__art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.ee-bug--hurt {
  filter: brightness(1.6) saturate(1.4);
  animation: ee-bug-hurt 0.18s steps(2, end);
}
.ee-bug--squash {
  animation: ee-bug-squash 0.4s steps(4, end) forwards !important;
  pointer-events: none;
}
.nav-badge--ee {
  background: #16a34a !important;
  color: #fff !important;
}
@keyframes ee-crt-flicker {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.7; }
}
@keyframes ee-bug-wiggle {
  0% { margin-left: 0; margin-top: 0; }
  50% { margin-left: 1px; margin-top: -1px; }
  100% { margin-left: 0; margin-top: 0; }
}
@keyframes ee-bug-hurt {
  0% { transform: rotate(var(--ee-rot, 0deg)) translateX(0); }
  50% { transform: rotate(var(--ee-rot, 0deg)) translateX(3px); }
  100% { transform: rotate(var(--ee-rot, 0deg)) translateX(0); }
}
@keyframes ee-bug-squash {
  0% {
    transform: rotate(var(--ee-rot, 0deg)) scale(1, 1);
    opacity: 1;
  }
  35% {
    transform: rotate(var(--ee-rot, 0deg)) scale(1.35, 0.45);
    opacity: 1;
  }
  70% {
    transform: rotate(var(--ee-rot, 0deg)) scale(1.55, 0.25);
    opacity: 0.85;
  }
  100% {
    transform: rotate(var(--ee-rot, 0deg)) scale(1.7, 0.12);
    opacity: 0;
  }
}

