/* Grundlage: was ohne eine einzige Klasse gilt. Elementregeln, Typografie,
   Formularelemente, Fokus, Bewegung. Kennt keine Bauteile und keine Seiten,
   das steht in komponenten.css und in den Feature-Dateien. */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

/* --- Typografie ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--text);
}
h1 { font-size: var(--txt-2xl); }
h2 { font-size: var(--txt-lg); }
h3 { font-size: var(--txt-md); }

a { color: var(--akzent); }
a:hover { color: var(--akzent); }

strong, b { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--linie); margin: var(--sp-5) 0; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--flaeche-2);
  padding: .15em .4em;
  border-radius: var(--radius-sm);
}
pre code { background: none; padding: 0; }

.muted { color: var(--text-leise); }
.small { font-size: var(--txt-sm); }

/* Zahlen stehen untereinander bündig. Gilt für Kennzahlen, Zeiten, Beträge
   und jede Tabellenspalte mit Zahlen, sonst tanzen die Ziffern. */
.zahl, .metric, td.zahl, th.zahl { font-variant-numeric: tabular-nums; }

/* Beschreibungslisten sind im CRM das Standardmittel für Stammdaten. */
dl { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-3); margin: 0; }
dl dt { color: var(--text-leise); font-size: var(--txt-sm); }
dl dd { margin: 0; font-weight: 500; }

/* --- Formularelemente ---------------------------------------------------- */
label {
  display: block;
  margin-bottom: var(--sp-3);
  font-weight: 500;
  font-size: var(--txt-md);
}

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=tel], input[type=url],
input[type=search], select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  margin-top: var(--sp-1);
  border: 1px solid var(--linie-feld);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--txt-md);
  background: var(--flaeche-ein);
  color: var(--text);
}
textarea { min-height: 4.5rem; resize: vertical; }

input::placeholder, textarea::placeholder { color: var(--text-leise); opacity: 1; }

input:disabled, select:disabled, textarea:disabled,
button:disabled, .btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
}

/* Auswahlkästchen und Radios sollen die Zeile nicht auf volle Breite ziehen. */
input[type=checkbox], input[type=radio] {
  width: auto;
  margin: 0;
  accent-color: var(--akzent);
}
input[type=color] {
  width: 3rem; height: 2.4rem; padding: 2px;
  border: 1px solid var(--linie-feld); border-radius: var(--radius-sm);
  background: var(--flaeche-ein);
}
input[type=file] { font-size: var(--txt-sm); max-width: 100%; }

/* --- Fokus ---------------------------------------------------------------
   Sichtbar für die Tastatur, unsichtbar für die Maus. Nie entfernen: ohne
   Ring findet man sich mit der Tastatur nicht zurecht. */
:focus-visible {
  outline: 2px solid var(--fokus);
  outline-offset: 2px;
  border-radius: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--fokus);
}

::selection { background: var(--akzent); color: var(--akzent-text); }

/* --- Bewegung ------------------------------------------------------------
   Wer im System weniger Bewegung eingestellt hat, bekommt hier keine. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Mobil ---------------------------------------------------------------- */
@media (max-width: 640px) {
  /* 16px verhindert, dass iOS beim Antippen eines Feldes hineinzoomt. */
  input, select, textarea { font-size: 16px; }
  h1 { font-size: var(--txt-xl); }
}
