/* Portal: Rahmen und gemeinsame Bausteine, ausschließlich über die Tokens aus brand/brand.css (UI-01).
   Gestaltung nach UI-01…11: neutrale Flächen, 1-px-Ränder, Radien 6/8 px, Geist 12–24 px, Schnitte 400–600,
   Abstände auf dem 4-px-Raster. Reihenfolge: Rahmen → Bausteine (Meldung, Karte, Formular, Tabelle, Badge, Menü) → Ansichten. */

/* ==== Rahmen ====================================================================================================================== */

body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar hint"
    "sidebar main";
}

.skip-link {
  position: absolute;
  left: -999px;
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-selected);
  color: var(--text-on-selected);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.skip-link:focus {
  left: var(--space-2);
}

/* Kopfzeile: rechts der Seitenleiste; Suchfeld, rechts eine optionale primäre Aktion, Darstellungsschalter,
   Sprache, persönliches Menü. Fläche wie die Seitenleiste, feine Linie unten; Icons einfarbig. */
.portal-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 5;
  box-sizing: border-box;
  height: var(--frame-header-height);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-4) 0 var(--space-5);
  background: var(--surface-header);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-default);
}

/* Versteckte Teile der Kopfzeile bleiben versteckt, auch wenn ihre Klasse eine Anzeigeart setzt (Sitzung noch nicht bestätigt). */
.portal-header [hidden] {
  display: none;
}

.header-search {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.search-field {
  position: relative;
  flex: 0 1 auto;
  width: 535px;
  min-width: 12rem;
}

.search-field input {
  width: 100%;
  height: var(--control-height);
  padding: 0 52px 0 36px;
  border-color: var(--border-default);
  background: var(--surface-app);
  color: var(--text-body);
  font-size: var(--text-sm);
  cursor: not-allowed;
}

/* Deaktiviert (Dummy), aber lesbar: Platzhalter im Nebentext statt grauer Browser-Vorgabe. */
.search-field input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.search-field svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--text-secondary);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  padding: 0 var(--space-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 18px;
  pointer-events: none;
}

.header-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  font-size: var(--text-base);
  white-space: nowrap;
}

/* Primäre Aktion der Kopfzeile mit Plus-Icon links (CD-05; hell Royal Blue, dunkel Icy Blue über die Aktions-Tokens). */
.header-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--control-height);
  margin-right: var(--space-1);
  padding: 0 var(--space-3) 0 10px;
}

.header-action svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
}

/* Nicht verfügbar: die Aktion ist ausgegraut und nicht bedienbar. */
.header-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Schaltfläche nur mit Icon (Sprache, persönliches Menü): ohne Fläche, Hover neutral, offen = gewählter Zustand */
.icon-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-base);
}

.icon-button:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-hover);
}

.icon-button[aria-expanded="true"],
.icon-button[aria-expanded="true"]:hover {
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

.icon-button svg,
.nav-toggle svg,
.portal-nav a svg {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Baustein Schalter (role="switch"): Pille 44 × 24 px mit rundem Knopf, aus links, an rechts;
   aus: neutrale Fläche mit Rand. Pillenform, weil die Form eine Funktion hat (UI-03). an = Aktionsfarbe des Modus, damit „frei“ in dichten Tabellen
   auf einen Blick vom Rand des ausgeschalteten Zustands zu unterscheiden ist (Bedienelement 3:1, UI-04). Das Darstellungssymbol der Kopfzeile ist
   kein Schalter, sondern ein Symbolknopf (.theme-cycle). */
.switch {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: flex-start;
  width: 44px;
  height: 24px;
  min-height: 24px;
  padding: 0 2px;
  border: 1px solid var(--border-field);
  border-radius: var(--radius-pill);
  background: var(--surface-app);
  color: var(--text-primary);
}

.switch:hover:not(:disabled) {
  border-color: var(--surface-selected);
  background: var(--surface-app);
}

.switch-knob {
  display: grid;
  flex: none;
  place-items: center;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  background: var(--surface-card);
}

.switch[aria-checked="true"],
.switch[aria-checked="true"]:hover:not(:disabled) {
  justify-content: flex-end;
  border-color: var(--action-primary);
  background: var(--action-primary);
}

.switch[aria-checked="true"] .switch-knob {
  border-color: transparent;
  background: var(--action-primary-text);
}

/* Darstellungssymbol: quadratischer Symbolknopf (Breite = Höhe der Bedienelemente); das Symbol zeigt den gewählten Modus (Monitor,
   Sonne, Mond) in der Textfarbe, mittig. */
.theme-cycle {
  justify-content: center;
  width: var(--control-height);
  padding: 0;
}

.theme-cycle svg {
  width: 20px;
  height: 20px;
}

/* Während des Speicherns gesperrt: Wartezeiger statt Verbotszeichen; die Abschwächung kommt aus der Regel für gesperrte Bedienelemente. */
.portal-main .switch:disabled {
  cursor: progress;
}

/* Persönliches Menü: durch eine feine Linie abgesetzt; Benutzersymbol, Name, Pfeil nach unten. */
.user-container:has(> .user-button:not([hidden])) {
  margin-left: var(--space-1);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-default);
}

.user-button {
  height: 40px;
  padding: 0 var(--space-2) 0 var(--space-1);
  font-weight: var(--weight-medium);
}

.icon-button .user-icon {
  width: 20px;
  height: 20px;
  margin: 0 var(--space-1);
}

/* Pfeil als gezeichnete Ecke statt svg/img (keine zusätzlichen Bilder im Auslöser). */
.user-chevron {
  flex: none;
  width: 5px;
  height: 5px;
  margin: 0 var(--space-1) 3px 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

/* Seitenleiste: volle Fensterhöhe, bleibt beim Scrollen stehen; oben das Logo in Höhe der Kopfzeile, darunter die
   Navigation. Eingeklappt 64 px breit mit dem Logomark 35 × 35. Die Breite läuft als Übergang (--motion-sidebar); das Raster der Seite
   folgt ihr in jedem Bild (Spalte `auto`), daher beginnt die Kopfzeile stets rechts der Seitenleiste. Ruhiges Ein- und Ausklappen:
   Icons und Zeichen stehen in beiden Zuständen an derselben Stelle (gleiche Abstände, keine Zentrierung beim Einklappen); die
   schrumpfende Leiste schneidet Schriftzug und Beschriftungen ab, die zugleich weich aus- bzw. einblenden. Das Logomark ersetzt das
   Logo erst am Ende des Übergangs (nav.js) deckungsgleich. Reduzierte Bewegung: alles sofort.
   Ende des Bildlaufs: Die Seite kann eine gebrochene Höhe haben (z. B. 6458,5 px), die Bildlauflänge des Dokuments ist auf
   ganze Pixel gerundet (6459 px). Ganz unten endet der Rasterbereich der Leiste dann einen Bruchteil vor der Fensterunterkante, und
   `sticky` schöbe die Leiste um diesen Bruchteil nach oben. Der negative Außenabstand unten erlaubt der Leiste, den Rasterbereich um
   bis zu 1 px zu überragen; sie bleibt damit exakt bei y = 0. Maße und Raster ändern sich dadurch nicht (die Seite ist mindestens
   fensterhoch). */
.portal-sidebar {
  grid-area: sidebar;
  position: sticky;
  z-index: 6; /* eigene Stapelebene über dem Inhalt, damit Tooltips der eingeklappten Navigation nicht unter Karten liegen */
  top: 0;
  margin-bottom: -1px;
  align-self: start;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface-sidebar);
  border-right: 1px solid var(--border-default);
  transition: width var(--motion-sidebar);
}

.portal-sidebar.is-collapsed {
  width: var(--sidebar-width-collapsed);
}

/* Links 14 px: Mitte des Zeichens bei 31,5 px, der Mitte der eingeklappten Leiste ohne Rand (und der Icons darunter). */
.sidebar-brand {
  flex: none;
  box-sizing: border-box;
  height: var(--frame-header-height);
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 var(--space-4) 0 14px;
  border-bottom: 1px solid var(--border-default);
}

/* Deckkraft des Schriftzugs im Logo mit Schriftzug (rechts vom Zeichen, ab 28 % der Bildbreite); in Ruhe immer 100 %. */
@property --wordmark-alpha {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}

.portal-logo {
  display: block;
  flex: none;
  width: 150px;
  height: auto;
  --wordmark-alpha: 100%;
  mask-image: linear-gradient(to right, currentColor 28%, color-mix(in srgb, currentColor var(--wordmark-alpha), transparent) 28%);
  transition: --wordmark-alpha var(--motion-fade-in);
}

.portal-sidebar.is-collapsed .portal-logo {
  --wordmark-alpha: 0%;
  transition: --wordmark-alpha var(--motion-fade-out);
}

.portal-logo[data-variant="logomark"] {
  width: 35px;
  height: 35px;
  mask-image: none;
}

/* Seitennavigation: Bereiche oben, unten die Box mit dem Umschalter (und bei Bedarf „Einstellungen“). */
.portal-nav {
  --nav-inset: 10px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: var(--space-4) var(--space-3) var(--space-3);
}

.portal-nav[hidden] {
  display: none;
}

/* Rahmen ohne bestätigte Anmeldung: Kopfzeile und Seitenleiste bleiben versteckt, auch gegen ihre Anzeigeart. */
.portal-header[hidden],
.portal-sidebar[hidden] {
  display: none;
}

.portal-nav ul {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Reicht die Fensterhöhe nicht, scrollt nur die Liste der Bereiche; Logo, Kopfzeile und die Box unten stehen (UI-11).
   Eingeklappt entfällt der Überlauf: Unterpunkte sind zu, und die Tooltips ragen über den Rand der Leiste. Innenabstand und gleich großer
   negativer Außenabstand lassen den Fokusring der Einträge (2 px + 2 px Abstand) im Sichtbereich, ohne die Lage der Icons zu ändern. */
.portal-nav:not(.is-collapsed) > #nav-list {
  min-height: 0;
  margin: calc(-1 * var(--space-1));
  padding: var(--space-1);
  overflow-y: auto;
}

.portal-nav li {
  position: relative;
}

.portal-nav a,
.nav-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  min-height: 36px;
  padding: 0 var(--nav-inset);
  overflow: hidden;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.portal-nav a {
  margin: 0 0 var(--space-1);
  text-decoration: none;
}

.nav-toggle {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
}

/* Box unten: Einträge (z. B. „Einstellungen“) über dem Umschalter, 1-px-Rand und 8 px Radius, Fläche wie die Seitenleiste. Der
   Innenabstand (4 px) und der Rand werden im Innenabstand der Einträge ausgeglichen: Icons stehen genau über denen der Liste, in
   beiden Zuständen und in jedem Bild des Übergangs. Eingeklappt so breit wie die Seitenleiste abzüglich ihres Innenabstands. */
.nav-footer {
  --nav-inset: calc(10px - var(--space-1) - 1px);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.nav-item {
  position: relative;
}

.portal-nav .nav-footer a,
.nav-footer .nav-toggle {
  margin: 0;
  padding: 0 var(--nav-inset);
  border: 0;
}

/* Fokusring innerhalb der Box ohne Abstand, damit er nicht auf deren Rand liegt. */
.nav-footer :focus {
  outline-offset: 0;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  transition: opacity var(--motion-fade-in), visibility var(--motion-fade-in);
}

.portal-nav a:hover,
.nav-toggle:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-hover);
}

/* Aktiver Bereich: Icy-Blue-Fläche mit Deep-Teal-Text in beiden Modi (CD-05), 6 px Radius (UI-03). */
.portal-nav a[aria-current="page"] {
  background: var(--surface-nav-active);
  color: var(--text-on-selected);
}

/* Eingeklappt: Beschriftungen blenden aus und sind danach unsichtbar (visibility bleibt während des Ausblendens sichtbar). */
.portal-nav.is-collapsed .nav-label {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion-fade-out), visibility var(--motion-fade-out);
}

/* Unterpunkte: je Bereich eine Liste direkt unter dem Bereichslink, sichtbar nur, solange der Bereich aktiv
   (ein Unterpunkt mit aria-current, router.js; eine gezeigte Unterseite trägt "page") und die Navigation ausgeklappt ist; sonst Höhe 0 und unsichtbar (nicht fokussierbar).
   Die Höhe läuft mit der Breite der Leiste (keine Sprünge der übrigen Einträge); der Text blendet beim Einklappen mit den Beschriftungen
   aus und beim Ausklappen erst ein, wenn die Leiste fast breit ist. Der Text beginnt bündig mit dem Text des Bereichs (kein Einzug),
   13 px; aktiv markiert nur über die Schrift (Textfarbe --text-primary, 500), ohne Linie und ohne Fläche (Entscheidung Tim 2026-11-03). */
/* Die Höhe läuft je Unterpunkt (Zeile der li), nicht je Liste; die Liste selbst klappt nur Deckkraft und Sichtbarkeit. */
.portal-nav .nav-sublist {
  flex: none;
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion-fade-out), visibility var(--motion-fade-out);
}

/* Den Abstand zum nächsten Bereich (sonst der untere Rand des Bereichslinks, der aus dem li herausragt) trägt bei Bereichen mit
   Unterliste das li selbst; der Abstand zwischen Bereichslink und Unterpunkt ist der obere Rand des Unterpunkts und klappt mit ihm ein. Sonst
   bliebe der Rand des Bereichslinks zwischen Link und eingeklappter Liste stehen (Eintrag 4 px höher als sein Link). Aus- und eingeklappt
   stehen alle Einträge an derselben Stelle wie zuvor. */
.portal-nav li:has(> .nav-sublist) {
  margin-bottom: var(--space-1);
}

.portal-nav li:has(> .nav-sublist) > a {
  margin-bottom: 0;
}

.nav-sublist > li {
  min-height: 0;
  overflow: hidden;
}

/* Ein verborgener Unterpunkt (hidden, z. B. ohne Recht) bleibt verborgen; `display: grid` unten überstimmt sonst die Browserregel. */
.portal-nav .nav-sublist > li[hidden] {
  display: none;
}

/* Eine Zeile je Unterpunkt; minmax(0, …) hält die Zeile bei 0, auch wenn der Link seine Mindesthöhe (control-height) hat. */
.portal-nav .nav-sublist > li {
  display: grid;
  grid-template-rows: minmax(0, 0fr);
  transition: grid-template-rows var(--motion-subnav);
}

.portal-nav .nav-sublist:has(a[aria-current]) {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--motion-fade-in-late), visibility var(--motion-fade-in-late);
}

.portal-nav .nav-sublist:has(a[aria-current]) > li {
  grid-template-rows: minmax(0, 1fr);
}

.portal-nav.is-collapsed .nav-sublist,
.portal-nav.is-collapsed .nav-sublist:has(a[aria-current]) {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion-fade-out), visibility var(--motion-fade-out);
}

.portal-nav.is-collapsed .nav-sublist > li,
.portal-nav.is-collapsed .nav-sublist:has(a[aria-current]) > li {
  grid-template-rows: minmax(0, 0fr);
}

/* Per zweitem Klick auf den aktiven Bereich zugeklappt: Bereichslink mit aria-expanded="false" (router.js). */
.portal-nav li:has(> a[aria-expanded="false"]) > .nav-sublist {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion-fade-out), visibility var(--motion-fade-out);
}

.portal-nav li:has(> a[aria-expanded="false"]) > .nav-sublist > li {
  grid-template-rows: minmax(0, 0fr);
}

/* Textbeginn = Innenabstand + Icon (18 px) + Abstand zwischen Icon und Text, wie im Bereichslink. */
.portal-nav .nav-sublist a {
  --nav-sub-indent: calc(var(--nav-inset) + 18px + var(--space-3));
  min-height: var(--control-height);
  margin: var(--space-1) 0 0;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--nav-sub-indent);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
}

/* Markierter Unterpunkt: aria-current="true" (Aktion) bzw. "page" (gezeigte Unterseite). */
.portal-nav .nav-sublist a[aria-current],
.portal-nav .nav-sublist a[aria-current]:hover {
  background: transparent;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

/* Die Textbreite ist die der ausgeklappten Leiste und bleibt beim Ein- und Ausklappen gleich: kein Neuumbruch, keine Höhenänderung,
   der Link schneidet ab. Lange Texte brechen mit Silbentrennung der Seitensprache um. */
.portal-nav .nav-sublist a span {
  flex: none;
  width: calc(var(--sidebar-width) - 1px - 2 * var(--space-3) - var(--nav-sub-indent) - var(--space-2));
  line-height: var(--leading-tight);
  white-space: normal;
  hyphens: auto;
  overflow-wrap: anywhere;
}

/* Fokusring innen, damit die Liste ihn beim Auf- und Zuklappen nicht abschneidet. */
.portal-nav .nav-sublist a:focus {
  outline-offset: -2px;
}

.nav-toggle svg {
  transition: transform var(--motion-sidebar);
}

.portal-nav.is-collapsed .nav-toggle svg {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .portal-sidebar,
  .portal-logo,
  .nav-label,
  .portal-nav.is-collapsed .nav-label,
  .portal-nav .nav-sublist,
  .portal-nav .nav-sublist > li,
  .portal-nav .nav-sublist:has(a[aria-current]),
  .portal-nav.is-collapsed .nav-sublist,
  .portal-nav.is-collapsed .nav-sublist:has(a[aria-current]),
  .portal-nav li:has(> a[aria-expanded="false"]) > .nav-sublist,
  .portal-sidebar.is-collapsed .portal-logo,
  .nav-toggle svg {
    transition: none;
  }
}

.portal-nav [role="tooltip"] {
  position: absolute;
  left: calc(100% + var(--space-2));
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  color: var(--text-on-inverse);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  z-index: 7;
}

.portal-nav .nav-sublist[hidden] {
  display: none;
}

/* Zähler an einem Navigationseintrag: Anzahl offener Einträge, ab 10 „9+“. Royal Blue, im dunklen Modus Icy Blue (Token --action-primary), nie
   Orange. Ausgeklappt rechts im Link, eingeklappt klein oben rechts am Icon (der Text der Leiste ist dann ausgeblendet); der Link selbst bleibt der Bezugspunkt. */
.portal-nav a[data-view] {
  position: relative;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 20px;
  height: 18px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--action-primary);
  color: var(--hs-on-status);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-badge {
    color: var(--action-primary-text);
  }
}

:root[data-theme="dark"] .nav-badge {
  color: var(--action-primary-text);
}

/* Eingeklappt: kleiner Zähler oben rechts am Icon (Icon 18 px ab --nav-inset); die Breite wächst mit „9+“, bleibt aber im Link (39 px).
   Breite einschließlich Innenabstand: sonst ist schon „8“ 24 px breit und ragt über den Link hinaus. */
.portal-nav.is-collapsed .nav-badge {
  position: absolute;
  box-sizing: border-box;
  top: 2px;
  left: calc(var(--nav-inset) + 10px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
}

/* Inhaltsbereich */
.portal-main {
  grid-area: main;
  min-width: 0;
  padding: var(--space-5) var(--space-6);
  color: var(--text-body);
}

.portal-main:focus {
  outline: none;
}

.portal-main > p {
  max-width: 48rem;
  margin: 0 0 var(--space-4);
}

/* ==== Baustein: Dummy-Badge ======================================================================================================= */
/* Sichtbares Zeichen für eine künftige Funktion: gestrichelter Slate-Blue-Umriss, Text in der Textfarbe des Modus, keine Fläche. */
.dummy-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  box-sizing: border-box;
  height: 18px;
  padding: 0 6px;
  border: 1px dashed var(--hs-slate-blue);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}

/* ==== Baustein: Badge (CD-02, Statusfarben) ======================================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 20px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}

/* Statusfarben (Fehler, Erfolg, Warnung, Info) wie die Meldungen; immer mit Text. */
.badge-error {
  background: var(--message-error-bg);
  color: var(--message-on-status);
}

.badge-success {
  background: var(--message-success-bg);
  color: var(--message-on-status);
}

.badge-warning {
  background: var(--message-warning-bg);
  color: var(--message-on-warning);
}

.badge-info {
  background: var(--message-info-bg);
  color: var(--message-on-status);
}

/* ==== Baustein: Hinweisseite ohne Rahmen ========================================================================================== */
/* Eine Karte (Baustein Karte, section in main) schmal und mittig: Logo, Überschrift, ein Satz, Aktionen. Für die Hinweisseite und
   die Fehlerseiten der Anmeldung; Kopfzeile und Seitenleiste sind dabei versteckt. */
.portal-main > .notice-page {
  max-width: 32rem;
  margin: var(--space-6) auto;
  padding: var(--space-6);
}

.notice-page img {
  display: block;
  margin: 0 0 var(--space-6);
}

.notice-page h1 {
  margin: 0 0 var(--space-3);
}

.notice-page p {
  margin: 0 0 var(--space-5);
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* Link als primäre Aktion (CD-05): gleiche Form wie ein Button in der Aktionsfarbe des Modus. */
.notice-actions .notice-primary {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--action-primary);
  border-radius: var(--radius-sm);
  background: var(--action-primary);
  color: var(--action-primary-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.notice-actions .notice-primary:hover {
  border-color: var(--action-primary-hover);
  background: var(--action-primary-hover);
}

/* ==== Baustein: Meldung (CD-02 Statusfarben) ====================================================================================== */
.message {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  max-width: 48rem;
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
}

/* display: flex darf das hidden-Attribut nicht überstimmen (Meldungen sind nur sichtbar, wenn sie etwas sagen) */
.message[hidden] {
  display: none;
}

.message svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-error {
  background: var(--message-error-bg);
  color: var(--message-on-status);
}

.message-success {
  background: var(--message-success-bg);
  color: var(--message-on-status);
}

.message-info {
  background: var(--message-info-bg);
  color: var(--message-on-status);
}

.message-warning {
  background: var(--message-warning-bg);
  color: var(--message-on-warning);
}

/* Hinweis im Rahmen (z. B. „Sprachwahl nicht gespeichert“): eigene Zeile zwischen Kopfzeile und Inhalt, nur sichtbar, wenn er gebraucht wird */
.portal-hint {
  grid-area: hint;
  max-width: none;
  margin: 0;
  border-radius: 0;
}

/* Feldfehler: Statusfarbe auf hellem Grund, hält den Kontrast auch im Dunkelmodus (CD-02, WCAG AA) */
.field-error {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--field-error-bg);
  color: var(--field-error-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.field-error[hidden] {
  display: none;
}

.field-error svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==== Baustein: Karte (UI-07) ===================================================================================================== */
/* Ein Container je logischem Abschnitt: Formular, Liste, Detailabschnitt, die Abschnitte der
   Einstellungen. Fläche --surface-card, 1-px-Rand, 8 px Radius, 16 px Innenabstand, kein Schatten. */
.portal-main > form,
.portal-main > section,
.settings-section {
  box-sizing: border-box;
  max-width: 64rem;
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  box-shadow: none;
}

.portal-main > form h2,
.portal-main > section h2,
.settings-section h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
}

.portal-main > section > p:last-child,
.settings-section > p:last-child {
  margin-bottom: 0;
}

/* ==== Einstellungen: Unternavigation ============================================================================================== */
/* Links eine Spalte mit den Abschnitten der Einstellungen, rechts daneben deren Inhalt; Oberkante beider auf derselben Höhe. Die Liste
   ist keine Landmark; der aktive Eintrag trägt die Auswahlfläche wie andere gewählte Zustände (UI-04), 6 px Radius, 14 px/500. */
.settings-layout {
  container: settings / inline-size;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

/* Ohne Unternavigation: der Inhalt nimmt die ganze Breite. */
.settings-layout-single {
  grid-template-columns: minmax(0, 1fr);
}

/* ==== Einstellungen: Anordnung der Karten ========================================================================================= */
/* Hauptkarte links, Nebenkarte rechts (gleiche Höhe), weitere Karten bei Bedarf als ganze Zeile darunter. Unter 720 px
   Inhaltsbreite (Layout 200 + 24 + 720 px) eine Spalte; die Container-Abfrage folgt dem Ein-/Ausklappen der Seitenleiste. */
.settings-content {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  gap: var(--space-4);
  align-items: stretch;
  max-width: 64rem;
}

.settings-content > .settings-section {
  max-width: none;
  margin: 0;
  padding: calc(var(--space-4) + var(--space-1));
}

/* ==== Einstellungen: Preferences ================================================================================================== */
/* Eine Karte über die ganze Breite; Radiogruppen mit Auswahlkarten (Wahl, Beispiel), die gewählte trägt die Auswahlfläche (UI-04). */
.settings-preferences {
  grid-column: 1 / -1;
}

.pref-group {
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
}

.pref-group legend {
  margin-bottom: var(--space-1);
  padding: 0;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.pref-group .form-hint {
  margin: 0 0 var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.pref-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

@container settings (max-width: 600px) {
  .pref-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pref-option {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  cursor: pointer;
}

.pref-option:has(input:checked) {
  border-color: var(--action-primary);
  background: var(--surface-selected);
  box-shadow: inset 0 0 0 1px var(--action-primary);
}

.pref-option:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.pref-option input {
  margin-top: 3px;
}

.pref-option strong {
  display: block;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.pref-option .pref-example {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.pref-option svg {
  width: 18px;
  height: 18px;
  margin-right: var(--space-1);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}

@container settings (max-width: 943px) {
  .settings-content {
    grid-template-columns: minmax(0, 1fr);
  }
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-nav a {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  text-decoration: none;
}

.settings-nav a:hover {
  background: var(--surface-hover);
}

.settings-nav a[aria-current="true"],
.settings-nav a[aria-current="true"]:hover {
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

/* ==== Baustein: Formular ========================================================================================================== */
.portal-main form label {
  display: block;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.portal-main .form-stack {
  display: grid;
  grid-template-columns: minmax(0, 40rem);
  gap: var(--space-1);
  align-items: start;
}

.form-stack label {
  margin-top: var(--space-2);
}

.form-stack label:first-child,
.form-stack .form-hint + label {
  margin-top: 0;
}

/* Dauerhafter Formularhinweis: ruhiger Nebentext statt Statusfläche (CD-02: Statusfarben nur für Rückmeldungen) */
.form-stack .form-hint {
  margin: 0 0 var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.form-stack .form-hint[hidden] {
  display: none;
}

.form-stack input,
.form-stack textarea,
.form-stack select {
  width: 100%;
}

.form-stack input:not([type="file"]),
.form-stack select {
  height: 36px;
}

/* Dateiauswahl: kein Feldrahmen, die Auswahl-Schaltfläche als sekundäre Aktion */
.portal-main input[type="file"] {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.portal-main input[type="file"]::file-selector-button {
  box-sizing: border-box;
  height: var(--control-height);
  margin-right: var(--space-3);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-field);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.form-stack button {
  justify-self: start;
  margin-top: var(--space-3);
}

/* Die eine orange Hauptaktion einer Ansicht (CD-05) */
.primary-action,
.primary-action:hover:not(:disabled) {
  border-color: var(--action-emphasis);
  background: var(--action-emphasis);
  color: var(--action-emphasis-text);
}

/* Sekundäre Aktionen (CD-05, UI-05): Umriss, Text in der Textfarbe, keine zweite gefüllte Hauptaktion je Ansicht. */
.settings-section > button,
.form-stack button:not(.primary-action),
.notice-actions button {
  border-color: var(--border-field);
  background: transparent;
  color: var(--text-primary);
}

.settings-section > button:hover:not(:disabled),
.form-stack button:not(.primary-action):hover:not(:disabled) {
  border-color: var(--border-field);
  background: var(--surface-hover);
}

.portal-main button:disabled,
.portal-main input:disabled,
.portal-main textarea:disabled,
.portal-main select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==== Baustein: Seitenkopf, Karte mit Tabelle, Zellen ============================================================================= */
/* Seitenkopf: Überschrift (mit Untertitel .page-sub) links, Aktionen rechts. */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
}

.page-head h1 {
  margin: 0;
}

.page-actions {
  display: flex;
  flex: none;
  gap: var(--space-2);
}

.page-actions[hidden] {
  display: none;
}

button.with-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

button.with-icon svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Karte mit Tabelle in voller Breite: Kopf mit Titel und Anzahl, darunter die Tabelle bis an die Ränder der Karte (ohne Innenabstand). */
.portal-main .table-card {
  box-sizing: border-box;
  margin: 0 0 var(--space-4);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.table-card .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.portal-main .table-card .card-head h2 {
  margin: 0;
}

.table-card .count {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

/* Bei Überbreite scrollt nur die Tabelle seitlich; position hält auch visuell versteckte Beschriftungen in der Scrollfläche. */
.table-scroll {
  position: relative;
  overflow-x: auto;
}

/* Spaltenkopf in zwei Zeilen (Titel, Zusatz). */
.th-main,
.th-sub {
  display: block;
}

.th-sub {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Ganze Zeile öffnet das Detail: Zeiger, Fokusrahmen innen, Pfeil am Ende. */
.portal-main tr.row-open {
  cursor: pointer;
}

.portal-main tr.row-open:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.row-chevron {
  display: inline-flex;
  color: var(--text-secondary);
}

.row-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-main tr.row-open:hover .row-chevron {
  color: var(--text-primary);
}

/* Zellen mit Haupt- und Nebenzeile; leere Werte in der Nebentextfarbe. */
.cell-main {
  display: block;
  color: var(--text-body);
  white-space: nowrap;
}

.cell-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.cell-empty {
  color: var(--text-secondary);
}

/* ==== Baustein: Zustand, Tooltip, Laden, Leerzustand ============================================================================== */
/* Zustand: Symbol und englisches Label in der Textfarbe. */
.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-body);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.state svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Bereit bzw. in Ordnung: grüne Fläche mit weißem Haken (5,4:1, auch im Dunkelmodus) */
.state-ready .state-fill {
  fill: var(--hs-status-success);
  stroke: none;
}

.state-ready .state-mark {
  fill: none;
  stroke: var(--hs-on-status);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Achtung: Warnfläche Orange mit Deep-Teal-Zeichen (CD-02 Statusfarbe Warnung) */
.state-attention .state-fill {
  fill: var(--hs-status-warning);
  stroke: none;
}

.state-attention .state-mark {
  fill: none;
  stroke: var(--hs-deep-teal);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.has-tip {
  cursor: default;
}

.has-tip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Tooltip (role="tooltip"): fest positioniert, damit ihn die Scrollfläche nicht abschneidet; Stil wie die Navigations-Tooltips. */
.float-tip {
  position: fixed;
  z-index: 30;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  color: var(--text-on-inverse);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  pointer-events: none;
}

.float-tip > span {
  display: block;
}

/* Laden: je Karte zwei Platzhalterzeilen ohne Text; bei reduzierter Bewegung ohne Pulsieren. */
.skeleton {
  display: block;
  height: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton.short { width: 40%; }
.skeleton.mid { width: 65%; }
.skeleton.long { width: 90%; }

@keyframes skeleton-pulse {
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Leerzustand: Symbol im Kreis über Überschrift und Text (in .full-state bzw. .empty-state). */
.state-illustration {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-brand-subtle);
  color: var(--text-primary);
}

.state-illustration svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==== Baustein: Tabelle =========================================================================================================== */
.portal-main table {
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.portal-main th,
.portal-main td {
  height: 36px;
  box-sizing: border-box;
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}

.portal-main th {
  border-bottom-color: var(--border-default);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.portal-main td {
  color: var(--text-body);
  font-weight: var(--weight-regular);
}

.portal-main tbody tr:last-child td {
  border-bottom: 0;
}

.portal-main tbody tr:hover td {
  background: var(--surface-hover);
}

.portal-main td a {
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.portal-main td a:hover {
  text-decoration: underline;
}

.portal-main time {
  font-variant-numeric: tabular-nums;
}

/* Tabelle bündig mit dem Inhalt der Karte: volle Breite, ohne Innenabstand der ersten und letzten Spalte. */
.flush-table {
  width: 100%;
}

.flush-table th:first-child,
.flush-table td:first-child {
  padding-left: 0;
  font-variant-numeric: tabular-nums;
}

.flush-table th:last-child,
.flush-table td:last-child {
  padding-right: 0;
}

/* ==== Baustein: Werkzeugleiste und Zeilenaktionen ================================================================================= */
/* Werkzeugleiste über einer Liste: Suche, Auswahl, Kontrollkästchen, Segmente, Anzahl rechts; .toolbar-spacer schiebt Folgendes nach rechts. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
}

.filter-bar[hidden] {
  display: none;
}

.filter-bar .search-input {
  position: relative;
  flex: 0 1 18rem;
}

.filter-bar .search-input svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.filter-bar input[type="search"] {
  width: 100%;
  height: var(--control-height);
  padding: 0 var(--space-3) 0 36px;
  font-size: var(--text-sm);
}

.filter-bar input[type="search"]::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.filter-bar select {
  height: var(--control-height);
  font-size: var(--text-sm);
}

.filter-bar label.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.filter-bar .count {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.filter-bar .toolbar-spacer {
  flex: 1;
}

.filter-bar .segmented label {
  height: 26px;
  padding: 0 var(--space-3);
}

/* Symbolknöpfe am Zeilenende (vor dem Pfeil). */
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
}

.portal-main .row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--border-field);
  background: transparent;
  color: var(--text-primary);
}

.portal-main .row-action:hover:not(:disabled) {
  border-color: var(--border-field);
  background: var(--surface-hover);
}

.row-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Nur lesbare Angaben in einem Formular: ruhige Fläche statt Eingabefeld. */
.field input[readonly] {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.segmented:has(input:disabled) {
  opacity: 0.6;
}

/* Link in der Form der primären Aktion. */
.portal-main a.button {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--action-primary);
  border-radius: var(--radius-sm);
  background: var(--action-primary);
  color: var(--action-primary-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.portal-main a.button:hover {
  border-color: var(--action-primary-hover);
  background: var(--action-primary-hover);
}

/* ==== Menüs (Sprache, persönliches Menü) ======================================================================================= */
.menu-container {
  position: relative;
}

.menu-container [role="menu"] {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  min-width: 12rem;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-body);
  font-size: var(--text-base);
  z-index: 6;
}

.menu-container [role="menuitemradio"],
.menu-container [role="menuitem"],
.menu-container .menu-text {
  padding: 6px var(--space-2);
  border-radius: var(--radius-sm);
}

.menu-container [role="menuitemradio"],
.menu-container [role="menuitem"] {
  cursor: pointer;
}

.menu-container [role="menuitemradio"]:hover,
.menu-container [role="menuitem"]:hover,
.menu-container [role="menuitemradio"]:focus,
.menu-container [role="menuitem"]:focus {
  background: var(--surface-hover);
  outline-offset: -2px;
}

.menu-container [role="menuitemradio"]::before {
  content: "";
  display: inline-block;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  margin-right: var(--space-2);
  border-radius: 50%;
  border: 1.5px solid currentColor;
  vertical-align: middle;
}

.menu-container [role="menuitemradio"][aria-checked="true"]::before {
  border-color: var(--text-link);
  background: var(--text-link);
}

/* Sprachflagge: 18 × 12 px inklusive 1-px-Rand in der Rand-Rolle, Radius 2 px; Flaggenfarben unverändert in Hell
   und Dunkel (kein Filter, keine Deckkraft). Der Inhalt (16 × 10 px) wird ohne Verzerrung gefüllt. */
.lang-flag {
  box-sizing: border-box;
  flex: none;
  width: 18px;
  height: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-flag);
  object-fit: cover;
  vertical-align: middle;
}

.menu-container [role="menuitemradio"] .lang-flag {
  margin-right: var(--space-2);
}

.menu-text {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.menu-text strong {
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.menu-container .menu-text + [role="menuitem"] {
  margin-top: var(--space-1);
  border-top: 1px solid var(--border-subtle);
}

/* Persönliches Menü: Kopf mit Name und E-Mail (.pm-who, .pm-mail), Einträge mit Symbol, Trennlinie (.pm-sep). */
.menu-container .personal-menu {
  width: 18rem;
  padding: var(--space-1);
}

.personal-menu .pm-head {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2);
}

.pm-who {
  display: grid;
  min-width: 0;
}

.pm-who strong {
  overflow: hidden;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-mail {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personal-menu [role="menuitem"] {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.personal-menu [role="menuitem"] svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-secondary);
}

.personal-menu .pm-sep {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border-subtle);
}

/* ==== Baustein: Reiter ============================================================================================================ */
/* Reiter: gewählt mit der Auswahlfläche (CD-05: hell Frosted Breeze, dunkel Icy Blue). */
.tabs {
  display: flex;
  gap: var(--space-1);
}

.portal-main .tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.portal-main .tabs .tab:hover:not(:disabled) {
  border-color: var(--border-default);
  background: var(--surface-hover);
}

.portal-main .tabs .tab[aria-selected="true"],
.portal-main .tabs .tab[aria-selected="true"]:hover {
  border-color: var(--surface-selected);
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

.tabs .tab svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0 0 var(--space-3);
}

.portal-main .view-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.portal-main .view-tabs a:hover {
  background: var(--surface-hover);
}

.portal-main .view-tabs a[aria-current="page"],
.portal-main .view-tabs a[aria-current="page"]:hover {
  border-color: var(--surface-selected);
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

.portal-main .view-tabs a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ==== Übersicht ================================================================================================================== */
/* Kopf, vier gleich breite Kennzahl-Kacheln, darunter ein Raster aus zwei Spalten (5 : 4) und zwei Zeilen.
   Kacheln und Karten sind die gemeinsame Karte (Fläche --surface-card, 1-px-Rand, 8 px Radius); Icons einfarbig ohne Fläche.
   Ohne Scrollen (UI-11): Abstände, Innenabstände und Zeilenhöhen in zwei Stufen nach der Fensterhöhe, jeweils auf dem
   4-px-Raster (UI-06); Schriftgrößen bleiben fest (UI-02). */
.overview {
  --ov-gap: var(--space-2);
  --ov-pad: var(--space-3);
  --ov-tile-pad: var(--space-2);
  --ov-head-gap: var(--space-2);
  --ov-row: 28px;
  --ov-item: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--ov-gap);
}

@media (min-height: 800px) {
  .overview {
    --ov-gap: var(--space-4);
    --ov-pad: var(--space-4);
    --ov-tile-pad: var(--space-3);
    --ov-head-gap: var(--space-3);
    --ov-row: 36px;
    --ov-item: 28px;
  }
}

.overview svg {
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.overview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
}

.overview-title {
  margin: 0;
}

.overview-subtitle,
.overview-card-subtitle,
.overview-tile-period,
.overview-entry-meta {
  margin: 0;
  color: var(--text-secondary);
}

.overview-subtitle {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.overview-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--ov-gap);
}

/* Raster der Karten: links die Hauptkarte, rechts eine Spalte mit weiteren Karten (.overview-side). */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  gap: var(--ov-gap);
}

.overview-side {
  display: flex;
  flex-direction: column;
  gap: var(--ov-gap);
  min-width: 0;
}

.overview-side > .overview-card:last-child {
  flex: 1;
}

.overview-tile,
.overview-card {
  box-sizing: border-box;
  min-width: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-body);
  box-shadow: none;
}

/* Kachel: Bezeichnung, Wert, Trend in einer Zeile; das Icon klein oben rechts ohne eigene Fläche (UI-05) */
.overview-tile {
  position: relative;
  padding: var(--ov-tile-pad) var(--space-4);
}

.overview-tile-icon {
  position: absolute;
  top: var(--ov-tile-pad);
  right: var(--space-4);
  display: flex;
  color: var(--text-secondary);
}

.overview-tile-icon svg {
  width: 16px;
  height: 16px;
}

.overview-tile-body {
  min-width: 0;
}

.overview-tile-label {
  margin: 0;
  padding-right: var(--space-5);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 18px;
}

.overview-tile-value {
  margin: var(--space-1) 0 0;
  color: var(--text-primary);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-figure);
  line-height: 28px;
}

/* Trend (Dummy): „↑ +99 %“, „ggü. Vorperiode“ und das Badge in einer Zeile */
.overview-tile-trend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) 6px;
  margin-top: var(--space-1);
}

.overview-trend-row {
  display: contents;
}

.overview-trend-value {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.overview-trend-value svg {
  width: 12px;
  height: 12px;
}

.overview-tile-trend .dummy-badge {
  order: 2;
}

.overview-tile-period {
  order: 1;
  font-size: var(--text-xs);
  line-height: 18px;
  white-space: nowrap;
}

.overview-card {
  padding: var(--ov-pad);
}

/* Kopf der Karte als Raster: Icon | Titel mit Badge | Link, der Untertitel darunter über Titel- und Linkspalte */
.overview-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-2);
  margin-bottom: var(--ov-head-gap);
}

.overview-card-head > div {
  display: contents;
}

.overview-card-head > .overview-card-link {
  grid-column: 3;
  grid-row: 1;
}

.overview-card-subtitle {
  grid-column: 2 / span 2;
  margin-top: 2px;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.overview-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.overview-card-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.overview-card h2 {
  margin: 0;
  font-size: var(--text-base);
  letter-spacing: normal;
  line-height: 20px;
}

/* Kartenlinks: echter Link („Alle anzeigen“) und Link ohne Ziel sehen gleich aus; nur der echte ist bedienbar */
.overview-card-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-link);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
}

a.overview-card-link:hover {
  text-decoration: underline;
}

.overview-link-disabled {
  cursor: default;
}

.overview-card-link svg {
  width: 14px;
  height: 14px;
}

a.overview-tile-label {
  display: block;
  text-decoration: none;
}

a.overview-tile-label:hover {
  text-decoration: underline;
}

.overview-card .message {
  max-width: none;
}

.overview-entry-title {
  margin: 0;
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 20px;
}

.overview-entry-meta {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}

/* Letzte Aktivitäten: Icon, Text, Datum rechts; feine Trennlinien */
.overview-activities {
  margin: 0;
  padding: 0;
  list-style: none;
}

.overview-activities li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--ov-item);
  border-bottom: 1px solid var(--border-subtle);
}

.overview-activities li:last-child {
  border-bottom: 0;
}

.overview-activities svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.overview-activities .overview-entry-title {
  flex: 1;
  min-width: 0;
  font-weight: var(--weight-regular);
}

.overview-activities .overview-entry-meta {
  white-space: nowrap;
}

.portal-main .overview-table {
  width: 100%;
}

.portal-main .overview-table th,
.portal-main .overview-table td {
  height: var(--ov-row);
  padding: 0 var(--space-2);
}

.portal-main .overview-table th:first-child,
.portal-main .overview-table td:first-child {
  padding-left: 0;
}

.overview-table time {
  white-space: nowrap;
}

.overview-empty {
  margin: 0;
}

/* Höhen-Layout der Übersicht (UI-11): Solange die Übersicht im Inhaltsbereich steht, ist die Seite genau so hoch wie das Fenster;
   der Inhaltsbereich füllt die Höhe unter der Kopfzeile, das Raster der Karten den Rest unter Kopf und Kacheln. */
@media (min-width: 1101px) {
  body:has(> .portal-main > .overview) {
    height: 100vh;
    height: 100dvh;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .portal-main:has(> .overview) {
    box-sizing: border-box;
    min-height: 0;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }

  .portal-main > .overview {
    box-sizing: border-box;
    height: 100%;
  }

  .overview-grid {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: auto auto;
  }
}

@media (min-width: 1101px) and (min-height: 800px) {
  .portal-main:has(> .overview) {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }
}

@media (min-width: 1101px) and (min-height: 1000px) {
  .portal-main:has(> .overview) {
    padding-top: var(--space-5);
    padding-bottom: var(--space-5);
  }
}

@media (max-width: 1100px) {
  .overview-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .overview-tiles {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==== Baustein: Dialog ============================================================================================================ */
/* Modaler Dialog (native dialog, showModal): 8 px Radius, 1-px-Rand, keine Schatten (CD-05); Hintergrund abgedunkelt. Unterdialoge liegen
   über dem Detail-Pop-up. Sekundäre Aktionen als Umriss, die primäre in der Aktionsfarbe. */
dialog.hs-dialog {
  box-sizing: border-box;
  width: min(36rem, calc(100vw - 2 * var(--space-5)));
  max-height: calc(100vh - 2 * var(--space-5));
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-body);
  box-shadow: none;
}

dialog.hs-dialog.wide {
  width: min(46rem, calc(100vw - 2 * var(--space-5)));
}

dialog.hs-dialog::backdrop {
  background: var(--crop-shade);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) 0;
}

.dialog-head h2 {
  margin: 0;
}

.dialog-body {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.dialog-body > p {
  margin: 0 0 var(--space-3);
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

dialog button.secondary,
dialog .copy-button,
dialog .icon-close,
.wizard-form button.secondary,
.wizard-step button.secondary,
.wizard-step .copy-button {
  border-color: var(--border-field);
  background: transparent;
  color: var(--text-primary);
}

dialog button.secondary:hover:not(:disabled),
dialog .copy-button:hover:not(:disabled),
dialog .icon-close:hover:not(:disabled),
.wizard-form button.secondary:hover:not(:disabled),
.wizard-step button.secondary:hover:not(:disabled),
.wizard-step .copy-button:hover:not(:disabled) {
  border-color: var(--border-field);
  background: var(--surface-hover);
}

dialog button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

dialog .icon-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-color: transparent;
  color: var(--text-secondary);
}

dialog .icon-close svg,
.lock-note svg,
.readonly-value svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

dialog .message.inline,
.wizard-form .message.inline,
.wizard-step .message.inline {
  max-width: none;
  margin: 0 0 var(--space-3);
}

dialog code,
.wizard-step code {
  font-size: var(--text-sm);
}

/* ==== Baustein: Detail-Pop-up ===================================================================================================== */
/* Groß und mittig mit eigenem Scrollbereich; Kopf mit Name, Zustand und Kennzeichen; darunter Karten je Abschnitt (.detail-card). */
dialog.detail-dialog {
  width: min(72rem, calc(100vw - 2 * var(--space-6)));
  max-width: none;
  max-height: calc(100vh - 2 * var(--space-6));
  overflow: hidden;
  background: var(--surface-app);
}

dialog.detail-dialog[open] {
  display: flex;
  flex-direction: column;
}

.detail-head {
  flex: none;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-card);
}

.detail-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.detail-title h2 {
  margin: 0;
  font-size: var(--text-xl);
  overflow-wrap: anywhere;
}

.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.detail-scroll > .message,
.detail-scroll > .lock-note {
  max-width: none;
}

.detail-card {
  box-sizing: border-box;
  min-width: 0;
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.detail-card p {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  margin: 0 0 var(--space-3);
}

.section-head h3 {
  margin: 0;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-h2);
}

.section-note {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-4);
  align-items: start;
}

.detail-grid .detail-card,
.stack .detail-card {
  margin: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.muted {
  color: var(--text-secondary);
}

.mono {
  font-family: var(--font-mono);
}

/* Fakten: Beschriftung (dt) klein in der Nebentextfarbe, Wert (dd) darunter. */
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
  margin: 0;
}

.facts.facts-1 {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: var(--space-4);
}

.facts.facts-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.facts.facts-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.facts div {
  min-width: 0;
}

.facts dt {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.facts dd {
  margin: 2px 0 0;
  color: var(--text-body);
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.facts dd.mono {
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
}

.facts dd .cell-sub {
  font-weight: var(--weight-regular);
}

/* Die Bausteine aus Tabellenzellen sind einzeilig, damit Tabellenzeilen niedrig bleiben; in einer Fakten-Spalte brechen sie in
   ihrer Spalte um, statt in die Nachbarspalte zu laufen. */
.facts dd .cell-main,
.facts dd .cell-sub {
  white-space: normal;
}

.fact-link {
  text-decoration: none;
}

.fact-link:hover {
  text-decoration: underline;
}

/* Hinweis mit Symbol in einer ruhigen Markenfläche (z. B. „nur lesbar“). */
.lock-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-brand-subtle);
  color: var(--text-body);
  font-size: var(--text-sm);
}

.lock-note svg {
  margin-top: 2px;
}

/* Verlauf: ruhige Liste mit Trennlinien (Zeit, Inhalt, Zusatz). */
.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}

.history-list li:last-child {
  border-bottom: 0;
}

.history-list time {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Formulare im Dialog: Raster, Felder, Segment-Auswahl und Auswahlkacheln (.choice-grid). */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4) var(--space-5);
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: var(--space-4) 0;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.field > label,
.field > .label {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.field .optional {
  color: var(--text-secondary);
  font-weight: var(--weight-regular);
}

/* Nur Texteingaben (und Auswahllisten) füllen die Breite des Feldes und haben Feldhöhe; Kontrollkästchen und Auswahlpunkte in einem Feld behalten ihre Größe. :where() lässt die
   Spezifität der Regel unverändert. */
.field input:where(:not([type]), [type="text"], [type="email"], [type="url"], [type="tel"], [type="password"], [type="number"], [type="search"], [type="date"], [type="time"], [type="datetime-local"]),
.field select {
  width: 100%;
  height: 36px;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--hs-status-error);
}

.field .field-error {
  align-self: flex-start;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.section-messages:not(:empty) {
  margin-top: var(--space-3);
}

.section-messages .message {
  margin: 0;
}

.segmented {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px;
  border: 1px solid var(--border-field);
  border-radius: var(--radius-sm);
}

.segmented label,
.choice-grid label {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.segmented label {
  height: 30px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-2);
}

.choice-grid label {
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-field);
  border-radius: var(--radius-sm);
}

/* Unsichtbare Auswahl auf 1 px: in Standardgröße lag sie über dem Anfang kurzer Beschriftungen und fing Klicks auf den Text ab. */
.segmented input,
.choice-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.segmented label:has(input:checked),
.choice-grid label:has(input:checked) {
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

.choice-grid label:has(input:checked) {
  border-color: var(--text-primary);
}

.segmented label:has(input:focus-visible),
.choice-grid label:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
}

.readonly-value {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  color: var(--text-body);
}

/* Befehle (z. B. pull und install) und einmalig gezeigte Werte: Festbreitenschrift, umbrechend; die .token-box hebt sich mit dem Warnrand ab;
   „Kopieren“ klein als Umriss. */
.command-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: command;
}

.command-list > li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-3);
}

.command-list > li::before {
  counter-increment: command;
  content: counter(command);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-field);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.command-title {
  margin: 1px 0 var(--space-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.command,
.token-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-app);
}

.token-box {
  align-items: center;
  margin: 0 0 var(--space-3);
  border-color: var(--hs-status-warning);
}

.command code,
.token-box code {
  flex: 1;
  min-width: 0;
  color: var(--text-body);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dialog .copy-button,
.wizard-step .copy-button {
  flex: none;
  min-height: 28px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
}

dialog .copy-button svg,
.wizard-step .copy-button svg {
  width: 14px;
  height: 14px;
}

.full-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  text-align: center;
}

.full-state p {
  max-width: 34rem;
  margin: 0;
  color: var(--text-secondary);
}

.full-state .actions {
  margin-top: var(--space-3);
}

/* ==== Baustein: Assistent ========================================================================================================= */
/* Eigene Ansicht: Rücklink, Seitenkopf mit Untertitel, Schrittanzeige und je Schritt eine Karte (Baustein Karte).
   Auswahl und Fokus über die Auswahlfläche und den Fokusring (CD-05), erledigte Schritte mit ✓ auf der Erfolgsfarbe (Text immer dabei, CD-02);
   je Schritt höchstens eine primäre Aktion, kein Orange. */
.back-link.with-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.back-link svg,
.mode-title svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-head .page-sub {
  margin: var(--space-1) 0 0;
  color: var(--text-secondary);
}

.stepper {
  display: flex;
  gap: var(--space-2);
  max-width: 64rem;
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.stepper[hidden] {
  display: none;
}

.stepper li {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.stepper .step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid var(--border-field);
  border-radius: 50%;
  font-size: var(--text-xs);
}

.stepper li[aria-current="step"] {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.stepper li[aria-current="step"] .step-no {
  border-color: var(--surface-selected);
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

.stepper li.done {
  color: var(--text-primary);
}

.stepper li.done .step-no {
  border-color: var(--hs-status-success);
  background: var(--hs-status-success);
  color: var(--hs-on-status);
}

.wizard-form .form-grid {
  max-width: 44rem;
}

/* Auswahl des Wegs als Kacheln (.mode-card) in einer Feldgruppe. */
.mode-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22rem));
  gap: var(--space-3);
  min-width: 0;
  margin: 0 0 var(--space-5);
  padding: 0;
  border: 0;
}

.mode-choice legend {
  grid-column: 1 / -1;
  margin: 0 0 var(--space-2);
  padding: 0;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

/* Der Baustein Formular setzt Beschriftungen im Inhaltsbereich als Block; Kacheln und Segmente im Assistenten bleiben Flex-Elemente. */
.portal-main .wizard-form .segmented label,
.portal-main .wizard-form .choice-grid label {
  display: inline-flex;
}

.portal-main .mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.mode-card input {
  position: absolute;
  opacity: 0;
}

.mode-card:has(input:checked) {
  border-color: var(--text-primary);
  background: var(--surface-selected);
}

.mode-card:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
}

.mode-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.mode-text {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.mode-card:has(input:checked) .mode-title,
.mode-card:has(input:checked) .mode-text {
  color: var(--text-on-selected);
}

.field .field-help {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.wizard-scroll > p {
  max-width: 64rem;
}

/* Feste App (UI-11): das Dokument ist nie höher als das Fenster; Rücklink, Seitenkopf, Schrittanzeige, Titel der Karte, Meldungen
   und die Aktionen der Karte stehen, nur der Inhalt der Karte („wizard-scroll“) scrollt, in jedem Schritt.
   Die Karte (Baustein Karte, direktes Kind des Inhaltsbereichs) richtet sich nach ihrem Inhalt und schrumpft bis zur Resthöhe. Notlösung für sehr
   kleine Fenster: dann scrollt der Inhaltsbereich. */
body:has(.wizard-form, .wizard-step) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.portal-main:has(> .wizard-form, > .wizard-step) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.portal-main:has(> .wizard-form, > .wizard-step) > :not(.wizard-form, .wizard-step) {
  flex: none;
}

.portal-main:has(> .wizard-form, > .wizard-step) > .back-link {
  align-self: flex-start;
}

.wizard-form,
.wizard-step {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
}

.wizard-form > :not(.wizard-scroll),
.wizard-step > :not(.wizard-scroll) {
  flex: none;
}

/* Innenabstand und gleich großer negativer Außenabstand lassen den Fokusring der Felder im Sichtbereich, ohne die Lage des Inhalts zu ändern. */
.wizard-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin: calc(-1 * var(--space-1));
  padding: var(--space-1);
  overflow-y: auto;
}

.wizard-scroll:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

@media (max-width: 900px) {
  .detail-grid,
  .facts.facts-3,
  .facts.facts-5,
  .form-grid,
  .form-grid.three,
  .mode-choice {
    grid-template-columns: minmax(0, 1fr);
  }

  .stepper {
    flex-direction: column;
  }
}

/* ==== Baustein: Symbolknöpfe, Ladekreis, Kontrollkästchen ======================================================================= */
/* Aktionen als Symbolknöpfe mit Umriss (leiser als die primäre Aktion); eine laufende Aktion zeigt statt des Symbols den Ladekreis (.spinner). */
.icon-actions {
  display: inline-flex;
  gap: var(--space-1);
}

.icon-actions button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-primary);
}

.icon-actions button:hover:not(:disabled) {
  background: var(--surface-hover);
}

.icon-actions button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-actions .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .icon-actions .spinner { animation: none; }
}

.check-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
}

/* ==== Baustein: Formatierter Text (Markdown) ====================================================================================== */
.field-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* Formatierter Text (z. B. Chart-README): Darstellung des eigenen, sicheren Renderers für eine feste Teilmenge (architecture.md); Codeblöcke mit
   Kopf, Kopierknopf und einfacher Hervorhebung (.tok-*). */
.md {
  color: var(--text-body);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.md p,
.md ul,
.md ol {
  max-width: 90ch;
}

.md p {
  margin: 0 0 var(--space-2);
}

.md > :last-child {
  margin-bottom: 0;
}

.md ul,
.md ol {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
}

.md a {
  color: var(--text-link);
}

.md code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-hover);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.md .code {
  margin: 0 0 var(--space-3);
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-app);
}

.md .code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.md .code pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.md .code code {
  padding: 0;
  background: none;
  overflow-wrap: normal;
}

.md .tok-key {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.md .tok-str {
  color: var(--text-link);
}

.md .tok-com {
  color: var(--text-secondary);
  font-style: italic;
}

.md .copy-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
}

.md .copy-code:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.md .copy-code svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==== Baustein: Listenansicht mit scrollendem Panel (UI-11) ======================================================================= */
/* Feste App (UI-11): das Dokument ist nie höher als das Fenster; Kopf, Hinweis und Filterzeile stehen, in der Karte scrollt nur der
   Tabellenkörper („list-scroll“), der Tabellenkopf bleibt stehen, die Seitenzahlen liegen unter dem Scrollbereich. Notlösung für sehr kleine
   Fenster: dann scrollt der Inhaltsbereich unter Kopfzeile und Navigation. Aufbau: .list-page > Kopf, Filter (.list-filters), .list-work >
   .list-card > Kopf, .list-body > .list-scroll > .list-table, darunter .list-foot mit .pager. */
body:has(.list-page) {
  height: 100vh;
  overflow: hidden;
}

.portal-main:has(> .list-page) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.list-page {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.list-page > * {
  flex: none;
}

.list-page > .list-work {
  flex: 1 1 auto;
  min-height: 0;
}

.list-page [hidden] {
  display: none;
}

.list-page > .page-head {
  margin-bottom: var(--space-3);
}

/* Filterzeile mit Beschriftung über den Feldern */
.list-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(10rem, 1fr)) minmax(16rem, 2fr);
  align-items: end;
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}

.list-filters .fl {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.list-filters .fl > label,
.list-filters .fl > .label {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.portal-main .list-filters select,
.portal-main .list-filters input {
  width: 100%;
  min-height: 38px;
  border-color: var(--border-field);
  background-color: var(--surface-card);
  font-size: var(--text-sm);
}

.list-filters .search {
  position: relative;
  display: flex;
  align-items: center;
}

.list-filters .search svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.portal-main .list-filters .search input {
  padding-left: 34px;
}

/* Raster neben der Tabelle: eine Spalte; mit einer zweiten Karte rechts daneben. */
.list-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: var(--space-5);
}

.list-work:has(> :nth-child(2)) {
  grid-template-columns: minmax(0, 3fr) minmax(20rem, 1fr);
}

.list-card {
  display: flex;
  min-height: 0;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.list-card.list-error {
  align-self: start;
}

.list-card-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 18px 20px 0;
  margin-bottom: var(--space-3);
}

.portal-main .list-card-head h2 {
  margin: 0;
}

.list-card .count {
  color: var(--text-secondary);
  font-weight: var(--weight-regular);
  font-variant-numeric: tabular-nums;
}

.list-card-head .quiet-action {
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.list-card-head .quiet-action:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-hover);
  color: var(--text-primary);
}

.list-note {
  flex: none;
  padding: var(--space-2) 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-app);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.list-body,
.list-table-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.list-scroll:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.list-state-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.list-card .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.portal-main .list-card .empty-state h2 {
  margin: var(--space-2) 0 0;
}

.list-card .empty-state p {
  max-width: 34rem;
  margin: 0;
  color: var(--text-secondary);
}

/* Tabelle: kompakt (UI-06), Kopf haftet am Scrollbereich */
.portal-main .list-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.portal-main .list-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--surface-app);
  font-size: var(--text-xs);
}

.portal-main .list-table td {
  height: 60px;
  padding: 8px var(--space-3);
}

.portal-main .list-table th:first-child,
.portal-main .list-table td:first-child {
  padding-left: 20px;
}

.portal-main .list-table th:last-child,
.portal-main .list-table td:last-child {
  padding-right: 20px;
}

.portal-main .list-table tbody tr {
  cursor: pointer;
}

.portal-main .list-table tbody[aria-busy="true"] tr {
  cursor: default;
}

.portal-main .list-table tbody[aria-busy="true"] td {
  height: 52px;
}

.portal-main .list-table th .sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.portal-main .list-table th .sort:hover:not(:disabled) {
  border: 0;
  background: none;
  color: var(--text-primary);
}

.portal-main .list-table th .sort.on {
  color: var(--text-primary);
}

.list-table th .sort svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Seitenzahlen unter dem Scrollbereich */
.list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.list-foot .pager {
  display: flex;
  align-items: center;
  gap: 4px;
}

.portal-main .list-foot .pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.portal-main .list-foot .pager button:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-hover);
}

.portal-main .list-foot .pager button.nav {
  border-color: var(--border-default);
}

.portal-main .list-foot .pager button[aria-current="page"] {
  border-color: var(--action-primary);
  background: var(--action-primary);
  color: var(--action-primary-text);
}

.list-foot .pager svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==== Baustein: Brotkrume ========================================================================================================= */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.crumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.crumbs .sep {
  color: var(--border-field);
}

/* ==== Einstellungen: feste App (UI-11); Bausteine Text-Knopf und Zeilenmenü ====================================================== */
/* Feste App (UI-11): das Dokument scrollt nie; Kopf und Unternavigation stehen, nur der Inhalt rechts der Unternavigation scrollt. Eine Karte
   mit Tabelle (.settings-section.panel in .settings-content.panel-host) füllt die Resthöhe: Kopf, Meldungen und Werkzeugleiste stehen, nur die
   Tabelle scrollt, ihr Kopf bleibt stehen. Notlösung für sehr kleine Fenster: dann scrollt der Inhaltsbereich (.portal-main), nie das Fenster. */
body:has(.portal-main > .settings-layout) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.portal-main:has(> .settings-layout) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.portal-main:has(> .settings-layout) > :not(.settings-layout) {
  flex: none;
}

.portal-main > .settings-layout {
  flex: 1 1 auto;
  align-items: stretch;
  min-height: 24rem;
}

.portal-main > .settings-layout > .settings-content {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
}

.portal-main > .settings-layout > .settings-content:focus-visible,
.settings-section.panel > .table-scroll:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.settings-content.panel-host {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-content.panel-host > .panel {
  flex: 1 1 auto;
  min-height: 0;
}

.settings-section.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.settings-section.panel > * {
  flex: none;
}

/* Tabelle bis an die Kartenränder: der Scrollbereich liegt am Rand der Karte, der Inhalt bleibt im Innenabstand. */
.settings-section.panel > .table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 calc(-1 * (var(--space-4) + var(--space-1)));
  padding: 0 calc(var(--space-4) + var(--space-1));
  overflow: auto;
}

/* Text-Knopf mit Symbol (z. B. Stift „Umbenennen“) */
.text-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-link);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.text-action:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-hover);
}

.text-action svg,
.row-menu-button svg,
.row-menu [role="menuitem"] svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-action svg {
  width: 14px;
  height: 14px;
}

/* ---- Zeilenmenü „⋯“: Schaltfläche in der Zeile, ein Menü am Dokument (nicht im Scrollbereich der Tabelle) ---------------------------------------------- */
.row-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
}

.row-menu-button:hover:not(:disabled),
.row-menu-button[aria-expanded="true"] {
  border-color: transparent;
  background: var(--surface-selected);
  color: var(--text-on-selected);
}

.row-menu-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 3;
}

.row-menu {
  position: fixed;
  z-index: 8;
  box-sizing: border-box;
  min-width: 13rem;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-body);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.row-menu .menu-label {
  padding: 6px var(--space-2) 2px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.row-menu .menu-sep {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border-subtle);
}

.row-menu [role="menuitem"],
.row-menu [role="menuitemradio"] {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.row-menu [role="menuitem"]:hover,
.row-menu [role="menuitemradio"]:hover,
.row-menu [role="menuitem"]:focus,
.row-menu [role="menuitemradio"]:focus {
  background: var(--surface-hover);
  outline-offset: -2px;
}

.row-menu [role="menuitem"] svg {
  width: 14px;
  height: 14px;
}

.row-menu [role="menuitemradio"]::before {
  content: "";
  display: inline-block;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.row-menu [role="menuitemradio"][aria-checked="true"]::before {
  border-color: var(--text-link);
  background: var(--text-link);
}


/* ==== Rahmen der Registry (SPEC-002): feste App, Kennzeichen der Kopfzeile, Zustände, sortierbare Tabellen ===================================== */

/* Feste App (UI-11, Entscheidung Tim 2026-11-04): Das Dokument scrollt nie. Kopfzeile, Navigation und Inhaltsbereich haben Fensterhöhe; Ansichten
   bauen als <div class="page fixed"> mit Kopf (.head) und einem Bereich .fill, in dem nur ein Panel (.panel > .panel-body) scrollt. Notlösung in
   kleinen Fenstern: Die Ansicht behält eine Mindesthöhe, dann scrollt .portal-main – nie das Fenster, nie Kopfzeile oder Navigation. */
body[data-frame] {
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

body[data-frame] > .portal-main {
  box-sizing: border-box;
  min-height: 0;
  overflow-y: auto;
}

.portal-main:has(> .page.fixed) {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.page.fixed {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 20rem;
}

.page.fixed > * {
  flex: none;
}

.page.fixed > .fill {
  flex: 1 1 auto;
  min-height: 0;
}

.page.fixed > .head {
  margin-bottom: var(--space-4);
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel > * {
  flex: none;
}

.panel > .panel-body,
.panel > .table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.panel > .table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-card);
}

.panel-body {
  padding: var(--space-4);
}

.panel-body:focus-visible,
.panel > .table-scroll:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

/* Kennzeichen links in der Kopfzeile (öffentliche Registry, Tim 2026-11-12): Marke und Link „Powered by Zot“ (Satz entfernt, Tim 2026-11-16) */
.header-claim {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  margin-right: auto;
}

.header-claim-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-selected);
  color: var(--text-on-selected);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.header-claim-badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.header-claim-text {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.header-claim-link {
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  white-space: nowrap;
  text-decoration: none;
}

.header-claim-link:hover {
  color: var(--text-link);
  text-decoration: underline;
}

/* Zustände einer Ansicht: lädt, nicht erreichbar, nicht gefunden, Anmeldung verlangt (Karte im Panel) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  margin: var(--space-2) 0 0;
}

.empty-state p {
  max-width: 34rem;
  margin: 0;
  color: var(--text-secondary);
}

.empty-state .actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.portal-main .secondary,
.portal-main a.button.secondary {
  border-color: var(--border-field);
  background: transparent;
  color: var(--text-primary);
}

.portal-main .secondary:hover:not(:disabled),
.portal-main a.button.secondary:hover {
  border-color: var(--border-field);
  background: var(--surface-hover);
}

/* Tabellen größer (Tim 2026-11-12, UI-02): Zellen 14 px, Kopf und Nebenzeile 13 px, Zeilen mindestens 40 px */
.portal-main table {
  font-size: var(--text-base);
}

.portal-main td {
  height: 40px;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.portal-main .cell-sub {
  font-size: var(--text-sm);
}

/* Tabelle in der Tabellenkarte reicht bis an die Ränder der Karte; erste und letzte Spalte halten den Innenabstand der Karte. */
.table-card .flush-table th:first-child,
.table-card .flush-table td:first-child {
  padding-left: var(--space-4);
}

.table-card .flush-table th:last-child,
.table-card .flush-table td:last-child {
  padding-right: var(--space-4);
}

.portal-main tr.group-row td {
  font-weight: var(--weight-medium);
}

.table-card .flush-table tr.child-row td:first-child {
  padding-left: calc(var(--space-4) + 24px);
}

/* Sortierbare Spaltenköpfe (UI-12, Tim 2026-11-12, alle Tabellen): Kopf als Knopf mit Pfeil; aktive Spalte in Textfarbe, Pfeil deutlich */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.th-sort:hover {
  background: none;
  color: var(--text-primary);
}

.th-sort:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.th-sort-label .th-main,
.th-sort-label .th-sub {
  text-align: left;
}

.th-sort-icon {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.45;
}

th[aria-sort="ascending"] .th-sort,
th[aria-sort="descending"] .th-sort {
  color: var(--text-primary);
}

th[aria-sort="ascending"] .th-sort-icon,
th[aria-sort="descending"] .th-sort-icon {
  opacity: 1;
}


/* ==== Liste der Container-Images (SPEC-005): Namespaces als aufklappbare Gruppen, „Mehr laden“ ================================================ */
.portal-main tr.group-row[aria-expanded] {
  cursor: pointer;
}

.portal-main tr.group-row[aria-expanded]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.cell-main.group-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-medium);
}

.group-name svg,
.group-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.group-name svg {
  color: var(--text-secondary);
}

.group-chevron {
  display: inline-flex;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

tr.group-row[aria-expanded="true"] .group-chevron {
  transform: rotate(90deg);
}

/* Fußzeile der Liste mit „Mehr laden“ (und dem Hinweis, wenn das Nachladen scheiterte). */
.table-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
}

.table-more p {
  margin: 0;
  color: var(--text-secondary);
}

/* ==== Übersicht der Registry (SPEC-004): Markenkopf mit Suche, drei Kacheln, Art-Kennzeichen ==================================================== */

/* Kopf der Übersicht mit Marke: helle Markenfläche (Icy-Blue-Tönung, CD-02) mit Rand, Titel in Deep Teal, Suche; im Dunkelmodus die
   abgeleitete dunkle Tönung. Kein großer dunkler Block im Hellmodus (Tim 2026-11-12). */
.hero {
  box-sizing: border-box;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-brand-subtle);
  color: var(--text-body);
}

.hero h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-h1);
}

.hero .hero-eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--text-link);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.hero .hero-text {
  margin: var(--space-1) 0 var(--space-3);
  color: var(--text-secondary);
}

/* Großes Suchfeld der Übersicht (wie die Suche der großen Registries) */
.hero-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  max-width: 44rem;
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-field);
  border-radius: var(--radius-sm);
  background: var(--surface-field);
}

.hero-search svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
}

.hero-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text-body);
  font-size: var(--text-base);
}

.hero-search input:focus {
  outline: none;
}

.hero-search:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Drei Kacheln über die ganze Breite (Tim 2026-11-12); Kacheln mit Ziel sind Verknüpfungen */
.overview-tiles.tiles-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-tile[role="link"] {
  cursor: pointer;
}

.overview-tile[role="link"]:hover {
  border-color: var(--border-field);
  background: var(--surface-hover);
}

.overview-tile[role="link"]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.page.fixed > .hero ~ .overview,
.page.fixed > * > .overview,
.page.fixed > .hero ~ .table-card {
  margin-top: var(--space-4);
}

/* Art eines Eintrags als rundes Symbol mit Schrift darunter, eigene Spalte links (Tim 2026-11-12) */
.portal-main .kind-cell {
  width: 56px;
  text-align: center;
}

.kind-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.kind-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  background: var(--surface-brand-subtle);
  color: var(--text-primary);
}

.kind-circle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kind-label {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1;
}

/* ==== Image-Detail (SPEC-006): Tag-Tabelle links, Seitenspalte mit Pull-Befehlen rechts ======================================================= */
.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.digest {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.page-facts {
  margin-bottom: var(--space-4);
}

/* Links Inhalt, rechts Seitenspalte; beide in der Resthöhe, je ein Scrollbereich (UI-11). */
.detail-grid.fill {
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 26rem);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
}

.detail-grid.fill > .card,
.detail-grid.fill > .table-card {
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.detail-grid.fill .panel-body {
  padding: var(--space-4);
}

.portal-main tr.is-selected td {
  background: var(--surface-selected);
}

.side-section + .side-section,
.side-section + .annotations-slot > .side-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-default);
}

.side-section h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.side-section .command-list {
  margin-top: 0;
}

.side-section .command-list > li {
  grid-template-columns: minmax(0, 1fr);
}

.side-section .command-list > li::before {
  display: none;
}

.command .copy-button {
  flex: none;
  min-height: 28px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
}

.copy-button.copied {
  border-color: var(--hs-status-success);
}

.side-facts {
  margin-top: var(--space-3);
}

.platform-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

/* ==== Chart-Detail (SPEC-008): Reiter README, Standardwerte, Versionen links; Seitenspalte mit Befehlen, Chart.yaml und Paket rechts ============== */
/* Karte als Panel einer Ansicht (Rahmen wie die Tabellenkarte); den Innenabstand trägt der Scrollbereich (.panel-body). */
.portal-main .card {
  box-sizing: border-box;
  min-width: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

/* Reiterleiste oben in der Karte; der Reiterinhalt darunter ist der Scrollbereich (UI-11). */
.card-tabs {
  padding: var(--space-3) var(--space-4) 0;
}

/* values.yaml unverändert als Text in Festbreite, ohne Hervorhebung; breite Zeilen scrollen seitlich im Block. */
.values-text {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-app);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

.values-note {
  margin: 0 0 var(--space-3);
}

/* Überschriften und Tabellen der gerenderten README */
.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
  margin: var(--space-4) 0 var(--space-2);
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.md > h1:first-child,
.md > h2:first-child {
  margin-top: 0;
}

.md h1 {
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-h2);
}

.md h2 {
  font-size: var(--text-lg);
}

.md h3,
.md h4,
.md h5,
.md h6 {
  font-size: var(--text-base);
}

.md table {
  margin: 0 0 var(--space-3);
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.md th,
.md td {
  height: auto;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-default);
  text-align: left;
}

/* Mehrere Einträge einer Angabe (Quellen, Maintainer, Abhängigkeiten) untereinander */
.fact-line {
  display: block;
}
