/* Herstellerunterlagen — Rückmeldungen (js/rueckmeldungen.js)
 *
 * Baut auf app.css, liste.css und maske.css auf (hd-knopf, hd-marke, hd-leer, hd-daten, hd-dialog).
 * Farben nur über Variablen; Hell/Dunkel kommt aus app.css und liste.css.
 * Bewegung nur als Antwort auf Handlungen: keine Einflug- oder Daueranimation.
 */

:root {
    --rm-arbeit:    #00669F;  --rm-arbeit-bg: #e0f0fa;
}
html.dark, [data-theme="dark"] {
    --rm-arbeit:    #8fd0f6;  --rm-arbeit-bg: #10293a;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light) { --rm-arbeit: #8fd0f6; --rm-arbeit-bg: #10293a; }
}

/* Diese Ansicht nutzt die volle Breite (Liste und Detail nebeneinander). */
.inhalt:has(> #rueckmeldungen:not([hidden])) { max-width: 1680px; }
#rueckmeldungen > h1 { margin-bottom: .15em; }

/* ── Zähler in der Kopfzeile ─────────────────────────────────── */
.hd-rm-zaehler[hidden] { display: none; }
.hd-rm-zaehler { display: inline-flex; margin-left: -4px; }
.hd-rm-zaehler-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
    background: #fff; color: #7a4805; border: 1px solid rgba(255, 255, 255, .7);
    font: 700 .78rem 'Open Sans', sans-serif; text-decoration: none; line-height: 1;
}
.hd-rm-zaehler-link:hover { background: #fdf3e2; }
.hd-rm-zaehler-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Kopf, Kennzahlen, Filter ────────────────────────────────── */
.hd-rm-intro { margin: 0 0 10px; }

.hd-rm-platz { border-radius: var(--radius); background: var(--flaeche); border: 1px solid var(--rand); margin-bottom: 10px; min-height: 24px; }

.hd-rm-kennzahlen { margin-bottom: 10px; }
.hd-rm-kz-reihe {
    display: flex; flex-wrap: wrap; align-items: stretch; gap: 0;
    border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche);
}
.hd-rm-kz {
    display: flex; flex-direction: column; justify-content: center; gap: 1px;
    padding: 6px 14px; border-right: 1px solid var(--rand); min-width: 0;
}
.hd-rm-kz:last-child { border-right: 0; }
.hd-rm-kz-label { font-size: .72rem; font-weight: 600; color: var(--akzent-text); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.hd-rm-kz-wert { font: 700 1.25rem/1.2 'Montserrat', sans-serif; color: var(--text); }
.hd-rm-kz-unter { font-size: .74rem; color: var(--text-leise); white-space: nowrap; }
.hd-rm-alter { display: grid; grid-template-columns: repeat(4, auto); gap: 0 12px; list-style: none; margin: 2px 0 0; padding: 0; }
.hd-rm-alter li { display: flex; flex-direction: column; font-size: .72rem; color: var(--text-leise); white-space: nowrap; }
.hd-rm-alter b { font: 700 .98rem 'Montserrat', sans-serif; color: var(--text); }
.hd-rm-balkenreihe { display: flex; align-items: flex-end; gap: 2px; height: 30px; margin-top: 3px; }
.hd-rm-balken { display: flex; align-items: flex-end; width: 8px; height: 100%; border-bottom: 1px solid var(--rand); }
.hd-rm-balken > span { display: block; width: 100%; background: var(--akzent); border-radius: 2px 2px 0 0; }
.hd-rm-fussnote { margin: 0; padding: 7px 14px; font-size: .78rem; color: var(--text-leise); }

.hd-rm-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 0 10px; }
.hd-rm-gruppe { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.hd-rm-gruppe-label { font-size: .78rem; font-weight: 600; color: var(--text-leise); margin-right: 4px; }
.hd-rm-wahl {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 11px;
    border: 1px solid var(--rand); border-radius: 999px; background: var(--grund); color: var(--text);
    font: 600 .84rem 'Open Sans', sans-serif; cursor: pointer;
}
.hd-rm-wahl:hover { border-color: var(--akzent); }
.hd-rm-wahl.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.hd-rm-wahl-zahl {
    min-width: 1.5em; padding: 0 5px; border-radius: 999px; text-align: center;
    background: var(--flaeche); color: var(--text-leise); font-size: .76rem;
}
.hd-rm-wahl.an .hd-rm-wahl-zahl { background: #fff; color: #7a4805; }
.hd-rm-wahl-neu {
    padding: 0 6px; border-radius: 999px; font-size: .72rem;
    background: var(--akzent-hell); color: var(--akzent-text); border: 1px solid var(--akzent);
}
.hd-rm-wahl.an .hd-rm-wahl-neu { background: #fff; color: #7a4805; border-color: #fff; }
.hd-rm-art { display: inline-flex; align-items: center; gap: 4px; }
.hd-rm-art select {
    min-height: 32px; padding: 3px 8px; border: 1px solid var(--rand); border-radius: 8px;
    background: var(--grund); color: var(--text); font: inherit; font-size: .84rem;
}
.hd-rm-rechts { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.hd-rm-neu { min-width: 34px; justify-content: center; padding-left: 8px; padding-right: 8px; }

/* ── Raster: Liste links, Detail rechts (darunter, wenn es eng wird) ── */
.hd-rm-raster {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); gap: 14px; align-items: start;
}
@media (max-width: 1180px) {
    /* Seitenleiste + Inhalt lassen hier weniger als ~860 px: untereinander. */
    .hd-rm-raster { grid-template-columns: minmax(0, 1fr); }
}
.seitenleiste.schmal ~ .inhalt .hd-rm-raster { grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); }
.hd-rm-raster.hd-rm-einspaltig { grid-template-columns: minmax(0, 1fr); }
.hd-rm-detail[hidden] { display: none; }
@media (max-width: 1000px) {
    .seitenleiste.schmal ~ .inhalt .hd-rm-raster { grid-template-columns: minmax(0, 1fr); }
}

/* Liste */
.hd-rm-listenteil { min-width: 0; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--grund); overflow: clip; }
.hd-rm-listenteil .hd-leer { padding: 28px 18px; }
.hd-rm-tabelle { width: 100%; border-collapse: collapse; font-size: .88rem; }
.hd-rm-tabelle thead th {
    position: sticky; top: var(--kopf-hoehe); z-index: 1;
    padding: 7px 10px; text-align: left; background: var(--flaeche); border-bottom: 1px solid var(--rand);
    font-size: .74rem; font-weight: 600; color: var(--text-leise); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.hd-rm-tabelle abbr { text-decoration: none; cursor: help; }
.hd-rm-tabelle tbody tr { border-bottom: 1px solid var(--rand); cursor: pointer; }
.hd-rm-tabelle tbody tr:last-child { border-bottom: 0; }
.hd-rm-tabelle tbody tr:hover { background: var(--hover); }
.hd-rm-tabelle tbody tr.an { background: var(--akzent-hell); box-shadow: inset 3px 0 0 var(--akzent); }
.hd-rm-tabelle td { padding: 6px 10px; vertical-align: top; }
.hd-rm-nr { white-space: nowrap; }
.hd-rm-zeile-knopf {
    padding: 2px 4px; margin: -2px -4px; border: 0; border-radius: 6px; background: none; cursor: pointer;
    font: 600 .82rem 'Fira Code', monospace; color: var(--link); text-decoration: underline; text-underline-offset: 2px;
}
tr.an .hd-rm-zeile-knopf { color: var(--akzent-text); }
.hd-rm-datum { white-space: nowrap; color: var(--text-leise); font-size: .82rem; }
.hd-rm-text { min-width: 0; width: 100%; }
.hd-rm-kurz {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    overflow-wrap: anywhere; line-height: 1.4;
}
.hd-rm-stand { white-space: nowrap; }
.hd-rm-stand .hd-marke + .hd-marke { margin-left: 4px; }
.hd-rm-ansicht {
    display: inline-flex; align-items: center; gap: 3px; max-width: 100%; margin-top: 1px;
    font-size: .78rem; color: var(--link); text-decoration: none;
}
.hd-rm-ansicht span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.hd-rm-ansicht:hover span { text-decoration: underline; }
.hd-rm-ansicht .icon { flex: none; }

/* Marken dieser Ansicht */
.hd-rm-marke-arbeit { background: var(--rm-arbeit-bg); color: var(--rm-arbeit); }
.hd-rm-marke-neu { background: var(--akzent-hell); color: var(--akzent-text); border: 1px solid var(--akzent); }

/* Detail: bleibt beim Blättern in der Liste stehen und rollt in sich. */
.hd-rm-detail {
    position: sticky; top: calc(var(--kopf-hoehe) + 10px);
    max-height: calc(100vh - var(--kopf-hoehe) - 20px); overflow: auto; overscroll-behavior: contain;
    min-width: 0; padding: 12px 16px 14px; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--grund);
}
.hd-rm-detail:focus { outline: none; }
.hd-rm-detail .hd-leer { padding: 28px 12px; }
.hd-rm-detail h3 { margin: 0 0 4px; font-size: .8rem; font-weight: 600; color: var(--akzent-text); text-transform: uppercase; letter-spacing: .04em; font-family: 'Open Sans', sans-serif; }
.hd-rm-detail-kopf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hd-rm-detail-kopf h2 { margin: 0 4px 0 0; font: 700 1.15rem 'Fira Code', monospace; }
.hd-rm-detail-kopf h2:focus { outline: none; }
.hd-rm-detail-kopf h2:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.hd-rm-zurueck { margin-left: auto; }
.hd-rm-daten { margin: 8px 0 10px; grid-template-columns: max-content 1fr; font-size: .84rem; }
.hd-rm-daten .hd-rm-ansicht { font-size: .84rem; margin: 0; }
.hd-rm-meldung, .hd-rm-antwort { margin: 0 0 10px; }
.hd-rm-textblock { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hd-rm-antwort { padding: 8px 12px; border-left: 3px solid var(--hd-gut); background: var(--flaeche); border-radius: 0 8px 8px 0; }
.hd-rm-antwort .hd-klein { margin: 4px 0 0; }
.hd-rm-antwort-leer { border-left-color: var(--rand); }
.hd-rm-antwort-leer p { margin: 0; }

.hd-rm-bilder { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 10px; }
.hd-rm-bild { margin: 0; min-width: 0; }
.hd-rm-bild figcaption { margin-top: 3px; font-size: .76rem; color: var(--text-leise); }
.hd-rm-bild-knopf {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 100%; height: 132px; padding: 0; overflow: hidden;
    border: 1px solid var(--rand); border-radius: 8px; background: var(--flaeche); cursor: zoom-in;
}
.hd-rm-bild-knopf:hover:not(:disabled) { border-color: var(--akzent); }
.hd-rm-bild-knopf:disabled { cursor: default; }
.hd-rm-bild-knopf img { width: 100%; height: 100%; object-fit: contain; }
.hd-rm-bild-knopf img:not([src]) { display: none; }
.hd-rm-bild-hinweis { padding: 8px; font-size: .78rem; color: var(--text-leise); text-align: center; }

/* Formular (nur Freigeber) */
.hd-rm-formular { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--rand); border-radius: 8px; background: var(--flaeche); }
.hd-rm-stati { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; padding: 0; border: 0; }
.hd-rm-status-wahl { position: relative; display: inline-flex; }
.hd-rm-status-wahl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hd-rm-status-wahl span {
    display: inline-flex; align-items: center; min-height: 32px; padding: 3px 12px;
    border: 1px solid var(--rand); border-radius: 999px; background: var(--grund); color: var(--text);
    font: 600 .84rem 'Open Sans', sans-serif; cursor: pointer;
}
.hd-rm-status-wahl span:hover { border-color: var(--akzent); }
.hd-rm-status-wahl input:checked + span { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.hd-rm-status-wahl input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: 2px; }
.hd-rm-formular .hd-feld { margin: 8px 0 2px; }
.hd-rm-formular textarea { resize: vertical; min-height: 64px; }
.hd-rm-formular .hd-klein { margin: 2px 0 8px; }
.hd-rm-aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
.hd-rm-aktionen .hd-knopf .icon { flex: none; }
.hd-rm-hinweis { display: flex; gap: 6px; align-items: flex-start; margin: 0 0 10px; color: var(--text-leise); font-size: .84rem; }
.hd-rm-hinweis .icon { flex: none; margin-top: 2px; }

/* Verlauf */
.hd-rm-verlauf-block summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--akzent-text); text-transform: uppercase; letter-spacing: .04em; }
.hd-rm-verlauf-block summary:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.hd-rm-verlauf { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--rand); font-size: .84rem; }
.hd-rm-verlauf li { display: flex; gap: 10px; padding: 2px 0; }
.hd-rm-verlauf time { color: var(--text-leise); white-space: nowrap; min-width: 9.5em; }

/* Großansicht eines Bildes */
.hd-rm-gross { max-width: min(1400px, 96vw); width: auto; padding: 12px 14px; }
.hd-rm-gross-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hd-rm-gross-kopf h2 { margin: 0; font-size: 1rem; }
.hd-rm-gross-bild { display: flex; justify-content: center; background: var(--flaeche); border-radius: 8px; }
.hd-rm-gross-bild img { display: block; max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }

/* Fehlerzustand der ganzen Ansicht */
.hd-rm-fehler { border: 1px solid var(--rand); border-radius: var(--radius); }

/* ── Schmal ──────────────────────────────────────────────────── */
@media (max-width: 760px) {
    .hd-rm-kz { flex: 1 1 45%; border-bottom: 1px solid var(--rand); }
    .hd-rm-rechts { margin-left: 0; }
    .hd-rm-detail { position: static; max-height: none; overflow: visible; }
    .hd-rm-tabelle { table-layout: fixed; }
    .hd-rm-tabelle .hd-rm-th-datum, .hd-rm-tabelle td.hd-rm-datum { display: none; }
    .hd-rm-th-nr { width: 104px; }
    .hd-rm-th-melder { width: 58px; }
    .hd-rm-th-stand { width: 96px; }
    .hd-rm-tabelle td, .hd-rm-tabelle th { padding-left: 7px; padding-right: 7px; }
    .hd-rm-stand { white-space: normal; }
    .hd-rm-stand .hd-marke { margin: 0 0 3px; }
    .hd-rm-stand .hd-marke + .hd-marke { margin-left: 0; }
    .hd-rm-alter { grid-template-columns: repeat(2, auto); }
    .hd-rm-daten { grid-template-columns: max-content minmax(0, 1fr); }
}
