/*
 * J1 Foundations & Shell: base styles, AppHeader/MobileHeader/MobileNav, AdminTabs, footer,
 * buttons, forms, notices, tables, auth layout. Colours, type and spacing only via the tokens
 * of tokens.css (no colour literals here). Shell breakpoint at 768px; the participant screens
 * of J2 add a content breakpoint at 1024px (category navigation, two-column video page); the
 * admin screens of J3 use the same two breakpoints (cards below 768px, two-column video form
 * from 1024px).
 */

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: var(--color-surface);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: var(--type-body-size);
    line-height: var(--type-body-line);
}

h1,
h2,
h3,
h4 {
    margin: 0 0 var(--space-4);
    font-family: var(--font-heading);
    color: var(--color-ink);
}

h1 {
    font-size: var(--type-h1-size);
    line-height: var(--type-h1-line);
    font-weight: 600;
}

h2 {
    margin-top: var(--space-8);
    font-size: var(--type-h2-size);
    line-height: var(--type-h2-line);
    font-weight: 600;
}

h3,
h4 {
    font-size: var(--type-h3-size);
    line-height: var(--type-h3-line);
    font-weight: 500;
}

p {
    margin: 0 0 var(--space-4);
}

a {
    color: var(--color-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--color-ink-muted);
}

:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

img,
svg {
    max-width: 100%;
}

/* The hidden attribute wins over display rules of components (e.g. the upload cancel button). */
[hidden] {
    display: none !important;
}

small,
.text-small {
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
}

.text-caption {
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
}

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

.eyebrow {
    margin: 0 0 var(--space-1);
    font-family: var(--font-heading);
    font-size: var(--type-eyebrow-size);
    line-height: var(--type-eyebrow-line);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-ink-muted);
}

/* Long words (e-mails, titles, file names) break instead of widening the page. */
main {
    overflow-wrap: break-word;
}

.email,
.title,
.name,
.video-title,
.category-name,
.wrap-anywhere {
    overflow-wrap: anywhere;
}

/* Hidden visually, still read by screen readers. */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ---------- Page container ---------- */

body > main {
    flex: 1 0 auto;
    width: 100%;
    max-width: calc(var(--container-width) + 2 * var(--space-8));
    margin: 0 auto;
    padding: var(--space-8) var(--space-8) var(--space-12);
}

/* ---------- AppHeader ---------- */

.site-header {
    border-bottom: 1px solid var(--color-line);
    background-color: var(--color-surface);
}

.site-header__inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--space-4) var(--space-8);
    max-width: calc(var(--container-width) + 2 * var(--space-8));
    min-height: var(--header-height);
    margin: 0 auto;
    padding: 0 var(--space-8);
}

.logo {
    display: inline-flex;
    flex: 0 0 auto;
}

.logo img {
    display: block;
    width: 176px;
    max-width: 100%;
    height: auto;
}

.site-nav {
    display: flex;
    align-self: stretch;
    gap: var(--space-6);
}

.site-nav__link {
    display: flex;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 2px solid transparent;
    font-family: var(--font-heading);
    font-size: var(--type-button-size);
    line-height: var(--type-button-line);
    font-weight: 500;
    color: var(--color-ink-muted);
    text-decoration: none;
}

.site-nav__link:hover {
    color: var(--color-ink);
}

.site-nav__link[aria-current="page"] {
    border-bottom-color: var(--color-ink);
    color: var(--color-ink);
}

.site-header__user {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-4);
    min-width: 0;
    margin-left: auto;
}

/* "Zugang bis …" of participants (008): small and muted, next to the e-mail on one line. */
.site-header__access {
    flex: 0 0 auto;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink-muted);
    white-space: nowrap;
}

/* A long e-mail wraps inside its own block, the header row stays on one line. */
.site-header__email {
    min-width: 0;
    text-align: right;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink-muted);
    overflow-wrap: anywhere;
}

.logout-form {
    flex: 0 0 auto;
    margin: 0;
}

/* "Abmelden": text button without border (design), still a 44px tap target. */
.logout-form button {
    min-height: 44px;
    padding: 0 var(--space-1);
    font-size: var(--type-field-size);
    line-height: var(--type-field-line);
    white-space: nowrap;
}

/* ---------- AdminTabs ---------- */

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-6);
}

.admin-tabs__tab {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--type-field-size);
    line-height: var(--type-field-line);
    font-weight: 500;
    color: var(--color-ink-muted);
    text-decoration: none;
}

/* Inactive tab: recognisably clickable (J3 R2). */
.admin-tabs__tab:hover {
    background-color: var(--color-surface-sand-soft);
    color: var(--color-ink);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.admin-tabs__tab:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.admin-tabs__tab[aria-current="page"] {
    background-color: var(--color-surface-sand-soft);
    color: var(--color-ink);
    text-decoration: none;
}

/* ---------- Footer ---------- */

.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--color-line);
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink-muted);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-6);
    max-width: calc(var(--container-width) + 2 * var(--space-8));
    margin: 0 auto;
    padding: var(--space-6) var(--space-8);
}

.site-footer__copy {
    margin: 0;
}

.site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
}

.site-footer__nav a {
    color: var(--color-ink-muted);
}

.site-footer__nav a:hover,
.site-footer__nav a[aria-current="page"] {
    color: var(--color-ink);
}

/* ---------- Buttons ---------- */

button,
input[type="submit"],
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-3) var(--space-6);
    border: 1px solid var(--color-action);
    border-radius: var(--radius-sm);
    background-color: var(--color-action);
    color: var(--color-on-action);
    font-family: var(--font-heading);
    font-size: var(--type-button-size);
    line-height: var(--type-button-line);
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
input[type="submit"]:hover,
.button:hover {
    border-color: var(--color-action-hover);
    background-color: var(--color-action-hover);
    color: var(--color-on-action);
}

button:focus-visible,
input[type="submit"]:focus-visible,
.button:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.button--secondary {
    border-color: var(--color-line-strong);
    background-color: var(--color-surface);
    color: var(--color-ink);
}

.button--secondary:hover {
    border-color: var(--color-ink);
    background-color: var(--color-surface-sand-soft);
    color: var(--color-ink);
}

.button--danger {
    border-color: var(--color-danger);
    background-color: var(--color-surface);
    color: var(--color-danger);
}

.button--danger:hover {
    border-color: var(--color-danger);
    background-color: var(--color-danger-soft);
    color: var(--color-danger);
}

.button--text {
    min-height: 0;
    padding: 0;
    border-color: transparent;
    background-color: transparent;
    color: var(--color-ink);
    text-decoration: underline;
}

.button--text:hover {
    border-color: transparent;
    background-color: transparent;
    color: var(--color-ink-muted);
}

.button--small {
    min-height: 36px;
    padding: var(--space-2) var(--space-4);
    font-size: var(--type-field-size);
    line-height: var(--type-field-line);
}

.button--block {
    width: 100%;
}

button[disabled],
input[type="submit"][disabled],
.button[aria-disabled="true"] {
    border-color: var(--color-line);
    background-color: var(--color-line);
    color: var(--color-ink-muted);
    cursor: not-allowed;
}

/* ---------- Forms ---------- */

form > div,
fieldset > div {
    margin-bottom: var(--space-4);
}

label,
legend {
    display: block;
    margin-bottom: var(--space-1);
    font-family: var(--font-heading);
    font-size: var(--type-field-size);
    line-height: var(--type-field-line);
    font-weight: 500;
}

input[type="checkbox"] + label,
input[type="radio"] + label {
    display: inline;
    margin-left: var(--space-2);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
select,
textarea {
    display: block;
    width: 100%;
    max-width: var(--form-width);
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: var(--type-body-size);
    line-height: var(--type-body-line);
}

input[type="file"] {
    min-height: 0;
    padding: var(--space-2);
}

textarea {
    max-width: calc(var(--form-width) * 1.5);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 0;
    border-color: var(--color-focus);
}

[aria-invalid="true"] {
    border-color: var(--color-danger) !important;
}

fieldset {
    margin: 0 0 var(--space-6);
    padding: var(--space-4);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    min-width: 0;
}

legend {
    padding: 0 var(--space-1);
}

.upload-hint,
.form-hint {
    margin: var(--space-1) 0 0;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink-muted);
}

/* ---------- Notices ---------- */

.notice,
.form-error,
.confirm-warning,
.player-message,
.player-error,
.upload-status,
.upload-error,
.upload-warning {
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-left: 4px solid var(--color-line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-sand-soft);
    color: var(--color-ink);
}

.notice--success,
.upload-status {
    border-left-color: var(--color-success);
    background-color: var(--color-success-soft);
}

.notice--warning,
.confirm-warning,
.upload-warning {
    border-left-color: var(--color-warning);
    background-color: var(--color-warning-soft);
}

.notice--error,
.form-error,
.player-error,
.upload-error,
.player-message[role="alert"] {
    border-left-color: var(--color-danger);
    background-color: var(--color-danger-soft);
}

.notice--sand {
    border-left: 0;
    background-color: var(--color-surface-sand);
}

.notice__label {
    color: var(--color-ink);
}

.notice__text {
    margin: 0;
}

.notice--success .notice__label {
    color: var(--color-success);
}

.notice--warning .notice__label {
    color: var(--color-warning);
}

.notice--error .notice__label {
    color: var(--color-danger);
}

/*
 * Empty live regions stay in the DOM and in the accessibility tree (never display:none or
 * visibility:hidden), they only lose their visible area.
 */
[role="status"]:empty,
[role="alert"]:empty,
[aria-live]:empty {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
}

th {
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-surface-sand-soft);
    font-family: var(--font-heading);
    font-size: var(--type-eyebrow-size);
    line-height: var(--type-eyebrow-line);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
    color: var(--color-ink-muted);
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-line);
    vertical-align: top;
}

/* E-mails/titles break between words in their cell and keep a readable width; very long ones make the table scroll. */
td.email,
td.title,
td.name {
    min-width: 28ch;
    overflow-wrap: break-word;
}

/* ---------- Player (H follow-up; portrait 9:16 since J3 rework 2) ---------- */

/*
 * Widest player box: the 9:16 width that belongs to the height limit (80% of the small viewport
 * height, at most 720px). Older browsers without svh use 80vh (fallback declaration first).
 */
:root {
    --player-max-width: calc(min(80vh, 720px) * 9 / 16);
    --player-max-width: calc(min(80svh, 720px) * 9 / 16);
}

main video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 9 / 16;
    background-color: var(--color-player);
}

/* ---------- Video thumbnail (003) ---------- */

.video-thumb {
    position: relative;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    /* The placeholder sizes play symbol and logo after the frame width (container query). */
    container: video-thumb / inline-size;
}

/* Placeholder (rework 2, design/human-videocard-9x16-logo.png): play symbol in the middle, logo below. */
.video-thumb--placeholder {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    justify-items: center;
    background-color: var(--color-surface-sand);
}

.video-thumb--placeholder .video-thumb__play {
    grid-row: 2;
}

.video-thumb__logo {
    grid-row: 3;
    align-self: start;
    width: 58%;
    height: auto;
    margin-top: 12%;
}

/* Frames below about 120px width (admin list, small columns): play symbol only. */
@container video-thumb (max-width: 119.98px) {
    .video-thumb__logo {
        display: none;
    }
}

.video-thumb__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumb__play {
    width: 48px;
    height: 48px;
    width: clamp(28px, 24cqi, 72px);
    height: auto;
    aspect-ratio: 1;
}

.video-thumb__badge {
    position: absolute;
    right: var(--space-2);
    bottom: var(--space-2);
    padding: 2px 6px;
    background-color: var(--color-player);
    color: var(--color-on-player);
    font-family: var(--font-heading);
    font-size: var(--type-badge-size);
    line-height: var(--type-badge-line);
    font-weight: 500;
}

/* ---------- Auth layout (W01) ---------- */

.auth {
    display: grid;
    flex: 1 0 auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth__panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-12);
    padding: var(--space-12);
    background-color: var(--color-surface-sand);
}

.auth__claim {
    display: flex;
    flex-direction: column;
    margin: 0;
    font-family: var(--font-heading);
}

.auth__claim-brand {
    font-size: 40px;
    line-height: 48px;
    font-weight: 300;
    font-style: italic;
}

.auth__claim-product {
    font-size: 40px;
    line-height: 48px;
    font-weight: 600;
}

.auth__claim-text {
    margin-top: var(--space-4);
    font-family: var(--font-body);
    font-size: var(--type-body-size);
    line-height: var(--type-body-line);
    color: var(--color-ink-muted);
}

.auth__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: calc(var(--form-width) + 2 * var(--space-12));
    padding: var(--space-12);
}

.auth__lead {
    color: var(--color-ink-muted);
}

.auth__form {
    margin-top: var(--space-6);
}

.auth__form input:not([type="hidden"]) {
    max-width: none;
}

.auth__hint {
    margin-top: var(--space-6);
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink-muted);
}

/* ---------- Participant screens (J2) ---------- */

/* Back links ("Kategorie", "Alle Videos") with an arrow */
.back-link {
    margin: 0 0 var(--space-6);
    font-family: var(--font-heading);
    font-size: var(--type-button-size);
    line-height: var(--type-button-line);
    font-weight: 500;
}

.back-link a {
    display: inline-flex;
    gap: var(--space-2);
    align-items: center;
    max-width: 100%;
    min-height: 44px;
    text-decoration: none;
}

/* Long category names without break points wrap instead of widening the page. */
.back-link__text {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (hover: hover) {
    .back-link a:hover {
        text-decoration: underline;
    }
}

/* VideoCard: one link around image, eyebrow and title. */
.video-card {
    display: block;
    color: var(--color-ink);
    text-decoration: none;
}

.video-card:hover {
    color: var(--color-ink);
}

.video-card:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 4px;
}

.video-card__category {
    display: block;
    margin: var(--space-3) 0 var(--space-1);
}

.video-card__title {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--type-h3-size);
    line-height: var(--type-h3-line);
    font-weight: 500;
    overflow-wrap: anywhere;
}

@media (hover: hover) {
    .video-card:hover .video-card__title {
        text-decoration: underline;
        text-underline-offset: 2px;
    }
}

/* Subtle hover/focus cue: image zooms in slightly, play button grows (only on a card link). */
.video-card .video-thumb__image,
.video-card .video-thumb__play {
    transition: transform 200ms ease, filter 200ms ease;
}

@media (hover: hover) {
    .video-card:hover .video-thumb__image {
        transform: scale(1.03);
        filter: brightness(0.94);
    }

    .video-card:hover .video-thumb__play {
        transform: scale(1.08);
    }

    .video-card:hover .video-thumb--placeholder {
        filter: brightness(0.96);
    }
}

.video-card .video-thumb--placeholder {
    transition: filter 200ms ease;
}

.video-card:focus-visible .video-thumb__play {
    transform: scale(1.08);
}

@media (prefers-reduced-motion: reduce) {
    .video-card .video-thumb__image,
    .video-card .video-thumb__play {
        transition: none;
    }

    .video-card:hover .video-thumb__image,
    .video-card:hover .video-thumb__play,
    .video-card:focus-visible .video-thumb__play {
        transform: none;
    }
}

.card-grid,
.related-videos__list,
.category-nav__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.card-grid {
    display: grid;
    gap: var(--space-8) var(--space-6);
}

.card-grid > li {
    min-width: 0;
}

/* Category page (W11) */
.category-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-12);
}

.category-page__title {
    margin-bottom: var(--space-2);
}

.category-page__description {
    max-width: 70ch;
    color: var(--color-ink-muted);
}

.category-page .videos {
    margin-top: var(--space-6);
}

/* "Kategorien" (mobile, 008): opens the category list as a bottom sheet. */
.category-sheet-button {
    margin-top: var(--space-4);
}

.category-sheet-button__icon {
    flex: 0 0 auto;
    display: block;
}

.category-sheet__list {
    margin: 0 calc(-1 * var(--space-6)) var(--space-6);
}

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

.category-nav {
    align-self: start;
    padding: var(--space-4) 0;
    background-color: var(--color-surface-sand);
}

.category-nav__label {
    margin-bottom: var(--space-2);
    padding: 0 var(--space-4);
}

.category-nav__link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 44px;
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid transparent;
    font-family: var(--font-heading);
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink);
    text-decoration: none;
}

@media (hover: hover) {
    .category-nav__link:hover {
        background-color: var(--color-surface-sand-soft);
        color: var(--color-ink);
    }
}

.category-nav__link:focus-visible {
    outline-offset: -2px;
}

.category-nav__link[aria-current="page"] {
    border-left-color: var(--color-ink);
    background-color: var(--color-surface-sand-soft);
    font-weight: 500;
}

.category-nav__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.category-nav__count {
    flex: 0 0 auto;
    font-family: var(--font-body);
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    color: var(--color-ink-muted);
}

@media (min-width: 768px) {
    .category-page {
        grid-template-areas: "nav content";
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .category-page__content {
        grid-area: content;
        min-width: 0;
    }

    .category-nav {
        grid-area: nav;
    }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .category-page {
        grid-template-columns: 288px minmax(0, 1fr);
        gap: var(--space-8);
    }

    .card-grid {
        gap: var(--space-8);
    }
}

/* Video page (W12/M12) */
.video-page__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 var(--space-6);
    margin-bottom: var(--space-4);
}

.video-page__nav .back-link {
    margin: 0;
}

/* Back link as a sand badge (video page). */
.back-link__icon {
    flex: 0 0 auto;
    display: block;
}

.back-link--badge a {
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
    background-color: var(--color-surface-sand);
    border-radius: var(--radius-full);
    color: var(--color-ink);
}

@media (hover: hover) {
    .back-link--badge a:hover {
        text-decoration: none;
        background-color: var(--color-surface-sand-soft);
    }
}

.back-link--badge a:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/*
 * Rework 3: one grid, the parts are placed with grid areas. Below 768px everything stacks:
 * navigation, player, title, description, "Nächstes Video" (2026-11-25: the player comes before the
 * title on screen only; the DOM order stays navigation, title, player, description).
 */
.video-page__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "nav"
        "player"
        "head"
        "desc"
        "related";
    align-items: start;
}

.video-page__nav {
    grid-area: nav;
}

.video-page__head {
    grid-area: head;
    min-width: 0;
}

.video-page .player {
    grid-area: player;
    min-width: 0;
}

.video-page__description {
    grid-area: desc;
    min-width: 0;
    margin: var(--space-6) 0 0;
}

.video-page .related-videos {
    grid-area: related;
    min-width: 0;
    margin-top: var(--space-12);
}

.video-page__title {
    margin: 0 0 var(--space-6);
    overflow-wrap: anywhere;
}

/* "Video noch nicht verfügbar" / signing failed: only the notice below 768px. */
.player__placeholder .player-message {
    margin: 0;
}

.video-description {
    max-width: 75ch;
}

.video-player__frame {
    /* 9:16 box (rework 2): full width up to the height limit, centred, black as before. */
    width: 100%;
    max-width: var(--player-max-width);
    margin-inline: auto;
    background-color: var(--color-player);
}

.video-player .player-error {
    margin-top: var(--space-3);
}

/* Error state: a black 9:16 area (same box as the video) instead of it, no spinner, no speed choice. */
.video-player--failed .video-player__frame {
    aspect-ratio: 9 / 16;
}

.video-player--failed video {
    display: none;
}

/*
 * "Nächste Kategorie": the card of the first video of the next category is black, with
 * "Neue Kategorie" and the category name in white instead of image/logo (_video_thumb, category_intro).
 */
.video-thumb--category {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-content: safe center;
    gap: var(--space-2);
    padding: var(--space-4);
    background-color: var(--color-ink);
    color: var(--color-surface);
    text-align: center;
}

.video-thumb__intro-eyebrow {
    font-family: var(--font-heading);
    font-size: var(--type-eyebrow-size);
    line-height: var(--type-eyebrow-line);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-on-player-muted);
}

/* A very long name (up to 100 characters) is cut after four lines instead of overflowing the card. */
.video-thumb__intro-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    font-family: var(--font-heading);
    font-size: var(--type-h2-size);
    line-height: var(--type-h2-line);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.video-thumb--category .video-thumb__play {
    margin-top: var(--space-4);
}

/* The black logo PNG turned white on the black category card. */
.video-thumb--category .video-thumb__logo--inverted {
    align-self: center;
    width: 58%;
    margin-top: var(--space-4);
    filter: invert(1);
}

.related-videos__heading {
    margin: 0 0 var(--space-4);
}

.related-videos__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-8) var(--space-6);
}

.related-videos__list > li {
    min-width: 0;
}

/*
 * 768-1199px (rework 3, 2-column fallback): navigation and title across the full width, below them
 * the portrait player column (as wide as the player box) with the description under the player, and
 * "Nächstes Video" beside it in columns of at least 160px. Visual order = DOM order.
 * The notice without a file (or after a failed signing) sits in a sand 9:16 frame of the player's
 * size, so the page keeps the same shape with and without a file.
 */
@media (min-width: 768px) {
    .video-page__layout {
        grid-template-columns: minmax(0, var(--player-max-width)) minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr;
        grid-template-areas:
            "nav    nav"
            "head   head"
            "player related"
            "desc   related";
        column-gap: var(--space-8);
    }

    .video-page .related-videos {
        margin-top: 0;
    }

    .related-videos__list {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .player__placeholder {
        display: grid;
        align-content: center;
        aspect-ratio: 9 / 16;
        width: 100%;
        max-width: var(--player-max-width);
        padding: var(--space-6);
        border-radius: var(--radius-sm);
        background-color: var(--color-surface-sand);
    }
}

/*
 * From 1200px (rework 3, human feedback): three columns. Left: navigation, title, description;
 * middle: the 9:16 player (or the 9:16 notice frame); right: "Nächstes Video" with 2 columns of
 * cards of at least 200px (about 220px at 1200px, 240px at 1400px; the container stops at 1200px).
 * Below 1200px the left column (< 230px) or the cards (< 200px) would get too narrow, hence the
 * 2-column fallback above.
 */
@media (min-width: 1200px) {
    .video-page__layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, var(--player-max-width)) minmax(0, 1.4fr);
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "nav  player related"
            "head player related"
            "desc player related";
        column-gap: var(--space-6);
    }

    .video-page__description {
        margin-top: 0;
    }

    /* More air between player and "Nächstes Video" (about the width of "Abmelden"). */
    .video-page .related-videos {
        padding-left: clamp(var(--space-12), 20vw - 40px, 200px);
    }

    .related-videos__list {
        /* Cards stay ~220px wide even with only one video (no stretching). */
        grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
        column-gap: var(--space-4);
    }
}

/* "Video nicht verfügbar" (denied): navigation and the message only, full width. */
.video-page__layout.video-page__layout--denied {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
        "nav"
        "head";
}

/* ---------- Mobile (< 768px) ---------- */

@media (max-width: 767.98px) {
    body > main {
        padding: var(--space-6) var(--space-6) var(--space-8);
    }

    h1 {
        font-size: 26px;
        line-height: 34px;
    }

    .site-header__inner {
        flex-wrap: wrap;
        gap: 0 var(--space-4);
        min-height: 0;
        padding: var(--space-3) var(--space-6);
    }

    .logo img {
        width: 150px;
    }

    /* MobileHeader: logo + "Abmelden", no e-mail (no UserCard on mobile). */
    .site-header__email {
        display: none;
    }

    /* 008: the user block dissolves into the header row, so "Zugang bis …" can take its own
       full-width row below logo + "Abmelden" (no room next to them at 390px). */
    .site-header__user {
        display: contents;
    }

    .site-header__user .logout-form {
        margin-left: auto;
    }

    .site-header__access {
        order: 4;
        flex: 1 0 100%;
        padding-bottom: var(--space-1);
        text-align: left;
    }

    /* MobileNav: a row below the header with two equal tabs, admins only. */
    .site-nav {
        order: 3;
        flex: 1 0 100%;
        gap: 0;
        margin: var(--space-3) calc(-1 * var(--space-6)) calc(-1 * var(--space-3));
        border-top: 1px solid var(--color-line);
    }

    .site-nav--single {
        display: none;
    }

    .site-nav__link {
        flex: 1 1 0;
        justify-content: center;
        padding: var(--space-3) 0;
    }

    .site-footer__inner {
        justify-content: center;
        padding: var(--space-6);
        text-align: center;
    }

    .site-footer__nav {
        justify-content: center;
    }

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

    .auth__panel {
        gap: var(--space-6);
        padding: var(--space-6);
    }

    .auth__claim-brand,
    .auth__claim-product {
        font-size: 28px;
        line-height: 34px;
    }

    .auth__content {
        max-width: none;
        padding: var(--space-8) var(--space-6);
    }

    /* Category page (A5): one column; without JS the navigation follows the cards, with JS the
       "Kategorien" button opens it as a bottom sheet (008). */
    .category-page {
        gap: var(--space-8);
    }

    /* Portrait cards (rework 2): two per row, one full-width card would be a screen high. */
    .card-grid,
    .related-videos__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-6) var(--space-4);
    }

    .video-page .related-videos {
        margin-top: var(--space-8);
    }
}


/* ---------- Admin screens (J3) ---------- */

/* Page head: H1 + sub line left, actions right (W20); below 768px the primary button spans the width. */
.admin-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4) var(--space-8);
    margin-bottom: var(--space-8);
}

.admin-head__text {
    min-width: 0;
}

.admin-head__text h1 {
    margin-bottom: var(--space-2);
    overflow-wrap: anywhere;
}

.admin-head__sub {
    margin: 0;
    color: var(--color-ink-muted);
}

.admin-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-6);
}

.admin-page > h1 {
    margin-bottom: var(--space-6);
    overflow-wrap: anywhere;
}

.admin-page .back-link {
    margin-bottom: var(--space-6);
}

.admin-lead,
.admin-note {
    max-width: 70ch;
}

/*
 * Notice with a caps label ("ERLEDIGT", "FEHLER", "HINWEIS"): flat, square area in the -soft tone
 * without the left bar, label in the tone colour (J5, WEB.docx image15). Unlabelled legacy
 * notices (.form-error, .upload-*, .player-*, .confirm-warning) keep their bar.
 */
.notice--labelled {
    border-left: 0;
    border-radius: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
}

.notice--labelled .notice__label,
.upload-notice .notice__label {
    flex: 0 0 auto;
    font-family: var(--font-heading);
    font-size: var(--type-eyebrow-size);
    line-height: var(--type-eyebrow-line);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.notice--labelled .notice__text {
    flex: 1 1 240px;
    min-width: 0;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    overflow-wrap: anywhere;
}

.admin-form-notice {
    max-width: 640px;
}

/* Invite pages: the error notice is as wide as the fields, with room below (W21b, rework 1). */
.admin-form-notice--invite {
    max-width: 560px;
    margin-bottom: var(--space-8);
}

/* Status pill: outline in the tone, dot before the text (W20). */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px var(--space-2);
    border: 1px solid currentColor;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: var(--type-badge-size);
    line-height: var(--type-badge-line);
    font-weight: 500;
    white-space: nowrap;
}

.status-pill__dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: currentColor;
}

.status-pill--neutral {
    color: var(--color-ink);
}

.status-pill--info {
    color: var(--color-success);
}

.status-pill--warning {
    color: var(--color-warning);
}

.status-pill--danger {
    color: var(--color-danger);
}

/* "Archiviert": circle outline, neutral tone. */
.status-pill--archived {
    border-color: var(--color-line-strong);
    color: var(--color-ink-muted);
}

.status-pill--archived .status-pill__dot {
    border: 1px solid currentColor;
    background-color: transparent;
}

.invite-status {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    color: var(--color-ink-muted);
}

.invite-status > span {
    display: block;
}

.invite-status .invite-expired {
    color: var(--color-warning);
}

/* Buttons of a row or card. */
.action-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2) var(--space-3);
}

.action-group__form {
    display: contents;
}

.admin-page .button--text {
    min-height: 44px;
    padding: 0 var(--space-2);
    text-decoration: none;
}

.admin-page .button--text:hover {
    text-decoration: underline;
}

.expired-hint {
    margin: var(--space-2) 0 0;
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    color: var(--color-ink-muted);
    text-align: right;
}

/* User and admin list: table with a frame (W20). */
.admin-table {
    border: 1px solid var(--color-line);
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
}

.admin-table th {
    padding: var(--space-4);
}

.admin-table td {
    padding: var(--space-3) var(--space-4);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-table td.email {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-table__email {
    width: 32%;
}

.admin-table__access {
    color: var(--color-ink-muted);
}

.admin-table__actions {
    text-align: right;
}

/* Category and video list: ordered list with dividers (web-image13/14). */
.admin-list {
    margin: 0 0 var(--space-8);
    padding: 0;
    border-top: 1px solid var(--color-line);
    list-style: none;
}

.admin-list__item {
    display: flex;
    align-items: center;
    gap: var(--space-4) var(--space-6);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-line);
}

.admin-list__main {
    flex: 1 1 auto;
    min-width: 0;
}

.admin-list__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--type-h3-size);
    line-height: var(--type-h3-line);
    font-weight: 500;
    /* German compounds break with a hyphen (lang="de"); "anywhere" stays the fallback for overlong words (R3). */
    hyphens: auto;
    -webkit-hyphens: auto;
    overflow-wrap: anywhere;
}

.admin-list__meta {
    margin: 0;
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    color: var(--color-ink-muted);
}

.admin-list__meta a {
    color: var(--color-ink);
}

.admin-list__main .status-pill {
    margin-top: var(--space-1);
}

.admin-list__actions {
    flex: 0 0 auto;
}

/* Sort arrows: icon buttons, an invisible placeholder where a row cannot move (A11). */
.sort-arrows {
    display: flex;
    flex: 0 0 auto;
    gap: var(--space-2);
}

.sort-arrows__form {
    margin: 0;
}

.icon-button,
.icon-button-placeholder {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.icon-button {
    min-height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--color-ink);
}

.icon-button:hover {
    border-color: var(--color-line);
    background-color: var(--color-surface-sand-soft);
    color: var(--color-ink);
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

/* Video rows: narrow 9:16 thumbnail (rework 2); the placeholder shows the play symbol only. */
.video-row__thumb {
    flex: 0 0 80px;
}

.archived-videos__heading {
    margin: var(--space-8) 0 var(--space-4);
}

/* Empty video list (W24). */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-6);
    background-color: var(--color-surface-sand-soft);
    text-align: center;
}

.empty-state__title {
    margin: 0;
    font-size: var(--type-h3-size);
    line-height: var(--type-h3-line);
    font-weight: 500;
}

.empty-state__text {
    margin: 0;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    color: var(--color-ink-muted);
}

/* Forms of the admin pages: one column, limited width (W21/W22). */
.admin-form {
    max-width: 560px;
}

.admin-form--wide {
    max-width: 640px;
}

.admin-form .field {
    margin-bottom: var(--space-6);
}

.admin-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="file"]),
.admin-form select,
.admin-form textarea {
    max-width: none;
}

.admin-form .form-hint {
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
}

.form-hint--error {
    color: var(--color-danger);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--space-4);
}

.field--muted label,
.field--muted input {
    color: var(--color-ink-muted);
}

/* Number field with a visible unit ("2 Monate", A4). */
.input-unit {
    position: relative;
}

.admin-form .input-unit input {
    padding-right: 6em;
}

.input-unit__label {
    position: absolute;
    top: 50%;
    right: var(--space-8);
    transform: translateY(-50%);
    color: var(--color-ink-muted);
    pointer-events: none;
}

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

.save-reason {
    flex: 1 1 100%;
    margin: 0;
}

/* "Nutzer bearbeiten": sections divided by lines (W22). */
.admin-head--narrow {
    max-width: 720px;
    margin-bottom: 0;
}

.admin-sections {
    max-width: 720px;
}

.admin-section {
    margin-top: var(--space-8);
    padding-top: var(--space-8);
    border-top: 1px solid var(--color-line);
}

.admin-section h2 {
    margin: 0 0 var(--space-3);
}

.admin-section__text {
    color: var(--color-ink-muted);
    overflow-wrap: anywhere;
}

.admin-section .admin-form {
    max-width: none;
}

.admin-section .notice--labelled {
    margin-bottom: var(--space-4);
}

.extend-form {
    margin-top: var(--space-6);
}

.extend-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.extend-form__row .input-unit {
    flex: 0 1 220px;
}

/* Confirmation pages (R6). */
.confirm-page {
    max-width: 640px;
}

.confirm-page h1 {
    overflow-wrap: anywhere;
}

/* "Video bearbeiten" / "Video hochladen": form + side column from 1024px (W27, W24b). */
.video-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-12);
}

.video-form-layout__main {
    min-width: 0;
}

.side-section + .side-section {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-line);
}

.side-section h2 {
    margin: 0 0 var(--space-3);
}

.side-section .side-section__eyebrow {
    margin-bottom: var(--space-4);
}

.side-section__text {
    color: var(--color-ink-muted);
}

.video-preview {
    max-width: 240px;
    margin-bottom: var(--space-4);
}

@media (min-width: 1024px) {
    .video-form-layout {
        grid-template-columns: minmax(0, 640px) minmax(0, 1fr);
    }
}

/* File field: dashed sand area with the "Datei wählen" button and the state (W24b). */
.video-file-field {
    margin-bottom: var(--space-6);
}

.file-drop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-4);
    border: 1px dashed var(--color-line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-sand-soft);
}

.file-drop__state {
    flex: 1 1 200px;
    min-width: 0;
    margin: 0;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    overflow-wrap: anywhere;
}

.file-picker {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    min-width: 0;
}

/* With JavaScript the native input is hidden visually; it stays focusable and the label is the button. */
.file-picker.is-enhanced .file-picker__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-picker__button {
    margin: 0;
    cursor: pointer;
}

.file-picker.is-enhanced .file-picker__input:focus-visible + .file-picker__button {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.file-picker__name {
    min-width: 0;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
    overflow-wrap: anywhere;
}

.file-picker__name:empty {
    display: none;
}

/* Upload panel (W24b) and error panel (W25). */
.upload-panel {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background-color: var(--color-surface-sand-soft);
}

.upload-panel__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
}

.upload-panel__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.upload-panel__bar {
    display: block;
    width: 100%;
    height: 6px;
    margin: var(--space-3) 0;
    border: 0;
    border-radius: var(--radius-full);
    background-color: var(--color-line);
    -webkit-appearance: none;
    appearance: none;
}

.upload-panel__bar::-webkit-progress-bar {
    border-radius: var(--radius-full);
    background-color: var(--color-line);
}

.upload-panel__bar::-webkit-progress-value {
    border-radius: var(--radius-full);
    background-color: var(--color-ink);
}

.upload-panel__bar::-moz-progress-bar {
    border-radius: var(--radius-full);
    background-color: var(--color-ink);
}

.upload-panel__meta {
    margin: 0 0 var(--space-2);
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    color: var(--color-ink-muted);
}

.upload-error-panel.is-visible {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background-color: var(--color-danger-soft);
}

.upload-error-panel__state {
    color: var(--color-danger);
}

.upload-error-panel__message {
    margin: var(--space-2) 0 0;
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    overflow-wrap: anywhere;
}

.upload-error-panel__message:empty {
    margin: 0;
}

.upload-retry {
    margin-top: var(--space-3);
}

/* Size warning as HINWEIS notice; the live region stays in the DOM when empty. */
.upload-notice .notice__label {
    display: none;
    color: var(--color-warning);
}

.upload-notice.is-visible {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-left: 0;
    border-radius: 0;
    background-color: var(--color-warning-soft);
}

.upload-notice.is-visible .notice__label {
    display: block;
}

.upload-warning-text {
    flex: 1 1 240px;
    margin: 0;
    font-size: var(--type-small-size);
    line-height: var(--type-small-line);
}

/* "Vorschaubild (optional)": 9:16 field left (rework 2), buttons right (W27). */
.video-thumbnail {
    padding: 0;
    border: 0;
}

.video-thumbnail legend {
    padding: 0;
}

.thumbnail-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

.thumbnail-current {
    flex: 0 0 96px;
    width: 96px;
    aspect-ratio: 9 / 16;
}

.thumbnail-current__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-current__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 1px dashed var(--color-line-strong);
    background-color: var(--color-surface-sand);
    padding: var(--space-1);
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line);
    color: var(--color-ink-muted);
    text-align: center;
}

.thumbnail-controls {
    flex: 1 1 200px;
    min-width: 0;
}

.thumbnail-unavailable {
    margin: 0 0 var(--space-2);
}

.thumbnail-remove {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.thumbnail-remove input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--color-ink);
}

.thumbnail-remove label {
    margin: 0 0 0 var(--space-2);
    font-size: var(--type-button-size);
    line-height: var(--type-button-line);
    cursor: pointer;
}

/* ---------- Below 768px: admin cards (M5, M7, M8), participant video page (J2 N3) ---------- */

@media (max-width: 767.98px) {
    /* Back link of the participant video page: same space below as on the category page. */
    .video-page__nav {
        margin-bottom: var(--space-6);
    }

    .hide-mobile,
    .admin-head__sub-extra {
        display: none;
    }

    .admin-head {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: var(--space-6);
    }

    .admin-head__actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .admin-head__primary {
        width: 100%;
    }

    .admin-head .button--text {
        align-self: flex-start;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .button {
        width: 100%;
    }

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

    /* Table → one card per row; the roles in the markup keep the table semantics (A5). */
    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table {
        border: 0;
    }

    .admin-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .admin-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-2) var(--space-3);
        margin-bottom: var(--space-4);
        padding: var(--space-6);
        border: 1px solid var(--color-line);
    }

    .admin-table td {
        width: auto;
        padding: 0;
        border: 0;
    }

    .admin-table td.admin-table__email {
        flex: 1 1 100%;
        margin-bottom: var(--space-2);
        font-family: var(--font-heading);
        font-size: var(--type-h3-size);
        line-height: var(--type-h3-line);
        font-weight: 500;
    }

    .admin-table td.admin-table__actions {
        flex: 1 1 100%;
        margin-top: var(--space-3);
        text-align: left;
    }

    .admin-table .action-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        /* Both buttons of a row get the same height when one label wraps (rework 1, U3). */
        align-items: stretch;
    }

    .admin-table .action-group .button {
        width: 100%;
    }

    .expired-hint {
        text-align: left;
    }

    /* Category and video cards. */
    .admin-list {
        border-top: 0;
    }

    .admin-list__item {
        display: grid;
        grid-template-areas:
            "main main"
            "arrows actions";
        grid-template-columns: auto minmax(0, 1fr);
        gap: var(--space-4);
        margin-bottom: var(--space-4);
        padding: var(--space-6);
        border: 1px solid var(--color-line);
    }

    .admin-list__main {
        grid-area: main;
    }

    .sort-arrows {
        grid-area: arrows;
        align-self: center;
    }

    .admin-list__actions {
        grid-area: actions;
        justify-content: flex-end;
    }

    .icon-button {
        border-color: var(--color-line);
    }

    .video-row {
        grid-template-areas:
            "thumb main"
            "arrows actions";
        /* Narrow thumbnail like mobile-image8, more room for the title (rework 1, U2). */
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .video-row__thumb {
        grid-area: thumb;
        align-self: start;
    }

    .upload-panel__head {
        flex-direction: column;
    }
}

/* A hook class on the text of a labelled notice does not style it a second time. */
.notice .form-error {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

/* Category row: "Umbenennen" and "Löschen" as one group (desktop in line, mobile own row). */
.admin-list__more {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

/* User and admin table: dates on one line, compact buttons (W20). */
@media (min-width: 768px) {
    .admin-table__access {
        white-space: nowrap;
    }

    /* Labels never wrap inside a button (rework 1, U3); the buttons themselves may still stack. */
    .admin-table .action-group .button {
        padding: var(--space-2) var(--space-4);
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    .category-list .admin-list__item {
        grid-template-areas:
            "main main"
            "arrows videos"
            "more more";
    }

    .category-list .admin-list__actions {
        display: contents;
    }

    .category-list .videos-link {
        grid-area: videos;
        justify-self: end;
    }

    .category-list .admin-list__more {
        grid-area: more;
        justify-content: flex-end;
    }

    .admin-table .action-group .button,
    .video-row .admin-list__actions .button {
        padding: var(--space-2) var(--space-3);
    }
}

/* Very narrow screens (320px): cards a little tighter. */
@media (max-width: 359.98px) {
    .admin-list__item,
    .admin-table tbody tr {
        padding: var(--space-4);
    }

    /* "Umbenennen" and "Löschen" stay on one line (rework 1, U4). */
    .category-list .admin-list__more {
        gap: var(--space-2);
    }

    .category-list .admin-list__more .button {
        padding-inline: var(--space-3);
    }
}


/* ---------- Dialogs (J4): ConfirmDialog, FormDialog, ActionSheet on one <dialog> ---------- */

/* No background scrolling while a dialog is open. */
html.has-open-dialog {
    overflow: hidden;
}

/* Fragment wrapper of the pages "Kategorie anlegen/bearbeiten": same spacing as before. */
.form-page > h1 {
    margin-bottom: var(--space-6);
    overflow-wrap: anywhere;
}

.dialog {
    width: calc(100% - 2 * var(--space-4));
    max-width: 480px;
    max-height: calc(100dvh - 2 * var(--space-4));
    overflow-y: auto;
    padding: var(--space-6);
    border: 0;
    border-radius: var(--radius-none);
    background-color: var(--color-surface);
    color: var(--color-ink);
    box-shadow: 0 8px 32px var(--color-backdrop);
}

.dialog--form {
    max-width: 560px;
}

.dialog::backdrop {
    background-color: var(--color-backdrop);
}

.dialog h1,
.dialog .dialog__title {
    margin: 0 0 var(--space-4);
    font-size: var(--type-h2-size);
    line-height: var(--type-h2-line);
    overflow-wrap: anywhere;
}

.dialog .confirm-page {
    max-width: none;
}

.dialog .confirm-page > p,
.dialog__text {
    margin: 0 0 var(--space-6);
    overflow-wrap: anywhere;
}

.dialog .admin-form {
    max-width: none;
}

.dialog .notice {
    margin-bottom: var(--space-4);
}

.dialog__sheet-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.dialog__sheet-actions .button {
    width: 100%;
}

/* The destructive action of a ConfirmDialog is the filled red button (W26). */
.dialog .form-actions .button--danger:not([disabled]) {
    border-color: var(--color-danger);
    background-color: var(--color-danger);
    color: var(--color-on-danger);
}

.dialog .form-actions .button--danger:not([disabled]):hover {
    border-color: var(--color-danger-hover);
    background-color: var(--color-danger-hover);
    color: var(--color-on-danger);
}

/* From 768px: centred panel, buttons right-aligned, "Abbrechen" left of the action; when they do
   not fit in one line, "Abbrechen" goes above the action (W26). */
@media (min-width: 768px) {
    .dialog .form-actions {
        flex-direction: row-reverse;
        flex-wrap: wrap-reverse;
        justify-content: flex-start;
    }
}

/* Below 768px: every variant docked to the bottom, full width (D8). */
@media (max-width: 767.98px) {
    .dialog {
        width: 100%;
        max-width: none;
        max-height: 90dvh;
        margin: auto 0 0;
        padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
    }

    /* Category card with the ActionSheet: "Videos" and "Mehr" in one row (mobile-image7). */
    .category-list .admin-list__item:has(.more-button:not([hidden])) {
        grid-template-areas:
            "main main main"
            "arrows videos more";
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .category-list .more-button {
        grid-area: more;
        align-self: center;
    }
}

.more-button {
    min-height: 44px;
    padding-inline: var(--space-3);
}

/* 320px: arrows, "Videos" and "Mehr" still fit in one row. */
@media (max-width: 359.98px) {
    .category-list .admin-list__item:has(.more-button:not([hidden])) {
        column-gap: var(--space-2);
    }

    .category-list .admin-list__item:has(.more-button:not([hidden])) .videos-link {
        padding-inline: var(--space-2);
    }

    .category-list .more-button {
        padding-inline: var(--space-2);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .dialog[open] {
        animation: dialog-in 160ms ease-out;
    }

    .dialog[open]::backdrop {
        animation: dialog-fade 160ms ease-out;
    }

    @media (max-width: 767.98px) {
        .dialog[open] {
            animation-name: dialog-sheet-in;
        }
    }
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes dialog-sheet-in {
    from {
        transform: translateY(100%);
    }
}

@keyframes dialog-fade {
    from {
        opacity: 0;
    }
}

/* ---------- W30 "Zugang abgelaufen" (J5) ---------- */

/* One centred column (about 480px), horizontally and vertically; full width with gutter on mobile. */
body > main.status-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-page__content {
    width: 100%;
    max-width: 480px;
}

/* W30: eyebrow and heading as far apart as in Figma (006 C19); the global .eyebrow keeps its gap. */
.status-page__content .eyebrow {
    margin-bottom: var(--space-3);
}

.status-page__content h1 {
    margin-bottom: var(--space-4);
}

.status-page__text {
    color: var(--color-ink-muted);
}

.status-page__actions {
    margin: 0;
}
