/*
 * Dokumenten-Portal – Gestaltung wie Brandschatz (zbuero.css): dunkle Kopfleiste mit Lime-Logo, heller grauer Canvas,
 * weiße flache Karten, dunkle Hauptknöpfe, Petrol als Akzent, Schrift Red Hat Display (lokal, keine externen Anfragen).
 * Hell und dunkel nach Systemeinstellung.
 */
@font-face { font-family: "Red Hat Display"; font-weight: 400; font-display: swap; src: url(../fonts/red-hat-display-400.woff2) format("woff2"); }
@font-face { font-family: "Red Hat Display"; font-weight: 500; font-display: swap; src: url(../fonts/red-hat-display-500.woff2) format("woff2"); }
@font-face { font-family: "Red Hat Display"; font-weight: 600 700; font-display: swap; src: url(../fonts/red-hat-display-700.woff2) format("woff2"); }

:root {
    --bg: #ebebe8; --card: #fff; --surface-2: #eeeeeb; --line: #dcdcd8; --card-line: #d6d6d2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .03);
    --text: #232323; --muted: #5f5f5f; --faint: #808080;
    --bar: #2b2b2b; --bar-text: #c4c4c4; --lime: #e2ea4f;
    --teal: #4f7d79; --teal-soft: #e3eeec;
    --open: #c45452; --partial: #b8862b; --done: #4f8a6e; --gray: #808080;
    --btn: #2b2b2b; --btn-hover: #1a1a1a; --btn-text: #fff;
    --radius: 10px; --radius-sm: 6px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f0f; --card: #1f1f1f; --surface-2: #2b2b2b; --line: #363636; --card-line: #333;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5);
        --text: #ececec; --muted: #b0b0b0; --faint: #8a8a8a;
        --bar: #1b1b1b;
        --teal: #7fb3ae; --teal-soft: #22312f;
        --open: #e07b78; --partial: #e0b260; --done: #7fbf9e; --gray: #9a9a9a;
        --btn: #ececec; --btn-hover: #fff; --btn-text: #1b1b1b;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Red Hat Display", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; font-weight: 700; margin: 1.5rem 0 1rem; }
h1 small { font-weight: 400; color: var(--muted); font-size: 1rem; margin-left: .5rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
.muted { color: var(--muted); }

/* Kopfleiste: dunkel wie die Seitenleiste von Brandschatz */
.top { background: var(--bar); color: var(--bar-text); }
.top-inner { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; padding-bottom: 12px; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; }
.brand img { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-size: 15px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.brand-text span { font-size: 13px; color: var(--bar-text); }
.top-user { display: flex; gap: .75rem; align-items: center; font-size: 14px; }
.top .link { color: var(--bar-text); }
.top .link:hover { color: var(--lime); }

/* Karten */
.card { display: block; background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 12px; color: var(--text); }
a.card { text-decoration: none; transition: border-color .15s; }
a.card:hover { border-color: var(--teal); }
.narrow { max-width: 420px; margin: 2.5rem auto; border-radius: 14px; padding: 24px; }
.narrow h1 { margin-top: 0; font-size: 1.5rem; }

/* Formulare */
.form { display: grid; gap: .85rem; }
.form label { display: grid; gap: .3rem; font-size: 13px; font-weight: 500; color: var(--muted); }
.form .check { display: flex; align-items: center; gap: .5rem; font-size: 14px; color: var(--text); }
input[type=checkbox] { accent-color: var(--teal); width: 16px; height: 16px; }
input[type=email], input[type=password], textarea, input[type=file] { min-width: 0; max-width: 100%; font: inherit; font-size: 15px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--text); width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
input[type=file]::file-selector-button { font: inherit; font-weight: 500; margin-right: .75rem; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); cursor: pointer; }
.button { font: inherit; font-weight: 500; background: var(--btn); color: var(--btn-text); border: 0; border-radius: var(--radius-sm); padding: .6rem 1.1rem; cursor: pointer; justify-self: start; }
.button:hover { background: var(--btn-hover); }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.link.danger { color: var(--open); }

/* Meldungen */
.flash { background: var(--card); border: 1px solid var(--card-line); border-left: 4px solid var(--done); padding: .75rem 1rem; border-radius: var(--radius-sm); margin-top: 1rem; }
.flash.is-error { border-left-color: var(--open); }
.flash p { margin: 0; }

/* Liste der Prüfungen und Fortschritt */
.check-row { display: grid; grid-template-columns: 1fr minmax(160px, 220px); gap: .5rem 1rem; align-items: center; }
.check-row span { display: block; color: var(--muted); }
.progress { display: grid; gap: .25rem; }
.progress small { color: var(--muted); font-size: 13px; }
.progress.wide { margin-bottom: 1.25rem; }
.bar { display: block; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--teal); }

/* Status-Pillen: zarte Fläche, farbige Schrift (wie die Badges in Brandschatz) */
.badge { --c: var(--gray); display: inline-block; font-size: 12px; font-weight: 500; padding: .15rem .5rem; border-radius: 5px; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.is-open { --c: var(--open); } .is-partial { --c: var(--partial); } .is-done { --c: var(--done); } .is-not-needed { --c: var(--gray); }

/* Drei Spalten wie DocuStack: Leistungen → Dokumente → Dateien */
.columns { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(190px, .9fr) minmax(320px, 1.6fr); gap: 12px; align-items: start; }
.column { margin: 0; padding: 12px; min-width: 0; }
.column-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 2px 4px 8px; }
.pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pick a { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; text-decoration: none; }
.pick a:hover { background: var(--surface-2); }
.pick a.is-active { background: var(--teal-soft); box-shadow: inset 3px 0 0 var(--teal); }
.pick a.is-active .pick-name { font-weight: 700; }
.pick a.is-muted .pick-name { text-decoration: line-through; color: var(--faint); }
.pick-name { flex: 1 1 auto; min-width: 0; display: grid; font-weight: 500; overflow-wrap: anywhere; }
.pick-name small { font-size: 12px; font-style: italic; font-weight: 400; color: var(--muted); }
.pick-count { flex: none; font-size: 12px; color: var(--muted); }
.dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 999px; background: var(--c, var(--gray)); }
.hint { font-size: 14px; margin: 4px; }
.detail { padding: 18px; display: grid; gap: 12px; }
.document-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.document-head strong { display: block; font-size: 16px; }
.document-head small { display: block; font-size: 13px; }
.description { margin: 0; font-size: 14px; color: var(--muted); white-space: pre-line; }
.files { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.files li { padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: 14px; display: grid; gap: .1rem; }
.file-name { font-weight: 500; overflow-wrap: anywhere; }
.notice, .feedback { margin: 0; padding: .55rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.feedback { border-left: 3px solid var(--partial); }
.upload { min-width: 0; padding-top: .25rem; }
.upload h3 { margin: 0; font-size: 14px; }
.dropzone { position: relative; display: grid; gap: .3rem; justify-items: center; text-align: center; padding: 1.4rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 400; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--teal); background: var(--teal-soft); }
.dropzone:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.dropzone strong { color: var(--teal); }
.dropzone-files { list-style: none; margin: .35rem 0 0; padding: 0; display: grid; gap: .15rem; font-weight: 500; overflow-wrap: anywhere; }
.dropzone-files[hidden] { display: none; }
.button[disabled] { opacity: .6; cursor: progress; }
.inline { display: inline; }
.rejected { color: var(--open); font-weight: 500; }
@media (max-width: 960px) {
    .columns { grid-template-columns: minmax(190px, 1fr) minmax(260px, 1.6fr); }
    .detail { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
    .columns { grid-template-columns: minmax(0, 1fr); }
    .check-row { grid-template-columns: 1fr; }
    .document-head { flex-direction: column; gap: .35rem; }
    h1 small { display: block; margin: .25rem 0 0; }
}

/* Mängel: Einträge der Begehungsprotokolle mit Meldung „behoben“ */
.top-nav { display: flex; gap: .25rem; margin-left: auto; margin-right: 1rem; }
.top-nav a { padding: .35rem .7rem; border-radius: var(--radius-sm); color: inherit; text-decoration: none; font-weight: 500; opacity: .75; }
.top-nav a:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.top-nav a.is-active { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }
.defect-head { display: flex; align-items: flex-start; gap: .75rem; }
.defect-head > div { flex: 1; display: grid; gap: .1rem; min-width: 0; }
.defect-number { flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--surface-2); font-weight: 700; font-size: 13px; }
.defect.is-resolved { opacity: .7; }
.defect .description, .defect .feedback { white-space: pre-line; margin: .6rem 0 0; }
.defect-due { margin: .6rem 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.defect-due.is-late { color: var(--open); }
.defect-report { margin-top: .75rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--partial) 10%, transparent); }
.defect-report p { margin: .2rem 0 0; }
.defect-form { margin-top: .9rem; }
.defect-form > summary { list-style: none; display: inline-block; }
.defect-form > summary::-webkit-details-marker { display: none; }
.defect-form[open] > summary { display: none; }
