/* Bausteine für alle Bildschirme. Nur Tokens – keine feste Farbe, kein fester Radius (Test).
   Jeder Baustein: hell/dunkel über Tokens, sichtbarer Fokus, deaktiviert, Tippfläche >= 44 px. */

/* Text */
.leise { color: var(--muted); }
.klein { font-size: var(--fs-klein); }
.zahl { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.pfad { font-family: var(--f-mono); font-size: .9em; overflow-wrap: anywhere; }
.vorspann { font-size: var(--fs-klein); color: var(--muted); font-weight: 600; }

/* Knopf: primaer, zweit, leise, gefahr; Größe normal und gross */
.knopf {
  min-height: 44px; min-width: 44px; padding: 0 18px; border-radius: var(--r-s); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-knopf); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: var(--text); border-color: var(--line); cursor: pointer; text-decoration: none;
  transition: filter var(--dauer), background-color var(--dauer);
}
.knopf.primaer { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.knopf.zweit { background: var(--surface); color: var(--text); border-color: var(--line); }
.knopf.leise-knopf { background: transparent; border-color: transparent; color: var(--primary-text); }
.knopf.gefahr { background: transparent; color: var(--err); border-color: var(--line); }
.knopf.gross { min-height: 52px; padding: 0 24px; font-size: var(--fs-basis); }
.knopf:hover:not(:disabled) { filter: brightness(.97); }
.knopf:disabled, .knopf[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.verweis { background: none; border: 0; padding: 0; color: var(--primary-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; cursor: pointer; }

/* Eingabefeld */
.formular { display: flex; flex-direction: column; gap: var(--g3); margin-top: 8px; }
.feld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.feld > label, .feld > .feld-titel { font-weight: 600; font-size: var(--fs-knopf); }
.eingabe, .feld input[type="text"], .feld input[type="email"], .feld input[type="password"], .feld select {
  min-height: 48px; padding: 10px 12px; border-radius: var(--r-s); border: 1px solid var(--muted);
  background: var(--surface); color: var(--text); width: 100%;
}
.feld input:disabled, .feld select:disabled { opacity: .55; cursor: not-allowed; }
.feld-hilfe { font-size: var(--fs-klein); color: var(--muted); }
.fehlertext { color: var(--err); font-weight: 600; margin: 0; }
.fehlertext:empty, .meldung:empty { display: none; }
.meldung { color: var(--muted); }
input.code { font-size: 1.5rem; letter-spacing: .3em; font-variant-numeric: tabular-nums; max-width: 14ch; }
.farbzeile { display: flex; gap: 8px; align-items: center; }
.farbzeile input[type="color"] { width: 52px; height: 48px; padding: 2px; border: 1px solid var(--muted); border-radius: var(--r-s); background: var(--surface); flex: none; cursor: pointer; }

/* Schalter */
.schalter {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--text);
}
.schalter-text { flex: 1; min-width: 0; font-weight: 600; }
.schalter:has(input:disabled) { cursor: not-allowed; }
.schalter input {
  appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: var(--r-rund); margin: 0; flex: none;
  background: var(--muted); position: relative; cursor: inherit; transition: background-color var(--dauer);
}
.schalter input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: var(--r-kreis);
  background: var(--surface); transition: transform var(--dauer);
}
.schalter input:checked { background: var(--switch-on); }
.schalter input:checked::after { transform: translateX(20px); background: var(--on-primary); }
.schalter input:disabled { opacity: .55; cursor: not-allowed; }
.schalter input:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

/* Segment (Auswahl aus wenigen Werten) */
.segment { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: var(--r-s); background: var(--surface-2); max-width: 100%; }
.segment button {
  min-height: 44px; padding: 0 14px; border-radius: var(--r-s); border: 0; background: transparent; color: var(--text);
  font-weight: 600; font-size: var(--fs-knopf); cursor: pointer;
}
.segment button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--primary-text); }
.segment button:disabled { opacity: .55; cursor: not-allowed; }

/* Karte, Liste */
.karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: var(--g4) 20px; display: flex; flex-direction: column; gap: var(--g3); min-width: 0; }
.karte > .zeile { margin-top: 0; }
.karte.eng { padding: var(--g3); }
.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--g2); }
.eintrag {
  display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 14px; min-height: 64px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.eintrag[aria-current="true"] { border-color: var(--primary-text); box-shadow: 0 0 0 1px var(--primary-text); }
.eintrag .eintrag-symbol { width: 40px; height: 40px; border-radius: var(--r-s); background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; flex: none; }
.eintrag .eintrag-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.eintrag .eintrag-text strong { font-weight: 600; line-height: 1.3; }
.eintrag .eintrag-text span.leise { font-size: var(--fs-klein); }
.eintrag:disabled { opacity: .55; cursor: not-allowed; }

/* Kennzeichen */
.kennzeichen {
  display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 9px; border-radius: var(--r-rund);
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.kennzeichen .sym { width: 14px; height: 14px; }
.kz-extern { background: var(--extern-flaeche); color: var(--extern-text); box-shadow: inset 0 0 0 1px var(--extern-rand); }
.kz-intern { background: var(--intern-flaeche); color: var(--intern-text); }
.kz-info { background: var(--hinweis-flaeche); color: var(--hinweis-text); }
.kz-ok { background: var(--erfolg-flaeche); color: var(--erfolg-text); }
.kz-warnung { background: var(--warnung-flaeche); color: var(--warnung-text); }
.kz-gefahr { background: var(--gefahr-flaeche); color: var(--gefahr-text); }

/* Hinweiszeile (Notiz) und Warnkasten */
.notiz {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-s);
  background: var(--surface-2); color: var(--text); border: 1px solid transparent;
}
.notiz > p { flex: 1 1 220px; }
.notiz > .sym { color: var(--muted); }
.notiz.n-info { background: var(--hinweis-flaeche); }
.notiz.n-info > .sym { color: var(--hinweis-text); }
.notiz.n-ok { background: var(--erfolg-flaeche); }
.notiz.n-ok > .sym { color: var(--erfolg-text); }
.notiz.n-warnung { background: var(--warnung-flaeche); border-color: var(--warn); }
.notiz.n-warnung > .sym { color: var(--warnung-text); }
.notiz.n-gefahr { background: var(--gefahr-flaeche); border-color: var(--err); }
.notiz.n-gefahr > .sym { color: var(--gefahr-text); }
.notiz .zeile { margin-top: 0; flex-basis: 100%; }
.warnkasten {
  border: 1px solid var(--warn); background: var(--warn-soft); color: var(--text); border-radius: var(--r-s);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.warnkasten-titel { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.warnkasten-titel .sym { color: var(--warnung-text); }

/* Blatt / Dialog */
.dialog-hintergrund { position: fixed; inset: 0; z-index: 45; background: var(--abdunkeln); display: flex; align-items: flex-end; justify-content: center; }
.dialog {
  background: var(--surface); color: var(--text); width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto;
  border-radius: var(--r) var(--r) 0 0; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
@media (min-width: 760px) { .dialog-hintergrund { align-items: center; padding: 16px; } .dialog { border-radius: var(--r); } }

/* Laden und Leer */
.kreisel { width: 18px; height: 18px; border-radius: var(--r-kreis); border: 2.5px solid var(--line); border-top-color: var(--primary-text); animation: kreisel .8s linear infinite; flex: none; }
@keyframes kreisel { to { transform: rotate(360deg); } }
.ladezeile { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.leer { padding: var(--g5) var(--g3); text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; color: var(--muted); }
.leer .sym { width: 40px; height: 40px; color: var(--primary-text); }
.leer h2 { color: var(--text); }

/* Abzeichen */
.abzeichen {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-rund);
  background: var(--primary); color: var(--on-primary); font-size: 0.71875rem; font-weight: 700; font-family: var(--f-num); font-variant-numeric: tabular-nums; line-height: 1;
}

/* Zeilen und Raster */
.zeile { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.zeile .meldung { flex-basis: 100%; margin: 0; }
.stapel { display: flex; flex-direction: column; gap: var(--g3); }
.raster-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g3); }
@media (min-width: 760px) { .raster-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Code-App einrichten */
.einrichten { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin: 8px 0 4px; }
.einrichten > div { flex: 1 1 220px; min-width: 0; }
.qr { width: 200px; height: 200px; background: var(--bild-flaeche); border-radius: var(--r-s); padding: 8px; }
.geheim { font-family: var(--f-mono); font-size: 1.125rem; letter-spacing: .05em; background: var(--surface-2); border-radius: var(--r-s); padding: 8px 10px; }

/* Zustands-Bildschirm */
.sperre h1 { font-size: 1.5rem; }


/* Design-Kacheln (Einstellungen → Erscheinungsbild) */
.kacheln { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g2); }
@media (min-width: 760px) { .kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kacheln { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kachel {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; padding: 12px; min-height: 76px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.kachel[aria-pressed="true"] { border-color: var(--primary-text); box-shadow: 0 0 0 2px var(--primary-text); }
.kachel:disabled { cursor: default; }
.kachel strong { display: block; font-family: var(--f-head); font-weight: var(--w-head); }
.kachel .leise { display: block; font-size: var(--fs-klein); line-height: 1.35; }
.muster-farbe { width: 64px; height: 48px; border-radius: var(--r-s); overflow: hidden; display: grid; grid-template-rows: 1fr 14px; border: 1px solid var(--line); }
.muster-farbe b { display: flex; align-items: center; justify-content: center; font-size: 1.0625rem; }
.pruefung { padding: var(--g3); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.probe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.logo-platz { display: flex; gap: 12px; align-items: center; }
.logo-platz .logo { width: 64px; height: 64px; }
.probe-text { color: var(--primary-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.muster-farbe i { display: block; }
