/* AV-Board — Stile des Moduls js/kunde.js (Stufe 2, 24.08.2026).
   Gemeinsame Tokens/Basis bleiben in style.css; hier nur, was dieses Modul braucht:
   Kopf (Klasse-Badge, Betreuer-Wahl), Vorgangs-Tabelle, Deaktivieren je Aussage,
   Rangfolge-Zeile, Quellen-Verweise. */

/* ── Kopf: Debitor · Klasse · Betreuer · Stand ───────────────────────────── */

.kunde-identitaet { min-width: 0; }
.kunde-titelzeile { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kunde-titelzeile h1 { margin: 0; }

.badge.klasse { font-size: .78rem; padding: 3px 11px; border: 1.5px solid transparent; }
.badge.klasse.unbestaetigt { border-color: var(--st-work); cursor: help; }
.klasse-zusatz { font-weight: 400; color: var(--st-work); }

.kunde-meta {
    display: flex; gap: 22px; flex-wrap: wrap; align-items: center;
    margin-top: 6px; font-size: .84rem; color: var(--text-muted);
}
.meta-feld { display: inline-flex; align-items: center; gap: 8px; }
.meta-label {
    font-family: var(--font-display); font-weight: 600; font-size: .68rem;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle);
}
.meta-wert { color: var(--text); font-variant-numeric: tabular-nums; }

/* Betreuer als Auswahl — sieht aus wie ein Wert, verhält sich wie ein Feld. */
.betreuer-wahl {
    font: inherit; font-weight: 600; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 3px 26px 3px 10px; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat; background-position: right 9px center;
    transition: border-color var(--motion), background-color var(--motion);
}
.betreuer-wahl:hover { border-color: var(--primary); }
.betreuer-wahl:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.betreuer-wahl:disabled { opacity: .6; cursor: wait; }

/* ── Vorgänge des Kunden ─────────────────────────────────────────────────── */

.tabelle-scroll { overflow-x: auto; }
table.vorgaenge th, table.vorgaenge td { white-space: nowrap; }
table.vorgaenge td.betreff { white-space: normal; min-width: 180px; }
table.vorgaenge td { vertical-align: middle; }
tr.klick { cursor: pointer; transition: background var(--motion); }
tr.klick:hover td { background: var(--primary-soft); }
tr.klick:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
tr.klick.gedaempft td { color: var(--text-subtle); }

/* ── Deaktivieren je Aussage ─────────────────────────────────────────────── */

/* Der Knopf steht am rechten Rand jeder Aussage — sichtbar, aber leise. */
.aus-knopf {
    margin-left: auto; flex-shrink: 0; align-self: center;
    display: inline-flex; align-items: center; gap: 3px;
    background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
    color: var(--text-subtle); font-family: var(--font-body); font-size: .7rem;
    line-height: 1; padding: 2px 6px; cursor: pointer; opacity: .6;
    transition: all var(--motion);
}
.aus-knopf:hover, .aus-knopf:focus-visible {
    opacity: 1; color: var(--accent-dark); border-color: var(--accent);
    background: var(--accent-soft); outline: none;
}
.aus-knopf[hidden] { display: none; }
/* In Aufzählungen bleibt das Listenzeichen erhalten — der Knopf schwimmt rechts. */
li > .aus-knopf { float: right; margin-left: 8px; }
/* Materialkarte: Gruppe links, Badge und Knopf zusammen rechts. */
.regel-kopf { flex-wrap: wrap; }
.regel-kopf .regel-gruppe { flex: 1 1 auto; min-width: 0; }
.regel-kopf .aus-knopf { margin-left: 0; }
.aus-zelle { width: 1%; white-space: nowrap; text-align: right; }

/* Grund-Feld an Ort und Stelle: eine Zeile, Enter bestätigt, Esc bricht ab. */
.aus-feld {
    display: flex; gap: 6px; align-items: center; flex-basis: 100%;
    margin-top: 6px; clear: both;
}
.aus-feld input {
    flex: 1; min-width: 140px; font: inherit; font-size: .8rem;
    padding: 4px 9px; border: 1px solid var(--primary); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
}
.aus-feld input:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.aus-feld .btn { padding: 4px 10px; font-size: .74rem; white-space: nowrap; }
td .aus-feld { min-width: 260px; }
li > .aus-feld { margin-top: 6px; }

/* Deaktivierte Aussagen: unten im Block, grau, rückholbar. */
.deaktiviert-liste { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--border); }
.deaktiviert-liste > summary {
    cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 5px;
    font-size: .76rem; color: var(--text-subtle);
}
.deaktiviert-liste > summary::-webkit-details-marker { display: none; }
.deaktiviert-liste > summary::before {
    content: '▸'; font-size: .7rem; transition: transform var(--motion);
}
.deaktiviert-liste[open] > summary::before { transform: rotate(90deg); }
.deaktiviert-liste > summary:hover { color: var(--primary); }
.deaktiviert-liste ul { list-style: none; margin: 8px 0 0; padding: 0; }
/* Text oben, Kürzel · Datum · Grund darunter, der Rückhol-Knopf rechts. */
.deaktiviert-liste li {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 14px; align-items: start;
    padding: 6px 0; border-bottom: 1px solid var(--border);
    font-size: .8rem; color: var(--text-subtle);
}
.deaktiviert-liste li:last-child { border-bottom: 0; }
.deakt-text { text-decoration: line-through; line-height: 1.5; }
.deakt-meta { grid-column: 1; font-family: var(--font-mono); font-size: .68rem; line-height: 1.5; }
.deakt-zurueck { grid-column: 2; grid-row: 1 / span 2; font-size: .74rem; font-weight: 600; white-space: nowrap; }

/* ── Rangfolge als eine Zeile in „Umgang mit dem Kunden" ─────────────────── */

.rangfolge-zeile .eintrag-kern { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rangfolge-zeile .stufe-kurz { font-weight: 600; color: var(--text); }
.rangfolge-zeile .trenn { color: var(--primary); font-weight: 700; }
.rangfolge-zeile ol {
    margin: 7px 0 0; padding-left: 30px; font-size: .8rem; line-height: 1.55;
    color: var(--text-muted); border-left: 2px solid var(--border); margin-left: 0;
}
.rangfolge-zeile ol li { margin-bottom: 3px; }
.rangfolge-zeile .beleg { font-family: var(--font-mono); font-size: .72rem; }

/* ── Prüfpunkte und Begründungen als Listen mit Knopf ────────────────────── */

ul.pruefpunkte li { margin-bottom: 7px; }
ul.pruefpunkte .mehr { margin-top: 2px; }
ul.pruefpunkte .mehr > summary { font-size: .7rem; }

/* ── Quellen ─────────────────────────────────────────────────────────────── */

.quelle-link {
    font-family: var(--font-mono); font-weight: 600; font-size: .76rem;
    color: var(--primary); text-decoration: none; white-space: nowrap;
}
.quelle-link:hover { text-decoration: underline; }
/* Fundstelle mit Obergrenze — die Bezeichnung braucht den Platz, nicht der Pfad. */
.quelle-fund {
    display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; vertical-align: bottom; font-size: .72rem; color: var(--text-subtle);
}
table.quellen td:nth-child(2) { min-width: 240px; }
.quelle-stand, table.quellen td.num { white-space: nowrap; }

/* ── Schmale Bildschirme ─────────────────────────────────────────────────── */

@media (max-width: 1180px) {
    .kunde-kopf { align-items: flex-start; }
    .kunde-zahlen { gap: 16px; }
}
@media (max-width: 700px) {
    .kunde-meta { gap: 12px; }
    .deakt-meta { white-space: normal; }
}

/* Erhebungs-Regeln: Label-Zeilen bleiben Zeilen (der Text trägt Umbrüche). */
#block-aplan .mehr p, #block-wpos .mehr p { white-space: pre-line; }

/* ── Startseite: eine Kachel je Debitor (Lauf 0, V-5/V-6) ────────────────────
   Die Kachel trägt Nummer und Name groß, darunter drei Zahlen. Farbe steckt
   nur in der Klassen-Pille — Zahlen bleiben neutral, damit die Seite ruhig
   wirkt (Tabellen-Norm V-8).
   ------------------------------------------------------------------------- */

.kunden-suche {
    margin-top: 10px; width: min(320px, 100%);
    padding: 7px 11px; font-size: .86rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.kunden-suche:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.karte-kopf { display: flex; align-items: center; gap: 8px; }
.karte-nr {
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}
.karte-akte {
    margin-left: auto; font-size: .68rem; letter-spacing: .04em;
    text-transform: uppercase; color: var(--primary);
    background: var(--primary-soft); border-radius: 9px; padding: 2px 7px;
}
.karte-name {
    font-size: .84rem; color: var(--text-muted); margin: 2px 0 10px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.karte-zahlen {
    display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
    font-size: .78rem; color: var(--text-muted);
}
.karte-zahlen b {
    font-size: .95rem; color: var(--text); font-variant-numeric: tabular-nums;
    margin-right: 3px;
}
.karte-betreuer {
    margin-left: auto; font-family: var(--font-mono); font-size: .76rem;
    color: var(--text-subtle);
}
/* Kein Debitor zugeordnet: die Kachel zeigt den Bestand, führt aber nirgends hin. */
.karte-stumm { opacity: .72; cursor: default; }

/* ── Verknüpfungen nach draußen (V-4, V-7, V-14) ─────────────────────────── */

.verknuepfungen { margin-top: 16px; }
.verkn-laden { color: var(--text-subtle); font-size: .82rem; padding: 6px 0; }
.verkn-leiste { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.verkn {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 14px; min-width: 180px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); text-decoration: none; color: inherit;
    transition: box-shadow var(--motion), transform var(--motion);
}
.verkn:hover { box-shadow: var(--shadow-xl); transform: translateY(-1px); }
.verkn-titel { font-weight: 600; font-size: .88rem; }
.verkn-ziel { font-size: .76rem; color: var(--primary); }
.verkn-hinweis { font-size: .76rem; color: var(--text-subtle); }

.karten-liste { margin-top: 12px; }
.karten-liste a { color: inherit; text-decoration: none; }
.karten-liste a:hover { color: var(--primary); text-decoration: underline; }

/* ── Weg zur Kundenakte und zurück (V-1, V-2) ────────────────────────────── */

.akte-knopf {
    margin-left: 10px; padding: 4px 10px; font-size: .8rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text-muted); text-decoration: none;
    white-space: nowrap;
}
.akte-knopf:hover { color: var(--primary); border-color: var(--primary); }
.akte-reiter { margin: 14px 0 4px; border-bottom: 1px solid var(--border); }
.akte-inhalt { margin-top: 14px; }
.akte-inhalt .block { margin-bottom: 12px; }
.reiter.ohne-inhalt { color: var(--text-subtle); font-weight: 500; }
.reiter-zahl {
    font-family: var(--font-mono); font-size: .72rem; color: var(--text-subtle);
    background: var(--primary-soft); border-radius: 9px; padding: 1px 6px;
}
.reiter.aktiv .reiter-zahl { color: var(--primary); }


/* ── „Für mich" auf der Startseite (U-2) ─────────────────────────────────── */
.fuer-mich {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px;
    margin-bottom: 18px;
}
.fm-block {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 10px 14px 12px;
}
.fm-titel { font-weight: 600; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
            color: var(--text-muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.fm-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.fm-liste li { display: flex; gap: 8px; align-items: baseline; font-size: .86rem; }
.fm-liste a { font-family: var(--font-code); color: var(--primary); text-decoration: none; }
.fm-liste a:hover { text-decoration: underline; }
.fm-zeit { margin-left: auto; white-space: nowrap; }
