/* ==========================================================================
   Eigentümer-Erfassung
   Schmales Fenster, Bedienung per Tastatur, Design System Hausverwaltung
   ========================================================================== */

:root {
  /* Farben */
  --hell-1: #FFFFFF;
  --hell-2: #ECF0F4;
  --grau: #E0E0E0;
  --marke-dunkel: #264F7C;
  --marke-hell: #3569A3;
  --akzent: #FF6142;

  /* Abstände */
  --raum-1: 4px;
  --raum-2: 8px;
  --raum-3: 16px;
  --raum-4: 24px;
  --raum-5: 32px;
  --raum-6: 48px;

  /* Typografie */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --text-body: 16px;
  --text-klein: 13px;
  --text-h2: 26px;
  --text-h3: 18px;

  /* Sonstiges */
  --radius: 0px;
  --linie: 2.5px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Muss sein, sonst gewinnt display aus den Komponentenregeln gegen hidden. */
[hidden] {
  display: none !important;
}

html {
  background: var(--hell-2);
}

body {
  margin: 0;
  padding: var(--raum-3) var(--raum-3) var(--raum-5);
  min-width: 320px;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--marke-dunkel);
  background: var(--hell-2);
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Kopf
   -------------------------------------------------------------------------- */

.kopf {
  /* Bleibt beim Scrollen oben stehen. Die negativen Ränder heben die
     Innenabstände des Körpers auf, damit der Streifen bis an die Kanten geht. */
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--raum-2);
  margin: calc(var(--raum-3) * -1) calc(var(--raum-3) * -1) 0;
  padding: var(--raum-3);
  border-bottom: var(--linie) solid var(--marke-dunkel);
  background: var(--hell-2);
}

.kopf-titel {
  margin: 0;
  font-family: var(--font-serif);
  /* Schrumpft im schmalen Fenster so weit, dass der Titel einzeilig bleibt. */
  font-size: clamp(20px, 5.6vw, var(--text-h2));
  font-weight: 700;
  line-height: 1.2;
  color: var(--marke-dunkel);
}

.kopf-werkzeuge {
  display: flex;
  align-items: center;
  gap: var(--raum-2);
  flex: none;
}

.kopf-benutzer {
  margin: 0;
  font-size: var(--text-klein);
  line-height: 1.2;
  color: var(--marke-hell);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12ch;
}

.knopf-klein {
  flex: none;
  padding: var(--raum-1) var(--raum-2);
  border: var(--linie) solid var(--marke-dunkel);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-klein);
  font-weight: 600;
  line-height: 1.3;
  color: var(--marke-dunkel);
  background: var(--hell-1);
  cursor: pointer;
}

.knopf-klein:hover {
  color: var(--hell-1);
  background: var(--marke-dunkel);
}

.knopf-klein:focus-visible {
  outline: var(--linie) solid var(--marke-hell);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Anmeldung
   -------------------------------------------------------------------------- */

.ist-anmeldung {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.anmeldung {
  width: 100%;
  max-width: 380px;
}

.anmeldung-titel {
  margin: 0 0 var(--raum-5);
  padding-bottom: var(--raum-3);
  border-bottom: var(--linie) solid var(--marke-dunkel);
  font-family: var(--font-serif);
  font-size: clamp(20px, 5.6vw, var(--text-h2));
  font-weight: 700;
  line-height: 1.2;
  color: var(--marke-dunkel);
}

.anmeldung-formular .knopf-primaer {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Formular
   -------------------------------------------------------------------------- */

.formular {
  margin-top: var(--raum-5);
}

.feld {
  margin: 0 0 var(--raum-4);
  padding: 0;
  border: 0;
}

.feld-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--raum-2);
  margin-bottom: var(--raum-1);
  padding: 0;
  font-size: var(--text-klein);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--marke-hell);
}

/* Bricht nur an Leerzeichen und am Bindestrich um, nie mitten im Wort.
   hyphens: manual verhindert zusätzlich eingefügte Trennstriche. */
.feld-label-lang {
  /* float löst die Legende aus dem Rahmen des Feldblocks. Ohne das
     zerschneidet mehrzeiliger Text die obere Rahmenlinie. */
  float: left;
  display: block;
  width: 100%;
  margin: 0 0 var(--raum-3);
  padding: 0;
  hyphens: manual;
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: pretty;
}

.pflicht {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--marke-hell);
  opacity: 0.75;
}

.eingabe {
  display: block;
  width: 100%;
  padding: 10px var(--raum-3);
  /* Im Ruhezustand rahmenlos. Der Rahmen bleibt durchsichtig stehen, damit
     beim Fokus nichts springt. */
  border: var(--linie) solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.4;
  color: var(--marke-dunkel);
  background: var(--hell-1);
  appearance: none;
}

.eingabe::placeholder {
  color: var(--marke-hell);
  opacity: 0.6;
}

/* Nur das Feld mit dem Cursor bekommt eine graue Umrandung. */
.eingabe:focus,
.eingabe:focus-visible {
  border-color: var(--grau);
  outline: none;
}

select.eingabe {
  background-image: linear-gradient(45deg, transparent 50%, var(--marke-dunkel) 50%),
                    linear-gradient(135deg, var(--marke-dunkel) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: var(--raum-5);
}

.eingabe-fehler {
  border-color: var(--akzent);
}

.feld-hinweis {
  margin: var(--raum-1) 0 0;
  font-size: var(--text-klein);
  line-height: 1.4;
  color: var(--marke-hell);
}

/* --------------------------------------------------------------------------
   Auswahlliste Liegenschaft
   -------------------------------------------------------------------------- */

.combo {
  position: relative;
}

.combo-liste {
  position: absolute;
  z-index: 20;
  top: calc(100% - var(--linie));
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  list-style: none;
  border: var(--linie) solid var(--marke-dunkel);
  background: var(--hell-1);
  box-shadow: 0 8px 16px rgba(38, 79, 124, 0.12);
}

.combo-eintrag {
  padding: var(--raum-2) var(--raum-3);
  line-height: 1.35;
  cursor: pointer;
}

.combo-eintrag[aria-selected="true"] {
  color: var(--hell-1);
  background: var(--marke-dunkel);
}

.combo-eintrag mark {
  color: inherit;
  font-weight: 700;
  background: transparent;
}

.combo-eintrag-notiz {
  display: block;
  font-size: var(--text-klein);
  opacity: 0.75;
}

.combo-leer {
  padding: var(--raum-2) var(--raum-3);
  font-size: var(--text-klein);
  color: var(--marke-hell);
}

/* --------------------------------------------------------------------------
   Bekannte Mailadresse: vorhandene Einträge zum Korrigieren
   -------------------------------------------------------------------------- */

.mail-liste {
  margin-top: var(--raum-2);
  border: var(--linie) solid var(--grau);
  background: var(--hell-1);
  max-height: 200px;
  overflow-y: auto;
}

.mail-liste-titel {
  margin: 0;
  padding: var(--raum-2) var(--raum-3);
  font-size: var(--text-klein);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--marke-hell);
  border-bottom: 1px solid var(--grau);
}

.mail-treffer {
  display: block;
  width: 100%;
  padding: var(--raum-2) var(--raum-3);
  border: 0;
  border-bottom: 1px solid var(--grau);
  font: inherit;
  text-align: left;
  color: var(--marke-dunkel);
  background: transparent;
  cursor: pointer;
}

.mail-treffer:last-child {
  border-bottom: 0;
}

.mail-treffer:hover,
.mail-treffer:focus-visible {
  background: var(--hell-2);
  outline: none;
}

.mail-treffer:focus-visible {
  outline: var(--linie) solid var(--marke-hell);
  outline-offset: -2px;
}

.mail-treffer-kopf {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.mail-treffer-zeile {
  display: block;
  font-size: var(--text-klein);
  line-height: 1.4;
  color: var(--marke-hell);
}

/* --------------------------------------------------------------------------
   Korrekturmodus
   -------------------------------------------------------------------------- */

.korrektur {
  margin-bottom: var(--raum-4);
  padding: var(--raum-3);
  color: var(--hell-1);
  background: var(--marke-dunkel);
}

.korrektur-titel {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  font-weight: 700;
  line-height: 1.2;
}

.korrektur-text {
  margin: var(--raum-1) 0 0;
  font-size: var(--text-klein);
  line-height: 1.45;
  opacity: 0.85;
  word-break: break-word;
}

/* Solange korrigiert wird, hebt sich das ganze Formular vom Normalfall ab. */
.ist-korrektur .formular {
  padding-left: var(--raum-3);
  border-left: var(--linie) solid var(--marke-dunkel);
}

/* --------------------------------------------------------------------------
   Grenze
   -------------------------------------------------------------------------- */

.feld-grenze {
  border: var(--linie) solid var(--grau);
  padding: var(--raum-3);
}

.feld-grenze .feld-label {
  padding: 0 var(--raum-2);
  margin-left: -4px;
}

.grenze-wahl {
  /* clear gehört zur floatenden Legende darüber, sonst rutscht die Auswahl
     neben die Beschriftung statt darunter. */
  clear: both;
  display: flex;
  flex-direction: column;
  gap: var(--raum-1);
  margin-bottom: var(--raum-2);
}

.radio,
.haken {
  display: flex;
  align-items: center;
  gap: var(--raum-2);
  line-height: 1.35;
  cursor: pointer;
}

.radio input,
.haken input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--marke-dunkel);
}

.radio input:focus-visible,
.haken input:focus-visible {
  outline: var(--linie) solid var(--marke-hell);
  outline-offset: 2px;
}

.haken {
  margin-bottom: var(--raum-4);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Meldungen
   -------------------------------------------------------------------------- */

.meldung {
  margin: 0 0 var(--raum-3);
  padding: var(--raum-2) var(--raum-3);
  border-left: var(--linie) solid var(--marke-dunkel);
  font-size: var(--text-klein);
  line-height: 1.45;
  background: var(--hell-1);
}

.meldung-fehler {
  border-left-color: var(--akzent);
}

/* Bereits erfasst: gefuellter Block, damit die Meldung nicht zu uebersehen ist. */
.meldung-dublette {
  padding: var(--raum-3);
  border-left: 0;
  color: var(--hell-1);
  background: var(--marke-dunkel);
}

.meldung-titel {
  display: block;
  margin-bottom: var(--raum-2);
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  font-weight: 700;
  line-height: 1.2;
}

.meldung-daten {
  margin: 0;
}

.meldung-daten div {
  display: flex;
  gap: var(--raum-2);
  align-items: baseline;
}

.meldung-daten div + div {
  margin-top: var(--raum-1);
}

.meldung-daten dt {
  flex: 0 0 84px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.meldung-daten dd {
  flex: 1 1 auto;
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   Knöpfe
   -------------------------------------------------------------------------- */

.aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: var(--raum-2);
}

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--raum-2);
  padding: var(--raum-3) var(--raum-5);
  border: var(--linie) solid var(--marke-dunkel);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.2;
  color: var(--marke-dunkel);
  background: var(--hell-1);
  cursor: pointer;
}

.knopf:focus-visible {
  outline: var(--linie) solid var(--marke-hell);
  outline-offset: 2px;
}

.knopf-primaer,
.knopf-warn {
  flex: 1 1 auto;
  color: var(--hell-1);
  border-color: var(--akzent);
  background: var(--akzent);
}

.knopf-still {
  color: var(--marke-dunkel);
  border-color: var(--marke-dunkel);
  background: transparent;
}

.knopf-still:hover {
  background: var(--hell-1);
}

.knopf-breit {
  width: 100%;
}

.knopf[disabled] {
  opacity: 0.5;
  cursor: default;
}

.taste {
  padding: 2px var(--raum-1);
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Fuß
   -------------------------------------------------------------------------- */

.fuss {
  margin-top: var(--raum-6);
  padding-top: var(--raum-4);
  border-top: var(--linie) solid var(--grau);
}

.fuss-pfad {
  margin: var(--raum-2) 0 0;
  font-size: var(--text-klein);
  line-height: 1.45;
  color: var(--marke-hell);
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   Breitere Fenster
   -------------------------------------------------------------------------- */

@media (min-width: 720px) {
  body {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--raum-5) var(--raum-5) var(--raum-6);
  }

  .grenze-wahl {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--raum-3);
  }
}
