/*
 * BKC-Verwaltung (Site-Set bkc-verwaltung): Arbeitsoberflaeche im Stil der
 * aktuellen GitLab-Oberflaeche - getoente Grundflaeche mit Kopfzeile und
 * Seitenleiste ohne Rahmen, der Inhalt in einem weissen Panel mit runden
 * Ecken, Karten mit 12px-Radius, Kennzahlen als verschachtelte Karten.
 * Akzent im Navy des Chors. Hell und dunkel ueber prefers-color-scheme.
 * Kein Build-Schritt, keine externen Schriften.
 */

:root {
    --brand: #343e76;
    --shell: #ececf3;
    --bg: #ffffff;
    --bg-subtle: #fbfafd;
    --bg-tinted: #f4f3f8;
    --bg-hover: #dfdeea;
    --bg-active: #d9d8ea;
    --border: #dcdcde;
    --border-strong: #bfbfc3;
    --text: #28272d;
    --text-muted: #626168;
    --accent: #343e76;
    --accent-hover: #262e5c;
    --accent-text: #ffffff;
    --accent-soft: #e5e7f5;
    --accent-soft-text: #2a3263;
    --danger-soft: #fdd4cd;
    --danger-text: #8d1300;
    --focus: #428fdc;
    --radius: 6px;
    --radius-lg: 12px;
    --sidebar-width: 232px;
    --topbar-height: 48px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --shell: #111015;
        --bg: #1b1a20;
        --bg-subtle: #222128;
        --bg-tinted: #222128;
        --bg-hover: #2c2b33;
        --bg-active: #34333d;
        --border: #34333a;
        --border-strong: #55545b;
        --text: #ececef;
        --text-muted: #a4a3a8;
        --accent: #9aa3e0;
        --accent-hover: #b4bbea;
        --accent-text: #111015;
        --accent-soft: #2b3058;
        --accent-soft-text: #d3d7f2;
        --danger-soft: #5c1105;
        --danger-text: #fdd4cd;
        color-scheme: dark;
    }
}

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

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

body {
    margin: 0;
    background: var(--shell);
    color: var(--text);
    font: 14px/1.5 var(--font);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 1px var(--bg), 0 0 0 3px var(--focus);
    border-radius: var(--radius);
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0 0 8px; }

.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }

.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;
}

.icon { flex: none; }

/* ---------- Grundgeruest: Kopfzeile, Seitenleiste, Panel ---------- */

.shell { min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--topbar-height);
    padding: 0 12px;
    background: var(--shell);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 600;
}
.brand:hover { background: var(--bg-hover); text-decoration: none; }
.brand .logo { border-radius: 6px; }

.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.shell-body {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    display: flex;
    flex-direction: column;
    padding: 4px 8px 8px;
    background: var(--shell);
}

.sidebar-title {
    margin: 12px 8px 8px;
    font-weight: 600;
}

.nav { flex: 1; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    margin-bottom: 2px;
    padding: 4px 8px;
    border-radius: var(--radius);
    color: var(--text);
}
.nav-item .icon { color: var(--text-muted); }
.nav-item:hover { background: var(--bg-hover); text-decoration: none; }
.nav-item[aria-current="page"] {
    background: var(--bg-active);
    font-weight: 600;
}
.nav-item[aria-current="page"] .icon { color: var(--text); }

.sidebar-footer { padding-top: 8px; }

.panel {
    min-width: 0;
    min-height: calc(100vh - var(--topbar-height) - 8px);
    margin: 0 8px 8px 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.breadcrumb {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}
.breadcrumb li { color: var(--text-muted); }
.breadcrumb li + li::before {
    content: "/";
    margin: 0 8px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; }

.content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; }

/* ---------- Benutzermenue ---------- */

.user-menu { position: relative; }
.user-menu summary {
    display: block;
    list-style: none;
    border-radius: 50%;
    cursor: pointer;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(5, 5, 6, 0.12);
}
.dropdown-header {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.dropdown-header span { color: var(--text-muted); font-size: 13px; }
.dropdown form { margin: 0; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-tinted); }

.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-soft-text);
    font-size: 12px;
    font-weight: 600;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 26px;
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--border);
}

/* ---------- Uebersicht ---------- */

.welcome {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}
.welcome-name { margin: 0 0 2px; font-weight: 600; }
.welcome h1 { font-size: 32px; letter-spacing: -0.01em; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    padding: 4px;
    background: var(--bg-tinted);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 8px;
    color: var(--text-muted);
}
.stat-body {
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    box-shadow: 0 0 0 1px var(--border);
}
.stat-body p { margin: 0; }
.stat-number { font-size: 28px; font-weight: 600; line-height: 1.2; }
.stat-text { margin-top: 4px !important; }
.stat-meta { color: var(--text-muted); font-size: 12px; }

.columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 24px;
    align-items: start;
}

/* ---------- Bausteine ---------- */

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header { padding: 16px 16px 8px; }
.card-header h2 { font-size: 16px; }
.card-body { padding: 8px 16px 16px; }
.card-body > :last-child { margin-bottom: 0; }

.list { margin: 0; padding: 0 0 8px; list-style: none; }
.list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
}
.list li + li { border-top: 1px solid var(--border); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-soft-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-muted { background: var(--bg-tinted); color: var(--text-muted); font-weight: 400; box-shadow: inset 0 0 0 1px var(--border); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.btn:hover { background: var(--bg-tinted); text-decoration: none; }
.btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-text);
}
.btn-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.btn-block { width: 100%; }

.btn-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-soft-text);
}
.alert p { margin: 0; }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); }

/* ---------- Formulare ---------- */

.form-group { margin-bottom: 16px; }
.form-group label,
.auth-card label { display: block; margin-bottom: 4px; font-weight: 600; }

.form-control,
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    display: block;
    width: 100%;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
.form-control:focus,
.auth-card input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 1px var(--focus);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.form-check label { margin: 0; font-weight: 400; }

/* ---------- Anmeldung ---------- */

.auth {
    min-height: 100vh;
    padding: 64px 16px;
    background: var(--shell);
}
.auth-brand {
    margin-bottom: 24px;
    text-align: center;
}
.auth-brand .logo { width: 48px; height: 48px; border-radius: 10px; }
.auth-brand h1 { margin-top: 12px; font-size: 24px; }
.auth-brand p { color: var(--text-muted); }

.auth-card,
.auth-note {
    max-width: 400px;
    margin: 0 auto;
}
.auth-card {
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.auth-card fieldset { margin: 0; padding: 0; border: 0; }
.auth-card legend { display: none; }
.auth-card input[type="submit"] {
    width: 100%;
    min-height: 32px;
    margin-top: 8px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.auth-note { margin-top: 16px; color: var(--text-muted); text-align: center; }
.auth-links { margin: 16px 0 0; text-align: center; }

/* ---------- Schmale Bildschirme ---------- */

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-button { display: none; }

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

@media (max-width: 767px) {
    .shell-body { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed;
        z-index: 20;
        left: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.15s ease-out;
        box-shadow: 0 4px 16px rgba(5, 5, 6, 0.2);
    }
    .nav-toggle:checked ~ .shell .sidebar { transform: none; }
    .nav-toggle-button { display: inline-grid; }
    .panel { margin: 0 8px 8px; }
    .content { padding: 24px 16px 32px; }
    .welcome h1 { font-size: 24px; }
    .avatar-lg { width: 56px; height: 56px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
}

/* ---------- Navigation: zweite Ebene ---------- */

.nav-item[data-active="true"] { font-weight: 600; }
.nav-sub { margin: 0 0 4px 18px; padding-left: 8px; border-left: 1px solid var(--border-strong); }
.nav-sub .nav-item { min-height: 28px; font-size: 13px; }

/* ---------- Inhaltselemente (fluid_styled_content) ---------- */

.content .frame { margin-bottom: 24px; }
.content .frame:last-child { margin-bottom: 0; }
.content .frame-space-before-small { margin-top: 8px; }
.content .frame-space-before-medium { margin-top: 24px; }
.content .frame-space-before-large { margin-top: 48px; }
.content .frame-space-after-medium { margin-bottom: 40px; }

.content header { margin-bottom: 8px; }
.content h1:not(.page-header h1) { font-size: 24px; }
.content h2 { font-size: 20px; }
.content h3 { font-size: 16px; }
.content h4, .content h5 { font-size: 14px; margin: 0; }
.content header h2 + h3,
.content .subheader { margin-top: 4px; color: var(--text-muted); font-weight: 400; }

.content .ce-bodytext,
.content .frame p,
.content .frame li { max-width: 80ch; }
.content .frame ul,
.content .frame ol { margin: 0 0 8px; padding-left: 24px; }
.content .frame li { margin-bottom: 4px; }
.content blockquote {
    margin: 0 0 8px;
    padding: 8px 16px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-muted);
}
.content hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.content code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--bg-tinted);
    font-size: 13px;
}

/* Text & Medien */
.content .ce-gallery img,
.content .ce-gallery video,
.content .ce-gallery iframe { display: block; max-width: 100%; height: auto; border-radius: 8px; }
.content .ce-gallery figure { margin: 0; }
.content .ce-gallery figcaption { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.content .ce-gallery { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.content .ce-row { display: flex; flex-wrap: wrap; gap: 12px; }
.content .ce-column { flex: 1 1 200px; }
.content .ce-textpic::after,
.content .ce-image::after { content: ""; display: table; clear: both; }
.content .ce-intext.ce-right .ce-gallery { float: right; max-width: 40%; margin: 0 0 12px 24px; }
.content .ce-intext.ce-left .ce-gallery { float: left; max-width: 40%; margin: 0 24px 12px 0; }
.content .ce-center .ce-outer { display: flex; justify-content: center; }
@media (max-width: 767px) {
    .content .ce-intext.ce-right .ce-gallery,
    .content .ce-intext.ce-left .ce-gallery { float: none; max-width: 100%; margin: 0 0 12px; }
}

/* Tabelle */
.content table,
.table {
    width: 100%;
    margin-bottom: 8px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 14px;
}
.content th, .content td,
.table th, .table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.content thead th,
.table thead th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}
.content tr:last-child td,
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-subtle); }
.content table caption { padding: 0 0 8px; text-align: left; color: var(--text-muted); }

/* Dateien */
.content .ce-uploads { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.content .ce-uploads li { display: flex; gap: 12px; align-items: center; padding: 10px 16px; margin: 0; max-width: none; }
.content .ce-uploads li + li { border-top: 1px solid var(--border); }
.content .ce-uploads img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.content .ce-uploads-fileName { font-weight: 600; }
.content .ce-uploads-filesize { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.content .ce-uploads-description { color: var(--text-muted); font-size: 13px; }

/* Menues (Unterseiten, Abschnitte) als Linkliste */
.content .frame-type-menu_subpages ul,
.content .frame-type-menu_pages ul,
.content .frame-type-menu_section ul {
    padding: 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: none;
}
.content .frame-type-menu_subpages li,
.content .frame-type-menu_pages li,
.content .frame-type-menu_section li { margin: 0; max-width: none; }
.content .frame-type-menu_subpages li + li,
.content .frame-type-menu_pages li + li,
.content .frame-type-menu_section li + li { border-top: 1px solid var(--border); }
.content .frame-type-menu_subpages a,
.content .frame-type-menu_pages a,
.content .frame-type-menu_section a { display: block; padding: 10px 16px; color: var(--text); }
.content .frame-type-menu_subpages a:hover,
.content .frame-type-menu_pages a:hover,
.content .frame-type-menu_section a:hover { background: var(--bg-subtle); text-decoration: none; }

/* ---------- Eigene Elemente: Hinweis, Kacheln, Ansprechpartner ---------- */

.notice {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--notice-border, var(--border));
    border-radius: var(--radius-lg);
    background: var(--notice-bg, var(--accent-soft));
    color: var(--notice-text, var(--accent-soft-text));
}
.notice-icon { margin-top: 3px; }
.notice-body > :last-child { margin-bottom: 0; }
.notice-title { font-weight: 600; margin-bottom: 4px; }
.notice-info { --notice-bg: #e9f3fc; --notice-border: #cbe2f9; --notice-text: #0b5cad; }
.notice-success { --notice-bg: #ecf4ee; --notice-border: #c3e6cd; --notice-text: #217645; }
.notice-warning { --notice-bg: #fdf1dd; --notice-border: #f5d9a8; --notice-text: #8f4700; }
.notice-danger { --notice-bg: #fcf1ef; --notice-border: #fdd4cd; --notice-text: #ae1800; }
@media (prefers-color-scheme: dark) {
    .notice-info { --notice-bg: #0f2c4a; --notice-border: #1d4a78; --notice-text: #cbe2f9; }
    .notice-success { --notice-bg: #0f3321; --notice-border: #1d5a39; --notice-text: #c3e6cd; }
    .notice-warning { --notice-bg: #3d2300; --notice-border: #6a3d00; --notice-text: #f5d9a8; }
    .notice-danger { --notice-bg: #4a0e05; --notice-border: #7a1a0b; --notice-text: #fdd4cd; }
}

.stat-link { display: block; color: var(--text); }
.stat-link:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-link:hover .stat-body { box-shadow: 0 0 0 1px var(--border-strong); }
.stat-link .stat-head, .stat-link .stat-body { display: block; }
.stat-link .stat-head { display: flex; }
.stat-body .stat-number, .stat-body .stat-text { display: block; }

.contacts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.contacts .contact {
    display: flex;
    gap: 12px;
    max-width: none;
    margin: 0;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.contact-body { display: flex; flex-direction: column; min-width: 0; }
.contact-links { display: flex; flex-direction: column; margin-top: 4px; font-size: 13px; }
.contact-links a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Datensaetze verwalten ---------- */

.manage { margin-bottom: 24px; }
.manage .notice { margin-bottom: 16px; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.toolbar-search { display: flex; gap: 8px; flex: 1 1 280px; max-width: 480px; margin: 0; }
.toolbar-new { margin-left: auto; }

.segmented {
    display: inline-flex;
    padding: 2px;
    background: var(--bg-tinted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.segmented-item {
    padding: 4px 12px;
    border-radius: 4px;
    color: var(--text);
}
.segmented-item:hover { text-decoration: none; background: var(--bg-hover); }
.segmented-item.is-active { background: var(--bg); box-shadow: 0 0 0 1px var(--border-strong); font-weight: 600; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table .row-title { font-weight: 600; color: var(--text); }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .col-actions > * { vertical-align: middle; }

.btn-sm { min-height: 28px; padding: 3px 10px; font-size: 13px; }
.btn-danger { border-color: #dd2b0e; background: #dd2b0e; color: #fff; }
.btn-danger:hover { border-color: #ae1800; background: #ae1800; }
.btn-danger-outline { color: #c91c00; border-color: var(--border-strong); }

.confirm { position: relative; display: inline-block; }
.confirm summary { list-style: none; }
.confirm summary::-webkit-details-marker { display: none; }
.confirm-box {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 5;
    min-width: 180px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(5, 5, 6, 0.12);
    text-align: left;
    white-space: normal;
}
.confirm-box form { margin: 0; }

.empty {
    padding: 32px 16px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    text-align: center;
}
.manage-note { margin-top: 12px; }

.form-header { margin-bottom: 16px; }
.form-header .back { display: inline-block; margin-bottom: 4px; color: var(--text-muted); font-size: 13px; }
.form-header h2 { font-size: 20px; }

.form-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0 20px;
}
.form-group-wide { grid-column: 1 / -1; }
.form-group textarea.form-control { min-height: 96px; resize: vertical; }
select.form-control { appearance: auto; }
.required { color: #c91c00; }
.has-error .form-control { border-color: #dd2b0e; }
.form-error { margin: 4px 0 0; color: #c91c00; font-size: 13px; }
.form-help { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ---------- Formular: Abschnitte, Unterdatensaetze, Dateien, Editor ---------- */

.form-section {
    margin: 0 0 16px;
    padding: 16px 20px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 0;
}
.form-section legend { padding: 0 6px; margin-left: -6px; font-weight: 600; font-size: 15px; }

.form-actions-sticky {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin: 0 -1px;
    padding: 12px 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
}
.btn-link { border-color: transparent; background: transparent; color: var(--text-muted); }

.children { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.child {
    padding: 10px 12px 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}
.child-new { border-style: dashed; background: var(--bg-subtle); }
.child-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}
.child-new .child-head strong { color: var(--text-muted); font-weight: 500; }
.child-remove { margin: 0; color: #c91c00; font-size: 13px; }
.children:not(.children-blocks) .child .form-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.file-current { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.file-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.file-icon {
    display: grid; place-items: center; width: 48px; height: 56px;
    border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 11px; font-weight: 600;
}
.file-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta .form-check { margin: 0; font-size: 13px; }
.form-file { padding: 4px; }

.contributors-table td { padding: 6px 8px; }
.contributors-table .form-control { min-width: 120px; }
.contributor .target { display: none; }
.contributor-person .target-person,
.contributor-group .target-group,
.contributor-other .target-other { display: block; }
.contributor:has(.contributor-type option[value="person"]:checked) .target { display: none; }
.contributor:has(.contributor-type option[value="person"]:checked) .target-person { display: block; }
.contributor:has(.contributor-type option[value="group"]:checked) .target { display: none; }
.contributor:has(.contributor-type option[value="group"]:checked) .target-group { display: block; }
.contributor:has(.contributor-type option[value="other"]:checked) .target { display: none; }
.contributor:has(.contributor-type option[value="other"]:checked) .target-other { display: block; }

.richtext { border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.richtext:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.richtext-toolbar { display: flex; gap: 4px; padding: 4px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); }
.richtext-toolbar .btn { min-height: 26px; padding: 2px 8px; }
.richtext-editor {
    min-height: 140px;
    max-height: 480px;
    overflow-y: auto;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
}
.richtext-editor p { margin: 0 0 8px; }
.richtext-editor ul, .richtext-editor ol { margin: 0 0 8px; padding-left: 24px; }
