/* =========================================================================
   TVA Modular 3-column layout shell (shared on subpages)
   ========================================================================= */
.tva-layout-shell--loading main {
  visibility: hidden;
}

/* Sprungmarken-Ziele (h2 mit id, ueber "Auf dieser Seite" verlinkt) duerfen
   nicht unter dem sticky Header landen - 2..3 Zeilen Puffer nach unten. */
.tva-layout-shell__content h2[id] {
  scroll-margin-top: calc(var(--tva-layout-header-height, 0px) + 56px);
}

.tva-layout-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 24px);
  align-items: start;
}

.tva-layout-shell__content {
  /* Innenabstand der Inhaltsspalte. --tva-shell-inset (Grundabstand) kommt
     aus :root in embedded/core/styles.css; --tva-content-gap ist der
     zusaetzliche seitliche Abstand zwischen Spaltenrand und Inhalt: auf jeder
     Seite gleich, links wie rechts, auch wenn die rechte Spalte fehlt (dann
     zum Aussenrand). Bis 2000px Viewport ist er 0, darueber waechst er linear
     (bei 3440px: 288px, plus 24px Grundabstand). Werte und Herleitung:
     .github/decision-records/content-width-layout-types.md */
  --tva-content-gap: clamp(0px, (100vw - 2000px) * 0.2, 340px);
  min-width: 0;
  min-height: calc(100vh - var(--tva-layout-header-height, 0px));
  display: grid;
  align-content: start;
  gap: var(--tva-shell-inset);
  padding: var(--tva-shell-inset);
  padding-inline: calc(var(--tva-shell-inset) + var(--tva-content-gap));
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 6px 18px rgba(53, 83, 108, 0.08);
  transition: opacity 160ms ease;
}

.tva-layout-shell__content > * {
  min-width: 0;
  max-width: 100%;
}

.tva-layout-shell__content > .tva-main-content-bleed {
  max-width: none;
  margin-inline: calc(-1 * (var(--tva-shell-inset) + var(--tva-content-gap)));
}

/* Inhaltsblock im Shell (Typ 2 und 3): fuellt die Spalte innerhalb des
   Abstands. Ohne diese Regel wuerde ein .tva-content-block mit Auto-Raendern
   im Grid nur so breit wie sein laengster Text. `:where()` haelt die
   Spezifitaet bei (0,1,0). Die Breite ergibt sich allein aus Spalte minus
   Abstand; eine Obergrenze je Typ gibt es im Shell nicht mehr. */
:where(.tva-layout-shell__content) > .tva-content-block {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
}

.tva-layout-shell__content > .tva-main-content-bleed:first-child {
  margin-top: calc(-1 * var(--tva-shell-inset));
}

.tva-layout-shell--partial-loading .tva-layout-shell__content {
  opacity: 0.55;
  pointer-events: none;
}

.tva-layout-shell__sidebar {
  min-width: 0;
}

.tva-layout-shell__sidebar--left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tva-layout-shell__resizer,
.tva-layout-shell__row-resizer {
  display: none;
}

.tva-layout-card {
  position: static;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 5px);
  box-shadow: 0 6px 18px rgba(53, 83, 108, 0.08);
  overflow: hidden;
}

.tva-layout-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent-soft) 65%, var(--card-bg));
}

/* Navigationskachel: Kopf mit zweizeiliger Ueberschrift (Bereichsname in
   Serife, Unterzeile) und dem Uebersicht-Chip darunter. */
.tva-layout-card--nav > .tva-layout-card__header {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 16px 14px;
}

.tva-layout-card__header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tva-layout-card__heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tva-layout-card__title {
  margin: 0;
  font-size: 0.98rem;
}

.tva-layout-card--nav .tva-layout-card__title {
  font-family: "Newsreader", serif;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.05;
}

.tva-layout-card__eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.tva-layout-card__overview-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  box-sizing: border-box;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  background: var(--card-bg);
  color: var(--accent-solid);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease-out;
}

/* Ohne Ziel (keine Uebersichtsseite) entfernt layout-shell.js das href;
   der Chip verschwindet dann statt als toter Text stehen zu bleiben. */
.tva-layout-card__overview-link:not([href]) {
  display: none;
}

.tva-layout-card__overview-link:hover {
  background: var(--accent-soft);
}

.tva-layout-card__overview-link:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: 2px;
}

.tva-layout-card__overview-link svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.tva-layout-card__overview-link-label {
  flex: 1 1 auto;
  min-width: 0;
}

.tva-layout-card__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill, 999px);
  background: var(--card-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

.tva-layout-card__toggle:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: 2px;
}

.tva-layout-card__favorites-toggle,
.tva-layout-card__nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease;
}

.tva-layout-card__favorites-toggle:hover,
.tva-layout-card__favorites-toggle:focus-visible,
.tva-layout-card__nav-toggle:hover,
.tva-layout-card__nav-toggle:focus-visible {
  background: var(--accent-soft);
}

.tva-layout-card__favorites-toggle:focus-visible,
.tva-layout-card__nav-toggle:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: 2px;
}

.tva-layout-card__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  color: var(--navy-soft);
  transition: transform 0.25s ease;
}

.tva-layout-card__chevron svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.tva-layout-card__favorites-toggle[aria-expanded="true"] .tva-layout-card__chevron,
.tva-layout-card__nav-toggle[aria-expanded="true"] .tva-layout-card__chevron {
  transform: rotate(180deg);
}

.tva-layout-card__body {
  padding: 12px 14px 14px;
}

.tva-layout-shell__sidebar--left .tva-layout-card__body,
.tva-layout-shell__sidebar--right .tva-layout-card__body {
  padding-inline: 0;
}

.tva-layout-shell__sidebar--left .tva-side-nav__empty,
.tva-layout-shell__sidebar--right .tva-toc-nav__empty {
  margin-inline: 14px;
}

/* Look & Feel der linken Navigationskachel (From Uiverse.io, Struktur an TVA angepasst) */
/* Struktur-Regeln (Layout/Groessen, theme-unabhaengig) */
.tva-layout-shell__sidebar--left .tva-layout-card {
  border: none;
}

.tva-layout-shell__sidebar--left .tva-layout-card__header {
  background: transparent;
}

.tva-layout-shell__sidebar--left .tva-layout-card__body {
  padding: 10px 8px 16px;
}

.tva-layout-shell__sidebar--left .tva-side-nav__empty {
  margin-inline: 6px;
}

/* Einklapp-Buttons der linken Kacheln als kleine, umrandete Schaltflaechen */
.tva-layout-shell__sidebar--left .tva-layout-card__favorites-toggle,
.tva-layout-shell__sidebar--left .tva-layout-card__nav-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 10px);
  background: var(--card-bg);
  color: var(--muted);
}

.tva-layout-shell__sidebar--left .tva-layout-card__favorites-toggle:hover,
.tva-layout-shell__sidebar--left .tva-layout-card__nav-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-solid);
}

/* Look & Feel der rechten Navigationskachel (gleiches Design wie links) */
.tva-layout-shell__sidebar--right .tva-layout-card {
  border: none;
}

.tva-layout-shell__sidebar--right .tva-layout-card__header {
  background: transparent;
}

.tva-layout-shell__sidebar--right .tva-layout-card__body {
  padding-inline: 10px;
}

.tva-layout-shell__sidebar--right .tva-toc-nav__empty {
  margin-inline: 4px;
}

.tva-side-nav__list,
.tva-toc-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.tva-toc-nav__list {
  gap: 8px;
}

.tva-side-nav__list {
  gap: 2px;
}

.tva-side-nav__item,
.tva-toc-nav__item {
  margin: 0;
}

/* Ein aufgeklappter Zweig wird zu einer eingesetzten Gruppe: Rahmen und leicht
   getoenter Hintergrund fassen Elternzeile und Kinder sichtbar zusammen. Eine
   tiefere Gruppe wird etwas kraeftiger getoent, damit die Ebenen ablesbar sind. */
.tva-side-nav__item--branch.is-open {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent-solid) 5%, transparent);
}

.tva-side-nav__list--nested .tva-side-nav__item--branch.is-open {
  background: color-mix(in srgb, var(--accent-solid) 8%, transparent);
}

.tva-side-nav__row {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-height: 38px;
  box-sizing: border-box;
  padding: 0 4px 0 2px;
  border-radius: 8px;
  transition: background-color 0.2s ease-out;
}

.tva-side-nav__row:hover,
.tva-side-nav__row:has(:focus-visible) {
  background-color: var(--accent-soft);
}

.tva-side-nav__link,
.tva-toc-nav__link {
  display: inline-block;
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--radius-sm, 4px);
  padding: 4px 6px;
}

.tva-side-nav__link {
  display: block;
  width: 100%;
  padding: 7px 4px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.2s ease-out;
}

.tva-side-nav__item--branch > .tva-side-nav__row > .tva-side-nav__link {
  font-weight: 600;
}

.tva-layout-shell__sidebar--right .tva-toc-nav__link {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  font-weight: 600;
  transition: color 0.25s ease-out, background-color 0.25s ease-out, transform 0.2s ease-out;
}

.tva-layout-shell__sidebar--right .tva-toc-nav__link:hover {
  transform: translate(1px, -1px);
}

.tva-layout-shell__sidebar--right .tva-toc-nav__link:active {
  transform: scale(0.99);
}

.tva-side-nav__row .tva-side-nav__link {
  flex: 1 1 auto;
  min-width: 0;
}

.tva-side-nav__link:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: -2px;
}

/* Der Aufklapp-Chevron steht links vor dem Label. Blattzeilen reservieren
   dieselbe Spalte als Leerraum, damit alle Labels einer Ebene buendig stehen. */
.tva-side-nav__toggle,
.tva-side-nav__lead {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
}

.tva-side-nav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-solid);
  font: inherit;
  cursor: pointer;
}

.tva-side-nav__toggle:hover {
  background: var(--accent-soft-strong);
}

.tva-side-nav__toggle:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: -2px;
}

.tva-side-nav__toggle-icon {
  display: inline-flex;
  width: 15px;
  height: 15px;
  line-height: 1;
}

.tva-side-nav__toggle-icon svg {
  width: 100%;
  height: 100%;
}

.tva-side-nav__toggle[aria-expanded="true"] .tva-side-nav__toggle-icon {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: no-preference) {
  .tva-side-nav__toggle-icon {
    transition: transform 0.2s ease-out;
  }
}

.tva-side-nav__count {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: var(--radius-pill, 999px);
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
}

.tva-side-nav__favorite-toggle {
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease-out;
}

.tva-side-nav__favorite-toggle.is-active,
.tva-side-nav__row:hover .tva-side-nav__favorite-toggle {
  color: var(--accent-solid);
}

.tva-side-nav__favorite-toggle:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: -2px;
}

@media (hover: hover) {
  .tva-side-nav__favorite-toggle:not(.is-active) {
    opacity: 0;
  }

  .tva-side-nav__row:hover .tva-side-nav__favorite-toggle,
  .tva-side-nav__favorite-toggle:focus-visible {
    opacity: 1;
  }
}

.tva-side-nav__drag-handle {
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  transition: color 0.2s ease-out;
}

.tva-side-nav__row:hover .tva-side-nav__drag-handle {
  color: var(--accent-solid);
}

.tva-side-nav__drag-handle:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: -2px;
}

.tva-side-nav__item.is-dragging {
  height: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.tva-side-nav__item.is-dragging .tva-side-nav__drag-handle {
  cursor: grabbing;
}

.tva-side-nav__list--draggable.tva-side-nav__list--dragging {
  cursor: grabbing;
}

.tva-side-nav__item--placeholder {
  pointer-events: none;
}

.tva-side-nav__row--ghost {
  opacity: 0.5;
  outline: 1.5px dashed var(--accent-solid);
  outline-offset: -1.5px;
  background-color: var(--accent-soft);
}

.tva-side-nav__list--nested {
  margin: 0 0 2px 14px;
}

.tva-side-nav__list--nested[hidden] {
  display: none;
}

.tva-side-nav__list--nested .tva-side-nav__link {
  font-size: 0.92rem;
}

.tva-side-nav__list--nested .tva-side-nav__list--nested .tva-side-nav__link {
  font-size: 0.9rem;
}

/* Aktive Seite: voll gefuellte Zeile in der Akzentfarbe des jeweiligen Themes
   (Navy auf hell, Hellblau auf dunkel); alle Bedienelemente der Zeile wechseln
   auf die Kontrastfarbe. */
.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]),
.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]):hover {
  background-color: var(--accent-solid);
}

.tva-side-nav__link[aria-current="page"] {
  font-weight: 600;
  color: var(--accent-contrast);
}

.tva-side-nav__link[aria-current="page"]:focus-visible {
  outline-color: var(--accent-contrast);
}

.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]) .tva-side-nav__toggle,
.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]) .tva-side-nav__favorite-toggle,
.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]) .tva-side-nav__drag-handle {
  color: var(--accent-contrast);
}

.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]) .tva-side-nav__toggle:hover {
  background: color-mix(in srgb, var(--accent-contrast) 14%, transparent);
}

.tva-side-nav__row:has(> .tva-side-nav__link[aria-current="page"]) .tva-side-nav__count {
  background: color-mix(in srgb, var(--accent-contrast) 14%, transparent);
  color: var(--accent-contrast);
}

.tva-layout-shell__sidebar--left .tva-side-nav__empty {
  color: var(--muted);
}

/* Dark-Mode Farbgebung der linken Kachel: nur die Kachel-Huelle ist theme-
   spezifisch, Zeilen und Bedienelemente nutzen die Theme-Tokens. */
[data-theme="dark"] .tva-layout-shell__sidebar--left .tva-layout-card {
  background-color: rgba(16, 29, 39, 1);
  background-image: linear-gradient(139deg, rgba(16, 29, 39, 1) 0%, rgba(16, 29, 39, 1) 40%, rgba(13, 24, 33, 1) 100%);
  box-shadow: 0 6px 18px rgba(6, 14, 20, 0.4);
}

[data-theme="dark"] .tva-layout-shell__sidebar--left .tva-layout-card__header {
  border-bottom: 1px solid var(--line);
}

[data-theme="dark"] .tva-layout-shell__sidebar--left .tva-layout-card__title {
  color: var(--ink);
}

[data-theme="dark"] .tva-layout-shell__sidebar--left .tva-layout-card__toggle {
  border-color: #2b3b4d;
  background: transparent;
  color: #7c93a6;
}

[data-theme="dark"] .tva-layout-shell__sidebar--left .tva-layout-card__toggle:hover {
  background: #4b6cb7;
  border-color: #4b6cb7;
  color: #ffffff;
}

[data-theme="dark"] .tva-layout-shell__sidebar--left .tva-layout-card__toggle:focus-visible {
  outline-color: #4b6cb7;
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-layout-card {
  background-color: rgba(16, 29, 39, 1);
  background-image: linear-gradient(139deg, rgba(16, 29, 39, 1) 0%, rgba(16, 29, 39, 1) 40%, rgba(13, 24, 33, 1) 100%);
  box-shadow: 0 6px 18px rgba(6, 14, 20, 0.4);
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-layout-card__header {
  border-bottom: 1.5px solid #2b3b4d;
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-layout-card__title {
  color: #ffffff;
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-layout-card__toggle {
  border-color: #2b3b4d;
  background: transparent;
  color: #7c93a6;
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-layout-card__toggle:hover {
  background: #4b6cb7;
  border-color: #4b6cb7;
  color: #ffffff;
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-layout-card__toggle:focus-visible {
  outline-color: #4b6cb7;
}

[data-theme="dark"] .tva-toc-nav__link {
  color: #7c93a6;
}

[data-theme="dark"] .tva-toc-nav__link:hover,
[data-theme="dark"] .tva-toc-nav__link:focus-visible {
  background-color: #4b6cb7;
  color: #ffffff;
}

[data-theme="dark"] .tva-toc-nav__link:focus-visible {
  outline: 2px solid #4b6cb7;
  outline-offset: -2px;
}

[data-theme="dark"] .tva-toc-nav__link[aria-current="location"] {
  background-color: rgba(75, 108, 183, 0.35);
  color: #ffffff;
  font-weight: 700;
}

[data-theme="dark"] .tva-layout-shell__sidebar--right .tva-toc-nav__empty {
  color: #7c93a6;
}

/* Hell-Mode Farbgebung der linken Kachel (Kachel-Huelle; Rest ueber Tokens) */
[data-theme="light"] .tva-layout-shell__sidebar--left .tva-layout-card {
  background-color: var(--card-bg);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(53, 83, 108, 0.08);
}

[data-theme="light"] .tva-layout-shell__sidebar--left .tva-layout-card__header {
  border-bottom: 1px solid var(--line);
}

[data-theme="light"] .tva-layout-shell__sidebar--left .tva-layout-card__title {
  color: var(--ink);
}

[data-theme="light"] .tva-layout-shell__sidebar--left .tva-layout-card__toggle {
  border-color: var(--line);
  background: var(--card-bg);
  color: var(--ink);
}

[data-theme="light"] .tva-layout-shell__sidebar--left .tva-layout-card__toggle:hover {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
  color: var(--accent-contrast);
}

[data-theme="light"] .tva-layout-shell__sidebar--left .tva-layout-card__toggle:focus-visible {
  outline-color: var(--accent-solid);
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-layout-card {
  background-color: var(--card-bg);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(53, 83, 108, 0.08);
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-layout-card__header {
  border-bottom: 1px solid var(--line);
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-layout-card__title {
  color: var(--ink);
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-layout-card__toggle {
  border-color: var(--line);
  background: var(--card-bg);
  color: var(--ink);
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-layout-card__toggle:hover {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
  color: var(--accent-contrast);
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-layout-card__toggle:focus-visible {
  outline-color: var(--accent-solid);
}

[data-theme="light"] .tva-toc-nav__link {
  color: var(--muted);
}

[data-theme="light"] .tva-toc-nav__link:hover,
[data-theme="light"] .tva-toc-nav__link:focus-visible {
  background-color: var(--accent-soft-strong);
  color: var(--accent-solid);
}

[data-theme="light"] .tva-toc-nav__link:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: -2px;
}

[data-theme="light"] .tva-toc-nav__link[aria-current="location"] {
  background-color: var(--accent-soft);
  color: var(--accent-solid);
  font-weight: 700;
}

[data-theme="light"] .tva-layout-shell__sidebar--right .tva-toc-nav__empty {
  color: var(--muted);
}

.tva-side-nav__empty,
.tva-toc-nav__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.tva-layout-shell__sidebar--left .tva-side-nav__empty {
  color: #7c93a6;
}

.tva-layout-shell__sidebar--left,
.tva-layout-shell__sidebar--right {
  margin-top: 0;
}

.tva-layout-shell__sidebar--left .tva-layout-card,
.tva-layout-shell__sidebar--right .tva-layout-card {
  position: static;
  top: auto;
}

/* Favourites and navigation tiles on the left have square corners; the
   table of contents on the right keeps its rounded tile. */
.tva-layout-shell__sidebar--left .tva-layout-card {
  border-radius: 0;
}

.tva-layout-shell__sidebar--right .tva-layout-card {
  border-radius: 10px;
}

.tva-layout-shell__sidebar--left {
  order: 1;
}

.tva-layout-shell__content {
  order: 2;
}

.tva-layout-shell__sidebar--right {
  order: 3;
}

@media (min-width: 1024px) {
  .tva-layout-shell {
    grid-template-columns:
      var(--tva-layout-left-width, 340px)
      10px
      minmax(0, 1fr)
      10px
      var(--tva-layout-right-width, 280px);
    column-gap: 0;
  }

  .tva-layout-shell__resizer {
    display: block;
    position: relative;
    align-self: stretch;
    cursor: col-resize;
    touch-action: none;
  }

  .tva-layout-shell__resizer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: var(--line);
    transition: background-color 0.15s ease, width 0.15s ease;
  }

  .tva-layout-shell__resizer:hover::before,
  .tva-layout-shell__resizer.is-dragging::before {
    width: 3px;
    background: var(--accent-solid);
  }

  .tva-layout-shell__resizer:focus-visible {
    outline: none;
  }

  .tva-layout-shell__resizer:focus-visible::before {
    width: 3px;
    background: var(--accent-solid);
  }

  .tva-layout-shell--resizing {
    cursor: col-resize;
    user-select: none;
  }

  .tva-layout-shell--resizing .tva-layout-shell__content {
    pointer-events: none;
  }

  .tva-layout-card {
    position: sticky;
    top: 12px;
  }

  .tva-layout-shell__sidebar--left,
  .tva-layout-shell__sidebar--right {
    position: sticky;
    top: var(--tva-layout-header-height, 0);
    z-index: 10;
  }

  /* Die Hoehe beider Sidebars kommt per Scroll-Handler aus JS
     (--tva-layout-sidebar-height) und schrumpft, sobald der Footer beim
     Scrollen sichtbar wird, damit keine der beiden Sidebars ihn ueberdeckt.
     Die linke Spalte verteilt diese Hoehe per Flexbox auf ihre beiden
     Kacheln: Favoriten wachsen bis zu einem Anteil mit dem Inhalt, die
     Navigationskachel fuellt den Rest und scrollt intern; "overflow: hidden"
     verhindert, dass die Favoritenkachel (die selbst nicht schrumpft) im
     Randfall trotzdem ueber den Footer hinausragt. Rechts hat die TOC-Kachel
     nur sich selbst und bekommt die Hoehe direkt. */
  .tva-layout-shell__sidebar--left {
    height: var(--tva-layout-sidebar-height, calc(100vh - var(--tva-layout-header-height, 0px)));
    overflow: hidden;
  }

  .tva-layout-shell__sidebar--right .tva-layout-card {
    height: var(--tva-layout-sidebar-height, calc(100vh - var(--tva-layout-header-height, 0px)));
  }

  /* Waechst mit dem Inhalt bis genau 6 Favoriten ohne Scrollbalken
     (Kopfzeile 47px + Body-Padding 26px + 6 * 36px Zeile + 5 * 8px Listenabstand
     = 329px, plus etwas Puffer); ab dem 7. Favoriten greift der interne Scroll. */
  .tva-layout-shell__sidebar--left .tva-layout-card--favorites {
    flex: 0 0 auto;
    /* The navigation tile below always keeps at least 160px. */
    max-height: min(var(--tva-layout-favorites-height, 333px), calc(100% - 160px));
  }

  /* Horizontal splitter between favourites and navigation (panel-resizers.js):
     it sets --tva-layout-favorites-height, the favourites' height limit. */
  .tva-layout-shell__row-resizer {
    display: block;
    position: relative;
    flex: 0 0 10px;
    cursor: row-resize;
    touch-action: none;
  }

  .tva-layout-shell__row-resizer::before {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: var(--line);
    transition: background-color 0.15s ease, height 0.15s ease;
  }

  .tva-layout-shell__row-resizer:hover::before,
  .tva-layout-shell__row-resizer.is-dragging::before,
  .tva-layout-shell__row-resizer:focus-visible::before {
    height: 3px;
    background: var(--accent-solid);
  }

  .tva-layout-shell__row-resizer:focus-visible {
    outline: none;
  }

  .tva-layout-shell--resizing-rows {
    cursor: row-resize;
    user-select: none;
  }

  .tva-layout-shell--resizing-rows .tva-layout-shell__content,
  .tva-layout-shell--resizing-rows .tva-layout-shell__sidebar--left .tva-layout-card {
    pointer-events: none;
  }

  .tva-layout-shell__sidebar--left .tva-layout-card--nav {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Kopfzeile (Titel/Toggle) bleibt beim Scrollen fest stehen: die Kachel
     wird intern in Kopf (fixe Groesse) und Body (scrollt) aufgeteilt, statt
     wie zuvor die ganze Kachel inklusive Titel zu scrollen. */
  .tva-layout-shell__sidebar--left .tva-layout-card--favorites,
  .tva-layout-shell__sidebar--left .tva-layout-card--nav,
  .tva-layout-shell__sidebar--right .tva-layout-card {
    display: flex;
    flex-direction: column;
  }

  .tva-layout-shell__sidebar--left .tva-layout-card--favorites > .tva-layout-card__header,
  .tva-layout-shell__sidebar--left .tva-layout-card--nav > .tva-layout-card__header,
  .tva-layout-shell__sidebar--right .tva-layout-card > .tva-layout-card__header {
    flex: 0 0 auto;
  }

  .tva-layout-shell__sidebar--left .tva-layout-card--favorites > .tva-layout-card__body,
  .tva-layout-shell__sidebar--left .tva-layout-card--nav > .tva-layout-card__body,
  .tva-layout-shell__sidebar--right .tva-layout-card > .tva-layout-card__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  /* Zusaetzlicher Scroll-Puffer, damit der letzte Eintrag nicht hinter dem
     fixierten Cookie-Einstellungen-Icon (unten links) verschwindet. */
  .tva-layout-shell__sidebar--left .tva-layout-card--nav .tva-side-nav {
    padding-bottom: 76px;
  }

  .tva-layout-card__toggle {
    display: none;
  }

  .tva-layout-shell__sidebar--left,
  .tva-layout-shell__content {
    order: initial;
  }

  .tva-layout-shell__sidebar--right {
    order: initial;
  }

  /* Weniger als PAGE_TOC_MIN_HEADINGS Ueberschriften: rechte TOC-Spalte und
     ihr Resizer sind per [hidden] ausgeblendet, daher hier auch die dafuer
     reservierten Grid-Spalten entfernen, sonst bleibt rechts eine Luecke. */
  .tva-layout-shell--no-toc {
    grid-template-columns:
      var(--tva-layout-left-width, 340px)
      10px
      minmax(0, 1fr);
  }
}
