/*
 * LSMD Schulungsportal – Design-System
 *
 * Farben, Maße und Zustände der Komponenten folgen shadcn/ui (Stil „new-york“, Basisfarbe zinc).
 * Markenfarbe Rot nur für Logo, aktive Hauptnavigation und Warnhinweise.
 *
 * Raster 4 px · Radien 8 / 6 / 4 px · Systemschrift (keine externen Font-Requests)
 * Typo-Skala: 12 / 13 / 14 / 16 / 18 / 22 / 30 px
 */

/* ======================================================================== Tokens */

:root {
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --subtle: #fafafa;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --accent: #f4f4f5;
    --primary: #18181b;
    --primary-hover: #27272a;
    --primary-foreground: #fafafa;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --input: #a1a1aa;
    --ring: #18181b;

    --brand: #c8102e;
    --danger: #dc2626;
    --danger-foreground: #b91c1c;
    --danger-subtle: #fef2f2;
    --danger-border: #fecaca;
    --warning-foreground: #a16207;
    --warning-subtle: #fefce8;
    --warning-border: #fde68a;
    --success-foreground: #15803d;
    --success-subtle: #f0fdf4;
    --success-border: #bbf7d0;
    --mark: #fef08a;

    --radius: 8px;
    --radius-md: 6px;
    --radius-sm: 4px;
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .06);

    --header-h: 56px;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #09090b;
        --foreground: #fafafa;
        --card: #09090b;
        --subtle: #111113;
        --muted: #27272a;
        --muted-foreground: #a1a1aa;
        --accent: #27272a;
        --primary: #fafafa;
        --primary-hover: #e4e4e7;
        --primary-foreground: #18181b;
        --border: #27272a;
        --border-strong: #3f3f46;
        --input: #52525b;
        --ring: #d4d4d8;

        --brand: #dc2626;
        --danger: #ef4444;
        --danger-foreground: #f87171;
        --danger-subtle: rgb(239 68 68 / .07);
        --danger-border: rgb(239 68 68 / .35);
        --warning-foreground: #facc15;
        --warning-subtle: rgb(234 179 8 / .06);
        --warning-border: rgb(234 179 8 / .3);
        --success-foreground: #4ade80;
        --success-subtle: rgb(34 197 94 / .08);
        --success-border: rgb(34 197 94 / .3);
        --mark: rgb(250 204 21 / .28);

        --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .4);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .5);
        --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
        color-scheme: dark;
    }
}

/* ======================================================================== Basis */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    color: var(--foreground);
    font: 16px/1.5 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
main { flex: 1; }
main:focus { outline: none; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.015em; }
a { color: inherit; text-underline-offset: 4px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
abbr[title] { text-decoration: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--foreground) 14%, transparent); }

.icon { width: 16px; height: 16px; flex: none; }
.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: -.01em; }
.muted { color: var(--muted-foreground); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.print-only { display: none; }

.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }
@media (min-width: 1280px) { .container { padding: 0 32px; } }

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 100;
    padding: 8px 12px; border-radius: var(--radius-md);
    background: var(--primary); color: var(--primary-foreground); font-size: 14px; font-weight: 500; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ======================================================================== Komponenten (shadcn/ui) */

/* --- Button ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 16px;
    border: 1px solid transparent; border-radius: var(--radius-md);
    background: transparent; color: var(--foreground);
    font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none;
    cursor: pointer; user-select: none;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--outline { background: var(--background); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn--outline:hover { background: var(--accent); }
.btn--secondary { background: var(--muted); }
.btn--secondary:hover { background: var(--border); }
.btn--ghost:hover { background: var(--accent); }
.btn--destructive { background: var(--danger); color: #fff; box-shadow: var(--shadow-xs); }
.btn--destructive:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn--ghost-destructive { color: var(--danger-foreground); }
.btn--ghost-destructive:hover { background: var(--danger-subtle); }
.btn--sm { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn--block { width: 100%; }

/* --- Input, Select, Textarea, Label ------------------------------------ */
.input, .select, .textarea {
    display: block; width: 100%; min-width: 0; height: 36px; padding: 0 12px;
    background: var(--background); color: var(--foreground);
    border: 1px solid var(--input); border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
    outline: none; border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent);
}
.input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.textarea { height: auto; min-height: 72px; padding: 8px 12px; line-height: 1.55; resize: vertical; }
.select {
    appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
    background-image: var(--chevron); background-repeat: no-repeat;
    background-position: right 10px center; background-size: 16px;
}
.label { display: block; font-size: 14px; font-weight: 500; line-height: 1.2; }
.field { display: grid; gap: 8px; margin-bottom: 20px; min-width: 0; border: 0; padding: 0; }
.field__hint { font-size: 13px; color: var(--muted-foreground); line-height: 1.4; }
.field__req { color: var(--danger-foreground); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; align-items: start; }
.input-group { display: flex; }
.input-group__addon {
    display: flex; align-items: center; padding: 0 10px; flex: none;
    border: 1px solid var(--input); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md);
    background: var(--muted); color: var(--muted-foreground); font-family: var(--font-mono); font-size: 13px;
}
.input-group .input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* --- Checkbox ----------------------------------------------------------- */
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--primary); cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check__hint { color: var(--muted-foreground); font-size: 13px; }
.check-list { display: grid; gap: 10px; }

/* --- Badge -------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 8px; border: 1px solid transparent; border-radius: var(--radius-md);
    font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap;
}
.badge--outline { border-color: var(--border-strong); color: var(--foreground); }
.badge--secondary { background: var(--muted); color: var(--foreground); }
.badge--success { background: var(--success-subtle); border-color: var(--success-border); color: var(--success-foreground); }
.badge--warning { background: var(--warning-subtle); border-color: var(--warning-border); color: var(--warning-foreground); }
.badge-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.badge .icon { width: 12px; height: 12px; }
.doc-header__id { flex-wrap: wrap; }

/* --- Card --------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.card__header { padding: 20px 20px 0; }
.card__title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.card__description { margin-top: 4px; font-size: 14px; color: var(--muted-foreground); }
.card__content { padding: 20px; }
.card__footer { display: flex; gap: 8px; padding: 0 20px 20px; }
.card--danger { border-color: var(--danger-border); }

/* --- Table -------------------------------------------------------------- */
.table-container { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table-container--overflow { overflow: visible; }
.table-container--overflow .table th:first-child { border-top-left-radius: var(--radius); }
.table-container--overflow .table th:last-child { border-top-right-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    height: 40px; padding: 0 12px; text-align: left; vertical-align: middle; white-space: nowrap;
    font-weight: 500; color: var(--muted-foreground);
    background: var(--subtle); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; vertical-align: top; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .1s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.table td.text-right, .table th.text-right { text-align: right; }
.table td.text-center, .table th.text-center { text-align: center; }
.table--middle td { vertical-align: middle; }

/* --- Tabs --------------------------------------------------------------- */
.tabs-list {
    display: inline-flex; align-items: center; height: 36px; padding: 3px;
    border-radius: var(--radius); background: var(--muted); color: var(--muted-foreground);
}
.tabs-trigger {
    display: inline-flex; align-items: center; justify-content: center; height: 100%; padding: 0 12px;
    border: 0; border-radius: var(--radius-md); background: transparent; color: inherit;
    font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s;
}
.tabs-trigger:hover { color: var(--foreground); }
.tabs-trigger[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.tabs-trigger:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }

/* --- Alert (auch für Hinweisboxen in SOPs) ----------------------------- */
.alert {
    display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 12px;
    padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card); font-size: 14px; line-height: 1.6;
}
.alert > .icon { margin-top: 3px; color: var(--muted-foreground); }
.alert__title { font-weight: 600; line-height: 1.55; }
.alert__body { grid-column: 2; margin-top: 2px; }
.alert__body > * + * { margin-top: 8px; }
.alert__body ul, .alert__body ol { padding-left: 20px; margin: 0; }
.alert__body li + li { margin-top: 4px; }
.alert--danger { background: var(--danger-subtle); border-color: var(--danger-border); }
.alert--danger > .icon, .alert--danger .alert__label { color: var(--danger-foreground); }
.alert--warning { background: var(--warning-subtle); border-color: var(--warning-border); }
.alert--warning > .icon, .alert--warning .alert__label { color: var(--warning-foreground); }
.alert--success { background: var(--success-subtle); border-color: var(--success-border); }
.alert--success > .icon { color: var(--success-foreground); }
.alerts { display: grid; gap: 8px; margin-top: 20px; }

/* --- Breadcrumb --------------------------------------------------------- */
.breadcrumb ol {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted-foreground);
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumb li + li::before {
    content: ""; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.breadcrumb a { text-decoration: none; transition: color .15s; }
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb [aria-current="page"] { color: var(--foreground); }

/* --- Sidebar-Navigation ------------------------------------------------- */
.side-nav + .side-nav { margin-top: 24px; }
.side-nav__label { padding: 0 8px; margin-bottom: 4px; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--muted-foreground); }
.side-nav ul { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.side-nav a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-height: 32px; padding: 6px 8px; border-radius: var(--radius-md);
    font-size: 14px; line-height: 1.35; text-decoration: none; color: var(--foreground);
    transition: background-color .1s, color .1s;
}
.side-nav a:hover { background: var(--accent); }
.side-nav a[aria-current] { background: var(--accent); font-weight: 500; }
.side-nav__count { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; font-weight: 400; }
.side-nav--docs a { color: var(--muted-foreground); }
.side-nav--docs a:hover, .side-nav--docs a[aria-current] { color: var(--foreground); }

/* ======================================================================== Seitenrahmen */

.site-header {
    position: sticky; top: 0; z-index: 40; height: var(--header-h);
    background: var(--background); border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: 24px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--foreground); text-decoration: none; }
.brand__mark { width: 28px; height: 28px; }
.logo-bg { fill: var(--brand); }
.logo-star { fill: #fff; }
.logo-rod { stroke: var(--brand); }
.brand__name { font-size: 15px; font-weight: 700; letter-spacing: .03em; }
.brand__divider { width: 1px; height: 18px; background: var(--border-strong); }
.brand__product { font-size: 14px; color: var(--muted-foreground); }
.main-nav { display: flex; align-self: stretch; gap: 4px; }
.main-nav a {
    display: flex; align-items: center; padding: 0 10px; margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-size: 14px; font-weight: 500; color: var(--muted-foreground); text-decoration: none;
    transition: color .15s;
}
.main-nav a:hover { color: var(--foreground); }
.main-nav a[aria-current="page"] { color: var(--foreground); border-bottom-color: var(--brand); }
.site-header__end { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.header-search { position: relative; width: 260px; }
.account-link {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 4px; min-width: 0;
    border-radius: var(--radius-md); font-size: 14px; font-weight: 500; text-decoration: none;
    transition: background-color .15s;
}
.account-link:hover, .account-link[aria-current] { background: var(--accent); }
.account-link__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
@media (max-width: 639px) { .account-link__name { display: none; } .account-link { padding: 0 4px; } }
.header-search .icon, .search-field .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.header-search .input { height: 34px; padding-left: 34px; background: var(--subtle); }
@media (max-width: 767px) { .header-search { display: none; } }
@media (max-width: 459px) {
    .brand__divider, .brand__product { display: none; }
    .site-header__inner { gap: 16px; }
}

.site-footer { margin-top: 64px; border-top: 1px solid var(--border); }
.site-footer__inner {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
    padding-top: 20px; padding-bottom: 24px; font-size: 13px; color: var(--muted-foreground);
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--foreground); text-decoration: underline; }

.page-header h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.025em; }
.page-header p { margin-top: 8px; max-width: 68ch; color: var(--muted-foreground); }
.page-header--split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header--split h1 { font-size: 24px; }
.page-header--split p { font-size: 14px; margin-top: 4px; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.link-back {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px;
    font-size: 14px; color: var(--muted-foreground); text-decoration: none;
}
.link-back:hover { color: var(--foreground); }

/* ======================================================================== Bibliothek */

.library { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding-top: 32px; }
.library__sidebar { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.search-field { position: relative; flex: 1 1 260px; }
.search-field .input { padding-left: 34px; }
.toolbar__selects { display: flex; gap: 8px; }
.toolbar__selects .select { width: auto; min-width: 190px; }
.toolbar__filter { display: none; }
.result-count { margin: 16px 0 10px; font-size: 13px; color: var(--muted-foreground); }

.sop-table .col-code { width: 112px; white-space: nowrap; }
.sop-table .col-cat { width: 180px; }
.sop-table .col-aud { width: 128px; }
.sop-table .col-date { width: 96px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sop-table td.col-code { color: var(--muted-foreground); padding-top: 13px; }
.sop-table td.col-cat, .sop-table td.col-aud, .sop-table td.col-date { color: var(--muted-foreground); }
@media (max-width: 1199px) and (min-width: 768px) { .sop-table .col-cat { display: none; } }
.sop-row { position: relative; }
.sop-row__link { font-weight: 500; text-decoration: none; }
.sop-row__link::after { content: ""; position: absolute; inset: 0; }
.sop-row__link:focus-visible { outline: none; }
.sop-row:has(.sop-row__link:focus-visible) { box-shadow: inset 0 0 0 2px var(--ring); }
.sop-row:hover .sop-row__link { text-decoration: underline; }
.sop-row .badge { position: relative; vertical-align: 1px; margin-left: 6px; }
.sop-row__summary {
    margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--muted-foreground);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.empty-state {
    margin-top: 12px; padding: 48px 24px; text-align: center;
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty-state__title { font-weight: 600; }
.empty-state p + p { margin-top: 4px; font-size: 14px; color: var(--muted-foreground); }
.empty-state .btn { margin-top: 16px; }

@media (max-width: 1023px) {
    .library { grid-template-columns: minmax(0, 1fr); padding-top: 24px; }
    .library__sidebar { display: none; }
    .toolbar__filter { display: block; }
    .toolbar__selects { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .toolbar__selects .select { width: 100%; min-width: 0; }
}
@media (max-width: 767px) {
    .page-header h1 { font-size: 26px; }
    .toolbar__selects .toolbar__filter:first-child { grid-column: 1 / -1; }
    .sop-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .sop-table, .sop-table tbody { display: block; }
    .sop-table tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
        padding: 14px 16px; border-bottom: 1px solid var(--border);
    }
    .sop-table tbody tr:last-child { border-bottom: 0; }
    .sop-table td { display: block; padding: 0; border: 0; width: auto; }
    .sop-table td.col-code { order: 1; padding: 0; font-size: 12px; }
    .sop-table td.col-date { order: 2; font-size: 12px; text-align: right; }
    .sop-table td.col-title { order: 3; grid-column: 1 / -1; }
    .sop-table td.col-cat { order: 4; font-size: 13px; align-self: center; }
    .sop-table td.col-aud { order: 5; text-align: right; }
}

/* ======================================================================== SOP-Dokument */

.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 200px; gap: 48px; padding-top: 32px; }
.doc-sidebar {
    position: sticky; top: calc(var(--header-h) + 24px); align-self: start;
    max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding-right: 4px;
    scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.doc-sidebar:hover, .doc-sidebar:focus-within { scrollbar-color: var(--border-strong) transparent; }
.doc { min-width: 0; max-width: 760px; }
.doc-toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; font-size: 13px; }
.doc-toc__label { margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.doc-toc ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.doc-toc a { display: block; padding: 4px 0; line-height: 1.4; color: var(--muted-foreground); text-decoration: none; transition: color .15s; }
.doc-toc a:hover, .doc-toc a.is-active { color: var(--foreground); }
.doc-toc a.is-active { font-weight: 500; }

.doc-header { margin-top: 16px; }
.doc-header__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.doc-header__id { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); }
.doc-header__actions { display: flex; gap: 8px; }
.doc-header h1 { margin-top: 12px; font-size: 32px; line-height: 1.15; letter-spacing: -.025em; }
.doc-header__lead { margin-top: 12px; max-width: 65ch; font-size: 17px; line-height: 1.6; color: var(--muted-foreground); }
.doc-meta {
    display: flex; flex-wrap: wrap; gap: 1px; margin-top: 24px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.doc-meta > div { flex: 1 1 140px; padding: 10px 14px; background: var(--background); min-width: 0; }
.doc-meta dt { font-size: 12px; color: var(--muted-foreground); }
.doc-meta dd { margin-top: 2px; font-size: 14px; font-weight: 500; }

.doc-toc-inline { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--radius); display: none; }
.doc-toc-inline summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 14px; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none;
}
.doc-toc-inline summary::-webkit-details-marker { display: none; }
.doc-toc-inline summary .icon { color: var(--muted-foreground); transition: transform .15s; }
.doc-toc-inline[open] summary .icon { transform: rotate(180deg); }
.doc-toc-inline ol { margin: 0; padding: 0 14px 12px 34px; font-size: 14px; color: var(--muted-foreground); }
.doc-toc-inline li + li { margin-top: 4px; }
.doc-toc-inline a { color: var(--foreground); text-decoration: none; }
.doc-toc-inline a:hover { text-decoration: underline; }

.doc-note { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.6; color: var(--muted-foreground); }
.doc-tags { margin-top: 8px; font-size: 13px; color: var(--muted-foreground); }
.doc-tags a { color: inherit; }
.doc-tags a:hover { color: var(--foreground); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; }
.pager a {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 16px;
    border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none;
    transition: background-color .15s, border-color .15s;
}
.pager a:hover { background: var(--subtle); border-color: var(--border-strong); }
.pager__dir { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted-foreground); }
.pager__title { font-size: 14px; font-weight: 500; }
.pager__next { grid-column: 2; align-items: flex-end; text-align: right; }

@media (max-width: 1279px) {
    .doc-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; }
    .doc-toc { display: none; }
    .doc-toc-inline { display: block; }
}
@media (max-width: 1023px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); padding-top: 20px; }
    .doc-sidebar { display: none; }
    .doc { max-width: none; }
}
@media (max-width: 639px) {
    .doc-header h1 { font-size: 26px; }
    .doc-header__lead { font-size: 16px; }
    .pager { grid-template-columns: 1fr; }
    .pager__next { grid-column: 1; }
}

/* --- Fließtext ---------------------------------------------------------- */
.prose { margin-top: 32px; font-size: 16px; line-height: 1.75; }
.prose > * + * { margin-top: 20px; }
.prose h2 {
    margin-top: 48px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
    font-size: 22px; line-height: 1.3; letter-spacing: -.02em;
}
.prose > h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 32px; font-size: 18px; line-height: 1.4; }
.prose h4 { margin-top: 24px; font-size: 16px; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 12px; }
.prose ul, .prose ol { margin-bottom: 0; padding-left: 24px; }
.prose li + li { margin-top: 6px; }
.prose li > ul, .prose li > ol { margin-top: 6px; }
.prose li::marker { color: var(--muted-foreground); }
.prose strong { font-weight: 600; }
.prose a { font-weight: 500; text-decoration: underline; }
.prose mark { padding: 0 3px; border-radius: 3px; background: var(--mark); color: inherit; }
.prose code { padding: 2px 5px; border-radius: var(--radius-sm); background: var(--muted); font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.prose pre { padding: 14px 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--subtle); line-height: 1.6; }
.prose pre code { padding: 0; background: none; font-weight: 400; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.prose blockquote { margin: 0; padding-left: 20px; border-left: 2px solid var(--border-strong); font-style: italic; color: var(--muted-foreground); }

/* Schritte (shadcn/ui „Steps“) */
.prose ol.steps { margin-left: 14px; padding-left: 34px; border-left: 1px solid var(--border); list-style: none; counter-reset: step; }
.prose ol.steps > li { position: relative; counter-increment: step; }
.prose ol.steps > li + li { margin-top: 16px; }
.prose ol.steps > li::before {
    content: counter(step); position: absolute; left: -48.5px; top: 0;
    display: grid; place-items: center; width: 28px; height: 28px;
    border: 3px solid var(--background); border-radius: 50%; background: var(--muted);
    font: 600 12px/1 var(--font-mono); color: var(--foreground);
}

/* Checklisten */
.prose ul.tasks { padding-left: 0; list-style: none; border-top: 1px solid var(--border); }
.prose ul.tasks > li { margin: 0; border-bottom: 1px solid var(--border); }
.prose li.task label { display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px; line-height: 1.55; cursor: pointer; }
.prose li.task input { margin-top: 4px; }
.prose li.task input:checked + span { color: var(--muted-foreground); text-decoration: line-through; text-decoration-color: var(--border-strong); }

/* Tabellen */
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.prose th { padding: 8px 12px; text-align: left; vertical-align: bottom; font-weight: 600; background: var(--subtle); border-bottom: 1px solid var(--border); }
.prose td { padding: 8px 12px; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th + th, .prose td + td { border-left: 1px solid var(--border); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose .ta-center { text-align: center; }
.prose .ta-right { text-align: right; }

.prose .alert { font-size: 15px; }

/* ======================================================================== Verwaltung */

.subnav { border-bottom: 1px solid var(--border); }
.subnav__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.subnav__tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.subnav__tabs::-webkit-scrollbar { display: none; }
.subnav__tabs a {
    display: flex; align-items: center; height: 44px; padding: 0 10px; margin-bottom: -1px;
    border-bottom: 2px solid transparent; white-space: nowrap;
    font-size: 14px; font-weight: 500; color: var(--muted-foreground); text-decoration: none;
}
.subnav__tabs a:hover { color: var(--foreground); }
.subnav__tabs a[aria-current="page"] { color: var(--foreground); border-bottom-color: var(--foreground); }

.page { padding-top: 32px; }
.page--narrow { max-width: 560px; }

.section { margin-top: 24px; }
.form-actions { margin-top: 12px; }
@media (min-width: 900px) { .field-row--3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 899px) { .field-row--3 { grid-template-columns: 1fr; } }
.table-link { font-weight: 500; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.table-empty { padding: 32px 12px; }
.form-alert { margin-bottom: 20px; }
.row-actions { display: inline-flex; justify-content: flex-end; gap: 4px; }
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover__content {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 300px; text-align: left;
    padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card); box-shadow: var(--shadow-md);
}
.popover__content .field { margin-bottom: 12px; }

.editor__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor__side { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; }
.editor__side .card__content > .field:last-child { margin-bottom: 0; }
.md-editor {
    border: 1px solid var(--input); border-radius: var(--radius-md); overflow: clip;
    background: var(--background); box-shadow: var(--shadow-xs);
    transition: border-color .15s, box-shadow .15s;
}
.md-editor:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
.md-editor__bar {
    position: sticky; top: var(--header-h); z-index: 2;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px; border-bottom: 1px solid var(--border); background: var(--subtle);
}
.md-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.md-tools.is-disabled { opacity: .4; pointer-events: none; }
.md-tools__sep { width: 1px; height: 16px; margin: 0 4px; background: var(--border-strong); }
.md-tools button {
    height: 28px; min-width: 28px; padding: 0 8px; border: 0; border-radius: var(--radius-md);
    background: transparent; color: var(--muted-foreground); font-size: 13px; font-weight: 500; cursor: pointer;
}
.md-tools button:hover { background: var(--accent); color: var(--foreground); }
.md-tools button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.md-editor__input {
    display: block; width: 100%; min-height: 520px; padding: 16px; border: 0; resize: vertical;
    background: transparent; font: 13.5px/1.7 var(--font-mono); tab-size: 2;
}
.md-editor__input:focus { outline: none; }
.md-editor__preview { min-height: 520px; margin: 0; padding: 24px; }
.md-help { margin-top: 12px; font-size: 14px; }
.md-help summary { cursor: pointer; color: var(--muted-foreground); font-weight: 500; padding: 4px 0; }
.md-help summary:hover { color: var(--foreground); }
.md-help .table-container { margin-top: 8px; }
.md-help td:first-child { white-space: nowrap; }
.md-help code { font-family: var(--font-mono); font-size: 13px; }

.cat-table .input { min-width: 160px; }
.cat-table td:nth-child(2) .input { min-width: 260px; }

.auth { display: grid; place-items: center; padding-top: 64px; }
.auth__card { width: 100%; max-width: 380px; }
.auth__mark { display: block; width: 36px; height: 36px; margin-bottom: 16px; }
.auth .card__content { padding-top: 16px; }
.auth__back { margin-top: 16px; text-align: center; font-size: 14px; }
.auth__back a { color: var(--muted-foreground); text-decoration: none; }
.auth__back a:hover { color: var(--foreground); text-decoration: underline; }

/* Mitarbeiterkonto */
.avatar { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--muted); object-fit: cover; }
.avatar--md { width: 40px; height: 40px; }
.avatar--lg { width: 48px; height: 48px; }
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity__name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.identity__name--lg { font-size: 18px; letter-spacing: -.015em; }
.identity__sub { margin-top: 2px; font-size: 13px; color: var(--muted-foreground); }
.form-intro { margin-bottom: 20px; }
.form-hint { margin-top: 12px; }
.list-steps { margin: 0 0 20px; padding-left: 20px; font-size: 14px; line-height: 1.55; }
.list-steps li + li { margin-top: 6px; }
.list-steps li::marker { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.nick-preview { margin: 4px 0 20px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--subtle); }
.nick-preview__value { margin: 6px 0 4px; font-size: 16px; font-weight: 500; color: var(--foreground); overflow-wrap: anywhere; }
.nick-preview__value.is-too-long { color: var(--danger-foreground); }
.profile-meta { margin-top: 0; }
.profile-status { margin-top: 16px; }
.profile-status .alert__body p { color: var(--muted-foreground); }
.member-logout { margin-top: 16px; }
.privacy-note { margin-top: 24px; font-size: 13px; color: var(--muted-foreground); }

/* Ausbildung (Verwaltung) */
.stack { display: grid; gap: 16px; min-width: 0; }
.cell-sub { margin-top: 2px; font-size: 13px; color: var(--muted-foreground); }
.check-list--box { max-height: 340px; overflow-y: auto; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); gap: 0; }
.check-list--box .check { padding: 8px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.check-list--box .check:last-child { border-bottom: 0; }
.check-list--box input[type="checkbox"] { margin-top: 3px; }
.check__hint--end { margin-left: auto; padding-left: 12px; white-space: nowrap; }
.field--inline { max-width: 220px; }
.progress-list { margin-bottom: 8px; }
.progress-list dd { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.progress { position: relative; display: block; width: 72px; height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress__bar { position: absolute; inset: 0 auto 0 0; background: var(--foreground); border-radius: inherit; }
.progress-hint { margin-bottom: 16px; }
.training-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.training-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.training-list a { text-decoration: none; font-weight: 500; }
.training-list a:hover { text-decoration: underline; }

/* Discord-Einrichtung */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 899px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.status-list { margin-bottom: 20px; }
.status-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.status-list > div:first-child { padding-top: 0; }
.status-list dt { color: var(--muted-foreground); }
.status-list dd { text-align: right; }
.copy-field-wrap { margin-bottom: 0; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-size: 13px; }
.card__title .badge { margin-left: 6px; vertical-align: 2px; }

.notfound { padding-top: 96px; max-width: 560px; }
.notfound .mono { color: var(--muted-foreground); }
.notfound h1 { margin-top: 8px; font-size: 30px; }
.notfound p { margin-top: 12px; color: var(--muted-foreground); }
.notfound .btn { margin-top: 24px; }

@media (max-width: 1023px) {
    .editor__grid { grid-template-columns: minmax(0, 1fr); }
    .editor__side { position: static; }
}

/* ======================================================================== Druck */

@media print {
    @page { margin: 16mm 15mm; }
    :root {
        --background: #fff; --foreground: #000; --card: #fff; --subtle: #f4f4f5; --muted: #e4e4e7;
        --muted-foreground: #3f3f46; --border: #c4c4c8; --border-strong: #a1a1aa;
    }
    body { font-size: 10.5pt; }
    .site-header, .site-footer, .doc-sidebar, .doc-toc, .doc-toc-inline, .pager, .breadcrumb,
    .doc-header__actions, .doc-tags, .skip-link { display: none !important; }
    .print-only { display: block; }
    .container { max-width: none; padding: 0; }
    .doc-layout { display: block; padding: 0; }
    .doc { max-width: none; }
    .doc-header { margin: 0; }
    .prose { font-size: 10.5pt; line-height: 1.55; }
    .prose h2 { break-after: avoid; margin-top: 1.6em; }
    .prose h3 { break-after: avoid; }
    .alert, .prose table, .prose ol.steps > li, .prose li.task, .doc-meta { break-inside: avoid; }
    .alert, .doc-meta, .prose ol.steps > li::before, .prose th {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .prose a { text-decoration: none; }
    .print-note { margin-top: 1.2em; font-size: 8.5pt; color: #3f3f46; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
