/* ==========================================================================
   Komponenten
   Namen entsprechen docs/11-ui-ux/04-komponenten.md (Button, Badge, Card, ...)
   ========================================================================== */

/* --- Wordmark --------------------------------------------------------- */

.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wordmark__mark { width: 28px; height: 28px; flex: none; }
.wordmark__mark .bg { fill: var(--primary); }
.wordmark__mark .fg { stroke: var(--on-primary); fill: none; }
.wordmark__mark .dot { fill: var(--on-primary); }
.wordmark__text { font-weight: 650; font-size: 17px; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
.wordmark__text span { color: var(--primary-text); }

/* --- Button ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn--sm { height: 32px; padding: 0 var(--space-3); }
.btn--lg { height: 48px; padding: 0 var(--space-6); font-size: var(--text-body); }
.btn--block { width: 100%; }

.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--primary-hover); }

.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn--secondary:hover { background: var(--surface-raised); border-color: var(--border-input); }

.btn--ghost { color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-raised); color: var(--text); }

.btn--danger { background: var(--danger); color: #fff; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-raised); color: var(--text); }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn__dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--bg);
}

/* --- Avatar ----------------------------------------------------------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary-text);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-btn { border-radius: var(--radius-full); padding: 2px; }
.avatar-btn:hover .avatar, .avatar-btn[aria-expanded="true"] .avatar { box-shadow: 0 0 0 2px var(--border-input); }

/* --- SearchBar -------------------------------------------------------- */

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(440px, 100%);
}
.search .icon { position: absolute; left: 12px; color: var(--text-subtle); pointer-events: none; }
.search__input {
  width: 100%;
  height: 36px;
  padding: 0 44px 0 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search__input::placeholder { color: var(--text-subtle); }
.search__input:hover { border-color: var(--border-input); }
.search__input:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.kbd {
  position: absolute;
  right: 8px;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 500;
}
.search-mobile-btn { display: none; }

@media (max-width: 767px) {
  .topbar .search { display: none; }
  .search-mobile-btn { display: inline-grid; }
  .topbar .btn-upload .btn__label { display: none; }
  .topbar .btn-upload { width: 36px; padding: 0; }
}

/* --- Badge ------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-raised);
  color: var(--text-muted);
}
.badge .icon { width: 12px; height: 12px; }
.badge--info    { background: var(--info-subtle);    color: var(--info); }
.badge--success { background: var(--success-subtle); color: var(--success); }
.badge--warning { background: var(--warning-subtle); color: var(--warning); }
.badge--danger  { background: var(--danger-subtle);  color: var(--danger); }
.badge--outline { background: transparent; border: 1px solid var(--border); }

/* --- Card ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card--pad { padding: var(--space-6); }
a.card, .card--link { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
a.card:hover, .card--link:hover { border-color: var(--border-input); box-shadow: var(--shadow-md); }

/* --- Section ---------------------------------------------------------- */

.section { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.section__header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.section__title { font-size: var(--text-h3); font-weight: 600; }
.section__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}
.section__link:hover { color: var(--primary-text); }
.section__link .icon { width: 14px; height: 14px; }

/* --- StatCard --------------------------------------------------------- */

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5);
}
.stat-card__top { display: flex; align-items: center; justify-content: space-between; }
.stat-card__label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.stat-card__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-muted);
}
.stat-card__value {
  margin-top: var(--space-2);
  font-size: 2rem;
  line-height: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-card__hint { font-size: var(--text-sm); color: var(--text-subtle); }
.stat-card__hint--warning { color: var(--warning); }

/* --- ProgressBar ------------------------------------------------------ */

.progress { display: flex; align-items: center; gap: var(--space-3); }
.progress__track {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  overflow: hidden;
}
.progress__bar { height: 100%; border-radius: inherit; background: var(--primary); }
.progress__value { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }

/* --- DeadlineItem ----------------------------------------------------- */

.deadline-list { display: flex; flex-direction: column; }
.deadline-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
}
.deadline-item:first-child { border-top: 0; }
.deadline-item:hover { background: color-mix(in srgb, var(--surface-raised) 60%, transparent); }
.deadline-item__body { min-width: 0; }
.deadline-item__title { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deadline-item__module { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.deadline-item__due { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.deadline-item__type { display: grid; place-items: center; width: 24px; height: 24px; color: var(--text-subtle); }
.deadline-item.is-done .deadline-item__title { text-decoration: line-through; color: var(--text-subtle); }
.deadline-item.is-done .badge { display: none; }
.deadline-list__more {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Aufgaben-Checkbox (TaskCheck) */
.task-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  color: var(--border-input);
  transition: color var(--dur) var(--ease);
}
.task-check::before { content: ""; position: absolute; inset: -10px; } /* 44-px-Trefferflaeche */
.task-check .icon { width: 20px; height: 20px; }
.task-check .icon-done { display: none; color: var(--success); }
.task-check:hover { color: var(--primary); }
.task-check[aria-pressed="true"] .icon-open { display: none; }
.task-check[aria-pressed="true"] .icon-done { display: block; }

/* --- ExamCard (hervorgehoben) ----------------------------------------- */

.exam-card { display: flex; flex-direction: column; overflow: hidden; }
.exam-card__head {
  padding: var(--space-5);
  background: linear-gradient(180deg, var(--primary-subtle), color-mix(in srgb, var(--primary-subtle) 35%, var(--surface)));
  border-bottom: 1px solid var(--border);
}
.exam-card__eyebrow { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--primary-text); }
.exam-card__module { margin-top: var(--space-3); font-size: var(--text-h2); font-weight: 600; letter-spacing: -0.01em; }
.exam-card__kind { font-size: var(--text-sm); color: var(--text-muted); }
.exam-card__countdown { display: flex; align-items: baseline; gap: var(--space-2); margin-top: var(--space-4); }
.exam-card__days { font-size: 2.75rem; line-height: 1; font-weight: 650; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--text); }
.exam-card__days-label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.exam-card__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); }
.meta-row { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--text); }
.meta-row .icon { color: var(--text-subtle); }
.exam-card__notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--warning-subtle);
  color: var(--warning);
  font-size: var(--text-sm);
  font-weight: 500;
}
.exam-card__notice .icon { margin-top: 2px; }
.exam-card__next { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-muted); }
.exam-card__next strong { color: var(--text); font-weight: 600; }

/* --- ModuleCard ------------------------------------------------------- */

.module-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
.module-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.module-card__name { font-size: var(--text-h3); font-weight: 600; line-height: 1.375rem; }
.module-card__code { margin-top: 2px; font-size: var(--text-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.module-card__stats { display: flex; gap: var(--space-5); font-size: var(--text-sm); color: var(--text-muted); }
.module-card__stat { display: inline-flex; align-items: center; gap: 6px; }
.module-card__stat strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.module-card__next { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-muted); }
.module-card__next span:last-child { color: var(--text); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- DocumentItem (DocumentCard, kompakt) ----------------------------- */

.doc-list { display: flex; flex-direction: column; }
.doc-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
}
.doc-item:first-child { border-top: 0; }
.doc-item:hover { background: color-mix(in srgb, var(--surface-raised) 60%, transparent); }
.file-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--danger-subtle);
  color: var(--danger);
}
.file-icon .icon { width: 18px; height: 18px; }
.file-icon__ext { position: absolute; bottom: -4px; right: -6px; padding: 0 4px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); font-size: 9px; font-weight: 700; line-height: 14px; color: var(--danger); letter-spacing: 0.02em; }
.doc-item__title { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item__title a { color: inherit; text-decoration: none; }
.doc-item__title a:hover { color: var(--primary-text); }
.doc-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); margin-top: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.doc-item__meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); }
.doc-item__uploader { display: inline-flex; align-items: center; gap: 6px; }
.doc-item__actions { display: flex; align-items: center; gap: var(--space-1); }

.bookmark-btn[aria-pressed="true"] { color: var(--primary-text); }
.bookmark-btn .icon-on { display: none; }
.bookmark-btn[aria-pressed="true"] .icon-on { display: block; }
.bookmark-btn[aria-pressed="true"] .icon-off { display: none; }

/* --- Skeleton --------------------------------------------------------- */

.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-raised) 0%, color-mix(in srgb, var(--surface-raised) 50%, var(--surface)) 50%, var(--surface-raised) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* --- Dropdown --------------------------------------------------------- */

.dropdown { position: relative; }
.dropdown__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 240px;
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transform-origin: top right;
  animation: pop var(--dur) var(--ease);
}
.dropdown__panel[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text);
  text-align: left;
}
a.dropdown__item { text-decoration: none; }
.dropdown__item:hover, .dropdown__item:focus-visible { background: var(--surface-raised); outline: none; }
.dropdown__item .icon { color: var(--text-muted); }
.dropdown__item .check { margin-left: auto; color: var(--primary-text); visibility: hidden; }
.dropdown__item[aria-pressed="true"] .check { visibility: visible; }
.dropdown__item--danger, .dropdown__item--danger .icon { color: var(--danger); }
.dropdown__sep { height: 1px; margin: var(--space-1) 0; background: var(--border); }
.dropdown__user { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.dropdown__user-name { font-size: var(--text-sm); font-weight: 600; }
.dropdown__user-mail { font-size: var(--text-xs); color: var(--text-muted); }

.notif { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: var(--space-3); align-items: start; padding: var(--space-3); border-radius: var(--radius-sm); }
.notif:hover { background: var(--surface-raised); }
.notif__dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--primary); }
.notif__dot--read { background: transparent; }
.notif__text { font-size: var(--text-sm); }
.notif__time { margin-top: 2px; font-size: var(--text-xs); color: var(--text-subtle); }
.dropdown__panel--wide { width: 340px; }

/* --- Modal (natives <dialog>) ----------------------------------------- */

.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.modal[open] { animation: pop var(--dur) var(--ease); }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6) 0; }
.modal__title { font-size: var(--text-h2); font-weight: 600; }
.modal__body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5) var(--space-6); }
.modal__footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-raised) 40%, var(--surface)); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

@media (max-width: 767px) {
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal__footer { border-radius: 0; }
}

/* --- Formularfelder (FormField) --------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--text-sm); font-weight: 500; }
.field__label .optional { color: var(--text-subtle); font-weight: 400; }
.field__help { font-size: var(--text-xs); color: var(--text-subtle); }
.input, .select {
  height: 40px;
  width: 100%;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus-visible, .select:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 767px) { .field-row { grid-template-columns: 1fr; } }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--surface-raised); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; padding: 6px 12px; border-radius: 4px; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }

/* --- Toast ------------------------------------------------------------ */

.toast-region {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 400px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 200ms var(--ease);
}
.toast .icon { color: var(--bg); opacity: 0.8; }
.toast__action { margin-left: auto; padding: 4px 8px; border-radius: 4px; font-weight: 600; color: var(--bg); text-decoration: underline; text-underline-offset: 2px; }
.toast__action:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 767px) {
  .toast-region { left: var(--space-4); right: var(--space-4); bottom: calc(var(--bottomnav-h) + var(--space-4)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
}

/* --- Tooltip (nur fuer Icon-Buttons) ---------------------------------- */

[data-tooltip] { position: relative; }
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
[data-tooltip][aria-expanded="true"]::after { display: none; }
:root[data-sidebar="collapsed"] .sidebar [data-tooltip]:hover::after,
:root[data-sidebar="collapsed"] .sidebar [data-tooltip]:focus-visible::after { top: 50%; left: calc(100% + 10px); transform: translateY(-50%); }
.sidebar [data-tooltip]::after { display: none; }
:root[data-sidebar="collapsed"] .sidebar [data-tooltip]:hover::after,
:root[data-sidebar="collapsed"] .sidebar [data-tooltip]:focus-visible::after { display: block; }
@media (min-width: 768px) and (max-width: 1279px) {
  .sidebar [data-tooltip]:hover::after,
  .sidebar [data-tooltip]:focus-visible::after { display: block; top: 50%; left: calc(100% + 10px); transform: translateY(-50%); }
}

/* ==========================================================================
   Ergänzungen für Materialien, Moduldetail, Aufgaben, Upload, Login
   ========================================================================== */

/* --- Breadcrumb ------------------------------------------------------- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .icon { width: 14px; height: 14px; color: var(--text-subtle); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 500; }

/* --- Tabs ------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--space-6);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.tab__count { padding: 0 6px; border-radius: var(--radius-full); background: var(--surface-raised); color: var(--text-muted); font-size: var(--text-xs); line-height: 18px; font-variant-numeric: tabular-nums; }
.tab-panel[hidden] { display: none !important; }

/* --- Chips (Filter-Chips, aktive Filter, Tags) ----------------------- */
.chip-group { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--border-input); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary-subtle); border-color: transparent; color: var(--primary-text); font-weight: 600; }
.chip__count { font-size: var(--text-xs); color: inherit; opacity: 0.75; font-variant-numeric: tabular-nums; }
.chip--removable { height: 28px; padding: 0 6px 0 10px; background: var(--primary-subtle); border-color: transparent; color: var(--primary-text); }
.chip--removable .icon { width: 14px; height: 14px; }
.chip--removable:hover { color: var(--primary-text); filter: brightness(0.97); }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-full); background: var(--surface-raised); color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; }
.tag::before { content: "#"; opacity: 0.6; margin-right: 1px; }

/* --- Select mit Pfeil ------------------------------------------------- */
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-subtle) 50%), linear-gradient(135deg, var(--text-subtle) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.select--sm { height: 36px; font-size: var(--text-sm); }
.textarea { width: 100%; min-height: 96px; padding: var(--space-3); border: 1px solid var(--border-input); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); resize: vertical; line-height: 1.5; }
.textarea:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.field__error { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--danger); font-weight: 500; }
.input[aria-invalid="true"] { border-color: var(--danger); }

/* --- FilterBar -------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.filter-bar .select { width: auto; min-width: 150px; }
.filter-bar__spacer { flex: 1; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.active-filters[hidden] { display: none; }

/* Große Suche */
.search--lg { width: 100%; }
.search--lg .search__input { height: 48px; padding-left: 44px; font-size: var(--text-body); border-radius: var(--radius-md); border-color: var(--border-input); box-shadow: var(--shadow-sm); }
.search--lg .icon { left: 16px; width: 18px; height: 18px; }

/* --- DocumentCard (Liste, horizontal) -------------------------------- */
.doc-cards { display: flex; flex-direction: column; gap: var(--space-3); }
.doc-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-5);
}
.doc-card .file-icon { width: 48px; height: 48px; }
.doc-card .file-icon .icon { width: 22px; height: 22px; }
.doc-card__title { font-size: var(--text-body); font-weight: 600; line-height: 1.375rem; }
.doc-card__title a:hover { color: var(--primary-text); }
.doc-card__module { margin-top: 2px; font-size: var(--text-sm); color: var(--text-muted); }
.doc-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); margin-top: var(--space-3); font-size: var(--text-xs); color: var(--text-muted); }
.doc-card__meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); }
.doc-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.doc-card__actions { display: flex; align-items: center; gap: var(--space-1); }
.doc-card__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.doc-card[hidden] { display: none; }

@media (max-width: 767px) {
  .doc-card { grid-template-columns: 40px minmax(0, 1fr); padding: var(--space-4); gap: var(--space-3); }
  .doc-card .file-icon { width: 40px; height: 40px; }
  .doc-card__actions { grid-column: 1 / -1; justify-content: flex-start; padding-top: var(--space-3); border-top: 1px solid var(--border); }
  .doc-card__actions .btn { flex: 1; }
}

/* --- Pagination ------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }
.pagination .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* --- EmptyState ------------------------------------------------------- */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-6); text-align: center; }
.empty-state__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--space-2); border-radius: var(--radius-full); background: var(--surface-raised); color: var(--text-subtle); }
.empty-state__icon .icon { width: 22px; height: 22px; }
.empty-state__title { font-weight: 600; }
.empty-state__text { max-width: 380px; font-size: var(--text-sm); color: var(--text-muted); }
.empty-state .btn { margin-top: var(--space-3); }
.empty-state[hidden] { display: none; }

/* --- Alert ------------------------------------------------------------ */
.alert { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-sm); background: var(--info-subtle); color: var(--info); }
.alert .icon { margin-top: 2px; }
.alert--warning { background: var(--warning-subtle); color: var(--warning); }
.alert--danger { background: var(--danger-subtle); color: var(--danger); }
.alert--success { background: var(--success-subtle); color: var(--success); }
.alert__title { font-weight: 600; }
.alert p + p { margin-top: 2px; }

/* --- TaskRow ---------------------------------------------------------- */
.task-group { display: flex; flex-direction: column; }
.task-group__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.task-group__label--danger { color: var(--danger); }
.task-group[hidden] { display: none; }
.task-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 170px 180px 140px 36px;
  align-items: center;
  gap: var(--space-4);
  min-height: 56px;
  padding: var(--space-2) var(--space-5);
  border-top: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
}
.task-row:hover { background: color-mix(in srgb, var(--surface-raised) 60%, transparent); }
.task-row[hidden] { display: none; }
.task-row__title { font-size: var(--text-sm); font-weight: 600; min-width: 0; }
.task-row__title > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row__title .badge { margin-left: 6px; vertical-align: 1px; }
.task-row__module { font-size: var(--text-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row__due { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-row__due .icon { color: var(--text-subtle); }
.task-row__due--soon { color: var(--warning); font-weight: 500; }
.task-row__due--soon .icon { color: var(--warning); }
.task-row__status { display: flex; align-items: center; gap: 6px; }
.task-row.is-done .task-row__title > span { text-decoration: line-through; color: var(--text-subtle); font-weight: 500; }
.task-row__sub { display: none; }
.task-head {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 170px 180px 140px 36px;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-subtle);
}

/* Status-Auswahl in der Zeile */
.status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px 0 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-raised);
  color: var(--text-muted);
  transition: filter var(--dur) var(--ease);
}
.status-btn:hover { filter: brightness(0.96); }
.status-btn .icon { width: 12px; height: 12px; }
.status-btn .chev { opacity: 0.7; }
.status-btn[data-status="in_progress"] { background: var(--info-subtle); color: var(--info); }
.status-btn[data-status="done"] { background: var(--success-subtle); color: var(--success); }
.dropdown__panel--left { left: 0; right: auto; transform-origin: top left; min-width: 190px; }

@media (max-width: 1023px) {
  .task-head { display: none; }
  .task-row { grid-template-columns: 24px minmax(0, 1fr) auto 36px; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
  .task-row__module, .task-row__due { display: none; }
  .task-row__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); margin-top: 2px; font-size: var(--text-xs); font-weight: 400; color: var(--text-muted); }
  .task-row__sub .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); }
  .task-row__sub .soon { color: var(--warning); font-weight: 500; }
  .task-row__title > span { white-space: normal; }
  .task-group__label { padding-left: var(--space-4); }
}
@media (max-width: 767px) {
  .task-row .badge--prio { display: none; }
  .task-row { grid-template-columns: 24px minmax(0, 1fr) auto auto; }
  .status-btn span, .status-btn .chev { display: none; }
  .status-btn { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .status-btn .icon { width: 16px; height: 16px; }
  .filter-bar__spacer { display: none; }
  #task-module { flex: 1 1 100%; }
}

/* Schnellerfassung */
.quick-add { display: grid; grid-template-columns: minmax(0, 1fr) 200px 200px auto; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-raised) 35%, var(--surface)); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.quick-add .input, .quick-add .select { height: 36px; }
@media (max-width: 1023px) {
  .quick-add { grid-template-columns: minmax(0, 1fr) auto; padding: var(--space-3) var(--space-4); }
  .quick-add .select, .quick-add .input[type="date"] { display: none; }
}

/* --- Dropzone (Upload) ------------------------------------------------ */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  border: 1.5px dashed var(--border-input);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone.is-dragover { border-color: var(--primary); background: var(--primary-subtle); }
.dropzone__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--space-2); border-radius: var(--radius-full); background: var(--primary-subtle); color: var(--primary-text); }
.dropzone__icon .icon { width: 24px; height: 24px; }
.dropzone__title { font-size: var(--text-h3); font-weight: 600; }
.dropzone__or { font-size: var(--text-sm); color: var(--text-muted); }
.dropzone__hint { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--text-subtle); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone[hidden] { display: none; }
.dropzone__title--touch { display: none; }
@media (hover: none) { .dropzone__title--desktop, .dropzone__or { display: none; } .dropzone__title--touch { display: block; } }

.file-chip { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.file-chip[hidden] { display: none; }
.file-chip__name { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip__meta { font-size: var(--text-xs); color: var(--text-muted); }

/* Nummerierte Formularabschnitte */
.form-section { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--space-4); }
.form-section__num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--surface-raised); color: var(--text-muted); font-size: var(--text-sm); font-weight: 600; }
.form-section.is-complete .form-section__num { background: var(--primary); color: var(--on-primary); }
.form-section__title { font-size: var(--text-h3); font-weight: 600; line-height: 28px; }
.form-section__body { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }
@media (max-width: 767px) { .form-section { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); } .form-section__head { display: flex; align-items: center; gap: var(--space-3); } }

/* RadioCards */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.radio-card { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border-input); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.radio-card:hover { border-color: var(--primary); }
.radio-card input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.radio-card:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary-subtle) 55%, var(--surface)); box-shadow: 0 0 0 1px var(--primary); }
.radio-card__title { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.radio-card__text { margin-top: 2px; font-size: var(--text-xs); color: var(--text-muted); }
@media (max-width: 767px) { .radio-cards { grid-template-columns: 1fr; } }

/* Checkbox mit Text */
.check-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); align-items: start; font-size: var(--text-sm); }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); }
.check-row[hidden] { display: none; }

/* TagInput */
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); background: var(--surface); }
.tag-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.tag-input input { flex: 1; min-width: 140px; height: 28px; border: 0; background: transparent; font-size: var(--text-sm); }
.tag-input input:focus-visible { outline: none; }
.tag-input .chip--removable { height: 26px; }

/* Upload-Status */
.upload-status { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); }
.upload-status[hidden] { display: none; }
.upload-status__head { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; }
.upload-status__head .file-icon { width: 48px; height: 48px; }
.upload-status__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status__meta { font-size: var(--text-sm); color: var(--text-muted); }
.upload-status__state { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.upload-status__text { font-size: var(--text-sm); color: var(--text-muted); }
.upload-status__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.progress--lg .progress__track { height: 8px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.steps { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: var(--text-xs); color: var(--text-subtle); }
.steps span { display: inline-flex; align-items: center; gap: 6px; }
.steps .icon { width: 14px; height: 14px; }
.steps .is-done { color: var(--success); }
.steps .is-active { color: var(--text); font-weight: 600; }

/* Demo-Leiste (nur Prototyp) */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px dashed var(--border-input); border-radius: var(--radius-md); font-size: var(--text-xs); color: var(--text-muted); }
.demo-bar strong { color: var(--text); margin-right: var(--space-2); }
.demo-bar .chip { height: 28px; font-size: var(--text-xs); }

/* --- Auth-Rahmen (Login) ---------------------------------------------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  padding: var(--space-6) var(--space-4);
  background:
    radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--primary-subtle) 80%, transparent), transparent 70%),
    var(--bg);
}
.auth__top { display: flex; justify-content: flex-end; }
.auth__main { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: var(--space-8) 0; }
.auth__card { width: min(420px, 100%); display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-8); }
.auth__brand { display: flex; justify-content: center; }
.auth__brand .wordmark__mark { width: 36px; height: 36px; }
.auth__brand .wordmark__text { font-size: 21px; }
.auth__title { text-align: center; }
.auth__title h1 { font-size: var(--text-h1); }
.auth__title p { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
.auth__form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.auth__label-row a { font-size: var(--text-sm); font-weight: 500; color: var(--primary-text); }
.auth__label-row a:hover { text-decoration: underline; text-underline-offset: 2px; }
.auth__switch { text-align: center; font-size: var(--text-sm); color: var(--text-muted); }
.auth__switch a { font-weight: 600; color: var(--primary-text); }
.auth__switch a:hover { text-decoration: underline; text-underline-offset: 2px; }
.auth__footer { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-5); font-size: var(--text-xs); color: var(--text-subtle); }
.auth__footer a:hover { color: var(--text); }
.password { position: relative; }
.password .input { padding-right: 88px; }
.password__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 28px; padding: 0 8px; border-radius: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.password__toggle:hover { background: var(--surface-raised); color: var(--text); }
@media (max-width: 480px) { .auth__card { padding: var(--space-6) var(--space-5); } }

/* ==========================================================================
   Ergänzungen: Tabelle, Listen, Katalog, Stepper, Auth-Zustände
   ========================================================================== */

.stack { display: flex; flex-direction: column; gap: var(--space-5); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.avatar--xl { width: 56px; height: 56px; font-size: var(--text-h3); }
.prose { max-width: 68ch; color: var(--text); line-height: 1.65; }
.fieldset { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; border: 0; }
.fieldset legend { margin-bottom: var(--space-2); padding: 0; }
.modal--sm { width: min(460px, calc(100vw - 32px)); }

/* --- Table ------------------------------------------------------------ */
.table-wrap { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--space-3) var(--space-5); text-align: left; vertical-align: middle; border-top: 1px solid var(--border); }
.table thead th { border-top: 0; font-size: var(--text-xs); font-weight: 500; color: var(--text-subtle); white-space: nowrap; }
.table tbody th { font-weight: 400; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-raised) 60%, transparent); }
.table .cell-title { display: block; font-weight: 600; color: var(--text); }
.table .cell-sub { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--text-muted); }
.table .cell-right { text-align: right; white-space: nowrap; }
.table td { color: var(--text-muted); }
.table td strong { color: var(--text); font-weight: 600; }
.table .is-muted .cell-title { color: var(--text-muted); }
.table__group th { padding-top: var(--space-4); padding-bottom: var(--space-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); background: transparent; }
.table__group:hover { background: transparent !important; }
.row-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.table tr.is-resolved { opacity: 0.55; }

@media (max-width: 767px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table tr { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }
  .table tbody tr:first-child { border-top: 0; }
  .table th, .table td { padding: 2px 0; border: 0; }
  .table .cell-right { text-align: left; padding-top: var(--space-2); }
  .table td:empty { display: none; }
  .table__group th { padding: var(--space-3) 0 0; }
  .row-actions { justify-content: flex-start; }
}

/* --- Listen ----------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--border); font-size: var(--text-sm); }
.list-row:first-child { border-top: 0; }
.list > .list-row:only-child, .list-row > div:first-child:not(.list-row__icon) { min-width: 0; }
.list-row__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--text-muted); }
.list--bordered { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.list--bordered .list-row { padding: var(--space-3); }
.modal .list-row:has(> div:first-child:not(.list-row__icon)) { grid-template-columns: minmax(0, 1fr) auto auto; }

/* --- Katalog-Suche (Modul hinzufügen, Onboarding) ------------------- */
.catalog-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.catalog-list--compact { max-height: 260px; }
.catalog-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }
.catalog-item:first-child { border-top: 0; }
.catalog-item[hidden] { display: none; }
.catalog-item__name { font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.catalog-item__meta { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.catalog-item [aria-pressed="true"] { background: var(--success-subtle); border-color: transparent; color: var(--success); }

/* --- Prüf-Dialog (Moderation) ----------------------------------------- */
.review-doc { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); }

/* --- Auth-Zustände, Stepper, Onboarding ------------------------------ */
.auth__card--wide { width: min(600px, 100%); }
.auth__step { display: flex; flex-direction: column; gap: var(--space-5); }
.auth__icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto; border-radius: var(--radius-full); background: var(--primary-subtle); color: var(--primary-text); }
.auth__icon .icon { width: 24px; height: 24px; }
.auth__icon--success { background: var(--success-subtle); color: var(--success); }
.auth__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-2); }
.auth__switch a .icon { display: inline; vertical-align: -3px; width: 14px; height: 14px; }

.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter span { height: 4px; border-radius: var(--radius-full); background: var(--surface-raised); transition: background var(--dur) var(--ease); }
.pw-meter[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-level="2"] span:nth-child(-n+2) { background: var(--warning); }
.pw-meter[data-level="3"] span:nth-child(-n+3) { background: var(--success); }
.pw-meter[data-level="4"] span { background: var(--success); }

.stepper { display: flex; align-items: center; justify-content: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-subtle); font-weight: 500; }
.stepper__item { display: inline-flex; align-items: center; gap: var(--space-2); }
.stepper__num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-full); border: 1px solid var(--border-input); font-size: var(--text-xs); font-weight: 600; }
.stepper__item.is-active { color: var(--text); }
.stepper__item.is-active .stepper__num { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.stepper__item.is-done .stepper__num { background: var(--success-subtle); border-color: transparent; color: var(--success); }
.stepper__line { width: 48px; height: 1px; background: var(--border-input); }

.semester-pick { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--primary); border-radius: var(--radius-md); background: color-mix(in srgb, var(--primary-subtle) 55%, var(--surface)); }
.semester-pick__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--surface); color: var(--primary-text); }
.picked { display: flex; flex-direction: column; gap: var(--space-2); }

/* --- Nachbesserungen --------------------------------------------------- */
.page-header__meta .sep, .toolbar .sep { display: inline-block; width: 3px; height: 3px; flex: none; border-radius: 50%; background: var(--text-subtle); }
.auth .search, .modal .search { width: 100%; }
.catalog-item > div { min-width: 0; }

/* Faktenliste (Moduldetail, Dokumentdetail) */
.facts { display: flex; flex-direction: column; margin: 0; }
.facts > div { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); font-size: var(--text-sm); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }

@media (max-width: 767px) {
  .table td { display: inline-flex; gap: 4px; width: auto; margin-right: var(--space-3); padding: 2px 0; font-size: var(--text-sm); }
  .table td.cell-right { display: flex; width: 100%; margin: 0; }
  .table td[colspan] { display: block; width: 100%; }
}
