/* ===========================================================================
   AV-Board — PPS
   Folgt dem OSP-Muster (NZA 2026 / RMS / FehlerDB): 64-px-Glasheader,
   CI-Farben, Karten, Ampel-Badges. Bewusst schlank gehalten — der Auftrag
   lautet "maximal nützliche Daten ohne überfrachtete Oberfläche".
   =========================================================================== */

:root, [data-theme="light"] {
    --primary: #0080C9;  --primary-dark: #005f97;  --primary-soft: #e6f3fb;
    --accent:  #DC500F;  --accent-dark:  #a83b08;  --accent-soft:  #fdeee5;

    --st-done: #16a34a;  --st-done-soft: #dcfce7;
    --st-work: #d97706;  --st-work-soft: #fef3c7;
    --st-crit: #dc2626;  --st-crit-soft: #fee2e2;
    --st-neutral: #64748b; --st-neutral-soft: #f1f5f9;

    --glass-blur: blur(18px) saturate(150%);
    --hdr-bg: rgba(0,128,201,0.92);
    --hdr-border: rgba(220,80,15,0.22);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(14,30,52,0.08);
    --shadow-xl: 0 12px 36px -8px rgba(0,128,201,0.18);

    --bg: #f4f7fa;  --surface: #ffffff;
    --text: #0f172a;  --text-muted: #475569;  --text-subtle: #94a3b8;
    --border: #e2e8f0;

    --radius-sm: 6px;  --radius: 10px;  --radius-lg: 14px;
    --font-display: 'Montserrat', system-ui, sans-serif;
    --font-body: 'Open Sans', system-ui, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, monospace;
    --page-gutter: 32px;
    --motion: 160ms cubic-bezier(.4,0,.2,1);
}

html.dark, [data-theme="dark"] {
    --primary-soft: #0c2c3f;  --accent-soft: #3a1d0c;
    --st-done-soft: #0f2e1c;  --st-work-soft: #33260a;
    --st-crit-soft: #3a1414;  --st-neutral-soft: #1e293b;
    --hdr-bg: rgba(12,44,63,0.94);
    --bg: #0f172a;  --surface: #1e293b;
    --text: #e2e8f0;  --text-muted: #94a3b8;  --text-subtle: #64748b;
    --border: #334155;
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

#app-header {
    background: var(--hdr-bg);
    border-bottom: 1px solid var(--hdr-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: #fff;
    padding: 0 var(--page-gutter);
    height: 64px;
    display: grid;
    grid-template-columns: minmax(0, auto) 1fr minmax(0, auto);
    align-items: center;
    gap: 0 24px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-md);
}
@media (display-mode: standalone) {
    #app-header { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); }
}

.hdr-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hdr-app-favicon-link {
    width: 40px; height: 40px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 0; padding: 0; cursor: pointer;
    transition: transform var(--motion);
}
.hdr-app-favicon-link:hover { transform: scale(1.06); }
.hdr-app-favicon { width: 40px; height: 40px; object-fit: contain; display: block; }

.hdr-wordmark { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hdr-title-row { display: flex; align-items: center; gap: 10px; }
.hdr-title {
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
    color: #fff; text-decoration: none; letter-spacing: -.015em; white-space: nowrap;
}
.hdr-title:hover { text-decoration: underline; }
.hdr-subtitle {
    font-size: .72rem; color: rgba(255,255,255,.65);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hdr-version-pill {
    font-family: var(--font-mono); font-size: .68rem; font-weight: 600;
    background: rgba(255,255,255,.16); color: #fff;
    border: 1px solid rgba(255,255,255,.22); border-radius: 999px;
    padding: 2px 9px; cursor: pointer; white-space: nowrap;
    transition: background var(--motion);
}
.hdr-version-pill:hover { background: rgba(255,255,255,.28); }
.hdr-release-date {
    font-family: var(--font-mono); font-size: .68rem;
    color: rgba(255,255,255,.55); font-variant-numeric: tabular-nums;
}
.hdr-app-switch-group { display: flex; gap: 6px; align-items: center; }
.hdr-app-switch { opacity: .75; transition: opacity var(--motion); display: flex; }
.hdr-app-switch:hover { opacity: 1; }

.hdr-center { display: flex; justify-content: center; gap: 10px; }
.hdr-right  { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.hdr-icon-btn {
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
    color: #fff; border-radius: var(--radius-sm);
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background var(--motion);
}
.hdr-icon-btn:hover { background: rgba(255,255,255,.28); }
.hdr-icon-lg { width: 40px; height: 40px; }
.hdr-icon-feedback { background: var(--accent); border-color: var(--accent-dark); }
.hdr-icon-feedback:hover { background: var(--accent-dark); }

.hdr-anmelden {
    font-family: var(--font-body); font-size: .8rem; font-weight: 600;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
    color: #fff; border-radius: var(--radius-sm); padding: 6px 14px; cursor: pointer;
    transition: background var(--motion); white-space: nowrap;
}
.hdr-anmelden:hover { background: rgba(255,255,255,.3); }

/* Anmelde-Schirm statt technischer Fehlermeldung, wenn das Token fehlt. */
.anmelde-schirm {
    max-width: 460px; margin: 60px auto; text-align: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 36px 28px; box-shadow: var(--shadow-md);
}
.anmelde-schirm h1 { font-size: 1.25rem; margin-bottom: 10px; }
.anmelde-schirm p { color: var(--text-muted); font-size: .9rem; margin: 0 0 20px; }

.hdr-user-badge {
    font-family: var(--font-mono); font-size: .74rem; font-weight: 600;
    background: rgba(255,255,255,.16); border-radius: 999px; padding: 3px 10px;
}
.hdr-clock {
    font-family: var(--font-mono); font-size: .7rem;
    color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */

#breadcrumb {
    padding: 10px var(--page-gutter);
    font-size: .8rem; color: var(--text-muted);
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    border-bottom: 1px solid var(--border); background: var(--surface);
}
#breadcrumb a { color: var(--primary); text-decoration: none; }
#breadcrumb a:hover { text-decoration: underline; }
#breadcrumb .trenner { color: var(--text-subtle); }

/* ── Layout ──────────────────────────────────────────────────────────────── */

main { padding: 24px var(--page-gutter) 56px; max-width: 1400px; margin: 0 auto; }

h1 { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 28px 0 12px; letter-spacing: -.01em; }
h3 { font-family: var(--font-display); font-size: .9rem; margin: 0 0 8px; }
.seiten-kopf { margin-bottom: 20px; }
.seiten-kopf .unterzeile { color: var(--text-muted); font-size: .88rem; }

.lade { color: var(--text-subtle); padding: 40px 0; text-align: center; }
.leer { color: var(--text-subtle); font-style: italic; padding: 12px 0; }

/* ── Karten ──────────────────────────────────────────────────────────────── */

.karten { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.karte {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
    display: block; transition: box-shadow var(--motion), transform var(--motion);
}
a.karte:hover { box-shadow: var(--shadow-xl); transform: translateY(-2px); }
.karte-titel { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin-bottom: 2px; }
.karte-zeile { display: flex; justify-content: space-between; gap: 10px; font-size: .82rem; padding: 3px 0; }
.karte-zeile .label { color: var(--text-muted); }
.karte-zeile .wert { font-weight: 600; font-variant-numeric: tabular-nums; }

/* KPI-Kacheln */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 8px; }
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px; text-align: center;
}
.kpi .zahl { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi .text { font-size: .74rem; color: var(--text-muted); }
.kpi.gut .zahl { color: var(--st-done); }
.kpi.warn .zahl { color: var(--st-work); }
.kpi.krit .zahl { color: var(--st-crit); }

/* ── Badges / Ampel ──────────────────────────────────────────────────────── */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .72rem; font-weight: 600; padding: 2px 9px;
    border-radius: 999px; white-space: nowrap;
    background: var(--st-neutral-soft); color: var(--st-neutral);
}
.badge.gruen { background: var(--st-done-soft); color: var(--st-done); }
.badge.gelb  { background: var(--st-work-soft); color: var(--st-work); }
.badge.rot   { background: var(--st-crit-soft); color: var(--st-crit); }
.badge.blau  { background: var(--primary-soft); color: var(--primary-dark); }
.badge.orange{ background: var(--accent-soft); color: var(--accent-dark); }

.punkt { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.punkt.gruen { background: var(--st-done); }
.punkt.gelb  { background: var(--st-work); }
.punkt.rot   { background: var(--st-crit); }
.punkt.grau  { background: var(--st-neutral); }

/* ── Tabellen ────────────────────────────────────────────────────────────── */

.tabelle-rahmen {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th {
    text-align: left; font-family: var(--font-display); font-weight: 600; font-size: .76rem;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    background: var(--bg); position: sticky; top: 0;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--primary-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.mono { font-family: var(--font-mono); font-size: .8rem; }
td.kein { color: var(--text-subtle); }

/* ── Tabellen-Norm (Lauf 0, V-8) ─────────────────────────────────────────────
   Eine Regel für alle Tabellen des Boards, auch für die, die noch kommen:

   1. Zahlen stehen neutral. Farbe bekommt nur, was den Bediener zum Handeln
      zwingt — offene Punkte, Fehlteile, Blocker.
   2. Kein grüner Punkt für „ist in Ordnung". Erledigtes ist ruhig.
   3. Zeilen sind kompakt: 6 statt 9 Pixel Innenabstand, damit mehr Zeilen
      auf den Schirm passen, ohne dass es eng wirkt.
   4. Erklärungen, Rechenwege und Belege stehen hinter einem Info-Zeichen,
      nicht als eigene Zeile unter dem Wert.
   ------------------------------------------------------------------------- */

.tab th, table.eng th { padding: 7px 10px; }
.tab td, table.eng td { padding: 6px 10px; vertical-align: middle; line-height: 1.4; }

/* Neutrale Zahl: der Regelfall. */
.wert-zahl { font-variant-numeric: tabular-nums; color: var(--text); }
/* Handlungsbedarf: gelb, wenn jemand ran muss; rot, wenn es blockiert. */
.wert-zahl.offen { color: var(--st-work); font-weight: 600; }
.wert-zahl.kritisch { color: var(--st-crit); font-weight: 600; }
.wert-zahl.ruhig { color: var(--text-subtle); }

/* Info-Zeichen mit Tooltip — trägt Rechenweg, Beleg oder Begründung. */
.info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; margin-left: 5px; vertical-align: middle;
    border: 1px solid var(--border); border-radius: 50%;
    font-family: var(--font-body); font-size: .66rem; font-weight: 700;
    color: var(--text-subtle); cursor: help; flex-shrink: 0;
}
.info:hover { color: var(--primary); border-color: var(--primary); }

/* Formularfelder überall gleich — vorher übernahmen einzelne Felder das
   Weiß des Browsers und leuchteten im dunklen Board (FB-3, 07.09.2026). */
select, input[type="text"], input[type="search"], input[type="number"],
input[type="date"], textarea {
    font-family: var(--font-body); font-size: .8rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 4px 7px;
}
select:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
select option { background: var(--surface); color: var(--text); }

/* ── Anforderungs-Block (Kundenseite) ────────────────────────────────────── */

.regel {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--st-neutral);
    border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 8px;
}
.regel.nein  { border-left-color: var(--st-crit); }
.regel.frei  { border-left-color: var(--st-done); }
.regel.ruecksprache { border-left-color: var(--st-work); }
.regel-kopf { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 3px; }
.regel-titel { font-weight: 600; font-size: .9rem; }
.regel-text { font-size: .84rem; color: var(--text-muted); }
.regel-beleg { font-size: .72rem; color: var(--text-subtle); margin-top: 5px; font-family: var(--font-mono); }
.merkmale { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.merkmal { font-size: .7rem; background: var(--bg); border: 1px solid var(--border);
           border-radius: var(--radius-sm); padding: 1px 7px; color: var(--text-muted); }

.hinweis-box {
    background: var(--accent-soft); border: 1px solid var(--accent);
    border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: .86rem;
}
.hinweis-box strong { color: var(--accent-dark); }
.hinweis-box.info { background: var(--primary-soft); border-color: var(--primary); }
.hinweis-box.info strong { color: var(--primary-dark); }

/* Ein Hinweis auf etwas Offenes führt dorthin, wo man es erledigt. */
.hinweis-link {
    display: inline-block; margin-left: 6px; white-space: nowrap;
    color: var(--accent-dark); font-weight: 600; text-decoration: none;
    border-bottom: 1px solid currentColor;
}
.hinweis-box.info .hinweis-link { color: var(--primary-dark); }
.hinweis-link:hover { opacity: .75; }

/* Kurzes Aufblitzen der Prüf-Knöpfe, damit das Sprungziel sichtbar wird. */
.aktionen.hervorgehoben {
    animation: aufblitzen 2s ease-out;
    border-radius: var(--radius); padding: 6px; margin-left: -6px;
}
@keyframes aufblitzen {
    0%, 55% { background: var(--st-work-soft); box-shadow: 0 0 0 3px var(--st-work-soft); }
    100%    { background: transparent; box-shadow: none; }
}


/* ── Aktionen ────────────────────────────────────────────────────────────── */

.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.btn {
    font-family: var(--font-body); font-size: .84rem; font-weight: 600;
    border-radius: var(--radius-sm); padding: 7px 15px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    transition: background var(--motion), border-color var(--motion);
}
.btn:hover { background: var(--bg); }
.btn.primaer { background: var(--primary); border-color: var(--primary-dark); color: #fff; }
.btn.primaer:hover { background: var(--primary-dark); }
.btn.gruen { background: var(--st-done); border-color: var(--st-done); color: #fff; }
.btn.gruen:hover { filter: brightness(.92); }
.btn.gelb { background: var(--st-work); border-color: var(--st-work); color: #fff; }
.btn.gelb:hover { filter: brightness(.92); }
.link-btn {
    background: none; border: 0; color: var(--primary);
    cursor: pointer; font-size: inherit; font-family: inherit; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ── Fuß, Modal, Toast ───────────────────────────────────────────────────── */

#app-footer {
    border-top: 1px solid var(--border); background: var(--surface);
    padding: 12px var(--page-gutter);
    display: flex; justify-content: space-between; align-items: center;
    font-size: .78rem; color: var(--text-muted); flex-wrap: wrap; gap: 8px;
}

dialog {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 0; max-width: 620px; width: 92vw; max-height: 82vh;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-xl);
}
dialog::backdrop { background: rgba(15,23,42,.45); backdrop-filter: blur(3px); }
.modal-kopf {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-kopf h2 { margin: 0; font-size: 1.05rem; }
.modal-schliessen {
    background: none; border: 0; font-size: 1.6rem; line-height: 1;
    cursor: pointer; color: var(--text-muted); padding: 0 4px;
}
#version-liste { padding: 16px 20px; overflow-y: auto; max-height: 62vh; }
.version-eintrag { margin-bottom: 18px; }
.version-eintrag .kopf { display: flex; align-items: baseline; gap: 10px; }
.version-eintrag .nr { font-family: var(--font-mono); font-weight: 700; color: var(--primary); }
.version-eintrag .datum { font-size: .76rem; color: var(--text-subtle); }
.version-eintrag .titel { font-weight: 600; font-size: .9rem; margin: 2px 0 4px; }

#toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(120%);
    background: var(--text); color: var(--bg); padding: 11px 20px;
    border-radius: var(--radius); font-size: .86rem; box-shadow: var(--shadow-xl);
    transition: transform var(--motion), visibility var(--motion);
    z-index: 300; max-width: 90vw;
    /* Ohne visibility bliebe der Balken im Seiten-Screenshot und für
       Screenreader präsent, obwohl er aus dem Bild geschoben ist. */
    visibility: hidden;
}
#toast.sichtbar { transform: translateX(-50%) translateY(0); visibility: visible; }
#toast.fehler { background: var(--st-crit); color: #fff; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    :root { --page-gutter: 16px; }
    .hdr-subtitle, .hdr-release-date, .hdr-app-switch-group { display: none; }
}
@media (max-width: 600px) {
    :root { --page-gutter: 12px; }
    #app-header { gap: 0 10px; }
    .hdr-clock { display: none; }
    h1 { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
@media print {
    #app-header, #breadcrumb, #app-footer, .aktionen { display: none; }
    body { background: #fff; }
    .karte, .tabelle-rahmen { break-inside: avoid; }
}

/* ===========================================================================
   Verifikations-Arbeitsplatz
   Zwei Spalten: links die gelesenen Werte, rechts das Blatt — beides
   gleichzeitig sichtbar, denn Prüfen heißt Vergleichen. Die Zeichnung bleibt
   beim Blättern stehen, damit der Blick nicht springt.
   =========================================================================== */

/* Volle Breite nur dort, wo zwei Spalten nebeneinander stehen. */
body.breit main { max-width: none; padding-left: 20px; padding-right: 20px; }

.akte-kopf { margin-bottom: 14px; }
.akte-titel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.akte-titel h1 { margin: 0; font-size: 1.45rem; }
.akte-unterzeile { color: var(--text-muted); font-size: .9rem; margin-top: 2px; }

/* Kennzahlen als Zeile statt als Kachelreihe — sie sind Beiwerk, nicht Hauptsache. */
.akte-leiste {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
    padding: 10px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.zahlenreihe { display: flex; gap: 20px; flex-wrap: wrap; font-size: .84rem; color: var(--text-muted); }
.zahlenreihe b { font-family: var(--font-display); font-size: 1.05rem; color: var(--text); margin-right: 3px; }
.zahlenreihe .gut b  { color: var(--st-done); }
.zahlenreihe .warn b { color: var(--st-work); }
.zahlenreihe .krit b { color: var(--st-crit); }
.akte-aktionen { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.verifiziert-vermerk { font-size: .82rem; color: var(--st-done); font-weight: 600; }

/* Klappbare Hinweise — sie sollen verfügbar sein, aber nicht den Blick belegen. */
.klappe {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 14px;
}
.klappe > summary {
    cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: .88rem;
    font-family: var(--font-display); list-style: none;
    display: flex; align-items: center; gap: 8px;
}
.klappe > summary::-webkit-details-marker { display: none; }
.klappe > summary::before {
    content: '▸'; color: var(--text-subtle); transition: transform var(--motion);
}
.klappe[open] > summary::before { transform: rotate(90deg); }
.klappe > summary:hover { color: var(--primary); }
.klappe-inhalt { padding: 0 14px 12px; border-top: 1px solid var(--border); padding-top: 12px; }

ul.punkte { margin: 6px 0; padding-left: 20px; font-size: .85rem; color: var(--text-muted); }
ul.punkte li { margin-bottom: 4px; }

.block-intro {
    margin: 0 0 12px; font-size: .82rem; line-height: 1.6; color: var(--text-muted);
}
.block-intro b { color: var(--text); }

/* Stücklistenposition: Zustand der Materialentscheidung + die Alternative.
   Dieselbe Farbsprache wie bei den Zeichnungswerten — bestätigt grün hinterlegt,
   verworfen ausgegraut, aber NICHT ausgeblendet: Eine Position verschwindet
   nicht, nur weil ihre Zuordnung verworfen wurde. */
.pos-zeile.bestaetigt { background: rgba(22,163,74,.05); }
.pos-zeile.verworfen  { background: var(--accent-soft); }
.pos-zeile.verworfen .pos-bez, .pos-zeile.verworfen .mono { color: var(--text-subtle); }

/* Arbeitsplan: Arbeitsgänge nach Fertigungsphasen. Gestrichene Schritte
   bleiben stehen, durchgestrichen — sie belegen eine Entscheidung. */
.arbeitsplan tr.phasenzeile td {
    background: var(--primary-soft); font-family: var(--font-display);
    font-weight: 600; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--primary); padding: 5px 10px;
}
/* Merkmale, aus denen die Arbeitsgangwahl folgt — sie machen den Plan prüfbar. */
.plan-merkmale {
    margin-bottom: 12px; padding: 9px 12px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
    display: flex; flex-direction: column; gap: 3px;
}
.pm-zeile { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px;
    font-size: .8rem; color: var(--text-muted); }
.pm-label {
    font-family: var(--font-display); font-weight: 600; font-size: .7rem;
    text-transform: uppercase; letter-spacing: .03em; color: var(--text-subtle);
}
.arbeitsplan tr.uebernommen { background: rgba(22,163,74,.05); }
.arbeitsplan tr.gestrichen td:nth-child(2) { text-decoration: line-through; }
.arbeitsplan tr.gestrichen { opacity: .6; }

/* Prüfplan: ein Merkmal je Karte. Der Sollwert steht NIE hier — die Marke
   „Sollwert aus BMM" sagt, wo er herkommt (CLAUDE.md §2). */
.pruefmerkmal {
    padding: 9px 0; border-top: 1px solid var(--border);
}
.pruefmerkmal:first-child { border-top: 0; padding-top: 2px; }
.pm-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.pm-titel {
    font-family: var(--font-display); font-weight: 600; font-size: .86rem;
    color: var(--text);
}
.pm-text { margin-top: 3px; font-size: .82rem; line-height: 1.55; color: var(--text-muted); }
.pm-grundlage { margin-top: 2px; font-size: .74rem; color: var(--text-subtle); }
.pruefmerkmal .mehr { margin-top: 4px; }
.pruefmerkmal .mehr > summary { font-size: .7rem; }

/* Selbstkosten je Staffel — beide Varianten nebeneinander, Vorbehalte oben.
   Ein Preis von 2015 rechnet durch und sieht aus wie ein Ergebnis; wer die
   Zahlen liest, muss vorher wissen, worauf sie beruhen. */
.kalk-vorbehalte { margin-bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.kalk-vorbehalt {
    font-size: .8rem; line-height: 1.5; padding: 6px 10px;
    border-left: 3px solid var(--border); border-radius: 0 6px 6px 0;
    background: var(--bg); color: var(--text-muted);
}
.kalk-vorbehalt.preis    { border-left-color: var(--st-work); }
.kalk-vorbehalt.werkzeug { border-left-color: var(--accent); color: var(--accent-dark); }
.kalk-vorbehalt.luecke   { border-left-color: var(--text-subtle); }

.kalk-staffeln { width: 100%; border-collapse: collapse; font-size: .84rem; }
.kalk-staffeln th {
    background: var(--primary); color: #fff; font-family: var(--font-display);
    font-weight: 600; font-size: .74rem; padding: 6px 10px; text-align: left;
    border-right: 1px solid rgba(255,255,255,.22);
}
.kalk-staffeln thead tr:first-child th { text-align: center; }
.kalk-staffeln th.num, .kalk-staffeln td.num { text-align: right; }
.kalk-staffeln td {
    padding: 7px 10px; border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.kalk-staffeln tbody tr:nth-child(even) { background: var(--bg); }
.kalk-staffeln td.stark { font-weight: 700; color: var(--text); }
.kalk-staffeln td.krit { color: var(--st-crit); }
.kalk-staffeln td.gut  { color: var(--st-done); }

.kalk-fuss {
    margin: 9px 0 4px; font-size: .78rem; line-height: 1.55; color: var(--text-muted);
}
.kalk-stand {
    margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--border);
    font-size: .74rem; color: var(--text-subtle);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.kalk-stand .btn.klein { margin-left: auto; padding: 3px 11px; font-size: .72rem; }
.schlicht tr.summe td { border-top: 2px solid var(--border); }

.pos-verbrauch {
    margin-top: 5px; padding: 5px 8px; border-left: 3px solid var(--st-done);
    background: var(--bg); border-radius: 0 6px 6px 0;
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px;
}
.pos-verbrauch.offen { border-left-color: var(--accent); }
.pos-verbrauch.offen .alt-marke { color: var(--accent-dark); }
.pos-verbrauch .btn.klein { padding: 2px 9px; font-size: .7rem; border-radius: 5px; }
.stufe-knopf { align-self: flex-start; margin-top: 5px; padding: 3px 11px; font-size: .72rem; }

/* Variante 2 als eigene Zeile in denselben Spalten — nur so ist das Paar
   vergleichbar. Der linke Balken bindet sie sichtbar an die Zeile darüber. */
.alt-zeile > td {
    padding-top: 3px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border); background: var(--bg);
    font-size: .8rem; vertical-align: top;
}
.alt-zeile > td:nth-child(2) { box-shadow: inset 3px 0 0 var(--primary); }
.pos-zeile:has(+ .alt-zeile) > td { border-bottom: 0; }
.alt-marke {
    font-family: var(--font-display); font-weight: 600; font-size: .66rem;
    text-transform: uppercase; letter-spacing: .04em; color: var(--primary);
    margin-right: 7px;
}
.alt-grund { font-size: .78rem; color: var(--text-muted); }
.alt-zeile .mehr { margin-top: 3px; }
.alt-zeile .mehr > summary { font-size: .68rem; }
.alt-zeile .mehr p {
    margin: 4px 0 0; font-size: .76rem; line-height: 1.55; color: var(--text-muted);
    max-width: 48ch;
}

/* Fortschritt eines Blattes: die vier Stufen des Anfrage-Prozesses.
   Die erste offene Stufe wird hervorgehoben — sie ist der nächste Handgriff. */
.fortschritt {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px; background: var(--border);
    border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; margin: 14px 0 4px;
}
.stufe {
    background: var(--surface); padding: 11px 14px;
    display: flex; flex-direction: column; gap: 2px;
    border-top: 3px solid transparent;
}
.stufe-zeichen {
    font-family: var(--font-mono); font-size: .82rem; line-height: 1;
    color: var(--text-subtle);
}
.stufe.fertig .stufe-zeichen { color: var(--st-done); }
.stufe.offen  .stufe-zeichen { color: var(--accent); }
.stufe-titel {
    font-family: var(--font-display); font-weight: 600; font-size: .82rem;
    color: var(--text);
}
.stufe-text { font-size: .76rem; color: var(--text-muted); }
.stufe.wartet .stufe-titel, .stufe.wartet .stufe-text { color: var(--text-subtle); }
.stufe.dran { border-top-color: var(--accent); background: var(--accent-soft); }
.stufe.dran .stufe-titel { color: var(--accent-dark); }
.stufe[role="button"] { cursor: pointer; }
.stufe[role="button"]:hover { background: var(--bg); }
.stufe.dran[role="button"]:hover { filter: brightness(.97); }
.stufe-sprung {
    margin-top: 3px; font-size: .74rem; font-weight: 600; color: var(--primary);
}

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

/* ERP-Lage je Stücklistenposition: Verfügbarkeit und Lieferzeit.
   Beides trägt einen Vorbehalt — eine veraltete Lieferzeit wird gedimmt und
   datiert statt weggelassen, damit niemand sie für aktuell hält. */
.erp-stand {
    margin-left: auto; display: inline-flex; align-items: center; gap: 10px;
    font-size: .74rem; color: var(--text-subtle);
}
.erp-stand .btn.klein {
    padding: 3px 10px; font-size: .72rem; border-radius: 6px;
}
.lieferzeit { font-size: .82rem; color: var(--text); white-space: nowrap; }
.lieferzeit.veraltet { color: var(--text-subtle); text-decoration: underline dotted; }
.subtil { color: var(--text-subtle); }

/* Offene Punkte: Marke links, Kernaussage rechts, Wortlaut am Pluszeichen.
   Die feste Markenspalte macht die Liste scannbar — man findet die Position,
   um die es geht, ohne den Satz zu lesen. */
.hinweis-eintrag {
    display: grid; grid-template-columns: 190px minmax(0, 1fr);
    gap: 4px 14px; align-items: baseline;
    padding: 7px 0; border-top: 1px solid var(--border);
}
.hinweis-eintrag:first-child { border-top: 0; padding-top: 0; }
.hinweis-marke {
    font-family: var(--font-display); font-weight: 600; font-size: .7rem;
    text-transform: uppercase; letter-spacing: .03em; color: var(--text-subtle);
    line-height: 1.45; word-break: break-word;
}
.hinweis-eintrag > .hinweis-marke:first-child + .hinweis-text { grid-column: 2; }
.hinweis-eintrag > .hinweis-text:first-child { grid-column: 1 / -1; }
.hinweis-text { font-size: .82rem; line-height: 1.55; color: var(--text-muted); }
.hinweis-eintrag > .mehr { grid-column: 2; margin-top: 0; }
.hinweis-eintrag > .hinweis-text:first-child ~ .mehr { grid-column: 1 / -1; }
.hinweis-eintrag > .mehr > summary { font-size: .68rem; }
.hinweis-eintrag > .mehr p {
    margin: 5px 0 0; font-size: .8rem; line-height: 1.6; color: var(--text);
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px;
}
.hinweis-eintrag.warnung .hinweis-marke,
.hinweis-eintrag.warnung .hinweis-text { color: var(--accent-dark); }

@media (max-width: 900px) {
    .hinweis-eintrag { grid-template-columns: minmax(0, 1fr); }
    .hinweis-eintrag > .mehr, .hinweis-eintrag > .hinweis-text { grid-column: 1; }
}
.warnung { color: var(--accent-dark); }

/* ── Zwei Spalten ────────────────────────────────────────────────────────── */

.arbeitsplatz {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 40%);
    gap: 18px; align-items: start;
}
.spalte-daten { min-width: 0; }
.tabellen-kopf {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.tabellen-kopf h2 { margin: 0; font-size: 1rem; }
.tabellen-hinweis { font-size: .76rem; color: var(--text-subtle); }

/* Die Zeichnung bleibt stehen — sie ist der Bezugspunkt der ganzen Prüfung. */
.spalte-zeichnung {
    position: sticky; top: 84px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.zeichnung-kopf {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 12px; border-bottom: 1px solid var(--border);
    font-family: var(--font-display); font-weight: 600; font-size: .86rem;
}
.mini-knopf {
    background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
    border-radius: var(--radius-sm); padding: 4px 10px; font-size: .76rem;
    cursor: pointer; font-family: var(--font-body); transition: background var(--motion);
}
.mini-knopf:hover { background: var(--primary-soft); color: var(--primary-dark); }
.zeichnung-buehne { max-height: calc(100vh - 220px); overflow: auto; background: #fff; }
.zeichnung-fuss {
    padding: 8px 12px; border-top: 1px solid var(--border);
    font-size: .78rem; color: var(--text-muted); min-height: 34px;
}
.fuss-quelle { color: var(--text-subtle); font-family: var(--font-mono); font-size: .72rem; }

/* ── Blatt mit Markierungen ──────────────────────────────────────────────── */

.blatt { position: relative; display: inline-block; min-width: 100%; }
.blatt img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.marken { position: absolute; inset: 0; pointer-events: none; }

/* Ruhende Marke: nur ein zarter Rahmen — 76 Kästen dürfen das Blatt nicht zupflastern. */
.marke {
    position: absolute; border: 1.5px solid rgba(0,128,201,.42);
    border-radius: 2px; background: rgba(0,128,201,.07);
    transition: all var(--motion);
}

/* Gewählte Marke: gelb hinterlegt wie ein Textmarker.
   Halbdurchsichtig, damit der Wert darunter lesbar bleibt — die Markierung
   soll ihn zeigen, nicht verdecken. Gelb hebt sich zugleich am deutlichsten
   von einer schwarz-weißen Zeichnung ab. */
.marke.aktiv {
    border: 2px solid rgba(202,138,4,.95);
    background: rgba(255,214,0,.34);
    border-radius: 3px;
    box-shadow: 0 0 0 3px rgba(255,214,0,.30), 0 0 16px rgba(202,138,4,.45);
    animation: markePuls 1.5s ease-out;
    /* Mischmodus lässt die Linien der Zeichnung durchscheinen. */
    mix-blend-mode: multiply;
}
html.dark .marke.aktiv, [data-theme="dark"] .marke.aktiv { mix-blend-mode: normal; }

@keyframes markePuls {
    0%   { box-shadow: 0 0 0 12px rgba(255,214,0,0); }
    35%  { box-shadow: 0 0 0 9px rgba(255,214,0,.5); }
    100% { box-shadow: 0 0 0 3px rgba(255,214,0,.30), 0 0 16px rgba(202,138,4,.45); }
}

/* ── Positionstabelle ────────────────────────────────────────────────────── */

table.positionen td { padding: 7px 10px; }
.pos-zeile { cursor: pointer; transition: background var(--motion); }
.pos-zeile:hover { background: var(--primary-soft); }
/* Die gewählte Zeile trägt dieselbe Farbe wie ihre Marke auf dem Blatt —
   so ist auf einen Blick klar, was zusammengehört. */
.pos-zeile.aktiv { background: rgba(255,214,0,.20); box-shadow: inset 3px 0 0 rgba(202,138,4,.95); }
.pos-zeile:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.pos-zeile.ohne-fundstelle .pos-bez::after {
    content: ' ⃰'; color: var(--st-work); font-weight: 700;
    /* Sternchen heißt: auf dem Blatt nicht auffindbar — von Hand suchen. */
}
.pos-bez { font-weight: 600; font-size: .84rem; }
.pos-typ { font-size: .74rem; color: var(--text-subtle); }
td.klein, .klein { font-size: .74rem; }
/* Eine Stufe unter .klein: Beiwerk, das die Hauptaussage nicht verdrängen
   darf — die Belegjahre der Lieferzeit, das Wort „durchschnittlich“ (AP-6). */
td.winzig, .winzig { font-size: .66rem; }

/* ── Vollbild: zoomen und drehen ─────────────────────────────────────────── */

.vollbild {
    position: fixed; inset: 0; z-index: 500;
    background: #0f172a; display: flex; flex-direction: column;
}
.vollbild-leiste {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 16px; background: rgba(15,23,42,.96);
    border-bottom: 1px solid rgba(255,255,255,.12); color: #fff; gap: 16px;
}
.vollbild-titel {
    font-family: var(--font-display); font-weight: 600; font-size: .9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vollbild-knoepfe { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.vollbild-knoepfe button {
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
    color: #fff; border-radius: var(--radius-sm); min-width: 34px; height: 32px;
    padding: 0 10px; cursor: pointer; font-size: .9rem; font-family: var(--font-body);
    transition: background var(--motion);
}
.vollbild-knoepfe button:hover { background: rgba(255,255,255,.26); }
.zoom-anzeige {
    font-family: var(--font-mono); font-size: .76rem; color: rgba(255,255,255,.75);
    min-width: 52px; text-align: center; font-variant-numeric: tabular-nums;
}
.vollbild-buehne {
    flex: 1; overflow: auto; padding: 20px;
    display: grid; place-items: center;
}
.vollbild-buehne .blatt {
    /* Drehpunkt in der Mitte: So bleibt das Blatt beim Drehen zentriert,
       statt aus dem sichtbaren Bereich zu wandern. */
    transform-origin: center center; transition: transform var(--motion);
    width: min(96%, 1900px);
}
/* Bei Vierteldrehung tauschen Breite und Höhe die Rollen — sonst überragt das
   quer gestellte Blatt oben und unten die Bühne. */
.vollbild-buehne .blatt.quer { width: min(72vh, 1200px); margin: 22vh 0; }
.vollbild-buehne .blatt img { cursor: default; }

/* ── Schmale Bildschirme: Spalten untereinander ──────────────────────────── */

@media (max-width: 1180px) {
    .arbeitsplatz { grid-template-columns: 1fr; }
    .spalte-zeichnung { position: static; order: -1; }
    .zeichnung-buehne { max-height: 52vh; }
}

/* ===========================================================================
   Kundenakte
   Gestaltungsregel: Eine Zeile sagt, was gilt. Alles Weitere — Bedingung,
   Beleg, Herleitung — steht dahinter und öffnet sich auf Klick. Die Seite ist
   ein Nachschlagewerk, kein Fließtext.
   =========================================================================== */

.kunde-kopf {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 24px; flex-wrap: wrap; margin-bottom: 16px;
}
.kunde-kopf h1 { margin: 0; font-size: 1.5rem; }
.kunde-unterzeile { color: var(--text-muted); font-size: .88rem; margin-top: 2px; }
.kunde-zahlen { display: flex; gap: 22px; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); }
.kunde-zahlen b {
    display: block; font-family: var(--font-display); font-size: 1.35rem;
    color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums;
}
.kunde-zahlen .warn b { color: var(--st-work); }

/* Die Rangfolge als Band über beiden Spalten — sie entscheidet jeden Widerspruch. */
.rangfolge {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: linear-gradient(90deg, var(--primary-soft), transparent 70%);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 12px 18px; margin-bottom: 18px;
}
.rangfolge-label {
    font-family: var(--font-display); font-weight: 700; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .07em; color: var(--primary-dark);
    white-space: nowrap;
}
.rangfolge-kette {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 0; padding: 0; list-style: none; counter-reset: stufe;
}
.rangfolge-kette li {
    display: flex; align-items: center; gap: 8px;
    font-size: .86rem; counter-increment: stufe;
}
.rangfolge-kette li::before {
    content: counter(stufe);
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary); color: #fff;
    font-family: var(--font-mono); font-size: .68rem; font-weight: 700;
    display: grid; place-items: center;
}
.rangfolge-kette li:not(:last-child)::after {
    content: '›'; color: var(--text-subtle); font-size: 1.1rem; margin-left: 4px;
}
.rangfolge-mehr { margin-left: auto; }

/* Zwei Spalten über die volle Breite. */
.kunde-raster {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px; align-items: start; margin-bottom: 18px;
}
.kunde-spalte { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ── Klappbarer Block ────────────────────────────────────────────────────── */

.block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.block > summary {
    cursor: pointer; padding: 11px 16px; list-style: none;
    display: flex; align-items: center; gap: 10px;
    border-left: 3px solid transparent; transition: all var(--motion);
}
.block > summary::-webkit-details-marker { display: none; }
.block > summary::before {
    content: '▸'; color: var(--text-subtle); font-size: .8rem;
    transition: transform var(--motion); flex-shrink: 0;
}
.block[open] > summary { border-left-color: var(--primary); background: var(--bg); }
.block[open] > summary::before { transform: rotate(90deg); }
.block > summary:hover { background: var(--primary-soft); }
.block-titel {
    font-family: var(--font-display); font-weight: 600; font-size: .92rem;
    letter-spacing: -.005em;
}
.block-zahl {
    margin-left: auto; font-family: var(--font-mono); font-size: .72rem;
    color: var(--text-muted); background: var(--bg);
    border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px;
}
.block-inhalt { padding: 14px 16px 16px; border-top: 1px solid var(--border); }

/* ── Eintrag: Kernaussage plus Aufklappbares ─────────────────────────────── */

.eintrag {
    padding: 9px 0; border-bottom: 1px solid var(--border);
}
.eintrag:last-child { border-bottom: 0; padding-bottom: 0; }
.eintrag-kopf { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.eintrag-titel {
    font-weight: 600; font-size: .87rem; flex: 1; min-width: 200px;
}
.eintrag-kern { margin: 3px 0 0; font-size: .83rem; color: var(--text-muted); line-height: 1.5; }
.eintrag-kern.stark { color: var(--text); font-size: .88rem; }
.eintrag.frei         { border-left: 3px solid var(--st-done); padding-left: 11px; }
.eintrag.ruecksprache { border-left: 3px solid var(--st-work); padding-left: 11px; }
.eintrag.risiko       { border-left: 3px solid var(--accent);  padding-left: 11px; }

/* Der Beleg öffnet sich unauffällig — er wird selten gebraucht, muss aber da sein. */
.mehr { margin-top: 5px; }
.mehr > summary {
    cursor: pointer; font-size: .74rem; color: var(--primary);
    list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
.mehr > summary::-webkit-details-marker { display: none; }
.mehr > summary::before { content: '+'; font-family: var(--font-mono); font-weight: 700; }
.mehr[open] > summary::before { content: '−'; }
.mehr > summary:hover { text-decoration: underline; }
.mehr p {
    margin: 7px 0 0; font-size: .8rem; color: var(--text-muted);
    line-height: 1.55; padding-left: 13px; border-left: 2px solid var(--border);
}
.mehr p.wirkung { color: var(--text); }

.datum-chip, .quelle-chip {
    font-family: var(--font-mono); font-size: .68rem; white-space: nowrap;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 999px; padding: 1px 8px; color: var(--text-muted);
}

/* ── Materialregeln als Karten ───────────────────────────────────────────── */

.regel-karten {
    display: grid; gap: 10px; align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
/* Gruppennamen wie "Aderendhülsen / Crimpkontakte / Flachsteckhülsen" brechen
   sonst auf vier Zeilen und sprengen die Reihe. */
.regel-gruppe { hyphens: auto; }
.regel-karte {
    background: var(--bg); border: 1px solid var(--border);
    border-left: 3px solid var(--st-neutral);
    border-radius: var(--radius-sm); padding: 11px 13px;
}
.regel-karte.nein         { border-left-color: var(--st-crit); }
.regel-karte.frei         { border-left-color: var(--st-done); }
.regel-karte.ruecksprache { border-left-color: var(--st-work); }
.regel-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.regel-gruppe { font-weight: 600; font-size: .84rem; line-height: 1.3; }
.regel-kern { margin: 5px 0 0; font-size: .79rem; color: var(--text-muted); line-height: 1.45; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.chip {
    font-size: .68rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1px 7px; color: var(--text-muted);
}
.merkmal-liste { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 7px 0; }
.merkmal-label { font-size: .7rem; color: var(--text-subtle); margin-right: 3px; }
.merkmal {
    font-size: .68rem; background: var(--primary-soft); color: var(--primary-dark);
    border-radius: var(--radius-sm); padding: 1px 7px;
}

.verbot-kasten {
    margin-top: 12px; padding: 11px 14px;
    background: var(--st-crit-soft); border: 1px solid var(--st-crit);
    border-radius: var(--radius-sm);
}
.verbot-titel {
    font-family: var(--font-display); font-weight: 700; font-size: .74rem;
    text-transform: uppercase; letter-spacing: .06em; color: var(--st-crit);
    margin-bottom: 5px;
}
.verbot-kasten ul { margin: 0; padding-left: 18px; font-size: .8rem; line-height: 1.5; }
.verbot-kasten li { margin-bottom: 3px; }

/* ── Freigaben ───────────────────────────────────────────────────────────── */

.freigabe-gruppe + .freigabe-gruppe { margin-top: 14px; }
.gruppe-titel {
    font-family: var(--font-display); font-weight: 600; font-size: .74rem;
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.gruppe-titel.gruen { color: var(--st-done); }
.gruppe-titel.gelb  { color: var(--st-work); }

/* ── Vorgangskarte ───────────────────────────────────────────────────────── */

.vorgang-karte {
    display: block; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--primary);
    border-radius: var(--radius); padding: 14px 16px;
    transition: box-shadow var(--motion), transform var(--motion);
}
.vorgang-karte:hover { box-shadow: var(--shadow-xl); transform: translateY(-1px); }
.vorgang-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.vorgang-nr { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--primary-dark); }
.vorgang-text { font-size: .82rem; color: var(--text-muted); margin-top: 3px; }
.vorgang-pfeil {
    display: inline-block; margin-top: 8px; font-size: .8rem;
    font-weight: 600; color: var(--primary);
}

.merksatz {
    margin-top: 10px; padding: 10px 13px;
    background: var(--primary-soft); border-radius: var(--radius-sm);
    font-size: .82rem; line-height: 1.5; font-style: italic;
}
.merksatz-label {
    display: block; font-style: normal; font-family: var(--font-display);
    font-weight: 600; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--primary-dark); margin-bottom: 3px;
}

/* ── Schlichte Tabelle in Blöcken ────────────────────────────────────────── */

table.schlicht { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.schlicht th {
    text-align: left; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-subtle); font-weight: 600;
    padding: 5px 8px; border-bottom: 1px solid var(--border); background: none;
}
table.schlicht td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
table.schlicht tr:last-child td { border-bottom: 0; }
.quellen-art {
    font-size: .68rem; color: var(--text-subtle);
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.fussnote { font-size: .74rem; color: var(--text-subtle); margin: 8px 0 0; line-height: 1.5; }

@media (max-width: 1180px) {
    .kunde-raster { grid-template-columns: 1fr; }
    .rangfolge-mehr { margin-left: 0; }
}

/* ===========================================================================
   Bemusterung nach RI-QM-03
   Steht vor der Stückliste: Erst wird geprüft, was die Zeichnung vorgibt,
   dann erst, womit es gebaut wird.
   =========================================================================== */

.ri-teil { margin-bottom: 26px; }
.ri-quelle {
    font-family: var(--font-mono); font-size: .7rem; font-weight: 400;
    color: var(--text-subtle); margin-left: 6px;
}
.tabellen-kopf.mit-abstand { margin-top: 26px; padding-top: 18px; border-top: 2px solid var(--border); }

.pruef-fortschritt {
    font-size: .78rem; color: var(--text-muted);
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 999px; padding: 3px 12px; white-space: nowrap;
}
.pruef-fortschritt b { font-family: var(--font-display); color: var(--text); }
.pruef-fortschritt.fertig {
    background: var(--st-done-soft); border-color: var(--st-done); color: var(--st-done);
}
.pruef-fortschritt.fertig b { color: var(--st-done); }

.ri-gruppe { margin-bottom: 14px; }
.ri-gruppe-kopf {
    font-family: var(--font-display); font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
    margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.ri-anzahl {
    font-family: var(--font-mono); font-size: .68rem; font-weight: 400;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 999px; padding: 0 7px; color: var(--text-subtle);
}

/* ── Werte-Tabelle ───────────────────────────────────────────────────────── */

table.werte { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.werte th {
    text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-subtle); font-weight: 600; padding: 7px 10px;
    border-bottom: 1px solid var(--border); background: var(--bg);
}
table.werte td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.stark { font-weight: 600; }

.wert-zeile { cursor: pointer; transition: background var(--motion); }
.wert-zeile:hover { background: var(--primary-soft); }
/* Gewählter Wert trägt dasselbe Gelb wie seine Markierung auf dem Blatt. */
.wert-zeile.gewaehlt { background: rgba(255,214,0,.20); box-shadow: inset 3px 0 0 rgba(202,138,4,.95); }
.wert-zeile.bestaetigt { background: rgba(22,163,74,.05); }
.wert-zeile.verworfen  { opacity: .55; text-decoration-color: var(--st-crit); }
.wert-zeile.verworfen td.stark { text-decoration: line-through; }
.wert-zeile.unklar td.mono.stark { color: var(--st-work); }
.wert-bemerkung td { padding-top: 0; border-bottom: 1px solid var(--border); }
.wert-bemerkung .mehr > summary { font-size: .72rem; }

.wert-knoepfe { display: inline-flex; gap: 4px; }
.wert-knopf {
    width: 26px; height: 24px; border-radius: var(--radius-sm); cursor: pointer;
    border: 1px solid var(--border); background: var(--surface);
    font-size: .82rem; line-height: 1; transition: all var(--motion);
}
/* Haken und Kreuz tragen ihre Farbe dauerhaft (AL 27.08.2026), nicht erst beim
   Überfahren: Auf einem Tablet gibt es kein Überfahren, und wer eine Zeile
   prüfen will, muss sehen können, welcher Knopf welcher ist. Gefüllt wird
   weiterhin erst beim Zeigen — sonst schreien zwanzig Zeilen gleichzeitig. */
.wert-knopf.ja   { color: var(--st-done); border-color: color-mix(in srgb, var(--st-done) 40%, var(--border)); }
.wert-knopf.nein { color: var(--st-crit); border-color: color-mix(in srgb, var(--st-crit) 40%, var(--border)); }
.wert-knopf.ja:hover, .wert-knopf.ja:focus-visible {
    background: var(--st-done); border-color: var(--st-done); color: #fff; }
.wert-knopf.nein:hover, .wert-knopf.nein:focus-visible {
    background: var(--st-crit); border-color: var(--st-crit); color: #fff; }
.wert-stand { font-size: .74rem; font-weight: 600; white-space: nowrap; }
.wert-stand.gruen { color: var(--st-done); }
.wert-stand.rot   { color: var(--st-crit); }

/* ── Gehäuse-Karten ──────────────────────────────────────────────────────── */

.gehaeuse-karten {
    display: grid; gap: 8px; align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.gehaeuse-karte {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 9px 11px;
}
.gehaeuse-karte.bestaetigt { border-color: var(--st-done); background: var(--st-done-soft); }
.gehaeuse-karte.verworfen  { opacity: .6; }
.gehaeuse-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gehaeuse-zeile {
    display: flex; justify-content: space-between; gap: 8px;
    font-size: .78rem; color: var(--text-muted); margin: 4px 0 6px;
}
.gehaeuse-fehlt {
    font-size: .7rem; color: var(--st-work); margin-bottom: 6px;
    padding-left: 8px; border-left: 2px solid var(--st-work);
}

/* ── Schriftfeld ─────────────────────────────────────────────────────────── */

.schriftfeld {
    display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
    padding: 9px 14px; margin-top: 12px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .8rem; color: var(--text-muted);
}
.schriftfeld.warnung { background: var(--accent-soft); border-color: var(--accent); }
.schriftfeld-label {
    font-family: var(--font-display); font-weight: 700; font-size: .68rem;
    text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle);
}
.schriftfeld b { color: var(--text); font-family: var(--font-mono); }
.schriftfeld-befund { color: var(--accent-dark); font-weight: 600; }

/* Maß-Marken heben sich von den Material-Marken ab — zwei Ebenen auf einem Blatt. */
.marke.mass {
    border-color: rgba(22,163,74,.5); background: rgba(22,163,74,.07);
    border-style: dashed;
}
.marke.mass.aktiv {
    border-style: solid; border-color: rgba(202,138,4,.95);
    background: rgba(255,214,0,.34);
}

/* ===========================================================================
   Verdichtung des Prüfbereichs
   Die linke Spalte trägt viele Zeilen, die rechte das Blatt. Beim Prüfen zählt
   die Zeichnung mehr als die Tabelle — also bekommt sie mehr Platz, und die
   Zeilen werden so eng geführt, wie es lesbar bleibt.
   =========================================================================== */

.arbeitsplatz { grid-template-columns: minmax(0, 1fr) minmax(560px, 52%); gap: 16px; }
.zeichnung-buehne { max-height: calc(100vh - 190px); }

/* Enge Tabelle: halbe Zeilenhöhe gegenüber der Standardtabelle. */
table.werte.eng th { padding: 4px 8px; font-size: .66rem; }
table.werte.eng td { padding: 3px 8px; font-size: .78rem; line-height: 1.35; }
table.werte.eng .punkt { width: 8px; height: 8px; }
td.tat { width: 1%; white-space: nowrap; text-align: right; }
td.gedaempft, .gedaempft { color: var(--text-subtle); }

/* Auch die Stückliste enger führen. */
table.positionen td { padding: 4px 9px; }
.pos-bez { font-size: .79rem; }
.pos-typ { font-size: .69rem; }

/* Wert im Feld ändern — der Regelfall beim Bemustern. */
.wert-feld {
    display: inline-block; cursor: text; border-radius: 3px;
    padding: 0 3px; margin: -1px -3px;
    border-bottom: 1px dashed transparent; transition: all var(--motion);
}
.wert-feld:hover, .wert-feld:focus-visible {
    background: var(--primary-soft); border-bottom-color: var(--primary); outline: none;
}
.wert-feld .einheit { color: var(--text-subtle); font-size: .9em; }
.wert-eingabe {
    width: 8ch; font-family: var(--font-mono); font-size: .78rem;
    border: 1px solid var(--primary); border-radius: 3px; padding: 1px 4px;
    background: var(--surface); color: var(--text);
}
td.mono .wert-eingabe { width: 14ch; }

/* Begründung: ein „+" in der Zeile, das darunter aufklappt. */
.grund-knopf {
    background: none; border: 0; cursor: pointer; padding: 0 0 0 5px;
    color: var(--text-subtle); font-family: var(--font-mono); font-size: .8rem;
    line-height: 1; transition: color var(--motion);
}
.grund-knopf:hover { color: var(--primary); }
.grund-zeile td {
    padding: 5px 10px 7px 22px; background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.grund-text { font-size: .75rem; color: var(--text-muted); line-height: 1.5; }

.ri-geprueft {
    margin-left: auto; font-size: .68rem; font-weight: 400;
    color: var(--st-done); text-transform: none; letter-spacing: 0;
}
.wert-zeile.ohne-fund td.stark { color: var(--text-muted); }
.wert-zeile.ohne-fund td.stark::after { content: ' ⃰'; color: var(--st-work); }

/* Prüfstand als Knopf — ein Klick nimmt die Prüfung zurück. */
.wert-stand {
    border: 0; background: none; cursor: pointer; padding: 0 4px;
    font-size: .9rem; font-weight: 700; line-height: 1;
}
.wert-stand.gruen { color: var(--st-done); }
.wert-stand.rot   { color: var(--st-crit); }
.wert-knopf { width: 22px; height: 20px; font-size: .72rem; }

.gehaeuse-karte { cursor: pointer; }
.gehaeuse-karte.gewaehlt { background: rgba(255,214,0,.20); border-color: rgba(202,138,4,.95); }
.gehaeuse-zeile .offen { color: var(--st-work); }
.fehlt-chip {
    display: inline-block; font-size: .66rem; background: var(--st-work-soft);
    color: var(--st-work); border-radius: 3px; padding: 0 5px; margin-right: 3px;
}

/* Marken je Wertart — vier Ebenen auf einem Blatt, unterscheidbar. */
.marke.ader   { border-color: rgba(124,58,237,.45); background: rgba(124,58,237,.06); border-style: dashed; }
.marke.kennz  { border-color: rgba(217,119,6,.45);  background: rgba(217,119,6,.06);  border-style: dotted; }
.marke.gehaeuse { border-color: rgba(8,145,178,.5); background: rgba(8,145,178,.06); }
.marke.ader.aktiv, .marke.kennz.aktiv, .marke.gehaeuse.aktiv {
    border-style: solid; border-color: rgba(202,138,4,.95); background: rgba(255,214,0,.34);
}

/* Lücken nach Kategorie gebündelt statt als Fließtext. */
.luecke-gruppe { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.luecke-kat {
    flex-shrink: 0; width: 118px; font-family: var(--font-display);
    font-weight: 600; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-subtle); padding-top: 2px;
}
.luecke-liste { margin: 0; padding-left: 16px; font-size: .78rem; line-height: 1.5; }
.luecke-liste li { margin-bottom: 3px; color: var(--text-muted); }
.luecke-liste .mehr { display: inline-block; margin-left: 6px; }
.luecke-liste .mehr > summary { font-size: .68rem; }

@media (max-width: 1400px) {
    .arbeitsplatz { grid-template-columns: minmax(0, 1fr) minmax(420px, 46%); }
}

/* ── Verweis auf die vorhandene Ablage ───────────────────────────────────── */

.ablage-karte {
    display: block; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--st-done);
    border-radius: var(--radius); padding: 11px 14px;
    transition: box-shadow var(--motion), transform var(--motion);
}
.ablage-karte:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.ablage-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ablage-titel { font-family: var(--font-display); font-weight: 600; font-size: .9rem; }
.ablage-ziel { font-size: .72rem; color: var(--st-done); white-space: nowrap; }
.ablage-inhalt { font-size: .78rem; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }

/* ── Hinweise zur Datenerhebung ──────────────────────────────────────────── */

.lernkasten {
    margin-top: 22px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.lernkasten-kopf { margin-bottom: 10px; }
.lernkasten-titel {
    font-family: var(--font-display); font-weight: 600; font-size: .9rem;
    display: block;
}
.lernkasten-sub { font-size: .78rem; color: var(--text-muted); }

.lern-bisher { list-style: none; margin: 0 0 12px; padding: 0; }
.lern-bisher li {
    padding: 7px 0 7px 11px; border-left: 2px solid var(--border);
    margin-bottom: 6px;
}
.lern-text { display: block; font-size: .82rem; line-height: 1.5; }
.lern-meta { font-size: .7rem; color: var(--text-subtle); font-family: var(--font-mono); }

.lern-eingabe { display: flex; gap: 8px; align-items: flex-start; }
.lern-eingabe textarea {
    flex: 1; font-family: var(--font-body); font-size: .84rem; line-height: 1.5;
    padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); resize: vertical; min-height: 46px;
}
.lern-eingabe textarea:focus {
    outline: none; border-color: var(--primary); background: var(--surface);
}
.lern-eingabe .btn { flex-shrink: 0; height: 38px; }
.lern-fuss { font-size: .72rem; color: var(--text-subtle); margin-top: 7px; line-height: 1.45; }

/* ── Pin-Belegung am Gehäuse ─────────────────────────────────────────────── */

.gehaeuse-pins { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pin-chip {
    font-family: var(--font-mono); font-size: .7rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1px 7px; color: var(--text-muted);
}
.pin-chip b { color: var(--primary-dark); }

/* ── Abschluss der Prüfung ───────────────────────────────────────────────── */

.uebermitteln {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap; margin-top: 18px; padding: 12px 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--primary); border-radius: var(--radius);
}
.uebermitteln.fertig { border-left-color: var(--st-done); background: var(--st-done-soft); }
.uebermitteln-text { font-size: .86rem; color: var(--text-muted); }
.uebermitteln-text b { color: var(--text); font-family: var(--font-display); }
.uebermitteln.fertig .uebermitteln-text b { color: var(--st-done); }
.uebermitteln-text .klein { display: block; font-size: .74rem; color: var(--text-subtle); }

/* Zentrierte Tabellenzellen (AV-Board Stufe 2, Vertrag §G) — Kopf und Zelle. */
.mitte, th.mitte, td.mitte { text-align: center; font-variant-numeric: tabular-nums; }

/* ── Alternativartikel in der Stückliste (Plan Stufe 3, AP-5) ───────────── */
/* Gleiche Form wie eine Position, andere Farbe: Es ist ein Vorschlag, keine
   Zuordnung. Der Pfeil in der ersten Spalte bindet ihn an die Zeile darüber. */
tr.pos-alternativ td { background: rgba(220, 80, 15, .055);
                       border-top: 1px dashed rgba(220, 80, 15, .35); }
tr.pos-alternativ .pos-bez { color: var(--accent, #DC500F); font-weight: 600; }
tr.pos-alternativ .pos-typ { font-size: .74rem; color: var(--text-subtle, #6a747c); }
tr.pos-alternativ.leer td { color: var(--text-subtle, #6a747c); font-size: .78rem; }
tr.pos-alternativ .alt-grund { font-weight: 600; margin-right: 8px; }
tr.pos-alternativ .alt-hinweis { color: var(--accent, #DC500F);
                                 border-bottom: 1px dotted currentColor; cursor: help; }

/* Erhebungsstand der Kunden-Kacheln (Befund AL 27.08.2026): Die Zahlen stammen
   aus einem generierten Stand und ändern sich erst, wenn er neu erhoben wird. */
.kunde-zahlen .zahlen-stand {
    font-size: .7rem; color: var(--text-subtle); align-self: center;
    border-left: 1px solid var(--border); padding-left: 12px; cursor: help;
}

/* Lernhinweis-Knopf in der globalen Kopfleiste (AL 27.08.2026): Im Kopf der
   Akte ging er unter, hier steht er neben dem Feedback-Knopf. */
.hdr-icon-lern { position: relative; }
.hdr-icon-lern.hat { color: var(--accent, #DC500F); }
.hdr-icon-zahl {
    position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
    padding: 0 3px; border-radius: 8px; background: var(--accent, #DC500F);
    color: #fff; font-size: .6rem; font-weight: 700; line-height: 15px; text-align: center;
}
