:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-soft: #eef3f5;
    --text: #1f2933;
    --muted: #677282;
    --line: #d9dee7;
    --primary: #126d7a;
    --primary-dark: #0d535d;
    --accent: #7b4d12;
    --error-bg: #fff1f0;
    --error-text: #8a1f17;
    --success-bg: #edf8f2;
    --success-text: #17643a;
    --info-bg: #eef6ff;
    --info-text: #205174;
    --add-bg: #dff6e7;
    --add-text: #145c32;
    --delete-bg: #ffe1df;
    --delete-text: #8a1f17;
    --change-bg: #fff1bd;
    --change-text: #6f4700;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.page.narrow {
    width: min(560px, calc(100% - 32px));
}

.page.readable {
    width: min(860px, calc(100% - 32px));
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 34px;
}

.brand {
    color: var(--text);
    font-size: 20px;
    font-weight: 750;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.page-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 30px;
    color: var(--muted);
    font-size: 14px;
}

.intro,
.section-heading,
.document-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.intro {
    margin-bottom: 22px;
}

.intro.compact {
    align-items: end;
}

.section-heading {
    margin-bottom: 16px;
}

.eyebrow {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0;
    margin: 0 0 6px;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    line-height: 1.2;
    margin: 0;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 22px;
    margin-top: 22px;
}

h3 {
    font-size: 18px;
}

p {
    margin: 0 0 12px;
}

.panel,
.empty,
.list,
.table-wrap,
.document,
.versions-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.panel,
.document,
.versions-section {
    margin-bottom: 24px;
}

.panel.wide {
    padding: 28px;
}

.table-wrap.flat {
    border: 0;
    padding: 0;
}

.empty {
    color: var(--muted);
}

.empty h1 {
    color: var(--text);
    margin-bottom: 10px;
}

.empty p {
    margin: 0;
}

.list {
    display: grid;
    gap: 0;
    padding: 0;
}

.list-item {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

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

time,
.muted,
.hint {
    color: var(--muted);
    font-size: 14px;
}

.hint {
    margin-top: 8px;
}

.document header {
    margin-bottom: 26px;
}

.document-content {
    font-size: 18px;
}

.rich-content h1,
.rich-content h2,
.rich-content h3 {
    margin: 22px 0 10px;
}

.rich-content p,
.rich-content ul,
.rich-content ol,
.rich-content blockquote {
    margin-bottom: 14px;
}

.rich-content blockquote {
    border-left: 4px solid var(--primary);
    color: var(--muted);
    margin-left: 0;
    padding-left: 16px;
}

.admin-edited-text {
    background: var(--change-bg);
    color: var(--change-text);
    padding: 1px 3px;
}

.admin-edit-marker {
    color: var(--accent);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.search-panel {
    margin-bottom: 18px;
}

.search-form {
    display: grid;
    align-items: end;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) auto auto;
}

.search-excerpt {
    color: var(--muted);
    margin: 8px 0 0;
}

.form {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.form-grid.two {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 650;
}

.check-row {
    align-content: end;
    grid-template-columns: auto 1fr;
    gap: 10px;
}

.check-row input {
    width: auto;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
}

textarea {
    resize: vertical;
    min-height: 280px;
}

input:focus,
select:focus,
textarea:focus,
.rich-editor:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(18, 109, 122, 0.14);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 9px 14px;
    text-decoration: none;
}

.button:hover {
    text-decoration: none;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.danger {
    border-color: #d99a95;
    color: var(--error-text);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.notice {
    border-radius: 6px;
    margin: 0 0 16px;
    padding: 12px 14px;
}

.notice.error {
    background: var(--error-bg);
    color: var(--error-text);
}

.notice.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.notice.info {
    background: var(--info-bg);
    color: var(--info-text);
}

.editor-panel {
    scroll-margin-top: 20px;
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.editor-panel.is-highlighted,
.version-card.is-highlighted {
    animation: focusPulse 1.6s ease;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(18, 109, 122, 0.16);
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.editor-toolbar button {
    min-height: 34px;
    padding: 6px 10px;
}

.rich-editor {
    display: block;
    width: 100%;
    min-height: 320px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-weight: 400;
    padding: 14px;
}

.rich-editor:empty::before {
    color: var(--muted);
    content: "Inhalt eingeben";
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    min-height: 26px;
    padding: 3px 9px;
}

.status-open {
    background: #fff7d6;
    border-color: #efd27c;
    color: #735800;
}

.status-reviewed {
    background: #eef6ff;
    border-color: #b9d7f3;
    color: #205174;
}

.status-accepted {
    background: var(--success-bg);
    border-color: #9fd6b4;
    color: var(--success-text);
}

.status-rejected,
.status-hidden {
    background: var(--error-bg);
    border-color: #efb0aa;
    color: var(--error-text);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.inline-action-form {
    display: inline;
    margin: 0;
}

.link-button {
    min-height: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 400;
    padding: 0;
}

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

.separate-actions {
    border-top: 1px solid var(--line);
    margin-top: 20px;
    padding-top: 16px;
}

.version-strip {
    display: grid;
    grid-auto-columns: minmax(280px, 360px);
    grid-auto-flow: column;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
}

.version-card {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    scroll-snap-align: start;
    scroll-margin-inline: 18px;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.version-card.original {
    background: var(--surface-soft);
}

.version-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.diff-preview,
.diff-full {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    padding: 12px;
}

.diff-preview {
    max-height: 150px;
    overflow: auto;
    font-size: 14px;
}

.diff-full {
    margin: 12px 0 22px;
}

.diff-output {
    color: var(--text);
}

.diff-add {
    background: var(--add-bg);
    color: var(--add-text);
    text-decoration: none;
    padding: 1px 3px;
}

.diff-delete {
    background: var(--delete-bg);
    color: var(--delete-text);
    padding: 1px 3px;
    text-decoration: line-through;
}

.diff-change {
    background: var(--change-bg);
    color: var(--change-text);
    padding: 1px 3px;
}

.diff-change del {
    color: var(--delete-text);
    text-decoration: line-through;
}

.diff-change ins {
    color: var(--add-text);
    text-decoration: none;
}

.meta-list {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 24px;
}

.meta-list div {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
}

.meta-list dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.meta-list dd {
    margin: 4px 0 0;
}

.admin-actions-panel {
    display: grid;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    margin-bottom: 24px;
    padding: 16px;
}

.inline-form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-form label {
    min-width: 220px;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-buttons label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 9px 12px;
}

.import-source-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 16px;
}

.import-preview-list {
    display: grid;
    gap: 14px;
}

.import-preview-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.compact-list {
    margin-top: 14px;
}

@keyframes focusPulse {
    0% {
        background-color: #fffdf2;
    }

    100% {
        background-color: var(--surface);
    }
}

@media (max-width: 720px) {
    .topbar,
    .intro,
    .section-heading,
    .document-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel,
    .panel.wide,
    .empty,
    .document,
    .versions-section {
        padding: 20px;
    }

    .form-grid.two,
    .meta-list,
    .search-form {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        overflow-x: auto;
        padding: 0;
    }

    table {
        min-width: 760px;
    }
}
