/* NDA-Versand: Komponenten-Stylesheet.
   Alle Werte kommen aus tokens.css (aus tokens.json erzeugt). Reines CSS, keine Inline-Styles,
   keine Skripte. Zustände für die Vorschau: .is-hover, .is-focus, .is-active spiegeln :hover,
   :focus-visible und [aria-current]. Sie sind nur für statische Darstellungen gedacht. */

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  line-height: var(--line-height-14);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
img, svg { display: block; }
strong { font-weight: var(--font-weight-bold); }
small { font-size: var(--font-size-13); line-height: var(--line-height-13); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.is-focus { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Icons ---------- */
.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--xs { width: 14px; height: 14px; }
.icon--sm { width: 16px; height: 16px; }
.icon--md { width: 18px; height: 18px; }
.icon--lg { width: 20px; height: 20px; }
.icon--xl { width: 32px; height: 32px; }

/* ---------- Text-Hilfsklassen ---------- */
.t-secondary { color: var(--text-secondary); }
.t-tertiary { color: var(--text-tertiary); }
.t-bold { font-weight: var(--font-weight-bold); }
.t-13 { font-size: var(--font-size-13); line-height: var(--line-height-13); }
.t-12 { font-size: var(--font-size-12); line-height: var(--line-height-12); }
.t-16 { font-size: var(--font-size-16); line-height: var(--line-height-16); }
.t-num { font-variant-numeric: tabular-nums; }
.t-nowrap { white-space: nowrap; }
.t-center { text-align: center; }
.link {
  color: var(--accent-strong);
  font-weight: var(--font-weight-bold);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link:hover, .link.is-hover { color: var(--accent); }

/* ---------- Layout-Hilfsklassen ---------- */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--start { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Vorschau-Rahmen (nur im Designsystem) ---------- */
.preview { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); min-height: 100vh; }
.preview--row { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.preview--center { align-items: center; justify-content: center; }
.preview--white { background: var(--surface); }
.preview--tight { padding: var(--space-4); gap: var(--space-3); }
.preview__group { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.preview__row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.preview__label {
  font-size: var(--font-size-11); line-height: var(--line-height-11);
  font-weight: var(--font-weight-bold); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.preview__note { font-size: var(--font-size-13); line-height: var(--line-height-13); color: var(--text-tertiary); max-width: 560px; }
.preview__col { width: 100%; max-width: 420px; }
.preview__col--wide { max-width: 640px; }
.preview__group--card { flex: 1 1 320px; max-width: 460px; }

/* ---------- App-Rahmen ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: minmax(100vh, auto);
  min-height: 100vh;
  background: var(--bg);
}
/* Grund der Seitenleiste über die ganze Seitenhöhe; die Leiste selbst klebt am Fenster */
.app::before { content: ""; grid-row: 1; grid-column: 1; background: var(--surface); border-right: 1px solid var(--border); }
.main { grid-row: 1; grid-column: 2; min-width: 0; display: flex; flex-direction: column; }
.page {
  padding: var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-6);
  width: 100%; max-width: var(--content-max);
}
.page--narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.page-title { font-size: var(--font-size-24); line-height: var(--line-height-24); font-weight: var(--font-weight-bold); letter-spacing: -0.01em; }
.page-sub { color: var(--text-secondary); margin-top: var(--space-1); }
.page-actions { display: flex; gap: var(--space-3); align-items: center; }

/* Mobile Navigation: Checkbox-Zustand, kein Skript */
.nav-toggle {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nav-scrim { display: none; }
.topbar .menu-btn { display: none; }

/* ---------- Seitenleiste ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-4);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  grid-row: 1; grid-column: 1; align-self: start; z-index: 1;
}
.sidebar--static { position: relative; height: auto; min-height: 100%; width: var(--sidebar-width); flex: none; }
.workspace {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.workspace__tile {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-sm);
  background: var(--text); color: var(--on-accent);
  display: grid; place-items: center;
  font-weight: var(--font-weight-bold); font-size: var(--font-size-16); line-height: var(--line-height-16);
}
.workspace__text { min-width: 0; }
.workspace__name {
  display: block; font-weight: var(--font-weight-bold);
  font-size: var(--font-size-14); line-height: var(--line-height-14);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace__sub {
  display: block; color: var(--text-tertiary);
  font-size: var(--font-size-12); line-height: var(--line-height-12);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.search {
  display: flex; align-items: center; gap: var(--space-2);
  height: var(--control-height); padding: 0 var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-muted); color: var(--text-tertiary);
}
.search:focus-within, .search.is-focus { border-color: var(--accent); outline: 2px solid var(--focus-ring); outline-offset: -1px; }
.search__input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); padding: 0; }
.search__input::placeholder { color: var(--text-tertiary); }
.search__input::-webkit-search-decoration, .search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search__kbd {
  font-size: var(--font-size-11); line-height: var(--line-height-11); font-family: inherit;
  padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--text-tertiary); white-space: nowrap;
}
.search--wide { max-width: 360px; width: 100%; background: var(--surface); }

.nav { display: flex; flex-direction: column; gap: var(--space-5); }
.nav__group { display: flex; flex-direction: column; gap: 2px; }
.nav__heading {
  font-size: var(--font-size-11); line-height: var(--line-height-11);
  font-weight: var(--font-weight-bold); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-tertiary); padding: 0 var(--space-3); margin-bottom: var(--space-1);
}
.nav__item {
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--control-height); padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary); font-weight: var(--font-weight-regular);
  transition: background 0.12s, color 0.12s;
}
.nav__item .icon { width: 20px; height: 20px; }
.nav__item:hover, .nav__item.is-hover { background: var(--surface-muted); color: var(--text); }
.nav__item--active, .nav__item--active:hover, .nav__item--active.is-hover {
  background: var(--accent); color: var(--on-accent); font-weight: var(--font-weight-bold);
}
.nav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__count {
  min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-muted); color: var(--text-secondary);
  font-size: var(--font-size-12); line-height: 20px; font-weight: var(--font-weight-bold);
  text-align: center; font-variant-numeric: tabular-nums;
}
.nav__item:hover .nav__count, .nav__item.is-hover .nav__count { background: var(--border); }
.nav__item--active .nav__count, .nav__item--active:hover .nav__count { background: var(--on-accent-soft); color: var(--on-accent); }

.folders { display: flex; flex-direction: column; gap: 2px; }
.folder-link {
  display: flex; align-items: center; gap: var(--space-3);
  height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.folder-link .icon { width: 18px; height: 18px; }
.folder-link:hover, .folder-link.is-hover { background: var(--surface-muted); color: var(--text); }
.folder-link__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-link__chevron { color: var(--text-tertiary); }

.userblock {
  margin-top: auto;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.userblock__text { flex: 1; min-width: 0; }
.userblock__name {
  display: block; font-weight: var(--font-weight-bold);
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.userblock__role {
  display: block; color: var(--text-tertiary);
  font-size: var(--font-size-12); line-height: var(--line-height-12);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Kopfzeile ---------- */
.topbar {
  height: var(--header-height);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--space-8);
  position: sticky; top: 0; z-index: 10;
}
.topbar--static { position: relative; }
.crumbs {
  display: flex; align-items: center; gap: var(--space-2); min-width: 0;
  color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13);
}
.crumbs__item { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.crumbs__item .icon { width: 16px; height: 16px; }
.crumbs__item--current { color: var(--text); font-weight: var(--font-weight-bold); overflow: hidden; text-overflow: ellipsis; }
.crumbs__sep { width: 16px; height: 16px; color: var(--border-strong); flex: none; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
.topbar__sync {
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  color: var(--text-tertiary); margin-right: var(--space-3); white-space: nowrap;
}

.iconbtn {
  position: relative;
  width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-md);
  display: inline-grid; place-items: center;
  color: var(--text-secondary);
}
.iconbtn .icon { width: 20px; height: 20px; }
.iconbtn:hover, .iconbtn.is-hover { background: var(--surface-muted); color: var(--text); }
.iconbtn--badge::after {
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Karten ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); flex-wrap: wrap;
  padding: var(--space-5) var(--space-6) 0;
}
.card__head--border { padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.card__title { font-size: var(--font-size-16); line-height: var(--line-height-16); font-weight: var(--font-weight-bold); min-width: 0; }
.card__sub { color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13); margin-top: 2px; }
.card__body { padding: var(--space-6); }
.card__body--tight { padding: var(--space-4) var(--space-6) var(--space-6); }
.card__section { padding: var(--space-5) var(--space-6); border-top: 1px solid var(--border); }
.card__section:first-child { border-top: 0; }
.card__section-title { font-size: var(--font-size-16); line-height: var(--line-height-16); font-weight: var(--font-weight-bold); margin-bottom: var(--space-3); }
.card__foot {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Kennzahl-Karte ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.kpi { display: flex; align-items: stretch; overflow: hidden; min-height: 96px; }
.kpi__body {
  flex: 1; min-width: 0;
  padding: var(--space-4) var(--space-5);
  display: flex; flex-direction: column; justify-content: center; gap: var(--space-1);
}
.kpi__label {
  font-size: var(--font-size-12); line-height: var(--line-height-12);
  color: var(--text-tertiary);
}
.kpi__value {
  font-size: var(--font-size-28); line-height: var(--line-height-28);
  font-weight: var(--font-weight-bold); letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.kpi__of {
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  color: var(--text-tertiary); font-weight: var(--font-weight-regular);
  margin-left: var(--space-1); letter-spacing: 0;
}
.kpi__tile {
  width: 88px; flex: none;
  display: grid; place-items: center;
  color: var(--on-accent);
}
.kpi__tile .icon { width: 32px; height: 32px; }
.kpi__tile--orange { background: linear-gradient(160deg, var(--tile-orange), var(--tile-orange-deep)); }
.kpi__tile--violet { background: linear-gradient(160deg, var(--tile-violet), var(--tile-violet-deep)); }
.kpi__tile--green  { background: linear-gradient(160deg, var(--tile-green), var(--tile-green-deep)); }
.kpi__tile--blue   { background: linear-gradient(160deg, var(--tile-blue), var(--tile-blue-deep)); }

.progress {
  height: 6px; border-radius: var(--radius-full);
  background: var(--border); overflow: hidden; width: 100%;
}
.progress__bar { height: 100%; border-radius: inherit; background: var(--accent); }
.progress__bar--5 { width: 5%; } .progress__bar--10 { width: 10%; } .progress__bar--15 { width: 15%; }
.progress__bar--18 { width: 17.5%; } .progress__bar--20 { width: 20%; } .progress__bar--25 { width: 25%; }
.progress__bar--30 { width: 30%; } .progress__bar--40 { width: 40%; } .progress__bar--50 { width: 50%; }
.progress__bar--60 { width: 60%; } .progress__bar--75 { width: 75%; } .progress__bar--90 { width: 90%; }
.progress__bar--100 { width: 100%; }
.kpi__progress { margin-top: var(--space-2); }

/* ---------- Diagramm ----------
   Das SVG enthält nur Fläche, Linien, Raster und Punkte und wird mit preserveAspectRatio="none"
   auf die Kartenbreite gestreckt. Strichstärken bleiben dank vector-effect gleich, Punkte sind
   Null-Längen-Pfade mit rundem Ende. Achsenbeschriftungen sind HTML und skalieren nicht mit. */
.chart { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 var(--space-2); }
.chart__y { position: relative; height: 200px; }
.chart__tick {
  position: absolute; right: 0; transform: translateY(-50%);
  font-size: var(--font-size-11); line-height: var(--line-height-11); color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.chart__tick--0 { top: 100%; } .chart__tick--1 { top: 80%; } .chart__tick--2 { top: 60%; }
.chart__tick--3 { top: 40%; } .chart__tick--4 { top: 20%; } .chart__tick--5 { top: 0; }
.chart__plot { min-width: 0; }
.chart__svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart__grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__area { fill: url(#chart-area-fill); }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart__line--dashed { stroke-dasharray: 6 6; }
.chart__dot { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart__dot-core { fill: none; stroke: var(--surface); stroke-width: 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart__stop-top { stop-color: var(--accent); stop-opacity: 0.22; }
.chart__stop-bottom { stop-color: var(--accent); stop-opacity: 0; }
.chart__x { display: flex; justify-content: space-between; margin-top: var(--space-2); }
.chart__x span {
  width: 0; display: flex; justify-content: center; white-space: nowrap;
  font-size: var(--font-size-11); line-height: var(--line-height-11); color: var(--text-tertiary);
}
.legend { display: flex; gap: var(--space-5); flex-wrap: wrap; font-size: var(--font-size-13); line-height: var(--line-height-13); color: var(--text-secondary); }
.legend__item { display: inline-flex; align-items: center; gap: var(--space-2); }
.legend__swatch { width: 20px; height: 0; border-top: 2px solid var(--accent); }
.legend__swatch--dashed { border-top-style: dashed; }
.chart-card__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-6) 0; flex-wrap: wrap; }

/* ---------- Avatar ---------- */
.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-full);
  background: var(--surface-muted); border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-grid; place-items: center;
  font-size: var(--font-size-12); line-height: 1; font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
}
.avatar--sm { width: 28px; height: 28px; font-size: var(--font-size-11); }
.avatar--lg { width: 48px; height: 48px; font-size: var(--font-size-16); }
.avatar--accent { background: var(--accent-light); color: var(--accent-strong); border-color: transparent; }

/* ---------- Status ---------- */
.status {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  font-weight: var(--font-weight-regular); white-space: nowrap;
}
.status__dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: currentColor; flex: none; }
.status--sent, .status--opened { color: var(--status-sent-text); }
.status--sent .status__dot { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }
.status--waiting, .status--pending { color: var(--status-waiting-text); }
.status--signed, .status--active { color: var(--status-signed-text); }
.status--declined, .status--error { color: var(--status-declined-text); }
.status--withdrawn, .status--inactive { color: var(--status-withdrawn-text); }
.status--pill {
  padding: 2px 10px 2px 8px; border-radius: var(--radius-full); border: 1px solid;
}
.status--pill.status--sent, .status--pill.status--opened { background: var(--status-sent-bg); border-color: var(--status-sent-border); }
.status--pill.status--waiting, .status--pill.status--pending { background: var(--status-waiting-bg); border-color: var(--status-waiting-border); }
.status--pill.status--signed, .status--pill.status--active { background: var(--status-signed-bg); border-color: var(--status-signed-border); }
.status--pill.status--declined, .status--pill.status--error { background: var(--status-declined-bg); border-color: var(--status-declined-border); }
.status--pill.status--withdrawn, .status--pill.status--inactive { background: var(--status-withdrawn-bg); border-color: var(--status-withdrawn-border); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  height: 24px; padding: 0 10px;
  border-radius: var(--radius-full); border: 1px solid transparent;
  font-size: var(--font-size-12); line-height: var(--line-height-12); font-weight: var(--font-weight-bold);
  white-space: nowrap;
}
.chip--admin { background: var(--accent-light); color: var(--accent-strong); }
.chip--user { background: var(--surface-muted); color: var(--text-secondary); border-color: var(--border); }
.chip--count { background: var(--surface); color: var(--text-tertiary); border-color: var(--border); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-height); padding: 0 var(--space-4);
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: var(--font-size-14); line-height: var(--line-height-14); font-weight: var(--font-weight-bold);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn .icon { width: 18px; height: 18px; }
.btn--sm {
  height: var(--control-height-sm); padding: 0 var(--space-3);
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  border-radius: var(--radius-sm);
}
.btn--sm .icon { width: 16px; height: 16px; }
.btn--icon { width: var(--control-height); padding: 0; }
.btn--sm.btn--icon { width: var(--control-height-sm); }
.btn--block { width: 100%; height: auto; min-height: var(--control-height); padding-top: var(--space-2); padding-bottom: var(--space-2); white-space: normal; }

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover, .btn--primary.is-hover { background: var(--accent-strong); }
.btn--primary:active, .btn--primary.is-active { background: var(--accent-strong); }

.btn--secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--secondary:hover, .btn--secondary.is-hover { background: var(--surface-muted); border-color: var(--border-strong); }
.btn--secondary:active, .btn--secondary.is-active { background: var(--border); }

.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover, .btn--ghost.is-hover { background: var(--surface-muted); color: var(--text); }
.btn--ghost:active, .btn--ghost.is-active { background: var(--border); color: var(--text); }

.btn--danger { background: var(--danger); color: var(--on-accent); }
.btn--danger:hover, .btn--danger.is-hover { background: var(--danger-strong); }
.btn--danger:active, .btn--danger.is-active { background: var(--danger-strong); }

.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; cursor: default; }

.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: var(--radius-full);
  border: 2px solid var(--on-accent); border-right-color: transparent;
  animation: btn-spin 0.8s linear infinite;
}
.btn--secondary.is-loading::after, .btn--ghost.is-loading::after { border-color: var(--text-secondary); border-right-color: transparent; }
.btn--sm.is-loading::after { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- Eingabefelder ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field__label {
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  font-weight: var(--font-weight-bold); color: var(--text);
}
.field__req { color: var(--danger); margin-left: 2px; }
.field__optional { color: var(--text-tertiary); font-weight: var(--font-weight-regular); margin-left: var(--space-1); }
.field__hint { font-size: var(--font-size-13); line-height: var(--line-height-13); color: var(--text-tertiary); }
.field__error {
  display: flex; align-items: flex-start; gap: var(--space-1);
  font-size: var(--font-size-13); line-height: var(--line-height-13); color: var(--danger);
}
.field__error .icon { width: 16px; height: 16px; margin-top: 1px; }

.input {
  display: block; width: 100%;
  height: var(--control-height); padding: 0 var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  font-size: var(--font-size-14); line-height: var(--line-height-14);
  transition: border-color 0.12s;
}
.input::placeholder { color: var(--text-tertiary); opacity: 1; }
.input:hover, .input.is-hover { border-color: var(--text-secondary); }
.input:focus, .input.is-focus { border-color: var(--accent); outline: 2px solid var(--focus-ring); outline-offset: -1px; }
.input[readonly], .input.is-readonly {
  background: var(--surface-muted); border-color: var(--border); color: var(--text-secondary);
}
.input[readonly]:hover { border-color: var(--border); }
.input[readonly]:focus { outline: 2px solid var(--focus-ring); outline-offset: -1px; border-color: var(--border); }
.input[disabled], .input.is-disabled { opacity: 0.5; background: var(--surface-muted); }
.field--error .input { border-color: var(--danger); }
.field--error .input:focus, .field--error .input.is-focus { outline-color: var(--danger); border-color: var(--danger); }
textarea.input { height: auto; min-height: 112px; padding: var(--space-2) var(--space-3); resize: vertical; }

.select { position: relative; display: block; }
.select .input { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }
.select__chevron {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-tertiary); pointer-events: none;
}
.select__lead {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-secondary); pointer-events: none;
}
.select--sm .input {
  height: var(--control-height-sm);
  font-size: var(--font-size-13); line-height: var(--line-height-13);
  padding: 0 32px 0 var(--space-3);
  border-color: var(--border); border-radius: var(--radius-sm);
  font-weight: var(--font-weight-bold); color: var(--text);
}
.select--sm.select--lead .input { padding-left: 32px; }
.select--sm .select__chevron { width: 16px; height: 16px; right: 10px; }

/* ---------- Formularabschnitt und Aktionsleiste ---------- */
.form-section__head { padding: var(--space-6) var(--space-6) 0; }
.form-section__title { font-size: var(--font-size-18); line-height: var(--line-height-18); font-weight: var(--font-weight-bold); }
.form-section__intro { color: var(--text-secondary); margin-top: var(--space-1); }
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
  padding: var(--space-5) var(--space-6) var(--space-6);
}
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.actionbar {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-4) var(--space-6);
}
.actionbar__hint {
  display: flex; align-items: center; gap: var(--space-2);
  margin-right: auto; color: var(--text-tertiary);
  font-size: var(--font-size-13); line-height: var(--line-height-13);
}
.actionbar__hint .icon { width: 16px; height: 16px; }

/* ---------- Schrittleiste ---------- */
.steps { display: flex; align-items: center; gap: var(--space-3); }
.step {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--text-tertiary); font-weight: var(--font-weight-bold); white-space: nowrap;
}
.step__num {
  width: 28px; height: 28px; flex: none;
  border-radius: var(--radius-full); border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: var(--font-size-13); line-height: 1; font-weight: var(--font-weight-bold);
}
.step__num .icon { width: 14px; height: 14px; }
.step--current { color: var(--text); }
.step--current .step__num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step--done { color: var(--text-secondary); }
.step--done .step__num { background: var(--accent-light); border-color: var(--accent-light); color: var(--accent-strong); }
.step__line { flex: 1; height: 1px; background: var(--border); min-width: 24px; }
.step__line--done { background: var(--accent); }

/* ---------- Zusammenfassung und Hinweiskasten ---------- */
.kv { display: grid; grid-template-columns: minmax(104px, min(34%, 200px)) minmax(0, 1fr); }
.kv__row { display: contents; }
.kv dt, .kv dd { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.kv dt { color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13); padding-top: calc(var(--space-3) + 1px); padding-right: var(--space-4); }
.kv dd { color: var(--text); overflow-wrap: anywhere; }
.kv__row:last-child dt, .kv__row:last-child dd { border-bottom: 0; }
.note {
  background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex; gap: var(--space-3);
}
.note .icon { width: 20px; height: 20px; color: var(--text-secondary); margin-top: 0; }
.note__body { min-width: 0; }
.note__title { font-weight: var(--font-weight-bold); margin-bottom: var(--space-2); }
.note__list { list-style: disc; padding-left: var(--space-5); color: var(--text-secondary); display: flex; flex-direction: column; gap: var(--space-1); }
.note__text { color: var(--text-secondary); }

/* ---------- Status-Banner ---------- */
.banner {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid; border-radius: var(--radius-md);
}
.banner .icon { width: 20px; height: 20px; }
.banner__body { min-width: 0; color: var(--text-secondary); }
.banner__title { display: block; font-weight: var(--font-weight-bold); }
.banner--info { background: var(--status-sent-bg); border-color: var(--status-sent-border); }
.banner--info .icon, .banner--info .banner__title { color: var(--status-sent-text); }
.banner--success { background: var(--status-signed-bg); border-color: var(--status-signed-border); }
.banner--success .icon, .banner--success .banner__title { color: var(--status-signed-text); }
.banner--warning { background: var(--status-waiting-bg); border-color: var(--status-waiting-border); }
.banner--warning .icon, .banner--warning .banner__title { color: var(--status-waiting-text); }
.banner--danger { background: var(--status-declined-bg); border-color: var(--status-declined-border); }
.banner--danger .icon, .banner--danger .banner__title { color: var(--status-declined-text); }
.banner--neutral { background: var(--status-withdrawn-bg); border-color: var(--status-withdrawn-border); }
.banner--neutral .icon, .banner--neutral .banner__title { color: var(--text); }
.banner__actions { margin-top: var(--space-3); display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Seitenmeldung ---------- */
.notice {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid; border-radius: var(--radius-md);
  background: var(--surface);
}
.notice .icon { width: 20px; height: 20px; }
.notice__text { flex: 1; min-width: 0; color: var(--text); }
.notice__text strong { font-weight: var(--font-weight-bold); }
.notice__close { margin: -6px -8px -6px 0; }
.notice--success { background: var(--status-signed-bg); border-color: var(--status-signed-border); }
.notice--success .icon { color: var(--status-signed-text); }
.notice--error { background: var(--status-error-bg); border-color: var(--status-error-border); }
.notice--error .icon { color: var(--status-error-text); }
.notice--info { background: var(--status-sent-bg); border-color: var(--status-sent-border); }
.notice--info .icon { color: var(--status-sent-text); }
.notice .iconbtn .icon { color: var(--text-secondary); }

/* ---------- Reiter ---------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-3); margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary); white-space: nowrap;
}
.tab:hover, .tab.is-hover { color: var(--text); }
.tab--active { color: var(--text); font-weight: var(--font-weight-bold); border-bottom-color: var(--accent); }
.tab__count {
  min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-muted); color: var(--text-secondary);
  font-size: var(--font-size-12); line-height: 20px; font-weight: var(--font-weight-bold);
  text-align: center; font-variant-numeric: tabular-nums;
}
.tab--active .tab__count { background: var(--accent-light); color: var(--accent-strong); }
.card .tabs { padding: 0 var(--space-6); }

/* ---------- Werkzeugleiste über Tabellen ---------- */
.toolbar {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
}

/* ---------- Datentabelle ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--font-size-12); line-height: var(--line-height-12);
  font-weight: var(--font-weight-bold); color: var(--text-tertiary);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border); vertical-align: middle;
  color: var(--text-secondary);
}
.table th:first-child, .table td:first-child { padding-left: var(--space-6); }
.table th:last-child, .table td:last-child { padding-right: var(--space-6); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td, .table tr.is-hover td { background: var(--surface-muted); }
.table__action { text-align: right; white-space: nowrap; }
.table__action .row { justify-content: flex-end; flex-wrap: nowrap; gap: var(--space-2); }
.table__num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-primary { color: var(--text); }
.table__date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table__date small { display: block; color: var(--text-tertiary); }
.table--card { border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden; }

.person { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.person__text { min-width: 0; }
.person__name { display: block; color: var(--text); font-weight: var(--font-weight-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__sub { display: block; color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-name { display: flex; align-items: center; gap: var(--space-2); color: var(--text); font-weight: var(--font-weight-bold); }
.doc-name .icon { width: 18px; height: 18px; color: var(--text-tertiary); }

/* ---------- Listen (Letzte Vorgänge) ---------- */
.list { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-6) var(--space-6); }
.list-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-muted); border: 1px solid transparent; border-radius: var(--radius-md);
  min-width: 0;
}
.list-row:hover, .list-row.is-hover { border-color: var(--border); background: var(--surface); }
.list-row__icon { color: var(--text-tertiary); }
.list-row__icon .icon { width: 18px; height: 18px; }
.list-row__main { min-width: 0; display: flex; align-items: center; gap: var(--space-3); }
.list-row__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.list-row__date { color: var(--text-tertiary); font-size: var(--font-size-12); line-height: var(--line-height-12); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Zeitleiste ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline__item {
  position: relative;
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--space-3);
  padding-bottom: var(--space-5);
}
.timeline__item::before {
  content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px;
  background: var(--border); border-radius: 1px;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::before { display: none; }
.timeline__dot {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  display: grid; place-items: center;
  background: var(--surface-muted); color: var(--text-secondary); border: 1px solid var(--border);
}
.timeline__dot .icon { width: 16px; height: 16px; }
.timeline__dot--sent, .timeline__dot--opened { background: var(--status-sent-bg); color: var(--status-sent-text); border-color: var(--status-sent-border); }
.timeline__dot--waiting { background: var(--status-waiting-bg); color: var(--status-waiting-text); border-color: var(--status-waiting-border); }
.timeline__dot--signed { background: var(--status-signed-bg); color: var(--status-signed-text); border-color: var(--status-signed-border); }
.timeline__dot--declined { background: var(--status-declined-bg); color: var(--status-declined-text); border-color: var(--status-declined-border); }
.timeline__body { min-width: 0; padding-top: 6px; }
.timeline__title { display: block; font-weight: var(--font-weight-bold); }
.timeline__detail { color: var(--text-secondary); font-size: var(--font-size-13); line-height: var(--line-height-13); margin-top: 2px; }
.timeline__time {
  color: var(--text-tertiary); font-size: var(--font-size-12); line-height: var(--line-height-12);
  white-space: nowrap; padding-top: 8px; font-variant-numeric: tabular-nums; text-align: right;
}

/* ---------- Dokumentenzeile ---------- */
.docrow {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.docrow__icon {
  width: 40px; height: 40px; flex: none;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-secondary);
}
.docrow__icon .icon { width: 20px; height: 20px; }
.docrow__text { flex: 1; min-width: 0; }
.docrow__title { display: block; font-weight: var(--font-weight-bold); color: var(--text); overflow-wrap: anywhere; }
.docrow__sub { display: block; color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docrow--pending .docrow__icon { color: var(--text-tertiary); border-style: dashed; }
.docrow--pending .docrow__title { color: var(--text-secondary); }

/* ---------- Ordnerkarte ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.folder {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-md);
  min-width: 0;
}
.folder__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.folder__icon { width: 60px; height: 52px; }
.folder__icon .fi-back { fill: var(--tile-orange-deep); }
.folder__icon .fi-front { fill: var(--tile-orange); }
.folder__icon--violet .fi-back { fill: var(--tile-violet-deep); }
.folder__icon--violet .fi-front { fill: var(--tile-violet); }
.folder__icon--green .fi-back { fill: var(--tile-green-deep); }
.folder__icon--green .fi-front { fill: var(--tile-green); }
.folder__icon--blue .fi-back { fill: var(--tile-blue-deep); }
.folder__icon--blue .fi-front { fill: var(--tile-blue); }
.folder__title { font-size: var(--font-size-16); line-height: var(--line-height-16); font-weight: var(--font-weight-bold); margin-top: var(--space-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder__desc {
  color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13);
  min-height: calc(var(--line-height-13) * 2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.folder__actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.folder__actions .btn { flex: 1; }

/* ---------- Leerzustand ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--space-12) var(--space-6); gap: var(--space-2);
}
.empty__icon {
  width: 48px; height: 48px; border-radius: var(--radius-full);
  background: var(--surface-muted); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}
.empty__icon .icon { width: 22px; height: 22px; }
.empty__title { font-size: var(--font-size-16); line-height: var(--line-height-16); font-weight: var(--font-weight-bold); }
.empty__text { color: var(--text-tertiary); max-width: 380px; }
.empty .btn { margin-top: var(--space-3); }
.empty--compact { padding: var(--space-8) var(--space-6); }

/* ---------- Anmeldung ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6); background: var(--bg); }
.auth { width: 100%; max-width: 440px; padding: var(--space-8); }
.auth__brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); }
.auth__brand-name { font-weight: var(--font-weight-bold); font-size: var(--font-size-16); line-height: var(--line-height-16); }
.auth__title { font-size: var(--font-size-24); line-height: var(--line-height-24); font-weight: var(--font-weight-bold); letter-spacing: -0.01em; }
.auth__intro { color: var(--text-secondary); margin-top: var(--space-1); }
.auth__form { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-6); }
.auth__form .btn { margin-top: var(--space-2); }
.auth__foot { margin-top: var(--space-5); text-align: center; font-size: var(--font-size-13); line-height: var(--line-height-13); color: var(--text-tertiary); }

/* ---------- Dialog ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: var(--scrim);
  display: grid; place-items: center; padding: var(--space-6);
}
.dialog-demo { border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); }
.dialog-demo .dialog-backdrop { position: relative; inset: auto; padding: var(--space-8) var(--space-6); }
.dialog {
  width: 100%; max-width: 480px;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-6) var(--space-6) 0; }
.dialog__title { font-size: var(--font-size-18); line-height: var(--line-height-18); font-weight: var(--font-weight-bold); }
.dialog__body { padding: var(--space-3) var(--space-6) var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); color: var(--text-secondary); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); }

/* ---------- Seiten-Raster ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.detail-head { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.detail-head__text { min-width: 0; flex: 1; }
.detail-head__name { font-size: var(--font-size-20); line-height: var(--line-height-20); font-weight: var(--font-weight-bold); }
.detail-head__sub { color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }
.signer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); }
.signer__text { min-width: 0; }
.signer__name { display: block; font-weight: var(--font-weight-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signer__sub { display: block; color: var(--text-tertiary); font-size: var(--font-size-13); line-height: var(--line-height-13); }
.actions-list { display: flex; flex-direction: column; gap: var(--space-2); }
.actions-list .btn { justify-content: flex-start; }
.review-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.quota { display: flex; flex-direction: column; gap: var(--space-2); }
.quota__row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--font-size-13); line-height: var(--line-height-13); color: var(--text-tertiary); }
.quota__value { font-weight: var(--font-weight-bold); color: var(--text); }

/* ---------- Icon-Übersicht (nur im Designsystem) ---------- */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-3); }
.icon-cell {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: var(--font-size-12); line-height: var(--line-height-12); color: var(--text-tertiary);
  text-align: center; overflow-wrap: anywhere;
}

/* ---------- Cover (nur im Designsystem) ---------- */
.cover { position: relative; height: 288px; overflow: hidden; background: var(--bg); }
.cover__art { position: absolute; top: 0; left: 480px; width: 480px; height: 288px; overflow: hidden; }
.cover__art svg { display: block; width: 560px; height: 288px; }
.cover .c-accent { fill: var(--accent); }
.cover .c-ink { fill: var(--text); }
.cover .c-tint { fill: var(--accent-light); }
.cover .c-violet { fill: var(--tile-violet-deep); }
.cover .c-green { fill: var(--tile-green-deep); }
.cover .c-blue { fill: var(--tile-blue-deep); }
.cover .c-surface { fill: var(--surface); }
.cover .c-lg { rx: var(--radius-lg); }
.cover .c-md { rx: var(--radius-md); }
.cover .c-sm { rx: var(--radius-sm); }
.cover__words { position: absolute; left: var(--space-8); bottom: var(--space-8); max-width: 440px; }
.cover__name { margin: 0; font-size: 96px; line-height: 0.95; font-weight: var(--font-weight-bold); letter-spacing: -0.03em; color: var(--text); }
.cover__tag { margin: var(--space-3) 0 0 4px; font-size: var(--font-size-14); line-height: var(--line-height-14); color: var(--text-tertiary); }

/* ---------- 1024 px: Seitenleiste als Icon-Leiste ----------
   Alle Regeln sind auf .app begrenzt, damit Einzelvorschauen der Seitenleiste unberührt bleiben. */
@media (max-width: 1024px) {
  .app { grid-template-columns: var(--sidebar-width-compact) minmax(0, 1fr); }
  .app .sidebar { padding: var(--space-3) var(--space-2); }
  .app .workspace { justify-content: center; padding: var(--space-1); border-color: transparent; }
  .app .workspace__text, .app .search__input, .app .search__kbd, .app .nav__heading, .app .nav__label, .app .nav__count,
  .app .folder-link__label, .app .folder-link__chevron, .app .userblock__text { display: none; }
  .app .search { justify-content: center; padding: 0; }
  .app .nav__item, .app .folder-link { justify-content: center; padding: 0; }
  .app .nav__group, .app .folders { gap: var(--space-1); }
  .app .userblock { flex-direction: column; gap: var(--space-2); padding: var(--space-2) var(--space-1); }
  .topbar { padding: 0 var(--space-6); }
  .page { padding: var(--space-6); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail-grid > :last-child { grid-column: 1 / -1; }
  .review-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Handy: Seitenleiste eingeblendet über Checkbox ---------- */
@media (max-width: 768px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app::before { display: none; }
  .main { grid-column: 1; }
  .app .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
    width: min(320px, 86vw); height: 100vh;
    padding: var(--space-4);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .app .workspace { justify-content: flex-start; padding: var(--space-2); border-color: var(--border); }
  .app .workspace__text, .app .search__input, .app .search__kbd, .app .nav__heading, .app .nav__label,
  .app .folder-link__label, .app .folder-link__chevron, .app .userblock__text { display: block; }
  .app .nav__count { display: inline-block; }
  .app .search { justify-content: flex-start; padding: 0 var(--space-3); }
  .app .nav__item, .app .folder-link { justify-content: flex-start; padding: 0 var(--space-3); }
  .app .nav__group { gap: 2px; }
  .app .userblock { flex-direction: row; padding: var(--space-2); }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: var(--shadow-card); }
  .nav-scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); cursor: pointer; }
  .nav-toggle:checked ~ .nav-scrim { display: block; }
  .nav-toggle:focus-visible ~ .main .menu-btn { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
  .topbar .menu-btn { display: inline-grid; margin-left: calc(var(--space-2) * -1); }
  .topbar { padding: 0 var(--space-4); gap: var(--space-2); }
  .topbar__sync { display: none; }
  .crumbs__item:not(.crumbs__item--current), .crumbs__sep { display: none; }
  .page { padding: var(--space-4); gap: var(--space-4); }
  .page-title { font-size: var(--font-size-20); line-height: var(--line-height-20); }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi { min-height: 80px; }
  .kpi__tile { width: 72px; }
  .folder-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid > :last-child { grid-column: auto; }
  .list-row { grid-template-columns: auto minmax(0, 1fr); }
  .list-row__meta { grid-column: 2; flex-direction: row; justify-content: space-between; align-items: center; }
  .form-grid { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); }
  .form-grid .span-2 { grid-column: auto; }
  .form-section__head, .card__head { padding-left: var(--space-4); padding-right: var(--space-4); }
  .card__body, .card__section, .card__foot, .toolbar, .actionbar, .list { padding-left: var(--space-4); padding-right: var(--space-4); }
  .table th:first-child, .table td:first-child { padding-left: var(--space-4); }
  .table th:last-child, .table td:last-child { padding-right: var(--space-4); }
  .card .tabs { padding: 0 var(--space-4); }
  .actionbar .btn { flex: 1; }
  .actionbar__hint { flex-basis: 100%; }
  .auth { padding: var(--space-6); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { padding-bottom: 0; border-bottom: 0; }
  .kv dd { padding-top: var(--space-1); }
  .timeline__item { grid-template-columns: 32px minmax(0, 1fr); }
  .timeline__time { grid-column: 2; text-align: left; padding-top: 0; }
  .steps { gap: var(--space-2); }
  .step__line { min-width: 12px; }
}
