/**
 * KOS KLIMA KI-Portal – Werkzeug "Halbfertige Arbeiten" (Wizard und Prüfmasken).
 *
 * Die Grundbausteine (Karte, Schrittleiste, Dateiablage, Felder, Hinweise, Tabellen)
 * stammen aus liquiditaet.css und werden bewusst geteilt – beide Werkzeuge sehen gleich
 * aus. Hier stehen nur die eigenen Bausteine: Kennzahlen, Filterleiste, Prüftabelle mit
 * Korrekturfeldern und die Berichtskarten. Farben und Formen über die Portal-Variablen
 * (:root in index.html).
 *
 * Schmale Bildschirme: Die Prüftabelle wird zur Kartenliste – je Auftrag eine Karte mit
 * beschrifteten Werten und gut bedienbaren Eingabefeldern; nichts scrollt waagerecht.
 */

.hfa-inner { max-width: 1280px; }

/* ---------- Kennzahlen ---------- */
.hfa-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.hfa-kachel {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-width: 0;
}
.hfa-kachel-titel { font-size: 12px; color: var(--gray-600); }
.hfa-kachel-wert {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.hfa-kachel.is-negativ { border-left-color: var(--danger); }
.hfa-kachel.is-negativ .hfa-kachel-wert { color: var(--danger); }

/* ---------- Filter ---------- */
.hfa-filterleiste {
  position: sticky;
  top: -24px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  background: var(--white);
  padding: 8px 0 10px;
}
.hfa-suche {
  flex: 1 1 240px;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  outline: none;
}
.hfa-suche:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.hfa-filterknoepfe { display: flex; flex-wrap: wrap; gap: 6px; }
.hfa-filter {
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.hfa-filter:hover { border-color: var(--accent); color: var(--navy); }
.hfa-filter.is-aktiv { background: var(--navy); border-color: var(--navy); color: var(--white); }
.hfa-filter-zahl { opacity: .75; margin-left: 2px; }
.hfa-treffer { margin-left: auto; }

/* ---------- Prüftabelle ---------- */
.hfa-tabelle {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 6px;
}
.hfa-pruef { width: 100%; border-collapse: collapse; font-size: 13px; }
.hfa-pruef th, .hfa-pruef td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--gray-100);
  text-align: left;
  vertical-align: top;
}
.hfa-pruef thead th {
  position: sticky;
  top: 0;
  background: var(--gray-50);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .2px;
  color: var(--gray-600);
  vertical-align: bottom;
  z-index: 1;
}
.hfa-pruef .liq-zahl { text-align: right; font-variant-numeric: tabular-nums; }
.hfa-pruef td.liq-zahl { white-space: nowrap; }
.hfa-pruef td > .liq-hint { display: block; }
.hfa-auftrag strong { white-space: nowrap; }
.hfa-kunde { min-width: 150px; }
.hfa-kunde > span:first-child { color: var(--gray-800); font-weight: 500; }
.hfa-betont { font-weight: 700; color: var(--navy); }
.hfa-eingabe input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  outline: none;
  font-size: 13.5px;
}
.hfa-eingabe input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.hfa-korrektur { min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.hfa-kommentar-zelle { min-width: 160px; }
.hfa-auffaellig { list-style: none; padding: 0; margin: 4px 0 0; }
.hfa-auffaellig li {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1.35;
  color: #7a4d0b;
  background: #fdf6ec;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 4px 0 0;
}

/* Voller Hinweistext für Screenreader (sichtbar ist die Kurzform, der Text steht im Tooltip) */
.hfa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hfa-zeile.is-negativ td { background: #fdf1f1; }
.hfa-zeile.is-negativ .hfa-betont, .hfa-zeile.is-negativ .liq-zahl { color: var(--danger); }
.hfa-zeile.is-korrigiert .hfa-korrektur { border-color: var(--accent-dark); background: var(--accent-light); }
.hfa-zeile.is-geaendert td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.hfa-zeile.is-fehler td { background: #fdf1f1; }
.hfa-zeile.is-fehler .hfa-kommentar, .hfa-zeile.is-fehler .hfa-korrektur { border-color: var(--danger); }

.hfa-details { margin: 4px 0 12px; }
.hfa-details summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-dark);
  padding: 6px 0;
}
.hfa-details .liq-tabelle { max-height: 420px; overflow: auto; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }

/* ---------- Aktionen ---------- */
.hfa-aktionen-rechts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.hfa-stichtag { max-width: 420px; }

/* ---------- Berichte ---------- */
.hfa-berichte { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 8px; }
.hfa-bericht-karte {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.hfa-bericht-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hfa-bericht-kopf strong { color: var(--navy); font-size: 15px; }
.hfa-bericht-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hfa-bericht-knoepfe a.btn { text-decoration: none; }
.hfa-warn { color: #7a4d0b; }

/* ---------- schmale Bildschirme ---------- */
@media (max-width: 860px) {
  .hfa-filterleiste { top: -16px; }
  .hfa-treffer { margin-left: 0; width: 100%; }
}

/* Karten statt Tabelle: Tablets, Telefone und kleine Laptops (mit Seitenleiste reicht die
   Breite dort nicht für alle Spalten samt Eingabefeldern) */
@media (max-width: 1180px) {
  .hfa-tabelle { border: 0; overflow: visible; }
  .hfa-pruef, .hfa-pruef tbody { display: block; }
  .hfa-pruef thead { display: none; }
  .hfa-pruef tr.hfa-zeile {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 2px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--white);
  }
  .hfa-pruef tr.hfa-zeile[hidden] { display: none; }
  .hfa-pruef td { border: 0; padding: 3px 0; background: none !important; min-width: 0; }
  .hfa-pruef td::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--gray-400);
  }
  .hfa-pruef td.liq-zahl { text-align: left; }
  .hfa-auftrag, .hfa-kunde, .hfa-kommentar-zelle { grid-column: 1 / -1; }
  .hfa-auftrag::before, .hfa-kunde::before { display: none !important; }
  .hfa-auftrag strong { font-size: 15px; color: var(--navy); }
  .hfa-auftrag .liq-hint { display: inline !important; margin-left: 8px; }
  .hfa-kunde { min-width: 0; }
  .hfa-kommentar-zelle { min-width: 0; }
  .hfa-eingabe input { padding: 9px 10px; font-size: 16px; }   /* 16 px: kein Zoom beim Fokus auf iOS */
  .hfa-korrektur { text-align: left; }
  .hfa-zeile.is-negativ { border-color: #f3c7c7 !important; background: #fdf1f1 !important; }
  .hfa-zeile.is-geaendert { box-shadow: inset 3px 0 0 var(--warning); }
  .hfa-zeile.is-geaendert td:first-child { box-shadow: none; }
  .hfa-zeile.is-fehler { border-color: var(--danger) !important; }
}
@media (max-width: 520px) {
  .hfa-aktionen-rechts { width: 100%; }
  .hfa-aktionen-rechts .btn { flex: 1 1 auto; justify-content: center; }
  .hfa-kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hfa-kachel-wert { font-size: 15px; }
  .hfa-bericht-knoepfe .btn { flex: 1 1 auto; justify-content: center; }
}
