/* Airtec Brandschutznormen — Brandsystem Airtec Energie (Skill airtec-design): einzige
   Akzentfarbe Flame Orange #F29100, warmes Stein-Grau, flache weisse Flächen, kleine Radien,
   dünne Rahmen. Schrift Manrope, falls installiert, sonst Systemstack (CSP strikt). */
:root {
  --orange: #f29100;
  --orange-hover: #d87f00;
  --orange-pressed: #bf6f00;
  --orange-weich: #fff4e5;

  --grund: #f7f5f1;
  --flaeche: #ffffff;
  --flaeche-2: #faf8f5;
  --linie: #e6e1d9;
  --linie-stark: #cfc8bd;
  --text: #1f1d1a;
  --text-2: #5e5850;
  --text-3: #8b847a;

  --ok: #2f7d4a;
  --ok-weich: #e8f3ec;
  --warn: #b7791f;
  --warn-weich: #fdf3e1;
  --rot: #b23a3a;
  --rot-weich: #fbeaea;
  --grau-weich: #eeebe6;

  --radius: 6px;
  --radius-s: 4px;
  --schatten: 0 1px 2px rgba(31, 29, 26, 0.06), 0 1px 1px rgba(31, 29, 26, 0.04);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Manrope, Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #161513;
    --flaeche: #1f1d1a;
    --flaeche-2: #262421;
    --linie: #34312c;
    --linie-stark: #4a463f;
    --text: #efece6;
    --text-2: #b8b1a6;
    --text-3: #857e73;
    --orange-weich: #33240f;
    --ok-weich: #16291d;
    --warn-weich: #33270f;
    --rot-weich: #341a1a;
    --grau-weich: #2b2925;
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--grund); min-height: 100vh;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; color: var(--text-2); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); }
.leise { color: var(--text-2); }
.leiser { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.versteckt { display: none !important; }
mark { background: var(--orange-weich); color: inherit; padding: 0 2px; border-radius: 2px; }

/* ------------------------------------------------------------- Login */
body.loginseite { display: grid; place-items: center; padding: 24px; }
.loginbox { width: min(100%, 380px); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 36px 32px 28px; }
.loginbox .logo { display: block; width: 120px; height: auto; margin: 0 0 20px; }
.login-kopf { display: flex; align-items: flex-start; justify-content: space-between; }
button.sprache { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; padding: 4px 8px; border: 1px solid var(--linie-stark) !important; }
.loginbox h1 { font-size: 24px; margin: 4px 0 24px; }
.loginbox label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.loginbox input { width: 100%; margin-bottom: 14px; }
.loginbox .fehler { min-height: 20px; color: var(--rot); font-size: 13px; margin-top: 10px; }

/* ------------------------------------------------------------- Formularelemente */
input[type="text"], input[type="number"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--linie-stark); border-radius: var(--radius-s);
  background: var(--flaeche); color: var(--text); outline: none; transition: border-color 120ms, box-shadow 120ms;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(242, 145, 0, 0.18); }
select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
label.feld { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
label.feld input, label.feld select, label.feld textarea { font-weight: 400; color: var(--text); }

button.primary, button.sekundaer, button.leise, button.gefaehrlich {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-s);
  border: 1px solid transparent; font-weight: 600; line-height: 1.2; white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, box-shadow 120ms, transform 60ms;
}
button.primary { background: var(--orange); color: #fff; box-shadow: var(--schatten); }
button.primary:hover { background: var(--orange-hover); }
button.primary:active { background: var(--orange-pressed); box-shadow: none; transform: translateY(1px); }
button.sekundaer { background: var(--flaeche); border-color: var(--linie-stark); }
button.sekundaer:hover { border-color: var(--text-3); background: var(--flaeche-2); }
button.leise { background: transparent; color: var(--text-2); padding: 6px 8px; }
button.leise:hover { background: var(--grau-weich); color: var(--text); }
button.gefaehrlich { background: transparent; color: var(--rot); }
button.gefaehrlich:hover { background: var(--rot-weich); }
button:disabled { opacity: 0.5; cursor: default; }
button.aktiv { background: var(--orange-weich); color: var(--text); border-color: var(--orange); }

/* ------------------------------------------------------------- Kopf */
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 5; }
.kopf-inhalt { max-width: 1480px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.kopf .logo { width: 96px; height: auto; align-self: flex-start; }
.kopf-titel { display: grid; gap: 1px; }
.kopf-titel h1 { font-size: 18px; }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pille { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding: 4px 8px; border: 1px solid var(--linie); border-radius: var(--radius-s); background: var(--flaeche-2); }
.pille .punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--linie-stark); }
.pille.ok .punkt { background: var(--ok); }
.pille.warn .punkt { background: var(--warn); }

/* ------------------------------------------------------------- Layout */
.seite { max-width: 1480px; margin: 0 auto; padding: 16px 20px 48px; display: grid; grid-template-columns: minmax(380px, 46fr) minmax(360px, 54fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .seite { grid-template-columns: 1fr; padding: 12px 12px 40px; } .kopf-inhalt { padding: 10px 12px; } }

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.karte-kopf { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--linie); }
.karte-kopf .rechts { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.karte-inhalt { padding: 14px; }

.reiter { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--linie); background: var(--flaeche-2); border-radius: var(--radius) var(--radius) 0 0; }
.reiter button { background: transparent; border: 1px solid transparent; border-bottom: none; padding: 8px 14px; font-weight: 600; color: var(--text-2); border-radius: var(--radius-s) var(--radius-s) 0 0; }
.reiter button.aktiv { background: var(--flaeche); color: var(--text); border-color: var(--linie); margin-bottom: -1px; }
.reiter button:hover:not(.aktiv) { color: var(--text); }
.panel { padding: 14px; }
.zeile { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.zeile > label.feld { flex: 1 1 160px; }
.hinweis { font-size: 12px; color: var(--text-3); margin-top: 8px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--linie-stark); border-bottom-width: 2px; border-radius: 3px; background: var(--flaeche-2); }

/* ------------------------------------------------------------- Antwort */
.antwort { margin-top: 14px; border-top: 1px solid var(--linie); padding-top: 14px; }
.antwort-text { white-space: pre-wrap; line-height: 1.6; }
.antwort-text .beleg, .chips .chip { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.antwort-text .beleg { display: inline-block; background: var(--orange-weich); color: var(--text); border: 1px solid var(--orange); border-radius: 3px; padding: 0 5px; margin: 0 1px; cursor: pointer; line-height: 1.5; }
.antwort-text .beleg:hover, .antwort-text .beleg.aktiv { background: var(--orange); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--linie-stark); border-radius: var(--radius-s); background: var(--flaeche); cursor: pointer; font-family: var(--sans) !important; font-size: 12px !important; font-weight: 500 !important; }
.chip:hover, .chip.aktiv { border-color: var(--orange); background: var(--orange-weich); }
.chip .nr { font-family: var(--mono); font-weight: 700; color: var(--orange); }
.chip .leiser { font-weight: 400; }
.meta { font-size: 12px; color: var(--text-3); margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.bewertung { display: inline-flex; gap: 4px; }
.bewertung button { padding: 4px 8px; font-size: 12px; }
.fehlerbox { background: var(--rot-weich); color: var(--rot); border-radius: var(--radius-s); padding: 10px 12px; margin-top: 12px; font-size: 13px; }
.warnbox { background: var(--warn-weich); color: var(--warn); border-radius: var(--radius-s); padding: 10px 12px; margin-top: 12px; font-size: 13px; }
.laedt { color: var(--text-3); font-size: 13px; display: inline-flex; gap: 8px; align-items: center; }
.laedt::before { content: ''; width: 12px; height: 12px; border: 2px solid var(--linie-stark); border-top-color: var(--orange); border-radius: 50%; animation: dreh 700ms linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- Listen */
.liste { display: grid; gap: 4px; margin-top: 12px; }
.treffer { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: var(--radius-s); background: var(--flaeche); cursor: pointer; text-align: left; width: 100%; }
.treffer:hover, .treffer.aktiv { border-color: var(--orange); background: var(--orange-weich); }
.treffer .ort { font-size: 12px; color: var(--text-2); display: flex; gap: 8px; align-items: baseline; }
.treffer .ort b { color: var(--text); }
.treffer .ausschnitt { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.leer { color: var(--text-3); font-size: 13px; padding: 10px 2px; }

.dok { margin-top: 14px; }
.block-titel { margin: 22px 0 4px; padding-top: 14px; border-top: 1px solid var(--linie); font-size: 14px; color: var(--text); }
.dok.zertifikat { padding: 8px 10px; border: 1px solid var(--linie); border-radius: var(--radius-s); margin-top: 6px; }
.dok.zertifikat h2 { font-size: 14px; font-weight: 600; }
.systeme { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dok:first-child { margin-top: 0; }
.dok-kopf { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dok-kopf .kurz { font-family: var(--mono); font-weight: 700; color: var(--orange); font-size: 13px; }
.dok-kopf .seiten-eingabe { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); }
.dok-kopf .seiten-eingabe input { width: 64px; padding: 4px 6px; }
.dok-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ivz { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 1px; max-height: 420px; overflow: auto; border: 1px solid var(--linie); border-radius: var(--radius-s); }
.ivz li button { width: 100%; text-align: left; background: transparent; border: none; padding: 5px 10px; display: flex; gap: 10px; font-size: 13px; border-radius: 0; }
.ivz li button:hover { background: var(--orange-weich); }
.ivz li.t1 button { font-weight: 700; background: var(--flaeche-2); }
.ivz li.t2 button { padding-left: 22px; }
.ivz li.t3 button { padding-left: 36px; color: var(--text-2); }
.ivz li.t4 button { padding-left: 50px; color: var(--text-2); }
.ivz .nummer { font-family: var(--mono); font-size: 12px; min-width: 44px; color: var(--text-3); }
.ivz .s { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }

/* ------------------------------------------------------------- Seitenansicht */
.viewer { position: sticky; top: 64px; }
@media (max-width: 960px) { .viewer { position: static; } }
.viewer-kopf { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--linie); flex-wrap: wrap; }
.viewer-kopf .ort { display: grid; gap: 0; min-width: 0; }
.viewer-kopf .ort .kurz { font-family: var(--mono); font-weight: 700; color: var(--orange); font-size: 13px; }
.viewer-kopf .ort .abschnitt { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 520px; }
.viewer-kopf .nav { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; }
.viewer-kopf .nav .nr { font-family: var(--mono); font-size: 13px; min-width: 70px; text-align: center; }
.viewer-bild .viewer-text { padding: 16px 18px; max-height: none; background: var(--flaeche); width: 100%; }
.viewer-bild .viewer-text a { color: var(--orange); word-break: break-all; }
.viewer-bild { background: var(--grau-weich); display: grid; place-items: start center; min-height: 320px; max-height: calc(100vh - 150px); overflow: auto; }
.viewer-bild img { width: 100%; height: auto; display: block; background: #fff; }
.viewer-text { padding: 14px; white-space: pre-wrap; font-size: 13px; line-height: 1.55; max-height: calc(100vh - 150px); overflow: auto; }
.viewer-leer { padding: 48px 20px; text-align: center; color: var(--text-3); }

/* ------------------------------------------------------------- Verlauf */
.verlauf-eintrag { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: var(--radius-s); cursor: pointer; text-align: left; background: var(--flaeche); width: 100%; }
.verlauf-eintrag:hover { border-color: var(--orange); }
.verlauf-eintrag .frage { font-weight: 600; }
.verlauf-eintrag .wann { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: var(--grau-weich); color: var(--text-2); }
.badge.richtig { background: var(--ok-weich); color: var(--ok); }
.badge.falsch { background: var(--rot-weich); color: var(--rot); }
.badge.teilweise { background: var(--warn-weich); color: var(--warn); }

@media print {
  .kopf, .reiter, .viewer, .bewertung, button { display: none !important; }
  .seite { display: block; }
}
